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);
     }
 }
 public void OnHeadIconSyncList(ushort count, COMDT_ACNT_HEADIMG_INFO[] astHeadImgInfo)
 {
     this.m_headImgInfo.Clear();
     for (int i = 0; i < (int)count; i++)
     {
         HeadIconSys.HeadImgInfo headImgInfo = new HeadIconSys.HeadImgInfo();
         headImgInfo.dwID      = astHeadImgInfo[i].dwID;
         headImgInfo.dwGetTime = astHeadImgInfo[i].dwGetTime;
         headImgInfo.bNtfFlag  = astHeadImgInfo[i].bNtfFlag;
         this.m_headImgInfo.Add(headImgInfo);
     }
 }
 public void AddHeadImgInfo(uint dwHeadImgID, uint dwGetTime)
 {
     HeadIconSys.HeadImgInfo headImgInfo = new HeadIconSys.HeadImgInfo();
     headImgInfo.dwID      = dwHeadImgID;
     headImgInfo.dwGetTime = dwGetTime;
     headImgInfo.bNtfFlag  = 1;
     for (int i = 0; i < this.m_headImgInfo.Count; i++)
     {
         if (this.m_headImgInfo[i].dwID == dwHeadImgID)
         {
             this.m_headImgInfo.RemoveAt(i);
             i--;
         }
     }
     this.m_headImgInfo.Add(headImgInfo);
 }
        private void On_HeadIcon_Change_Icon_Click(CUIEvent uiEvent)
        {
            CUIFormScript form = Singleton <CUIManager> .instance.GetForm(HeadIconSys.s_headImgChgForm);

            if (form != null)
            {
                int selectedIndex = uiEvent.m_srcWidget.GetComponent <CUIListScript>().GetSelectedIndex();
                this.OnShowDetailPanel(selectedIndex);
                ResHeadImage selectedHeadImg = this.GetSelectedHeadImg();
                if (selectedHeadImg != null)
                {
                    HeadIconSys.HeadImgInfo info = this.GetInfo(selectedHeadImg.dwID);
                    if (info != null && info.bNtfFlag == 1)
                    {
                        HeadIconSys.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);
                    }
                }
            }
        }