Exemple #1
0
        public int CompareTo(object obj)
        {
            CAchieveItem item = obj as CAchieveItem;

            if (this.m_state == item.m_state)
            {
                if (this.m_state == COM_ACHIEVEMENT_STATE.COM_ACHIEVEMENT_STATE_UNFIN)
                {
                    if (this.m_cfgInfo.dwClassification > item.m_cfgInfo.dwClassification)
                    {
                        return(-1);
                    }
                    if (this.m_cfgInfo.dwClassification < item.m_cfgInfo.dwClassification)
                    {
                        return(1);
                    }
                }
                return(this.m_cfgId.CompareTo(item.m_cfgId));
            }
            if (this.m_state != COM_ACHIEVEMENT_STATE.COM_ACHIEVEMENT_STATE_FIN)
            {
                if (this.m_state != COM_ACHIEVEMENT_STATE.COM_ACHIEVEMENT_STATE_UNFIN)
                {
                    return(1);
                }
                if (item.m_state == COM_ACHIEVEMENT_STATE.COM_ACHIEVEMENT_STATE_FIN)
                {
                    return(1);
                }
            }
            return(-1);
        }
        public void InitAchieveInfo(COMDT_ACHIEVEMENT_INFO svrAchieveInfo)
        {
            this.m_achieveList.Clear();
            int i;

            for (i = 0; i < 60; i++)
            {
                this.m_achieveDoneArr[i] = 0;
            }
            i = 0;
            while ((long)i < (long)((ulong)svrAchieveInfo.dwDoneTypeNum))
            {
                int dwDoneType = (int)svrAchieveInfo.astDoneData[i].dwDoneType;
                this.m_achieveDoneArr[dwDoneType] = svrAchieveInfo.astDoneData[i].iDoneCnt;
                i++;
            }
            i = 0;
            while ((long)i < (long)((ulong)svrAchieveInfo.dwAchievementNum))
            {
                CAchieveItem cAchieveItem = new CAchieveItem();
                cAchieveItem.InitStateData(svrAchieveInfo.astAchievementData[i]);
                cAchieveItem.SetDoneData(ref this.m_achieveDoneArr);
                this.m_achieveList.Add(cAchieveItem);
                i++;
            }
        }
Exemple #3
0
        private void SetAchievementListItemState(CUIListElementScript listElement, CAchieveItem achieveItem)
        {
            Transform  transform  = listElement.transform;
            GameObject gameObject = transform.Find("btnGet").gameObject;
            GameObject obj3       = transform.Find("imgAwardMark").gameObject;
            GameObject obj4       = transform.Find("txtInProcess").gameObject;

            if (achieveItem.GetAchieveState() == COM_ACHIEVEMENT_STATE.COM_ACHIEVEMENT_STATE_REWARD)
            {
                obj3.CustomSetActive(true);
                gameObject.CustomSetActive(false);
                obj4.CustomSetActive(false);
            }
            else if (achieveItem.GetAchieveState() == COM_ACHIEVEMENT_STATE.COM_ACHIEVEMENT_STATE_FIN)
            {
                obj3.CustomSetActive(false);
                gameObject.CustomSetActive(true);
                obj4.CustomSetActive(false);
            }
            else
            {
                obj3.CustomSetActive(false);
                gameObject.CustomSetActive(false);
                obj4.CustomSetActive(true);
                if (achieveItem.m_cfgInfo.dwClassification == 2)
                {
                    obj4.GetComponent <Text>().text = Singleton <CTextManager> .GetInstance().GetText("Achievement_State_In_Process");
                }
                else
                {
                    obj4.GetComponent <Text>().text = Singleton <CTextManager> .GetInstance().GetText("Achievement_State_Unfinish");
                }
            }
        }
Exemple #4
0
        private void SetAchievementListItem(CUIListElementScript listElement, CAchieveItem achieveItem)
        {
            Transform  transform  = listElement.transform;
            GameObject gameObject = transform.Find("Panel_NotGotAward").gameObject;
            GameObject obj3       = transform.Find("Panel_GotAward").gameObject;
            GameObject obj4       = transform.Find("imgIconBg/imgIcon").gameObject;
            Image      component  = transform.Find("imgIconBg").GetComponent <Image>();
            Image      image      = transform.Find("imgIconBg/imgIcon").GetComponent <Image>();
            Text       text       = transform.Find("txtName").GetComponent <Text>();
            Text       text2      = transform.Find("txtDesc").GetComponent <Text>();
            Text       text3      = transform.Find("txtProcess").GetComponent <Text>();

            if (achieveItem.GetAchieveState() == COM_ACHIEVEMENT_STATE.COM_ACHIEVEMENT_STATE_REWARD)
            {
                obj3.CustomSetActive(true);
                gameObject.CustomSetActive(false);
            }
            else
            {
                gameObject.CustomSetActive(true);
                obj3.CustomSetActive(false);
            }
            component.SetSprite(achieveItem.GetAchievementBgIconPath(), listElement.m_belongedFormScript, true, false, false);
            if (achieveItem.IsHideForegroundIcon())
            {
                obj4.CustomSetActive(false);
            }
            else
            {
                obj4.CustomSetActive(true);
                image.SetSprite(achieveItem.GetAchievementIconPath(), listElement.m_belongedFormScript, true, false, false);
            }
            text.text  = achieveItem.GetAchievementName();
            text2.text = achieveItem.GetAchievementDesc();
            if (achieveItem.m_cfgInfo.dwClassification == 2)
            {
                text3.gameObject.CustomSetActive(true);
                if (achieveItem.IsFinish())
                {
                    string[] args = new string[] { achieveItem.m_cfgInfo.dwDoneCondi.ToString(), achieveItem.m_cfgInfo.dwDoneCondi.ToString() };
                    text3.text = Singleton <CTextManager> .GetInstance().GetText("Achievement_Type_Process_Format", args);
                }
                else
                {
                    string[] textArray2 = new string[] { achieveItem.GetAchieveDoneCnt().ToString(), achieveItem.m_cfgInfo.dwDoneCondi.ToString() };
                    text3.text = Singleton <CTextManager> .GetInstance().GetText("Achievement_Type_Process_Format", textArray2);
                }
            }
            else
            {
                text3.gameObject.CustomSetActive(false);
            }
            this.SetAchievementListItemState(listElement, achieveItem);
            this.SetAchievementListItemAward(listElement, achieveItem);
        }
Exemple #5
0
 private void RefreshListForm(CUIFormScript listForm = null)
 {
     if (listForm == null)
     {
         listForm = Singleton <CUIManager> .GetInstance().GetForm("UGUI/Form/System/Achieve/Form_Achievement_List.prefab");
     }
     if (listForm != null)
     {
         listForm.GetWidget(1).GetComponent <Text>().text = CAchieveItem.GetAchievementTypeName(this.m_curAchievementType);
         this.m_oneTypeAchieveItems = CAchieveInfo.GetAchieveInfo().GetNeedShowAchieveItemsByType(this.m_curAchievementType);
         this.m_oneTypeAchieveItems.Sort();
         listForm.GetWidget(0).GetComponent <CUIListScript>().SetElementAmount(this.m_oneTypeAchieveItems.Count);
     }
 }
Exemple #6
0
        private void OnAchievementListElementEnabled(CUIEvent uiEvent)
        {
            CUIListElementScript srcWidgetScript = uiEvent.m_srcWidgetScript as CUIListElementScript;

            if ((uiEvent.m_srcWidgetIndexInBelongedList >= this.m_oneTypeAchieveItems.Count) || (uiEvent.m_srcWidgetIndexInBelongedList < 0))
            {
                object[] inParameters = new object[] { uiEvent.m_srcWidgetIndexInBelongedList };
                DebugHelper.Assert(false, "CAchievementSystem.OnAchievementListElementEnabled(): m_srcWidgetIndexInBelongedList out of range: {0}", inParameters);
            }
            else
            {
                CAchieveItem achieveItem = this.m_oneTypeAchieveItems[uiEvent.m_srcWidgetIndexInBelongedList];
                this.SetAchievementListItem(srcWidgetScript, achieveItem);
            }
        }
Exemple #7
0
 private void RefreshShareForm(CUIFormScript shareForm, uint achievementId)
 {
     if (shareForm == null)
     {
         shareForm = Singleton <CUIManager> .GetInstance().GetForm("UGUI/Form/System/Achieve/Form_Achievement_ShareNewAchievement.prefab");
     }
     if (shareForm != null)
     {
         CAchieveItem achieveItemById = CAchieveInfo.GetAchieveInfo().GetAchieveItemById(achievementId);
         if (achieveItemById != null)
         {
             shareForm.GetWidget(0).GetComponent <Text>().text = achieveItemById.GetAchievementName();
             shareForm.GetWidget(5).GetComponent <Text>().text = achieveItemById.GetAchievementDesc();
             shareForm.GetWidget(7).GetComponent <Text>().text = achieveItemById.GetAchievementTips();
             shareForm.GetWidget(9).GetComponent <Image>().SetSprite(achieveItemById.GetAchievementBgIconPath(), shareForm, true, false, false);
             GameObject widget = shareForm.GetWidget(6);
             if (achieveItemById.IsHideForegroundIcon())
             {
                 widget.CustomSetActive(false);
             }
             else
             {
                 widget.CustomSetActive(true);
                 widget.GetComponent <Image>().SetSprite(achieveItemById.GetAchievementIconPath(), shareForm, true, false, false);
             }
             this.RefreshAwardPanel(shareForm, achievementId);
             ShareSys.SetSharePlatfText(shareForm.GetWidget(10).GetComponent <Text>());
             if (CSysDynamicBlock.bSocialBlocked)
             {
                 Transform transform = shareForm.transform.Find("Panel_ShareAchievement_Btn");
                 if (transform != null)
                 {
                     transform.gameObject.CustomSetActive(false);
                 }
                 Transform transform2 = shareForm.transform.Find("Panel_NewAchievement_Btn/Btn_Share");
                 if (transform2 != null)
                 {
                     transform2.gameObject.CustomSetActive(false);
                 }
             }
         }
     }
 }
Exemple #8
0
        private void OnAchievementGetAward(CUIEvent uiEvent)
        {
            CUIListScript srcWidgetScript = uiEvent.m_srcWidgetScript as CUIListScript;

            if (srcWidgetScript == null)
            {
                DebugHelper.Assert(false, "CAchievementSystem.OnAchievementGetAward(): listScript is null");
            }
            else if ((srcWidgetScript.GetSelectedIndex() >= this.m_oneTypeAchieveItems.Count) || (srcWidgetScript.GetSelectedIndex() < 0))
            {
                object[] inParameters = new object[] { srcWidgetScript.GetSelectedIndex() };
                DebugHelper.Assert(false, "CAchievementSystem.OnAchievementGetAward(): list index out of range: {0}", inParameters);
            }
            else
            {
                CAchieveItem item = this.m_oneTypeAchieveItems[srcWidgetScript.GetSelectedIndex()];
                if (item.IsCanGetReward())
                {
                    SendGetAchieveRewardReq(item.m_cfgId);
                }
            }
        }
Exemple #9
0
        public int CompareTo(object obj)
        {
            CAchieveItem cAchieveItem = obj as CAchieveItem;

            if (this.m_state == cAchieveItem.m_state)
            {
                if (this.m_state != null)
                {
                    return(this.m_cfgId.CompareTo(cAchieveItem.m_cfgId));
                }
                if (this.m_cfgInfo.dwClassification > cAchieveItem.m_cfgInfo.dwClassification)
                {
                    return(-1);
                }
                if (this.m_cfgInfo.dwClassification < cAchieveItem.m_cfgInfo.dwClassification)
                {
                    return(1);
                }
                return(this.m_cfgId.CompareTo(cAchieveItem.m_cfgId));
            }
            else
            {
                if (this.m_state == 1)
                {
                    return(-1);
                }
                if (this.m_state != null)
                {
                    return(1);
                }
                if (cAchieveItem.m_state == 1)
                {
                    return(1);
                }
                return(-1);
            }
        }
Exemple #10
0
        public void InitAchieveInfo(COMDT_ACHIEVEMENT_INFO svrAchieveInfo)
        {
            this.m_achieveList.Clear();
            int index = 0;

            for (index = 0; index < 0x22; index++)
            {
                this.m_achieveDoneArr[index] = 0;
            }
            int dwDoneType = 0;

            for (index = 0; index < svrAchieveInfo.dwDoneTypeNum; index++)
            {
                dwDoneType = (int)svrAchieveInfo.astDoneData[index].dwDoneType;
                this.m_achieveDoneArr[dwDoneType] = svrAchieveInfo.astDoneData[index].iDoneCnt;
            }
            for (index = 0; index < svrAchieveInfo.dwAchievementNum; index++)
            {
                CAchieveItem item = new CAchieveItem();
                item.InitStateData(svrAchieveInfo.astAchievementData[index]);
                item.SetDoneData(ref this.m_achieveDoneArr);
                this.m_achieveList.Add(item);
            }
        }
Exemple #11
0
        private void SetAchievementListItemAward(CUIListElementScript listElement, CAchieveItem achieveItem)
        {
            Transform  transform           = listElement.transform;
            GameObject gameObject          = transform.Find("pnlAward/pnlPoint").gameObject;
            GameObject obj3                = transform.Find("pnlAward/pnlCoin").gameObject;
            GameObject obj4                = transform.Find("pnlAward/pnlDiamond").gameObject;
            GameObject obj5                = transform.Find("pnlAward/pnlItem").gameObject;
            GameObject obj6                = transform.Find("pnlAward/pnlSkin").gameObject;
            uint       dwPoint             = achieveItem.m_cfgInfo.dwPoint;
            uint       achievementAwardCnt = achieveItem.GetAchievementAwardCnt(RES_REWARDS_TYPE.RES_REWARDS_TYPE_HONOUR);
            uint       num3                = achieveItem.GetAchievementAwardCnt(RES_REWARDS_TYPE.RES_REWARDS_TYPE_DIAMOND);
            uint       num4                = achieveItem.GetAchievementAwardCnt(RES_REWARDS_TYPE.RES_REWARDS_TYPE_ITEM);
            uint       num5                = achieveItem.GetAchievementAwardCnt(RES_REWARDS_TYPE.RES_REWARDS_TYPE_SKIN);

            gameObject.transform.Find("txtNum").GetComponent <Text>().text = dwPoint.ToString();
            CUIEventScript component = gameObject.GetComponent <CUIEventScript>();
            CUseable       useable   = CUseableManager.CreateVirtualUseable(enVirtualItemType.enAchievementPoint, (int)dwPoint);

            this.SetAchievementAwardTipsEvent(component, useable);
            if (achievementAwardCnt > 0)
            {
                obj3.CustomSetActive(true);
                obj3.GetComponent <LayoutElement>().ignoreLayout         = false;
                obj3.transform.Find("txtNum").GetComponent <Text>().text = achievementAwardCnt.ToString();
                CUIEventScript eventScript = obj3.GetComponent <CUIEventScript>();
                CUseable       useable2    = CUseableManager.CreateVirtualUseable(enVirtualItemType.enGoldCoin, (int)achievementAwardCnt);
                this.SetAchievementAwardTipsEvent(eventScript, useable2);
            }
            else
            {
                obj3.CustomSetActive(false);
                obj3.GetComponent <LayoutElement>().ignoreLayout = true;
            }
            if (num3 > 0)
            {
                obj4.CustomSetActive(true);
                obj4.GetComponent <LayoutElement>().ignoreLayout         = false;
                obj4.transform.Find("txtNum").GetComponent <Text>().text = num3.ToString();
                CUIEventScript script3  = obj4.GetComponent <CUIEventScript>();
                CUseable       useable3 = CUseableManager.CreateVirtualUseable(enVirtualItemType.enDiamond, (int)num3);
                this.SetAchievementAwardTipsEvent(script3, useable3);
            }
            else
            {
                obj4.CustomSetActive(false);
                obj4.GetComponent <LayoutElement>().ignoreLayout = true;
            }
            if (num4 > 0)
            {
                obj5.CustomSetActive(true);
                obj5.GetComponent <LayoutElement>().ignoreLayout         = false;
                obj5.transform.Find("txtNum").GetComponent <Text>().text = num4.ToString();
                string prefabPath = CUIUtility.s_Sprite_Dynamic_Icon_Dir + achieveItem.GetAchievementAwardId(RES_REWARDS_TYPE.RES_REWARDS_TYPE_ITEM);
                obj5.transform.Find("imgIcon").GetComponent <Image>().SetSprite(prefabPath, listElement.m_belongedFormScript, true, false, false);
            }
            else
            {
                obj5.CustomSetActive(false);
                obj5.GetComponent <LayoutElement>().ignoreLayout = true;
            }
            if (num5 > 0)
            {
                obj6.CustomSetActive(true);
                obj6.GetComponent <LayoutElement>().ignoreLayout         = false;
                obj6.transform.Find("txtNum").GetComponent <Text>().text = num5.ToString();
                string str2 = CUIUtility.s_Sprite_Dynamic_Icon_Dir + achieveItem.GetAchievementAwardId(RES_REWARDS_TYPE.RES_REWARDS_TYPE_SKIN);
                obj6.transform.Find("imgIcon").GetComponent <Image>().SetSprite(str2, listElement.m_belongedFormScript, true, false, false);
            }
            else
            {
                obj6.CustomSetActive(false);
                obj6.GetComponent <LayoutElement>().ignoreLayout = true;
            }
        }