using cfg.CharacterCfg; using Framework; using NLDPB; using System; using System.Collections.Generic; using PhxhSDK; using TMPro; using UnityEngine; using UnityEngine.UI; using Image = UnityEngine.UI.Image; public class UISelectCharacterController : UIWindow { GameObject mFenLeiYiJuItemAssetObj; GameObject mCharacterItemAssetObj; Framework.PhxhScrollView _mCurrentScrollView = null; private int mCurrentFraction =0; private int mCurrentJob = 0; CharacterSortType mCurrentSortType = CharacterSortType.EAll; List mShowList = new List(); List mStorageCharacterInfo = new List(); List mSortedCInfoList = new List(); Dictionary mUIHeadGoDic = new Dictionary(); private GameObject mCurrentScrollViewContentObj = null; private CharacterBreak characterBreakCfg; private JobAttri jobAttriCfg; private FactionAttri factionAttriCfg; private GameObject mRarityBtnObj; private GameObject mLevelBtnObj; private GameObject mOtherBtnObj; private GameObject mFactionBtnObj; private GameObject mJobBtnObj; private bool IsSmall2Big = false; private CharacterSortType mCurOtherBtnState = CharacterSortType.EBreak; private TMP_Dropdown factionDropDown; private TMP_Dropdown otherDropDown; private TMP_Dropdown jobDropDown; private Sprite jobFirstSpr; //打开时传入队列信息 private Team _curTeam; private int _charIdx; private GameObject _goClearTeam; public struct InputData { public OpenType OpenType; public Team Data; public int Idx; } public enum OpenType { Default, EditTeam } private OpenType _curOpenType = OpenType.Default; enum CharacterSortType { EAll, EStar, ELevel, EAwake, EBreak, ELikely, } public override void OnAwake() { BindButton("Image_BG/Image_Menu/Button_Rarity", OnButton_RarityClick); BindButton("Image_BG/Image_Menu/Button_Level", OnButton_LevelClick); BindButton("Image_BG/Image_Menu/Button_AdvanceLevel", OnButton_AdvanceLevel); BindButton("Image_BG/Image_Menu/Button_ChangeLevel", OnButton_ChangeLevelClick); BindButton("Image_BG/Button_Back", OnButton_BackClick); mCurrentScrollViewContentObj = FindObj("ScrollView_SelectCharacter/Viewport/Content"); _mCurrentScrollView = GetComponent< Framework.PhxhScrollView>("ScrollView_SelectCharacter"); mRarityBtnObj = FindObj("Image_BG/Image_Menu/Button_Rarity"); mLevelBtnObj = FindObj("Image_BG/Image_Menu/Button_Level"); mOtherBtnObj = FindObj("Image_BG/Image_Menu/Button_AdvanceLevel"); mFactionBtnObj = FindObj("Image_BG/Button_Group"); mJobBtnObj = FindObj("Image_BG/Button_Profession"); factionDropDown = GetComponent("Image_BG/Button_Group"); otherDropDown = GetComponent("Image_BG/Image_Menu/Button_ChangeLevel"); jobDropDown = GetComponent("Image_BG/Button_Profession"); factionDropDown.onValueChanged.AddListener(delegate { FactionDropdownValueChanged(factionDropDown); }); otherDropDown.onValueChanged.AddListener(delegate { OtherBtnDropdownValueChanged(otherDropDown); }); jobDropDown.onValueChanged.AddListener(delegate { JobDropdownValueChanged(jobDropDown); }); PreLoadCfg(); RefreshUpperSortBtn(); AddDropDownOption(); LayoutRebuilder.ForceRebuildLayoutImmediate((FindObj("Image_BG/Image_Menu/Button_Rarity")).transform as RectTransform); LayoutRebuilder.ForceRebuildLayoutImmediate(FindObj("Image_BG/Image_Menu/Button_Level").transform as RectTransform); LayoutRebuilder.ForceRebuildLayoutImmediate(FindObj("Image_BG/Image_Menu/Button_AdvanceLevel").transform as RectTransform); } private void OnButton_BackClick() { if (_curOpenType == OpenType.EditTeam) { //TeamEditManager.Instance.SaveTeam(_curTeam); EventManager.Instance.Send(EventManager.EventName.TeamModified, _curTeam.TeamIndex); if (UIManager.Instance.IsWindowOpening(UINameConst.UITeamInfo)) { var window = UIManager.Instance.GetOpenedWindowByPath(UINameConst.UITeamInfo); window.ReloadWindow(_curTeam); } } CloseWindow(); } private void JobDropdownValueChanged(TMP_Dropdown change) { if (mCurrentJob == change.value) { return; } if (!IfHaveJob((Ejob)change.value)&&(change.value!=0)) { UIManager.Instance.ShowUITips(UINameConst.UIAirView, Utils.CommonUtils.GetLocalizeText("cultivate_notHaveFractionJob")); return; } mCurrentJob = change.value; if(change.value==0) { Utils.CommonUtils.GetComponent(Utils.CommonUtils.GetGameObject(mJobBtnObj, "Text_Profession")).text = Utils.CommonUtils.GetLocalizeText("cultivate_AllJob"); ; } else { Utils.CommonUtils.GetComponent(Utils.CommonUtils.GetGameObject(mJobBtnObj, "Text_Profession")).text =Utils.CommonUtils.GetLocalizeText( jobAttriCfg.Get(mCurrentJob).DisplayName); } SortList(mCurrentSortType); SelectListByJobAndFraction(); RefreshScrollView(); } private void OtherBtnDropdownValueChanged(TMP_Dropdown change) { if((int)mCurOtherBtnState==change.value) { return; } mCurOtherBtnState = (CharacterSortType)(change.value+3); Utils.CommonUtils.GetComponent(mOtherBtnObj, "Text_Default").text =GetCharactererSortTypeLocalize((CharacterSortType)(change.value + 3)); Utils.CommonUtils.GetComponent(mOtherBtnObj, "Text_Clip").text = GetCharactererSortTypeLocalize((CharacterSortType)(change.value + 3)); RefreshBtn(mOtherBtnObj,true,true); } private void FactionDropdownValueChanged(TMP_Dropdown change) { if (mCurrentFraction == change.value) { return; } if(!IfHaveFraction((Efaction)change.value) && (change.value != 0)) { UIManager.Instance.ShowUITips(UINameConst.UIAirView, Utils.CommonUtils.GetLocalizeText("cultivate_notHaveFractionJob")); return; } mCurrentFraction = change.value; if (change.value==0) { Utils.CommonUtils.GetComponent(Utils.CommonUtils.GetGameObject(mFactionBtnObj, "Text_Group")).text =Utils.CommonUtils.GetLocalizeText("cultivate_AllFraction"); } else { Utils.CommonUtils.GetComponent(Utils.CommonUtils.GetGameObject(mFactionBtnObj, "Text_Group")).text =Utils.CommonUtils.GetLocalizeText( factionAttriCfg.Get(mCurrentFraction).DisplayName); } SortList(mCurrentSortType); SelectListByJobAndFraction(); RefreshScrollView(); } private void AddDropDownOption() { AddFactionDropDownOption(); AddOtherBtnDropDownOption(); AddJobDropDownOption(); } private void AddFactionDropDownOption() { factionDropDown.ClearOptions(); TMP_Dropdown.OptionData m_NewData1 = new TMP_Dropdown.OptionData(); m_NewData1.text = Utils.CommonUtils.GetLocalizeText("cultivate_AllFraction"); factionDropDown.options.Add(m_NewData1); foreach (var factionItem in System.Enum.GetValues(typeof(Efaction))) { TMP_Dropdown.OptionData m_NewData = new TMP_Dropdown.OptionData(); m_NewData.text = Utils.CommonUtils.GetLocalizeText( factionAttriCfg.Get((int)factionItem).DisplayName); factionDropDown.options.Add(m_NewData); } } private void AddOtherBtnDropDownOption() { otherDropDown.ClearOptions(); System.Array ints = System.Enum.GetValues(typeof(CharacterSortType)); for (int i = 3; i < ints.Length; i++) { TMP_Dropdown.OptionData m_NewData1 = new TMP_Dropdown.OptionData(); m_NewData1.text =GetCharactererSortTypeLocalize( ((CharacterSortType)ints.GetValue(i))).ToString(); otherDropDown.options.Add(m_NewData1); } } string GetCharactererSortTypeLocalize(CharacterSortType sortType) { switch (sortType) { case CharacterSortType.EAwake: return Utils.CommonUtils.GetLocalizeText("culitivate_AwakeLevel"); case CharacterSortType.EBreak: return Utils.CommonUtils.GetLocalizeText("culitivate_BreakLevel"); case CharacterSortType.ELikely: return Utils.CommonUtils.GetLocalizeText("culitivate_likely"); } return ""; } private async void AddJobDropDownOption() { jobDropDown.ClearOptions(); TMP_Dropdown.OptionData m_NewData1 = new TMP_Dropdown.OptionData(); m_NewData1.image =await AssetManager.GetSingleton().LoadAssetAsync(@"Assets/Art/UI/Texture/Icon/Job/UI_Profession_Command.png"); jobDropDown.options.Add(m_NewData1); foreach (var factionItem in System.Enum.GetValues(typeof(Ejob))) { TMP_Dropdown.OptionData m_NewData = new TMP_Dropdown.OptionData(); m_NewData.image = await AssetManager.GetSingleton().LoadAssetAsync((jobAttriCfg.Get((int)factionItem).IconPath)); jobDropDown.options.Add(m_NewData); } } bool IfHaveJob(Ejob job) { foreach(var v in mStorageCharacterInfo) { if((v.Cfg.Job == job)&&(IsEqual((int)v.Cfg.Fraction,mCurrentFraction))) { return true; } } return false; } bool IfHaveFraction(Efaction fraction) { foreach (var v in mStorageCharacterInfo) { if ((v.Cfg.Fraction == fraction)&& (IsEqual((int)v.Cfg.Job, mCurrentJob))) { return true; } } return false; } private void OnImageLoad(Sprite sprite) { TMP_Dropdown.OptionData m_NewData1 = new TMP_Dropdown.OptionData(); m_NewData1.image = sprite; jobDropDown.options.Add(m_NewData1); } private void OnButton_ChangeLevelClick() { if (mCurrentSortType == CharacterSortType.ELevel) { IsSmall2Big = !IsSmall2Big; } else { mCurrentSortType = CharacterSortType.ELevel; IsSmall2Big = false; } RefreshUI(); } private void OnButton_AdvanceLevel() { if(mCurrentSortType== mCurOtherBtnState) { IsSmall2Big = !IsSmall2Big; }else { mCurrentSortType = mCurOtherBtnState; IsSmall2Big = false; } RefreshUI(); } private void OnButton_LevelClick() { if (mCurrentSortType == CharacterSortType.ELevel) { IsSmall2Big = !IsSmall2Big; } else { mCurrentSortType = CharacterSortType.ELevel; IsSmall2Big = false; } RefreshUI(); } private void OnButton_RarityClick() { if (mCurrentSortType == CharacterSortType.EStar) { IsSmall2Big = !IsSmall2Big; } else { mCurrentSortType = CharacterSortType.EStar; IsSmall2Big = false; } RefreshUI(); } private void PreLoadCfg() { characterBreakCfg = TableManager.Instance.Tables.CharacterBreak; jobAttriCfg = TableManager.Instance.Tables.JobAttri; factionAttriCfg = TableManager.Instance.Tables.FactionAttri; } protected override void OnOpenWindow(object data = null) { if (data != null) { var input = (InputData)data; _curOpenType = input.OpenType; if (_curOpenType == OpenType.EditTeam) { _curTeam = input.Data; _charIdx = input.Idx; } } GetStorageData(); PreLoadAllCharacter(); RegisterEvent(); RefreshUI(); CreateScrollView(); Utils.CommonUtils.GetComponent(mOtherBtnObj, "Text_Default").text = GetCharactererSortTypeLocalize(CharacterSortType.EAwake); Utils.CommonUtils.GetComponent(mOtherBtnObj, "Text_Clip").text = GetCharactererSortTypeLocalize(CharacterSortType.EAwake); } private void CreateScrollView() { if (!ShowIfNull()) { SetScrollViewAll(); } } private void PreLoadAllCharacter() { for (int i = 0; i < mStorageCharacterInfo.Count; i++) { string path = Utils.CommonUtils.GetCharacterPicPath(mStorageCharacterInfo[i].Cfg.RoleID, Utils.CommonUtils.ECharacterPicPathType.SelectCharacter); AssetManager.Instance.PostPreload(path); } } void RefreshUpperSortBtn() { RefreshBtn(mRarityBtnObj, mCurrentSortType==CharacterSortType.EStar); RefreshBtn(mLevelBtnObj, mCurrentSortType == CharacterSortType.ELevel); RefreshBtn(mOtherBtnObj, mCurrentSortType == mCurOtherBtnState,true); } void RefreshBtn(GameObject btnObj, bool IsSeleted, bool isLast = false) { if(IsSeleted) { Utils.CommonUtils.GetGameObject(btnObj, "Image_Default/Image_UP").SetActive(IsSmall2Big); Utils.CommonUtils.GetGameObject(btnObj, "Image_Default/Image_Down").SetActive(!IsSmall2Big); } else { Utils.CommonUtils.GetGameObject(btnObj, "Image_Default/Image_UP").SetActive(false); Utils.CommonUtils.GetGameObject(btnObj, "Image_Default/Image_Down").SetActive(!false); } if (!isLast) { Utils.CommonUtils.GetGameObject(btnObj, "Text_Default/Text_Clip").SetActive(IsSeleted); } else { Utils.CommonUtils.GetGameObject(btnObj, "Text_Clip").SetActive(IsSeleted); Utils.CommonUtils.GetGameObject(btnObj, "Text_Default").SetActive(!IsSeleted); } } void RefreshUI() { SortList(mCurrentSortType); SelectListByJobAndFraction(); RefreshUpperSortBtn(); RefreshScrollView(); } private bool ShowIfNull() { if (mShowList.Count == 0) { FindObj("Nothing").SetActive(true); return true; } else { FindObj("Nothing").SetActive(false); return false; } } private void RegisterEvent() { EventManager.Instance.Register(EventManager.EventName.EN_ShowAllCharacterSortType, OnReceiveShowAllCharacterSortEvent); EventManager.Instance.Register(EventManager.EventName.EN_CharacterLevelUp, (Action)OnCharacterLevelup); //EventManager.Instance.Register(EventManager.EventName.TeamUpdate, OnTeamUpdate); } private void OnCharacterLevelup(UpgradeType type) { if(type!=UpgradeType.UtLevel) { return; } GetStorageData(); RefreshUI(); } private void UnRegisterEvent() { EventManager.Instance.Unregister(EventManager.EventName.EN_ShowAllCharacterSortType, OnReceiveShowAllCharacterSortEvent); EventManager.Instance.Register(EventManager.EventName.EN_CharacterLevelUp, (Action)OnCharacterLevelup); //EventManager.Instance.Unregister(EventManager.EventName.TeamUpdate, OnTeamUpdate); } private void GetNeedInsObj() { FindObj("ScrollviewItem"); } void OnReceiveShowAllCharacterSortEvent() { DebugUtil.Log("事件接收成功"); } void SetScrollView() { _mCurrentScrollView.SetUpdateFunc(RefreshItem); _mCurrentScrollView.SetItemCountFunc(GetCountFunc); _mCurrentScrollView.UpdateData(false); _mCurrentScrollView.SetButton(SetScrollviewItemButton); } private void SetScrollviewItemButton(GameObject obj) { for (int i = 0; i < 6; i++) { GameObject singleObj = Utils.CommonUtils.GetGameObject(obj, (i + 1).ToString()); if (singleObj != null) { ClearBind(Utils.CommonUtils.GetGameObject(singleObj, "Image_Poster")); BindButton(Utils.CommonUtils.GetGameObject(singleObj, "Image_Poster"), On2DPicClick, singleObj); } } } int GetCountFunc() { int row; if (mShowList.Count % 6 == 0) { row = mShowList.Count / 6; } else { row = mShowList.Count / 6 + 1; } return row; } private void RefreshScrollView() { _mCurrentScrollView.UpdateData(true); } private void SetScrollViewAll() { if (null != mCurrentScrollViewContentObj) { Utils.CommonUtils.DestoryAllChildGameObject(mCurrentScrollViewContentObj); } switch (_curOpenType) { case (OpenType.EditTeam): { SetScrollView_EditTeam(); break; } default: { SetScrollView(); break; } } } void GetStorageData() { mStorageCharacterInfo.Clear(); mStorageCharacterInfo.AddRange(CharacterDataInfoManager.Instance.DataList); } void SortList(CharacterSortType ESortType) { mSortedCInfoList.Clear(); mSortedCInfoList.AddRange(mStorageCharacterInfo); switch (ESortType) { case CharacterSortType.EAll: return; case CharacterSortType.EStar: if (!IsSmall2Big) { mSortedCInfoList.Sort((a, b) => { return a.Cfg.StartStar.CompareTo(b.Cfg.StartStar); }); } else { mSortedCInfoList.Sort((a, b) => { return b.Cfg.StartStar.CompareTo(a.Cfg.StartStar); }); } break; case CharacterSortType.ELevel: if (IsSmall2Big) { mSortedCInfoList.Sort((a, b) => { return b.Level.CompareTo(a.Level); }); } else { mSortedCInfoList.Sort((a, b) => { return a.Level.CompareTo(b.Level); }); } break; case CharacterSortType.EAwake: if (IsSmall2Big) { mSortedCInfoList.Sort((a, b) => { return a.AwakeLevel.CompareTo(b.AwakeLevel); }); } else { mSortedCInfoList.Sort((a, b) => { return b.AwakeLevel.CompareTo(a.AwakeLevel); }); } break; case CharacterSortType.EBreak: if (IsSmall2Big) { mSortedCInfoList.Sort((a, b) => { return a.BreakLevel.CompareTo(b.BreakLevel); }); } else { mSortedCInfoList.Sort((a, b) => { return b.BreakLevel.CompareTo(a.BreakLevel); }); } break; case CharacterSortType.ELikely: if (IsSmall2Big) { mSortedCInfoList.Sort((a, b) => { return a.LikelyLevel.CompareTo(b.LikelyLevel); }); } else { mSortedCInfoList.Sort((a, b) => { return b.LikelyLevel.CompareTo(a.LikelyLevel); }); } break; default: DebugUtil.LogError("错误脱离switch"); throw new ArgumentOutOfRangeException(nameof(ESortType), ESortType, null); } } void SelectListByJobAndFraction() { mShowList.Clear(); for (int i = 0; i < mSortedCInfoList.Count; i++) { if (IsEqual((int)mSortedCInfoList[i].Cfg.Fraction, mCurrentFraction) && (IsEqual((int)mSortedCInfoList[i].Cfg.Job, mCurrentJob))) { mShowList.Add(mSortedCInfoList[i]); } } } bool IsEqual(int cfg,int current) { if(current==0) { return true; } return cfg == current; } private void RefreshItem(int index, RectTransform item) { item.gameObject.SetActive(true); for (int i = 0; i < 6; i++) { GameObject singleItem = Utils.CommonUtils.GetGameObject(item.gameObject, (i + 1).ToString()); if (index * 6 + i < mShowList.Count) { singleItem.SetActive(true); CharacterDataInfo tempDataInfo = mShowList[index * 6 + i]; RefreshSingleItem(singleItem, tempDataInfo); mUIHeadGoDic[singleItem] = tempDataInfo; } else { singleItem.SetActive(false); } } } public class CultivateStruct { public List showList; public CharacterDataInfo info; } private async void On2DPicClick(GameObject go) { CharacterDataInfo info = mUIHeadGoDic[go]; CultivateStruct cultivateStruct = new CultivateStruct(); cultivateStruct.showList = mShowList; cultivateStruct.info = info; await UIManager.Instance.OpenWindow(UINameConst.UI_Cultivate, cultivateStruct); } private async void RefreshSingleItem(GameObject go, CharacterDataInfo dataInfo) { Utils.CommonUtils.GetComponent(go, "Image_Poster/Image_Rect/Image_LevelBar").fillAmount = (float)dataInfo.Level / characterBreakCfg.Get(dataInfo.Cfg.RoleID, (int)dataInfo.BreakLevel).LevelLimit; Utils.CommonUtils.GetComponent(go, "Image_Poster/Image_Rect/Image_LevelBar/Text_Level").text = dataInfo.Level.ToString(); Utils.CommonUtils.GetComponent(go, "Image_Poster/Image_Rect/Image_ProfessionLogo").sprite = await AssetManager.GetSingleton().LoadAssetAsync(TableManager.Instance.Tables.JobAttri.GetOrDefault((int)dataInfo.Cfg.Job).IconPath); Utils.CommonUtils.GetComponent(go, "Image_Poster/Image_ColorCover/Image_CharacterName/Text_CharacterName").text =Utils.CommonUtils.GetLocalizeText( dataInfo.Cfg.Name); Utils.CommonUtils.GetComponent(go, "Image_Mask").gameObject.SetActive(_curOpenType == OpenType.EditTeam && _curTeam.IsCharacterInTeam(dataInfo.Uid)); var cmp = Utils.CommonUtils.GetComponent(go, "Image_Poster"); Utils.CommonUtils.RefreshCharacter2DPic(cmp,dataInfo.Cfg.RoleID, Utils.CommonUtils.ECharacterPicPathType.SelectCharacter); for (int i = 0; i < 4; i++) { GameObject starGo = Utils.CommonUtils.GetGameObject(go, string.Format("Image_Poster/Image_ColorCover/Image_CharacterName/Stars/{0}", i + 1)); if ((i + 1) < dataInfo.Cfg.StartStar) { starGo.SetActive(true); } else { starGo.SetActive(false); } } } private void On2DPicLoaded(Sprite sprite, Image image) { image.sprite= sprite; } void CloseCurWindow() { UnRegisterEvent(); CloseWindow(); } /// /// 编队使用 /// private void SetScrollView_EditTeam() { _mCurrentScrollView.SetUpdateFunc(RefreshItem_EditTeam); _mCurrentScrollView.SetItemCountFunc(GetCountFunc_EditTeam); _mCurrentScrollView.UpdateData(false); _mCurrentScrollView.SetButton(SetScrollViewItemButton_EditTeam); } private void RefreshItem_EditTeam(int index, RectTransform item) { item.gameObject.SetActive(true); int count = mShowList.Count + 1; for (int i = 0; i < 6; i++) { GameObject singleItem = Utils.CommonUtils.GetGameObject(item.gameObject, (i + 1).ToString()); if (index * 6 + i < count) { singleItem.SetActive(true); RefreshSingleItem_EditTeam(singleItem, index * 6 + i); int realIdx = index * 6 + i - 1; if (realIdx >= 0) { CharacterDataInfo tempDataInfo = mShowList[realIdx]; mUIHeadGoDic[singleItem] = tempDataInfo; } else { _goClearTeam = singleItem; } } else { singleItem.SetActive(false); } } } void RefreshSingleItem_EditTeam(GameObject go, int idx) { int realIdx = idx - 1; if (realIdx < 0) { Utils.CommonUtils.GetGameObject(go, "Image_Poster").SetActive(false); Utils.CommonUtils.GetGameObject(go, "Image_Mask").SetActive(false); Utils.CommonUtils.GetGameObject(go, "Image_Clear").SetActive(true); var imgBg = go.GetComponent(); if (imgBg) { var originColor = imgBg.color; imgBg.color = new Color(originColor.r, originColor.g, originColor.b, 0); } } else { CharacterDataInfo charDataInfo = mShowList[realIdx]; RefreshSingleItem(go, charDataInfo); if (_curTeam.IsCharacterInTeam(charDataInfo.Uid)) { Utils.CommonUtils.GetGameObject(go, "Image_Mask").SetActive(true); } else { Utils.CommonUtils.GetGameObject(go, "Image_Mask").SetActive(false); } } } private int GetCountFunc_EditTeam() { int row; var count = mShowList.Count + 1; if (count % 6 == 0) { row = count / 6; } else { row = count / 6 + 1; } return row; } private void SetScrollViewItemButton_EditTeam(GameObject obj) { for (int i = 0; i < 6; i++) { GameObject singleObj = Utils.CommonUtils.GetGameObject(obj, (i + 1).ToString()); if (singleObj != null) { ClearBind(Utils.CommonUtils.GetGameObject(singleObj, "Image_Poster")); var go = Utils.CommonUtils.GetGameObject(singleObj, "Image_Clear"); if (go != null) { ClearBind(Utils.CommonUtils.GetGameObject(singleObj, "Image_Clear")); BindButton(Utils.CommonUtils.GetGameObject(singleObj, "Image_Clear"), OnClickHeadClear, singleObj); } else { BindButton(Utils.CommonUtils.GetGameObject(singleObj, "Image_Poster"), OnClickHeadTeam_Edit, singleObj); } } } } void OnClickHeadTeam_Edit(GameObject go) { if (mUIHeadGoDic.TryGetValue(go, out var data)) { if (data != null) { uint id = data.Uid; if (_curTeam.IsCharacterInTeam(id)) { _curTeam.DoCharacterDown(id); } _curTeam.DoCharacterUp(_charIdx, id); EventManager.Instance.Send(EventManager.EventName.TeamEditModelCreate, new TeamPreviewNode.CharAddData{ID = id, Idx = _charIdx}); } } RefreshUI(); } void OnClickHeadClear(GameObject go) { _curTeam.DoCharacterDown(_charIdx); RefreshUI(); EventManager.Instance.Send(EventManager.EventName.TeamEditModelClear, _charIdx); } private void OnTeamUpdate() { //_curTeam = TeamEditManager.Instance.GetTeamByIndex(_curTeam.) RefreshUI(); } }