Esempio n. 1
0
        public static void SetAchieveBaseIcon(Transform trans, CAchieveItem2 achieveItem, CUIFormScript form = null)
        {
            if (achieveItem == null)
            {
                return;
            }
            if (trans == null)
            {
                return;
            }
            Image component = trans.GetComponent <Image>();

            component.SetSprite(achieveItem.GetAchievementBgIconPath(), form, true, false, false, false);
            Transform transform  = trans.Find("goldEffect");
            Transform transform2 = trans.Find("silverEffect");

            if (!achieveItem.IsFinish())
            {
                transform.gameObject.CustomSetActive(false);
                transform2.gameObject.CustomSetActive(false);
                return;
            }
            uint dwAchieveLvl = achieveItem.Cfg.dwAchieveLvl;

            if (dwAchieveLvl >= 3u)
            {
                transform.gameObject.CustomSetActive(true);
                transform2.gameObject.CustomSetActive(false);
            }
            else if (dwAchieveLvl == 2u)
            {
                transform.gameObject.CustomSetActive(false);
                transform2.gameObject.CustomSetActive(true);
            }
            else
            {
                transform.gameObject.CustomSetActive(false);
                transform2.gameObject.CustomSetActive(false);
            }
        }
Esempio n. 2
0
        public ListView <CAchieveItem2> GetTrophies(enTrophyState state)
        {
            ListView <CAchieveItem2> listView = new ListView <CAchieveItem2>();

            switch (state)
            {
            case enTrophyState.All:
                for (int i = 0; i < this.m_Trophies.Count; i++)
                {
                    CAchieveItem2 item = this.m_Trophies[i];
                    listView.Add(item);
                }
                break;

            case enTrophyState.Finish:
                for (int j = 0; j < this.m_Trophies.Count; j++)
                {
                    CAchieveItem2 cAchieveItem = this.m_Trophies[j];
                    if (cAchieveItem.IsFinish())
                    {
                        listView.Add(cAchieveItem);
                    }
                }
                break;

            case enTrophyState.UnFinish:
                for (int k = 0; k < this.m_Trophies.Count; k++)
                {
                    CAchieveItem2 cAchieveItem2 = this.m_Trophies[k];
                    if (!cAchieveItem2.IsFinish())
                    {
                        listView.Add(cAchieveItem2);
                    }
                }
                break;
            }
            return(listView);
        }
Esempio n. 3
0
        public ListView <CAchieveItem2> GetTrophies(enTrophyState state)
        {
            ListView <CAchieveItem2> listView = new ListView <CAchieveItem2>();

            switch (state)
            {
            case enTrophyState.All:
                for (int i = 0; i < this.m_Trophies.get_Count(); i++)
                {
                    CAchieveItem2 cAchieveItem = this.m_Trophies.get_Item(i);
                    listView.Add(cAchieveItem);
                }
                break;

            case enTrophyState.Finish:
                for (int j = 0; j < this.m_Trophies.get_Count(); j++)
                {
                    CAchieveItem2 cAchieveItem2 = this.m_Trophies.get_Item(j);
                    if (cAchieveItem2.IsFinish())
                    {
                        listView.Add(cAchieveItem2);
                    }
                }
                break;

            case enTrophyState.UnFinish:
                for (int k = 0; k < this.m_Trophies.get_Count(); k++)
                {
                    CAchieveItem2 cAchieveItem3 = this.m_Trophies.get_Item(k);
                    if (!cAchieveItem3.IsFinish())
                    {
                        listView.Add(cAchieveItem3);
                    }
                }
                break;
            }
            return(listView);
        }
Esempio n. 4
0
        public string GetGotTimeText(bool needCheckMostRecentlyDone = false, bool needJudgeLeveUp = false)
        {
            CAchieveItem2 cAchieveItem = this;

            if (needCheckMostRecentlyDone)
            {
                cAchieveItem = this.TryToGetMostRecentlyDoneItem();
            }
            if (cAchieveItem == null)
            {
                return(Singleton <CTextManager> .GetInstance().GetText("Achievement_Status_Not_Done"));
            }
            if (!cAchieveItem.IsFinish())
            {
                return(Singleton <CTextManager> .GetInstance().GetText("Achievement_Status_Not_Done"));
            }
            if (cAchieveItem == this)
            {
                if (this.DoneTime == 0u)
                {
                    return(Singleton <CTextManager> .GetInstance().GetText("Achievement_Status_Done"));
                }
                return(string.Format("{0:yyyy.M.d} {1}", Utility.ToUtcTime2Local((long)((ulong)this.DoneTime)), Singleton <CTextManager> .GetInstance().GetText("Achievement_Status_Done")));
            }
            else
            {
                if (cAchieveItem.DoneTime == 0u)
                {
                    return(Singleton <CTextManager> .GetInstance().GetText("Achievement_Status_Done"));
                }
                if (needJudgeLeveUp)
                {
                    return(string.Format("{0:yyyy.M.d} {1}", Utility.ToUtcTime2Local((long)((ulong)cAchieveItem.DoneTime)), Singleton <CTextManager> .GetInstance().GetText("Achievement_Status_Level_Up")));
                }
                return(string.Format("{0:yyyy.M.d} {1}", Utility.ToUtcTime2Local((long)((ulong)cAchieveItem.DoneTime)), Singleton <CTextManager> .GetInstance().GetText("Achievement_Status_Done")));
            }
        }
Esempio n. 5
0
        private void OnAchievementEnable(CUIEvent uiEvent)
        {
            if (this.m_CurAchieveItem == null)
            {
                Singleton <CUIManager> .GetInstance().CloseForm("UGUI/Form/System/Achieve/Form_Trophy_Detail.prefab");

                return;
            }
            int           srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;
            int           achievementCnt = this.m_CurAchieveItem.GetAchievementCnt();
            CAchieveItem2 cAchieveItem   = this.m_CurAchieveItem;
            bool          bActive        = srcWidgetIndexInBelongedList != achievementCnt - 1;

            for (int i = 0; i < srcWidgetIndexInBelongedList; i++)
            {
                cAchieveItem = cAchieveItem.Next;
            }
            CUIListElementScript cUIListElementScript = uiEvent.m_srcWidgetScript as CUIListElementScript;
            GameObject           widget   = cUIListElementScript.GetWidget(0);
            GameObject           widget2  = cUIListElementScript.GetWidget(1);
            GameObject           widget3  = cUIListElementScript.GetWidget(2);
            GameObject           widget4  = cUIListElementScript.GetWidget(3);
            GameObject           widget5  = cUIListElementScript.GetWidget(4);
            GameObject           widget6  = cUIListElementScript.GetWidget(5);
            GameObject           widget7  = cUIListElementScript.GetWidget(6);
            GameObject           widget8  = cUIListElementScript.GetWidget(7);
            GameObject           widget9  = cUIListElementScript.GetWidget(8);
            GameObject           widget10 = cUIListElementScript.GetWidget(9);

            widget4.CustomSetActive(bActive);
            Image component  = widget.GetComponent <Image>();
            Image component2 = widget9.GetComponent <Image>();
            Text  component3 = widget2.GetComponent <Text>();
            Text  component4 = widget3.GetComponent <Text>();
            Text  component5 = widget10.GetComponent <Text>();
            Text  component6 = widget5.GetComponent <Text>();
            Text  component7 = widget6.GetComponent <Text>();

            if (component == null || component3 == null || component4 == null || component6 == null || component7 == null || component2 == null || component5 == null)
            {
                return;
            }
            component.SetSprite(CUIUtility.GetSpritePrefeb(cAchieveItem.GetAchieveImagePath(), false, false), false);
            CAchievementSystem.SetAchieveBaseIcon(widget9.transform, cAchieveItem, null);
            component3.set_text(cAchieveItem.Cfg.szName);
            component4.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Achievement_Score"), cAchieveItem.Cfg.dwPoint));
            if (cAchieveItem.IsFinish())
            {
                if (cAchieveItem.DoneTime == 0u)
                {
                    widget10.CustomSetActive(false);
                }
                else
                {
                    widget10.CustomSetActive(true);
                    component5.set_text(string.Format("{0:yyyy.M.d}", Utility.ToUtcTime2Local((long)((ulong)cAchieveItem.DoneTime))));
                }
                component6.set_text(cAchieveItem.GetAchievementDesc());
                component7.set_text(Singleton <CTextManager> .GetInstance().GetText("Achievement_Status_Done"));
                widget7.CustomSetActive(true);
                widget8.CustomSetActive(false);
            }
            else
            {
                widget10.CustomSetActive(false);
                component6.set_text(cAchieveItem.GetAchievementDesc());
                widget6.CustomSetActive(false);
                widget7.CustomSetActive(false);
                widget8.CustomSetActive(true);
            }
        }