private void UpdateBuildMenulistTabIdx(int idx) { if (this._actvMenuList != null) { for (int i = 0; i < this._actvMenuList.get_Count(); i++) { this._actvMenuList.get_Item(i).Clear(); } this._actvMenuList = null; } this._actvMenuList = new ListView <CampaignForm.ActivityMenuItem>(); this._selectedIndex = -1; if (idx >= this.m_ActivtyTypeToTabIdx.Length) { return; } this.m_nSelectActivityIndex = this.m_ActivtyTypeToTabIdx[idx]; if (this.m_nSelectActivityIndex >= this.m_AllSelectActivityMenuList.Length) { return; } this._uiListMenu.SetElementAmount(this.m_AllSelectActivityMenuList[this.m_nSelectActivityIndex].get_Count()); for (int j = 0; j < this.m_AllSelectActivityMenuList[this.m_nSelectActivityIndex].get_Count(); j++) { Activity activity = this.m_AllSelectActivityMenuList[this.m_nSelectActivityIndex].get_Item(j).m_Activity; CUIListElementScript elemenet = this._uiListMenu.GetElemenet(j); CampaignForm.ActivityMenuItem activityMenuItem = new CampaignForm.ActivityMenuItem(elemenet.gameObject, activity); this._actvMenuList.Add(activityMenuItem); } this.SelectMenuItem(0); this._uiListMenu.SelectElement(0, true); }
private void SelectMenuItem(int index) { if (index < 0 || index >= this._actvMenuList.get_Count()) { this._titleImage.gameObject.CustomSetActive(false); this._titleText.gameObject.CustomSetActive(true); this._titleText.text = Singleton <CTextManager> .GetInstance().GetText("activityEmptyTitle"); this._view.SetActivity(null); return; } if (index != this._selectedIndex) { this._selectedIndex = index; CampaignForm.ActivityMenuItem activityMenuItem = this._actvMenuList.get_Item(this._selectedIndex); string title = activityMenuItem.activity.Title; if (string.IsNullOrEmpty(title)) { this._title.CustomSetActive(false); } else { this._title.CustomSetActive(true); if (activityMenuItem.activity.IsImageTitle) { this._titleText.gameObject.CustomSetActive(false); this._titleImage.gameObject.CustomSetActive(true); this._titleImage.SetSprite(CUIUtility.GetSpritePrefeb(ActivitySys.SpriteRootDir + title, false, false), false); this._titleImage.SetNativeSize(); } else { this._titleImage.gameObject.CustomSetActive(false); this._titleText.gameObject.CustomSetActive(true); this._titleText.text = title; } } this._view.SetActivity(activityMenuItem.activity); this._viewScroll.verticalNormalizedPosition = 1f; this.Update(); activityMenuItem.activity.Visited = true; } }