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(funcType*100 + id); } }