hch
3 小时以前 bc6f633a2f3cfc01122d8fd4452f69313ddcb32b
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
using UnityEngine;
using UnityEngine.UI;
 
//方案预设 方案选择组件, 隐藏的方案
public class FuncPresetChooseMoreCell : MonoBehaviour
{
    [SerializeField] Button lockBtn;
    [SerializeField] Button changeNameBtn;
    [SerializeField] Text caseNameText;
    [SerializeField] Button chooseBtn;
 
    [SerializeField] Transform selectObj;   //流派名才有选中,方案名选中后就显示在外层第四个
    [SerializeField] FuncPresetChooseCells pareant; //记录展开的方案ID用于表现
    [SerializeField] Transform moreCellObj;
    [SerializeField] Image redImg;
    
    public void Display(int battleType, int funcType, int id)
    {
        var data = FuncPresetManager.Instance.GetFuncPreset(funcType, id);
        if (data == null)
        {
            return;
        }
        var selectID = funcType == 1 ? FuncPresetManager.Instance.GetGlobalPresetID(battleType) : FuncPresetManager.Instance.GetFuncPresetIDByBattleType(battleType, funcType);
        caseNameText.text = UIHelper.AppendColor(selectID == id ? TextColType.titleSelectColor : TextColType.titleUnSelectColor,
                            Language.Get("FuncPreset11", id, data.PresetName));
        if (data.unLock)
        {
            lockBtn.SetActive(false);
            changeNameBtn.SetActive(true);
            changeNameBtn.AddListener(()=>
            {
                ChangeName(funcType, id);
                moreCellObj.SetActive(false);
            });
            chooseBtn.AddListener(() =>
            {
                if (pareant != null)
                {
                    pareant.unFoldID = id;
                }
                FuncPresetManager.Instance.ClickFuncPreset(battleType, funcType, id);
                moreCellObj.SetActive(false);
            });
        }
        else
        {
            lockBtn.SetActive(true);
            lockBtn.AddListener(() =>
            {
                FuncPresetManager.Instance.ClickFuncPreset(battleType, funcType, id);
                moreCellObj.SetActive(false);
            });
            changeNameBtn.SetActive(false);
            chooseBtn.RemoveAllListeners();
            redImg.SetActive(FuncPresetManager.Instance.ShowRed(funcType, id));
        }
        selectObj?.SetActive(selectID == id);
        
    }
 
 
    void ChangeName(int funcType, int id)
    {
        UIManager.Instance.OpenWindow<FuncPresetChangeNameWin>(funcType*100 + id);
    }
 
 
 
}