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)); } }
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); } }
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); } }