public void Init(bool bWin)
        {
            this.m_allAchievements = new bool[8];
            this.m_curAchievemnt   = RES_SHOW_ACHIEVEMENT_TYPE.RES_SHOW_ACHIEVEMENT_COUNT;
            if ((Singleton <BattleLogic> .GetInstance().battleStat != null) && (Singleton <BattleLogic> .GetInstance().battleStat.m_playerKDAStat != null))
            {
                PlayerKDA hostKDA = Singleton <BattleLogic> .GetInstance().battleStat.m_playerKDAStat.GetHostKDA();

                if (hostKDA != null)
                {
                    uint mvpPlayer = Singleton <BattleStatistic> .instance.GetMvpPlayer(hostKDA.PlayerCamp, bWin);

                    if ((mvpPlayer != 0) && (mvpPlayer == hostKDA.PlayerId))
                    {
                        this.m_allAchievements[7] = true;
                    }
                    COMDT_ACNT_INFO acntInfo = Singleton <BattleStatistic> .GetInstance().acntInfo;

                    if (acntInfo != null)
                    {
                        if (acntInfo.dwCurWeekContinousWinNum == 15)
                        {
                            this.m_allAchievements[0] = true;
                        }
                        else if (acntInfo.dwCurWeekContinousWinNum == 10)
                        {
                            this.m_allAchievements[2] = true;
                        }
                        else if (acntInfo.dwCurWeekContinousWinNum == 5)
                        {
                            this.m_allAchievements[4] = true;
                        }
                    }
                    IEnumerator <HeroKDA> enumerator = hostKDA.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        HeroKDA current = enumerator.Current;
                        if (current != null)
                        {
                            if (current.LegendaryNum > 0)
                            {
                                this.m_allAchievements[5] = true;
                            }
                            if (current.PentaKillNum > 0)
                            {
                                this.m_allAchievements[1] = true;
                            }
                            if (current.QuataryKillNum > 0)
                            {
                                this.m_allAchievements[3] = true;
                            }
                            if (current.TripleKillNum > 0)
                            {
                                this.m_allAchievements[6] = true;
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void SwitchAchievement(RES_SHOW_ACHIEVEMENT_TYPE achievement)
        {
            this.m_curAchievemnt = achievement;
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(PvpAchievementForm.s_formSharePVPVictoryPath);

            if (form == null)
            {
                return;
            }
            GameObject widget = form.GetWidget(0);

            Utility.FindChild(widget.gameObject, "Title/Text").GetComponent <Text>().set_text(Singleton <CTextManager> .instance.GetText("Share_PvpAchievement_Title" + (int)achievement));
            Utility.FindChild(widget.gameObject, "Grid").CustomSetActive(this.GetAchievementCount() > 1);
            if (this.IsVictoryStreak(achievement))
            {
                CUIUtility.SetImageSprite(form.GetWidget(1).GetComponent <Image>(), PvpAchievementForm.s_imageSharePVPBadge + 0 + ".prefab", form, true, false, false, false);
            }
            else
            {
                CUIUtility.SetImageSprite(form.GetWidget(1).GetComponent <Image>(), PvpAchievementForm.s_imageSharePVPBadge + (int)achievement + ".prefab", form, true, false, false, false);
            }
            GameObject gameObject = form.GetWidget(2).gameObject;

            if (gameObject != null)
            {
                int achievementCount = this.GetAchievementCount(achievement);
                if (achievementCount != 0)
                {
                    Utility.FindChild(gameObject, "Number").GetComponent <Text>().set_text(achievementCount.ToString());
                    Utility.FindChild(gameObject, "Text").GetComponent <Text>().set_text(Singleton <CTextManager> .instance.GetText("Share_PvpAchievement_Desc_" + (int)achievement));
                }
                gameObject.CustomSetActive(achievementCount != 0);
            }
        }
Exemple #3
0
        public void ShowDefeat()
        {
            if (this.m_allAchievements == null || this.m_allAchievements.Length != 8)
            {
                return;
            }
            CUIFormScript cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(PvpAchievementForm.s_formSharePVPDefeatPath, false, true);

            if (cUIFormScript == null)
            {
                return;
            }
            Transform transform = cUIFormScript.transform.Find("ShareFrame/Image");

            if (transform)
            {
                MonoSingleton <ShareSys> .GetInstance().SetShareDefeatImage(transform, cUIFormScript);
            }
            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SettlementSys_CloseSharePVPDefeat, new CUIEventManager.OnUIEventHandler(this.OnCloseSharePVPDefeat));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SettlementSys_ShareDefeatAddBarrage, new CUIEventManager.OnUIEventHandler(this.OnSharePVPDefeatAddBarrage));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SettlementSys_ShareDefeatSelectBarrage, new CUIEventManager.OnUIEventHandler(this.OnSharePVPDefeatSelectBarrage));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SettlementSys_ShareDefeatBarrageEnable, new CUIEventManager.OnUIEventHandler(this.OnBarrageEnable));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SettlementSys_CloseShareDefeatBarrage, new CUIEventManager.OnUIEventHandler(this.OnCloseBarrage));

            DatabinTable <ResDefeatBarrageText, ushort> databinTable = new DatabinTable <ResDefeatBarrageText, ushort>("Databin/Client/Text/DefeatBarrageText.bytes", "wID");

            for (int i = 0; i < this.m_allAchievements.Length; i++)
            {
                if (this.m_allAchievements[i])
                {
                    this.m_curAchievemnt = (RES_SHOW_ACHIEVEMENT_TYPE)i;
                    break;
                }
            }
            this.barrageList.Clear();
            if (databinTable != null)
            {
                Dictionary <long, object> .Enumerator enumerator = databinTable.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    KeyValuePair <long, object> current = enumerator.get_Current();
                    ResDefeatBarrageText        resDefeatBarrageText = (ResDefeatBarrageText)current.get_Value();
                    if ((RES_SHOW_ACHIEVEMENT_TYPE)resDefeatBarrageText.wAchievementType == this.m_curAchievemnt)
                    {
                        this.barrageList.Add(resDefeatBarrageText.szContent);
                    }
                }
            }
            MonoSingleton <ShareSys> .GetInstance().UpdateSharePVPForm(cUIFormScript, cUIFormScript.GetWidget(2));
        }
        private int GetAchievementCount(RES_SHOW_ACHIEVEMENT_TYPE achievement)
        {
            switch (achievement)
            {
            case RES_SHOW_ACHIEVEMENT_TYPE.RES_SHOW_ACHIEVEMENT_LEGENDARY:
                return(this.GetKVDataCount(RES_STATISTIC_SETTLE_DATA_TYPE.RES_STATISTIC_SETTLE_DATA_TYPE_GODLIKE_CNT));

            case RES_SHOW_ACHIEVEMENT_TYPE.RES_SHOW_ACHIEVEMENT_TRIPLEKILL:
                return(this.GetKVDataCount(RES_STATISTIC_SETTLE_DATA_TYPE.RES_STATISTIC_SETTLE_DATA_TYPE_TRIPLE_KILL_CNT));

            case RES_SHOW_ACHIEVEMENT_TYPE.RES_SHOW_ACHIEVEMENT_MVP:
                return(this.GetKVDataCount(RES_STATISTIC_SETTLE_DATA_TYPE.RES_STATISTIC_SETTLE_DATA_TYPE_MVP_CNT));
            }
            return(0);
        }
        public void ShowDefeat()
        {
            if ((this.m_allAchievements != null) && (this.m_allAchievements.Length == 8))
            {
                CUIFormScript form = Singleton <CUIManager> .GetInstance().OpenForm(s_formSharePVPDefeatPath, false, true);

                if (form != null)
                {
                    Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SettlementSys_CloseSharePVPDefeat, new CUIEventManager.OnUIEventHandler(this.OnCloseSharePVPDefeat));

                    Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SettlementSys_ShareDefeatAddBarrage, new CUIEventManager.OnUIEventHandler(this.OnSharePVPDefeatAddBarrage));

                    Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SettlementSys_ShareDefeatSelectBarrage, new CUIEventManager.OnUIEventHandler(this.OnSharePVPDefeatSelectBarrage));

                    Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SettlementSys_ShareDefeatBarrageEnable, new CUIEventManager.OnUIEventHandler(this.OnBarrageEnable));

                    Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SettlementSys_CloseShareDefeatBarrage, new CUIEventManager.OnUIEventHandler(this.OnCloseBarrage));

                    DatabinTable <ResDefeatBarrageText, ushort> table = new DatabinTable <ResDefeatBarrageText, ushort>("Databin/Client/Text/DefeatBarrageText.bytes", "wID");
                    for (int i = 0; i < this.m_allAchievements.Length; i++)
                    {
                        if (this.m_allAchievements[i])
                        {
                            this.m_curAchievemnt = (RES_SHOW_ACHIEVEMENT_TYPE)i;
                            break;
                        }
                    }
                    this.barrageList.Clear();
                    if (table != null)
                    {
                        Dictionary <long, object> .Enumerator enumerator = table.GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            KeyValuePair <long, object> current = enumerator.Current;
                            ResDefeatBarrageText        text    = (ResDefeatBarrageText)current.Value;
                            if (((RES_SHOW_ACHIEVEMENT_TYPE)text.wAchievementType) == this.m_curAchievemnt)
                            {
                                this.barrageList.Add(text.szContent);
                            }
                        }
                    }
                    MonoSingleton <ShareSys> .GetInstance().UpdateSharePVPForm(form, form.GetWidget(2));
                }
            }
        }
Exemple #6
0
        private int GetAchievementCount(RES_SHOW_ACHIEVEMENT_TYPE achievement)
        {
            int result = 0;

            switch (achievement)
            {
            case 5:
                result = this.GetKVDataCount(15);
                break;

            case 6:
                result = this.GetKVDataCount(17);
                break;

            case 7:
                result = this.GetKVDataCount(13);
                break;
            }
            return(result);
        }
Exemple #7
0
 private bool IsVictoryStreak(RES_SHOW_ACHIEVEMENT_TYPE achievement)
 {
     return(achievement == RES_SHOW_ACHIEVEMENT_TYPE.RES_SHOW_ACHIEVEMENT_FIFTEENVICTORY || achievement == RES_SHOW_ACHIEVEMENT_TYPE.RES_SHOW_ACHIEVEMENT_FIVEVICTORY || achievement == RES_SHOW_ACHIEVEMENT_TYPE.RES_SHOW_ACHIEVEMENT_TENVICTORY);
 }
Exemple #8
0
        public void Init(bool bWin)
        {
            this.m_allAchievements = new bool[8];
            this.m_curAchievemnt   = 8;
            if (Singleton <BattleLogic> .GetInstance().battleStat == null || Singleton <BattleLogic> .GetInstance().battleStat.m_playerKDAStat == null)
            {
                return;
            }
            PlayerKDA hostKDA = Singleton <BattleLogic> .GetInstance().battleStat.m_playerKDAStat.GetHostKDA();

            if (hostKDA == null)
            {
                return;
            }
            uint mvpPlayer = Singleton <BattleStatistic> .get_instance().GetMvpPlayer(hostKDA.PlayerCamp, bWin);

            if (mvpPlayer != 0u && mvpPlayer == hostKDA.PlayerId)
            {
                this.m_allAchievements[7] = true;
            }
            COMDT_ACNT_INFO acntInfo = Singleton <BattleStatistic> .GetInstance().acntInfo;

            if (acntInfo != null)
            {
                if (acntInfo.dwCurWeekContinousWinNum == 15u)
                {
                    this.m_allAchievements[0] = true;
                }
                else if (acntInfo.dwCurWeekContinousWinNum == 10u)
                {
                    this.m_allAchievements[2] = true;
                }
                else if (acntInfo.dwCurWeekContinousWinNum == 5u)
                {
                    this.m_allAchievements[4] = true;
                }
            }
            ListView <HeroKDA> .Enumerator enumerator = hostKDA.GetEnumerator();
            while (enumerator.MoveNext())
            {
                HeroKDA current = enumerator.get_Current();
                if (current != null)
                {
                    if (current.LegendaryNum > 0)
                    {
                        this.m_allAchievements[5] = true;
                    }
                    if (current.PentaKillNum > 0)
                    {
                        this.m_allAchievements[1] = true;
                    }
                    if (current.QuataryKillNum > 0)
                    {
                        this.m_allAchievements[3] = true;
                    }
                    if (current.TripleKillNum > 0)
                    {
                        this.m_allAchievements[6] = true;
                    }
                }
            }
        }
Exemple #9
0
 private bool IsVictoryStreak(RES_SHOW_ACHIEVEMENT_TYPE achievement)
 {
     return(achievement == null || achievement == 4 || achievement == 2);
 }