private void OnShowMainPanel(HeadIconSys.enHeadImgTab curTab) { CUIFormScript form = Singleton <CUIManager> .instance.GetForm(HeadIconSys.s_headImgChgForm); if (form != null) { ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(curTab); int count = curHeadImgList.Count; CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(form.gameObject, "pnlBg/Panel_Main/List"); componetInChild.SetElementAmount(count); int index = 0; for (int i = 0; i < count; i++) { if (this.IsHeadIconInUse(curHeadImgList[i].dwID)) { index = i; break; } } if (count > 0) { componetInChild.SelectElement(index, true); } else { this.OnShowDetailPanel(-1); } } }
private ListView <ResHeadImage> GetCurHeadImgList(HeadIconSys.enHeadImgTab curTab) { ListView <ResHeadImage> listView = null; if (!this.headImageDic.TryGetValue(curTab, out listView)) { DictionaryView <uint, ResHeadImage> .Enumerator enumerator = GameDataMgr.headImageDict.GetEnumerator(); RES_HEADIMG_SOURCE_TYPE headType = this.GetHeadType(curTab); listView = new ListView <ResHeadImage>(); if (GameDataMgr.headImageDict.Count == 0) { return(listView); } while (enumerator.MoveNext()) { KeyValuePair <uint, ResHeadImage> current = enumerator.Current; ResHeadImage value = current.get_Value(); if (headType == RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_MAX || headType == (RES_HEADIMG_SOURCE_TYPE)value.bHeadType) { listView.Add(value); } } this.headImageDic.Add(curTab, listView); } return(listView); }
private void On_HeadIcon_Change_Item_Enable(CUIEvent uiEvent) { HeadIconSys.enHeadImgTab curTab = this.GetCurTab(); int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList; ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(curTab); this.OnUpdateElement(uiEvent.m_srcWidget, srcWidgetIndexInBelongedList, curTab); }
private void SortResDic(HeadIconSys.enHeadImgTab tab) { ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(tab); if (tab == HeadIconSys.enHeadImgTab.All) { curHeadImgList.Sort(new Comparison <ResHeadImage>(this.ComparisonByTab)); } else if (tab == HeadIconSys.enHeadImgTab.Nobe || tab == HeadIconSys.enHeadImgTab.Team) { curHeadImgList.Sort(new Comparison <ResHeadImage>(this.ComparisonByWeight)); } else if (tab == HeadIconSys.enHeadImgTab.Activity || tab == HeadIconSys.enHeadImgTab.Skin) { curHeadImgList.Sort(new Comparison <ResHeadImage>(this.ComparisonByTime)); } }
private void OnHeadInfoRefresh() { CUIFormScript form = Singleton <CUIManager> .instance.GetForm(HeadIconSys.s_headImgChgForm); if (form != null) { HeadIconSys.enHeadImgTab curTab = this.GetCurTab(); ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(curTab); int count = curHeadImgList.Count; CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(form.gameObject, "pnlBg/Panel_Main/List"); for (int i = 0; i < count; i++) { CUIListElementScript elemenet = componetInChild.GetElemenet(i); if (elemenet != null && elemenet.gameObject != null) { this.OnUpdateElement(elemenet.gameObject, i, curTab); } } } }
private void OnUpdateElement(GameObject element, int index, HeadIconSys.enHeadImgTab curTab) { CUIFormScript form = Singleton <CUIManager> .instance.GetForm(HeadIconSys.s_headImgChgForm); if (form == null) { return; } ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(curTab); if (index < 0 || index >= curHeadImgList.Count) { return; } ResHeadImage resHeadImage = curHeadImgList[index]; if (resHeadImage == null) { return; } HeadIconSys.HeadImgInfo info = this.GetInfo(resHeadImage.dwID); Image componetInChild = Utility.GetComponetInChild <Image>(element, "HeadImg"); MonoSingleton <NobeSys> .instance.SetHeadIconBk(componetInChild, (int)resHeadImage.dwID); MonoSingleton <NobeSys> .instance.SetHeadIconBkEffect(componetInChild, (int)resHeadImage.dwID, form, 0.8f, true); if (info != null) { Utility.FindChild(element, "Flag").CustomSetActive(info.bNtfFlag == 1); Utility.FindChild(element, "Lock").CustomSetActive(false); Utility.FindChild(element, "Text").CustomSetActive(this.IsHeadIconInUse(info.dwID)); } else { Utility.FindChild(element, "Flag").CustomSetActive(false); Utility.FindChild(element, "Lock").CustomSetActive(true); Utility.FindChild(element, "Text").CustomSetActive(false); } }
private RES_HEADIMG_SOURCE_TYPE GetHeadType(HeadIconSys.enHeadImgTab type) { if (type == HeadIconSys.enHeadImgTab.All) { return(RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_MAX); } if (type == HeadIconSys.enHeadImgTab.Nobe) { return(RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_NOBE); } if (type == HeadIconSys.enHeadImgTab.Activity) { return(RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_ACTIVITY); } if (type == HeadIconSys.enHeadImgTab.Skin) { return(RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_SKIN); } if (type == HeadIconSys.enHeadImgTab.Team) { return(RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_BATTLE); } return(RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_MAX); }
private RES_HEADIMG_SOURCE_TYPE GetHeadType(HeadIconSys.enHeadImgTab type) { if (type == HeadIconSys.enHeadImgTab.All) { return(7); } if (type == HeadIconSys.enHeadImgTab.Nobe) { return(1); } if (type == HeadIconSys.enHeadImgTab.Activity) { return(2); } if (type == HeadIconSys.enHeadImgTab.Skin) { return(3); } if (type == HeadIconSys.enHeadImgTab.Team) { return(4); } return(7); }
private void OnShowDetailPanel(int index) { CUIFormScript form = Singleton <CUIManager> .instance.GetForm(HeadIconSys.s_headImgChgForm); if (form != null) { HeadIconSys.enHeadImgTab curTab = this.GetCurTab(); ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(curTab); if (index == -1) { Utility.FindChild(form.gameObject, "pnlBg/Panel_Detail/Node").SetActive(false); return; } if (index < curHeadImgList.Count) { Utility.FindChild(form.gameObject, "pnlBg/Panel_Detail/Node").SetActive(true); ResHeadImage resHeadImage = curHeadImgList[index]; HeadIconSys.HeadImgInfo info = this.GetInfo(resHeadImage.dwID); Text componetInChild = Utility.GetComponetInChild <Text>(form.gameObject, "pnlBg/Panel_Detail/Node/DescTxt"); Text componetInChild2 = Utility.GetComponetInChild <Text>(form.gameObject, "pnlBg/Panel_Detail/Node/AvaildTimeTxt"); Image componetInChild3 = Utility.GetComponetInChild <Image>(form.gameObject, "pnlBg/Panel_Detail/Node/HeadImg"); Button componetInChild4 = Utility.GetComponetInChild <Button>(form.gameObject, "pnlBg/Panel_Detail/Node/Button"); Text componetInChild5 = Utility.GetComponetInChild <Text>(form.gameObject, "pnlBg/Panel_Detail/Node/SrcTxt"); componetInChild.set_text(resHeadImage.szHeadDesc); MonoSingleton <NobeSys> .instance.SetHeadIconBk(componetInChild3, (int)resHeadImage.dwID); MonoSingleton <NobeSys> .instance.SetHeadIconBkEffect(componetInChild3, (int)resHeadImage.dwID, form, 1f, false); if (resHeadImage.dwValidSecond == 0u) { componetInChild2.set_text(Singleton <CTextManager> .instance.GetText("HeadImg_Tips_1")); } else if (info != null) { DateTime dateTime = Utility.ToUtcTime2Local((long)CRoleInfo.GetCurrentUTCTime() + (long)((ulong)resHeadImage.dwValidSecond)); componetInChild2.set_text(Singleton <CTextManager> .instance.GetText("HeadImg_Tips_2", new string[] { dateTime.get_Year().ToString(), dateTime.get_Month().ToString(), dateTime.get_Day().ToString() })); } else { componetInChild2.set_text(Singleton <CTextManager> .instance.GetText("HeadImg_Tips_3", new string[] { Math.Ceiling((double)(resHeadImage.dwValidSecond / 86400f)).ToString() })); } if (info != null) { componetInChild4.gameObject.CustomSetActive(!this.IsHeadIconInUse(info.dwID)); componetInChild5.gameObject.SetActive(false); } else { componetInChild4.gameObject.CustomSetActive(false); componetInChild5.gameObject.SetActive(true); componetInChild5.set_text(resHeadImage.szHeadAccess); } } } }
private void On_HeadIcon_Change_Tab_Click(CUIEvent uiEvent) { HeadIconSys.enHeadImgTab curTab = this.GetCurTab(); this.SortResDic(curTab); this.OnShowMainPanel(curTab); }