1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class FirstChargeHeroInfoWin : UIBase
{
    [SerializeField] ItemCell itemCell;
    [SerializeField] TextEx txtName;
    [SerializeField] TextEx txtJob;
    [SerializeField] TextEx txtDesc;
    [SerializeField] RichText txtInherit;   //武将继承描述
    [SerializeField] TextEx[] txtInheritAttr;    //武将会继承的属性
    [SerializeField] RichText txtHeroAddPer; //主公(上阵)加成描述
    [SerializeField] TextEx[] txtHeroAddAttrPer; //主公(上阵)加成
    [SerializeField] SkillBaseCell normalSkillCell;
    [SerializeField] SkillBaseCell angerSkillCell;
 
    protected override void InitComponent()
    {
        base.InitComponent();
        txtInherit.OnClick = () =>
        {
            SmallTipWin.showText = Language.Get("herocard47");
            SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
            UIManager.Instance.OpenWindow<SmallTipWin>();
        };
        txtHeroAddPer.OnClick = () =>
        {
            SmallTipWin.showText = Language.Get("herocard48");
            SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
            UIManager.Instance.OpenWindow<SmallTipWin>();
        };
 
    }
 
    protected override void OnPreOpen()
    {
        base.OnPreOpen();
        ItemInfo itemInfo = new ItemInfo();
        itemInfo.itemId = FirstChargeManager.Instance.heroItemID;
        HeroInfo heroInfo = new HeroInfo(new ItemModel(PackType.Item, itemInfo));
        txtInheritAttr[0].text = PlayerPropertyConfig.GetFullDescription(new Int2(PlayerPropertyConfig.inheritAttrs[0], heroInfo.heroConfig.AtkInheritPer));
        txtInheritAttr[1].text = PlayerPropertyConfig.GetFullDescription(new Int2(PlayerPropertyConfig.inheritAttrs[1], heroInfo.heroConfig.DefInheritPer));
        txtInheritAttr[2].text = PlayerPropertyConfig.GetFullDescription(new Int2(PlayerPropertyConfig.inheritAttrs[2], heroInfo.heroConfig.HPInheritPer));
 
        int valuePer = heroInfo.GetOnBattleAddPer();
        for (int i = 0; i < txtHeroAddAttrPer.Length; i++)
        {
            txtHeroAddAttrPer[i].text = PlayerPropertyConfig.GetFullDescription(new Int2(PlayerPropertyConfig.basePerAttrs[i], valuePer));
        }
 
        normalSkillCell.Init(heroInfo.heroConfig.AtkSkillID, () =>
        {
            UIManager.Instance.OpenWindow<HeroSkillWin>(heroInfo.heroId);
        }, true);
        angerSkillCell.Init(heroInfo.heroConfig.AngerSkillID, () =>
        {
            UIManager.Instance.OpenWindow<HeroSkillWin>(heroInfo.heroId);
        }, true);
 
        itemCell.Init(new ItemCellModel((int)FirstChargeManager.Instance.heroItemID, true, 1));
        txtName.text = Language.Get("FirstCharge09", Language.Get("CommonQuality" + heroInfo.Quality),heroInfo.heroConfig.Name); 
        txtName.color = UIHelper.GetUIColorByFunc(heroInfo.Quality);
        txtJob.text = Language.Get("FirstCharge06",Language.Get(StringUtility.Contact("HeroClass",heroInfo.heroConfig.Class)));
        txtDesc.text = Language.Get("FirstCharge07",heroInfo.heroConfig.Desc);
    }
 
    protected override void OnPreClose()
    {
        base.OnPreClose();
 
    }
 
}