Esempio n. 1
0
        private void OnTrophyEnable(CUIEvent uiEvent)
        {
            int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;

            if (srcWidgetIndexInBelongedList < 0 || srcWidgetIndexInBelongedList >= this.m_CurTrophies.Count)
            {
                return;
            }
            CUIListElementScript cUIListElementScript = uiEvent.m_srcWidgetScript as CUIListElementScript;

            if (cUIListElementScript == null)
            {
                DebugHelper.Assert(false, "achievement selector sery enable elementscript is null");
                return;
            }
            CAchieveItem2 cAchieveItem = this.m_CurTrophies[srcWidgetIndexInBelongedList];
            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);

            if (Array.IndexOf <CAchieveItem2>(this.SelectedTrophies, cAchieveItem) >= 0)
            {
                widget2.CustomSetActive(true);
            }
            else
            {
                widget2.CustomSetActive(false);
            }
            Image component  = widget.GetComponent <Image>();
            Image component2 = widget5.GetComponent <Image>();
            Text  component3 = widget3.GetComponent <Text>();
            Text  component4 = widget4.GetComponent <Text>();

            if (component == null || component2 == null || component3 == null || component4 == null)
            {
                return;
            }
            CAchieveItem2 cAchieveItem2 = cAchieveItem.TryToGetMostRecentlyDoneItem();

            if (cAchieveItem2 == null)
            {
                component.SetSprite(CUIUtility.GetSpritePrefeb(cAchieveItem.GetAchieveImagePath(), false, false), false);
                CAchievementSystem.SetAchieveBaseIcon(widget5.transform, cAchieveItem, null);
                component3.set_text(cAchieveItem.Cfg.szName);
                component4.set_text(cAchieveItem.GetGotTimeText(false, false));
            }
            else
            {
                component.SetSprite(CUIUtility.GetSpritePrefeb(cAchieveItem2.GetAchieveImagePath(), false, false), false);
                CAchievementSystem.SetAchieveBaseIcon(widget5.transform, cAchieveItem2, null);
                component3.set_text(cAchieveItem2.Cfg.szName);
                component4.set_text(cAchieveItem2.GetGotTimeText(false, false));
            }
        }
Esempio n. 2
0
        private void OnTrophyEnable(CUIEvent uiEvent)
        {
            int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;

            if (srcWidgetIndexInBelongedList < 0 || srcWidgetIndexInBelongedList >= this.m_CurAchieveSeries.Count)
            {
                return;
            }
            CUIListElementScript cUIListElementScript = uiEvent.m_srcWidgetScript as CUIListElementScript;

            if (cUIListElementScript == null)
            {
                DebugHelper.Assert(false, "achievement sery enable elementscript is null");
                return;
            }
            CAchieveItem2  cAchieveItem = this.m_CurAchieveSeries[srcWidgetIndexInBelongedList];
            CUIEventScript component    = cUIListElementScript.GetComponent <CUIEventScript>();

            component.SetUIEvent(enUIEventType.Click, enUIEventID.Achievement_Trophy_Click, new stUIEventParams
            {
                commonUInt32Param1 = cAchieveItem.Cfg.dwID
            });
            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);

            widget2.CustomSetActive(false);
            Image component2 = widget.GetComponent <Image>();
            Image component3 = widget5.GetComponent <Image>();
            Text  component4 = widget3.GetComponent <Text>();
            Text  component5 = widget4.GetComponent <Text>();

            if (component2 == null || component3 == null || component4 == null || component5 == null)
            {
                return;
            }
            CAchieveItem2 cAchieveItem2 = cAchieveItem.TryToGetMostRecentlyDoneItem();

            if (cAchieveItem2 == null)
            {
                component2.SetSprite(CUIUtility.GetSpritePrefeb(cAchieveItem.GetAchieveImagePath(), false, false), false);
                CAchievementSystem.SetAchieveBaseIcon(widget5.transform, cAchieveItem, null);
                component4.set_text(cAchieveItem.Cfg.szName);
                component5.set_text(cAchieveItem.GetGotTimeText(false, false));
                widget6.CustomSetActive(true);
            }
            else
            {
                component2.SetSprite(CUIUtility.GetSpritePrefeb(cAchieveItem2.GetAchieveImagePath(), false, false), false);
                CAchievementSystem.SetAchieveBaseIcon(widget5.transform, cAchieveItem2, null);
                component4.set_text(cAchieveItem2.Cfg.szName);
                if (cAchieveItem == cAchieveItem2)
                {
                    component5.set_text(cAchieveItem.GetGotTimeText(false, false));
                }
                else
                {
                    component5.set_text(cAchieveItem2.GetGotTimeText(false, true));
                }
                widget6.CustomSetActive(false);
            }
        }