private void OnShowMainPanel(enHeadImgTab curTab) { CUIFormScript form = Singleton <CUIManager> .instance.GetForm(s_headImgChgForm); if (form != null) { int count = this.GetCurHeadImgList(curTab).Count; CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(form.gameObject, "pnlBg/Panel_Main/List"); CUIListElementScript elemenet = null; componetInChild.SetElementAmount(count); for (int i = 0; i < count; i++) { elemenet = componetInChild.GetElemenet(i); if ((elemenet != null) && (elemenet.gameObject != null)) { this.OnUpdateElement(elemenet.gameObject, i, curTab); } } if (count > 0) { componetInChild.SelectElement(0, true); } else { this.OnShowDetailPanel(-1); } } }
private void OnUpdateElement(GameObject element, int index, enHeadImgTab curTab) { CUIFormScript form = Singleton <CUIManager> .instance.GetForm(s_headImgChgForm); if (form != null) { ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(curTab); if ((index >= 0) && (index < curHeadImgList.Count)) { ResHeadImage image = curHeadImgList[index]; if (image != null) { HeadImgInfo info; info = info = this.GetInfo(curHeadImgList[index].dwID); Utility.GetComponetInChild <Image>(element, "HeadImg").SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Nobe_Dir, image.szHeadIcon), form, true, false, false); 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 void On_HeadIcon_Change_Tab_Click(CUIEvent uiEvent) { enHeadImgTab curTab = this.GetCurTab(); this.SortResDic(curTab); this.OnShowMainPanel(curTab); }
private ListView <ResHeadImage> GetCurHeadImgList(enHeadImgTab curTab) { ListView <ResHeadImage> view = null; if (!this.headImageDic.TryGetValue(curTab, out view)) { DictionaryView <uint, ResHeadImage> .Enumerator enumerator = GameDataMgr.headImageDict.GetEnumerator(); RES_HEADIMG_SOURCE_TYPE headType = this.GetHeadType(curTab); view = new ListView <ResHeadImage>(); if (GameDataMgr.headImageDict.Count == 0) { return(view); } while (enumerator.MoveNext()) { KeyValuePair <uint, ResHeadImage> current = enumerator.Current; ResHeadImage item = current.Value; if ((headType == RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_MAX) || (headType == ((RES_HEADIMG_SOURCE_TYPE)item.bHeadType))) { view.Add(item); } } this.headImageDic.Add(curTab, view); } return(view); }
private void OnShowMainPanel(enHeadImgTab curTab) { CUIFormScript form = Singleton <CUIManager> .instance.GetForm(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 void On_HeadIcon_Change_Item_Enable(CUIEvent uiEvent) { enHeadImgTab curTab = this.GetCurTab(); int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList; ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(curTab); this.OnUpdateElement(uiEvent.m_srcWidget, srcWidgetIndexInBelongedList, curTab); }
private void OnShowDetailPanel(int index) { CUIFormScript form = Singleton <CUIManager> .instance.GetForm(s_headImgChgForm); if (form != null) { enHeadImgTab curTab = this.GetCurTab(); ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(curTab); if (index == -1) { Utility.FindChild(form.gameObject, "pnlBg/Panel_Detail/Node").SetActive(false); } else if (index < curHeadImgList.Count) { Utility.FindChild(form.gameObject, "pnlBg/Panel_Detail/Node").SetActive(true); ResHeadImage image = curHeadImgList[index]; HeadImgInfo info = this.GetInfo(image.dwID); Text componetInChild = Utility.GetComponetInChild <Text>(form.gameObject, "pnlBg/Panel_Detail/Node/DescTxt"); Text text2 = Utility.GetComponetInChild <Text>(form.gameObject, "pnlBg/Panel_Detail/Node/AvaildTimeTxt"); Image image2 = Utility.GetComponetInChild <Image>(form.gameObject, "pnlBg/Panel_Detail/Node/HeadImg"); Button button = Utility.GetComponetInChild <Button>(form.gameObject, "pnlBg/Panel_Detail/Node/Button"); Text text3 = Utility.GetComponetInChild <Text>(form.gameObject, "pnlBg/Panel_Detail/Node/SrcTxt"); componetInChild.text = image.szHeadDesc; image2.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Nobe_Dir, image.szHeadIcon), form, true, false, false); if (image.dwValidSecond == 0) { text2.text = Singleton <CTextManager> .instance.GetText("HeadImg_Tips_1"); } else if (info != null) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo(); if (masterRoleInfo != null) { DateTime time = Utility.ToUtcTime2Local(masterRoleInfo.getCurrentTimeSinceLogin() + image.dwValidSecond); string[] args = new string[] { time.Year.ToString(), time.Month.ToString(), time.Day.ToString() }; text2.text = Singleton <CTextManager> .instance.GetText("HeadImg_Tips_2", args); } } else { string[] textArray2 = new string[] { Math.Ceiling((double)(((float)image.dwValidSecond) / 86400f)).ToString() }; text2.text = Singleton <CTextManager> .instance.GetText("HeadImg_Tips_3", textArray2); } if (info != null) { button.gameObject.CustomSetActive(!this.IsHeadIconInUse(info.dwID)); text3.gameObject.SetActive(false); } else { button.gameObject.CustomSetActive(false); text3.gameObject.SetActive(true); text3.text = image.szHeadAccess; } } } }
private void SortResDic(enHeadImgTab tab) { ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(tab); if (tab == enHeadImgTab.All) { curHeadImgList.Sort(new Comparison <ResHeadImage>(this.ComparisonByTab)); } else if ((tab == enHeadImgTab.Nobe) || (tab == enHeadImgTab.Team)) { curHeadImgList.Sort(new Comparison <ResHeadImage>(this.ComparisonByWeight)); } else if ((tab == enHeadImgTab.Activity) || (tab == enHeadImgTab.Skin)) { curHeadImgList.Sort(new Comparison <ResHeadImage>(this.ComparisonByTime)); } }
private void OnHeadInfoRefresh() { CUIFormScript form = Singleton <CUIManager> .instance.GetForm(s_headImgChgForm); if (form != null) { enHeadImgTab curTab = this.GetCurTab(); int count = this.GetCurHeadImgList(curTab).Count; CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(form.gameObject, "pnlBg/Panel_Main/List"); CUIListElementScript elemenet = null; for (int i = 0; i < count; i++) { elemenet = componetInChild.GetElemenet(i); if ((elemenet != null) && (elemenet.gameObject != null)) { this.OnUpdateElement(elemenet.gameObject, i, curTab); } } } }
private RES_HEADIMG_SOURCE_TYPE GetHeadType(enHeadImgTab type) { if (type != enHeadImgTab.All) { if (type == enHeadImgTab.Nobe) { return(RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_NOBE); } if (type == enHeadImgTab.Activity) { return(RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_ACTIVITY); } if (type == enHeadImgTab.Skin) { return(RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_SKIN); } if (type == enHeadImgTab.Team) { return(RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_BATTLE); } } return(RES_HEADIMG_SOURCE_TYPE.RES_HEADIMG_SOURCE_MAX); }