private void BattleResultReceived(object res, object info)
        {
            BattleResultData resInfo = (BattleResultData)info;
            NoticeType       resType = (NoticeType)res;

            view.OpenBattleResult(resType, resInfo);
        }
예제 #2
0
        private void BattleResultReceived(object res, object info)
        {
            DebugUtils.Log(DebugUtils.Type.Battle, string.Format("Received BattleResult: {0}", res));

            BattleResultData resInfo = (BattleResultData)info;
            NoticeType       resType = (NoticeType)res;

            _view.OpenBattleResult(resType, resInfo);
        }
예제 #3
0
        private IEnumerator GenerateBanner(NoticeType resType, BattleResultData resInfo)
        {
            yield return(new WaitForSeconds(3.0f));

            GameObject banner;

            switch (resType)
            {
            case NoticeType.BattleResultBlueWin:
            {
                if (DataManager.GetInstance().GetMatchSide() == MatchSide.Red)
                {
                    banner = Instantiate(GameResourceLoadManager.GetInstance().LoadAsset <GameObject>("BannerDefeat"));

                    SoundManager.Instance.PlayMusic(GameConstants.SOUND_DEFEAT_ID, false);
                }
                else
                {
                    banner = Instantiate(GameResourceLoadManager.GetInstance().LoadAsset <GameObject>("BannerVictory"));

                    SoundManager.Instance.PlayMusic(GameConstants.SOUND_VICTORY_ID, false);
                }
                break;
            }

            case NoticeType.BattleResultRedWin:
            {
                if (DataManager.GetInstance().GetMatchSide() == MatchSide.Red)
                {
                    banner = Instantiate(GameResourceLoadManager.GetInstance().LoadAsset <GameObject>("BannerVictory"));

                    SoundManager.Instance.PlayMusic(GameConstants.SOUND_VICTORY_ID, false);
                }
                else
                {
                    banner = Instantiate(GameResourceLoadManager.GetInstance().LoadAsset <GameObject>("BannerDefeat"));

                    SoundManager.Instance.PlayMusic(GameConstants.SOUND_DEFEAT_ID, false);
                }
                break;
            }

            default:
            {
                banner = Instantiate(Resources.Load("Prefabs/UI/BattleScreenItem/banners/banner_draw") as GameObject);

                SoundManager.Instance.PlayMusic(GameConstants.SOUND_VICTORY_ID, false);
                break;
            }
            }

            //banner.transform.Find( "Image" ).gameObject.SetActive( false );
            banner.transform.SetParent(transform.parent, false);

            StartCoroutine(EnableBattleResult(resType, resInfo, banner));
        }
예제 #4
0
        public void SetBattleResultData(NoticeType resType, BattleResultData resInfo, bool isPlayBack = false)
        {
            resultInfo = resInfo;

            #region Judge winning or losing

            if (resType == NoticeType.BattleResultBlueWin)
            {
                switch (myselfMatchSide)
                {
                case MatchSide.Red:
                    currentResultType = BattleResultType.Lose;
                    break;

                case MatchSide.Blue:
                    currentResultType = BattleResultType.Win;
                    break;
                }
                redVictroy = false;
            }
            else if (resType == NoticeType.BattleResultRedWin)
            {
                switch (myselfMatchSide)
                {
                case MatchSide.Red:
                    currentResultType = BattleResultType.Win;
                    break;

                case MatchSide.Blue:
                    currentResultType = BattleResultType.Lose;
                    break;
                }
                redVictroy = true;
            }

            #endregion

            view.RefreshBattleResult();

            if (!isPlayBack)
            {
                DataManager dataM = DataManager.GetInstance();

                dataM.SetPlayerExp(resInfo.currentExp);
                int currentGold = dataM.GetPlayerGold();
                dataM.SetPlayerGold(currentGold += resInfo.gainGold);
                dataM.SetPlayerLevel(resInfo.playerLevel);
            }
        }
예제 #5
0
        private IEnumerator EnableBattleResult(NoticeType resType, BattleResultData resInfo, GameObject banner)
        {
            yield return(new WaitForSeconds(3f));

            Destroy(banner);

            UIManager.Instance.GetUIByType(UIType.BattleResultScreen, (ViewBase ui, System.Object param) => {
                if (!ui.openState)
                {
                    ui.OnEnter();
                    (ui as BattleResultView).SetIsMainUIOpen(false);
                    (ui as BattleResultView).SetBattleResultData(resType, resInfo, true);
                }
            });
        }
예제 #6
0
 public void OpenBattleResult(NoticeType resType, BattleResultData resInfo)
 {
     StartCoroutine(GenerateBanner(resType, resInfo));
 }
예제 #7
0
 public void SetBattleResultData(Data.NoticeType resType, BattleResultData resInfo, bool isPlayBack = false)
 {
     controller.SetBattleResultData(resType, resInfo, isPlayBack);
 }