private void RefreshUI() { List <KaiFuHuoDong> activityTypeCfgList = AcOpenServerManager.Instance.GetCanShowActivityTypes(); if (activityTypeCfgList != null && activityTypeCfgList.get_Count() > 0) { int tabIndex = AcOpenServerManager.Instance.GetSelectBtnTab(); tabIndex = ((tabIndex >= 0 && tabIndex < activityTypeCfgList.get_Count()) ? tabIndex : 0); this.activityTypeListPool.Create(activityTypeCfgList.get_Count(), delegate(int index) { if (index < this.activityTypeListPool.Items.get_Count() && index < activityTypeCfgList.get_Count()) { AcOpenServerBtnItem component = this.activityTypeListPool.Items.get_Item(index).GetComponent <AcOpenServerBtnItem>(); if (component != null) { component.UpdateUI(activityTypeCfgList.get_Item(index)); component.Selected = false; this.activityTypeListPool.Items.get_Item(index).GetComponent <ButtonCustom>().onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickActivityTypeItemBtn); if (this.currentSelectBtnItem == null) { if (tabIndex == index) { component.Selected = true; this.UpdateSelectBtnItem(component); } } else if (this.currentSelectBtnItem != null && index == this.currentSelectBtnItem.ActivityTypeID - 1) { this.UpdateSelectBtnItem(this.currentSelectBtnItem); } } } }); } }
private void OnClickActivityTypeItemBtn(GameObject go) { AcOpenServerBtnItem component = go.GetComponent <AcOpenServerBtnItem>(); if (component == null) { return; } if (!AcOpenServerManager.Instance.CheckActivityTypeUnLock(component.ActivityTypeID)) { KaiFuHuoDong kaiFuHuoDong = DataReader <KaiFuHuoDong> .Get(component.ActivityTypeID); if (kaiFuHuoDong != null && kaiFuHuoDong.openDay != null && kaiFuHuoDong.openDay.get_Count() > 0) { int num = kaiFuHuoDong.openDay.get_Item(0); if (num > 0) { UIManagerControl.Instance.ShowToastText(string.Format(GameDataUtils.GetChineseContent(513169, false), num) + GameDataUtils.GetChineseContent(508009, false)); } } return; } if (component == this.currentSelectBtnItem) { return; } if (this.currentSelectBtnItem != null) { this.currentSelectBtnItem.Selected = false; } component.Selected = true; this.UpdateSelectBtnItem(component); }
private void UpdateSelectBtnItem(AcOpenServerBtnItem btnItem) { if (btnItem == null) { return; } this.currentSelectBtnItem = btnItem; AcOpenServerManager.Instance.SendGetOpenServerActInfoReq(btnItem.ActivityTypeID); this.UpdateUIByType(btnItem.ActivityTypeID); this.UpdateMyTargetInfo(btnItem.ActivityTypeID); this.UpdateActivityCountDown(btnItem.ActivityTypeID); this.UpdateUpWayListByType(btnItem.ActivityTypeID); }