private void OnGodListPush(int type) { GodSoldierToggle godSoldierToggle = this.mToggleList.Find((GodSoldierToggle e) => e.Data.Type == type); if (godSoldierToggle != null) { GodWeaponInfo godWeaponInfo = GodSoldierManager.Instance.GodList.Find((GodWeaponInfo e) => e.Type == type); if (godWeaponInfo != null) { this.RefreshLeft(godWeaponInfo); this.RefreshRight(godWeaponInfo, false); godSoldierToggle.SetData(godWeaponInfo, string.Empty); } } }
private void CreateToggle(GodWeaponInfo data) { SShenBingPeiZhi sShenBingPeiZhi = DataReader <SShenBingPeiZhi> .Get(data.Type); if (sShenBingPeiZhi != null) { GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab("GodSoldierToggle"); UGUITools.SetParent(this.mToggleGrid, instantiate2Prefab, false); instantiate2Prefab.set_name(sShenBingPeiZhi.id.ToString()); instantiate2Prefab.SetActive(true); GodSoldierToggle component = instantiate2Prefab.GetComponent <GodSoldierToggle>(); component.SetData(data, GameDataUtils.GetChineseContent(sShenBingPeiZhi.name, false)); component.EventHandler = new Action <GodSoldierToggle>(this.OnClickMenu); this.mToggleList.Add(component); } }
private void SwitchToggle(int type) { if (this.mCurGodType == type) { return; } this.mCurGodType = type; if (this.mLastSelectToggle != null) { this.mLastSelectToggle.IsSelect = false; } for (int i = 0; i < this.mToggleList.get_Count(); i++) { if (type == this.mToggleList.get_Item(i).Data.Type) { this.mLastSelectToggle = this.mToggleList.get_Item(i); this.mLastSelectToggle.IsSelect = true; this.RefreshLeft(this.mLastSelectToggle.Data); this.RefreshRight(this.mLastSelectToggle.Data, true); } } }
private void OnClickMenu(GodSoldierToggle toggle) { this.SwitchToggle(toggle.Data.Type); }