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 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 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 int ComparisonByWeight(ResHeadImage left, ResHeadImage right) { HeadImgInfo info = this.GetInfo(left.dwID); HeadImgInfo info2 = this.GetInfo(right.dwID); if ((info != null) && (info2 == null)) { return(-10000); } if ((info == null) && (info2 != null)) { return(0x2710); } if ((info == null) && (info2 == null)) { return(0); } if ((info.bNtfFlag == 1) && (info2.bNtfFlag == 0)) { return(-100); } if ((info.bNtfFlag == 0) && (info2.bNtfFlag == 1)) { return(100); } if (left.bSortWeight >= right.bSortWeight) { return(-1); } return(1); }
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 int ComparisonByWeight(ResHeadImage left, ResHeadImage right) { HeadIconSys.HeadImgInfo info = this.GetInfo(left.dwID); HeadIconSys.HeadImgInfo info2 = this.GetInfo(right.dwID); if (info != null && info2 == null) { return(-10000); } if (info == null && info2 != null) { return(10000); } if (info == null && info2 == null) { if (left.bSortWeight > right.bSortWeight) { return(-10); } if (left.bSortWeight < right.bSortWeight) { return(10); } if (left.dwID < right.dwID) { return(-1); } return(1); } else { if (info == null || info2 == null) { return(0); } if (info.bNtfFlag == 1 && info2.bNtfFlag == 0) { return(-1000); } if (info.bNtfFlag == 0 && info2.bNtfFlag == 1) { return(1000); } if (left.bSortWeight > right.bSortWeight) { return(-10); } if (left.bSortWeight < right.bSortWeight) { return(10); } if (left.dwID < right.dwID) { return(-1); } return(1); } }
private void On_HeadIcon_Change_Confirm(CUIEvent uiEvent) { ResHeadImage selectedHeadImg = this.GetSelectedHeadImg(); if ((selectedHeadImg != null) && (MonoSingleton <NobeSys> .GetInstance().m_vipInfo.stGameVipClient.dwHeadIconId != selectedHeadImg.dwID)) { OnHeadIconChangeReq(selectedHeadImg.dwID); } }
public ResHeadImage GetResHeadImage(int id) { ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(HeadIconSys.enHeadImgTab.All); for (int i = 0; i < curHeadImgList.Count; i++) { ResHeadImage resHeadImage = curHeadImgList[i]; if (resHeadImage != null && (ulong)resHeadImage.dwID == (ulong)((long)id)) { return(resHeadImage); } } return(null); }
private int ComparisonByTab(ResHeadImage left, ResHeadImage right) { HeadImgInfo info = this.GetInfo(left.dwID); HeadImgInfo info2 = this.GetInfo(right.dwID); if ((info != null) && (info2 == null)) { return(-10000); } if ((info == null) && (info2 != null)) { return(0x2710); } if ((info == null) && (info2 == null)) { if (left.bHeadType < right.bHeadType) { return(-1); } if ((left.bHeadType <= right.bHeadType) && (left.dwID < right.dwID)) { return(-1); } return(1); } if ((info != null) && (info2 != null)) { if ((info.bNtfFlag == 1) && (info2.bNtfFlag == 0)) { return(-100); } if ((info.bNtfFlag == 0) && (info2.bNtfFlag == 1)) { return(100); } if ((info.bNtfFlag == 0) && (info2.bNtfFlag == 0)) { if (left.bHeadType < right.bHeadType) { return(-1); } if ((left.bHeadType <= right.bHeadType) && (left.dwID < right.dwID)) { return(-1); } return(1); } } return(0); }
public string GetHeadIdxResName(int id) { ListView <ResHeadImage> curHeadImgList = this.GetCurHeadImgList(enHeadImgTab.All); for (int i = 0; i < curHeadImgList.Count; i++) { ResHeadImage image = curHeadImgList[i]; if ((image != null) && (image.dwID == id)) { return(Utility.UTF8Convert(image.szHeadIcon)); } } return(string.Empty); }
private void On_HeadIcon_Change_Icon_Click(CUIEvent uiEvent) { if (Singleton <CUIManager> .instance.GetForm(s_headImgChgForm) != null) { int selectedIndex = uiEvent.m_srcWidget.GetComponent <CUIListScript>().GetSelectedIndex(); this.OnShowDetailPanel(selectedIndex); ResHeadImage selectedHeadImg = this.GetSelectedHeadImg(); if (selectedHeadImg != null) { HeadImgInfo info = this.GetInfo(selectedHeadImg.dwID); if ((info != null) && (info.bNtfFlag == 1)) { OnHeadIconFlagClearReq(info.dwID); } } } }
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 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 int ComparisonByTime(ResHeadImage left, ResHeadImage right) { HeadImgInfo info = this.GetInfo(left.dwID); HeadImgInfo info2 = this.GetInfo(right.dwID); if ((info != null) && (info2 == null)) { return(-10000); } if ((info == null) && (info2 != null)) { return(0x2710); } if ((info == null) && (info2 == null)) { if (left.bSortWeight > right.bSortWeight) { return(-10); } if (left.bSortWeight < right.bSortWeight) { return(10); } if (left.dwID < right.dwID) { return(-1); } return(1); } if ((info == null) || (info2 == null)) { return(0); } if ((info.bNtfFlag == 1) && (info2.bNtfFlag == 0)) { return(-1000); } if ((info.bNtfFlag == 0) && (info2.bNtfFlag == 1)) { return(0x3e8); } if (info.dwGetTime > info2.dwGetTime) { return(-100); } if (info.dwGetTime < info2.dwGetTime) { return(100); } if (left.bSortWeight > right.bSortWeight) { return(-10); } if (left.bSortWeight < right.bSortWeight) { return(10); } if (left.dwID < right.dwID) { return(-1); } return(1); }