/// <summary>
    /// 按钮点击事件
    /// </summary>
    /// <param name="gameObj">Game object.</param>
    public override void buttonEventBase(GameObject gameObj)
    {
        base.buttonEventBase(gameObj);
        string btnName = gameObj.name;

        switch (btnName)
        {
        case "btn_close":
            if (needRefresh)
            {
                LaddersWindow baseWindow = UiManager.Instance.getWindow <LaddersWindow> ();
                if (baseWindow != null)
                {
                    baseWindow.M_updateUserInfo();
                }
                if (closeCallback != null)
                {
                    closeCallback();
                    closeCallback = null;
                }
            }
            finishWindow();
            break;

        case "btn_receive":
            LaddersAwardFport fport = FPortManager.Instance.getFPort <LaddersAwardFport> ();
            fport.apply((msg) => {
                if (msg == "ok")
                {
                    needRefresh = true;
                    TextTipWindow.Show(Language("s0120"));
                    btn_receive.disableButton(true);
                    LaddersManagement.Instance.Award.M_clear();
                    finishWindow();

                    LaddersWindow ladderWin = UiManager.Instance.getWindow <LaddersWindow>();
                    if (ladderWin != null)
                    {
                        ladderWin.M_updateView();
                    }
                }
            });
            break;
        }
    }
Пример #2
0
    public IEnumerator  beginBattleOverAnim()
    {
        //锁屏幕,防止出去后狂点按钮报错
        MaskWindow.LockUI();

        Time.timeScale = GameManager.Instance.gameSpeed;
        yield return(new WaitForSeconds(1f));

        playAnimBattleOver();

        BattleDataErlang currentbattleData = BattleManager.battleData;

        if (BattleManager.battleData.isGMFight)
        {
            BattleManager.Instance.awardFinfish();
            yield break;
        }
        //恶魔挑战不播放战后动画
        if (BattleManager.battleData.isOneOnOneBossFight)
        {
            hideOther();
            UiManager.Instance.openDialogWindow <BossAwardWindow>((win) => {
                win.init(BattleManager.Instance.battleAwards, () => {
                    UiManager.Instance.switchWindow <EmptyWindow>((window) => {
                        ScreenManager.Instance.loadScreen(1, null, GameManager.Instance.outOneOnOneBossWindow);
                    });
                    BattleManager.battleData.isOneOnOneBossFight = false;
                });
            });
            yield break;
        }
        //  末日决战boss战阶段不播放胜利或失败动画//
        if (BattleManager.battleData.isLastBattleBossBattle)
        {
            hideOther();
            UiManager.Instance.openDialogWindow <LastBattleAwardWindow>((win) => {
                win.init(BattleManager.Instance.battleAwards, () => {
                    UiManager.Instance.switchWindow <EmptyWindow>((window) => {
                        ScreenManager.Instance.loadScreen(1, null, GameManager.Instance.outLastBattleWindow);
                    });
                    BattleManager.battleData.isLastBattleBossBattle = false;
                });
            });
            yield break;
        }
        // 末日决战结算界面//
        if (BattleManager.battleData.isLastBattle)
        {
            // 胜利//
            if (currentbattleData.winnerID == TeamInfo.OWN_CAMP)
            {
                StartCoroutine(showLastBattleAward());
                yield break;
            }
        }
        if (currentbattleData.isArenaMass || currentbattleData.isArenaFinal || currentbattleData.isGuide || currentbattleData.isLadders || currentbattleData.isPractice || currentbattleData.isGuildFight || currentbattleData.isMineralFightRecord || currentbattleData.isGodsWarFinal)
        {
            bool isWin = currentbattleData.winnerID == TeamInfo.OWN_CAMP;

            if (currentbattleData.isMineralFightRecord)
            {
                string name = BattleManager.battleData.winnerID == TeamInfo.ENEMY_CAMP ? currentbattleData.replayEnemyName : currentbattleData.replayAttackerName;
                TextTipWindow.Show(LanguageConfigManager.Instance.getLanguage("Arena39", name));
                yield return(new WaitForSeconds(1.5f));
            }

            if (currentbattleData.isArenaFinal)
            {
                string name = BattleManager.battleData.winnerID == TeamInfo.ENEMY_CAMP ? currentbattleData.replayEnemyName : currentbattleData.replayAttackerName;
                TextTipWindow.ShowNotUnlock(LanguageConfigManager.Instance.getLanguage("Arena39", name));

                yield return(new WaitForSeconds(1.5f));
            }
            if (currentbattleData.isGodsWarFinal)
            {
                string name = BattleManager.battleData.winnerID == TeamInfo.ENEMY_CAMP ? currentbattleData.replayEnemyName : currentbattleData.replayAttackerName;
                TextTipWindow.ShowNotUnlock(LanguageConfigManager.Instance.getLanguage("Arena39", name));

                yield return(new WaitForSeconds(1.5f));
            }
            if (currentbattleData.isArenaMass)              //delay do
            {
                if (isWin)
                {
                    yield return(new WaitForSeconds(4f));
                }
                else
                {
                    yield return(new WaitForSeconds(4.5f));
                }
            }
            else if (currentbattleData.isLadders)
            {
                if (currentbattleData.isLaddersRecord)
                {
                    string name = BattleManager.battleData.winnerID == TeamInfo.ENEMY_CAMP ? currentbattleData.replayEnemyName : currentbattleData.replayAttackerName;
                    TextTipWindow.Show(LanguageConfigManager.Instance.getLanguage("Arena39", name));
                    yield return(new WaitForSeconds(1.5f));
                }
                else
                {
                    LaddersManagement.Instance.currentChallengeTimes++;
                    LaddersWindow lw = UiManager.Instance.getWindow <LaddersWindow> ();
                    lw.fightBack = true;
                    lw.fightWin  = isWin;

                    if (isWin)
                    {
                        yield return(new WaitForSeconds(4f));
                    }
                    else
                    {
                        yield return(new WaitForSeconds(4.5f));
                    }
                }
            }
            else if (currentbattleData.isGuildFight)
            {
                GuildAreaWindow areaWindow = UiManager.Instance.getWindow <GuildAreaWindow>();
                if (areaWindow != null)
                {
                    areaWindow.isWin       = isWin;
                    areaWindow.isFightBack = true;
                }
                if (isWin)
                {
                    yield return(new WaitForSeconds(2f));
                }
                else
                {
                    yield return(new WaitForSeconds(2.5f));
                }
            }
            else if (currentbattleData.isGuide)
            {
                yield return(new WaitForSeconds(4.5f));
            }
            else if (currentbattleData.isPractice)
            {
                yield return(new WaitForSeconds(4.5f));
            }
            //锁屏幕,防止出去后狂点ArenaAuditionsWindow的关闭按钮报错

            BattleManager.Instance.awardFinfish();
            yield break;
        }

        //世界首领输赢都出去
        if (WorldBossManagerment.Instance.isAttackBoss)
        {
            yield return(new WaitForSeconds(3f));

            hideOther();
            BattleManager.Instance.awardFinfish();
            yield break;
        }
        //if (BattleManager.battleData.winnerID != TeamInfo.ENEMY_CAMP&&MissionInfoManager.Instance.mission!=null) {
        //    if(MissionInfoManager.Instance.mission.getChapterType() == ChapterType.TOWER_FUBEN)
        //    {
        //        yield return new WaitForSeconds(3f);
        //        hideOther();
        //        BattleManager.Instance.awardFinfish();
        //        yield break;
        //    }
        //}

        //敌人胜利的话
        if (BattleManager.battleData.winnerID == TeamInfo.ENEMY_CAMP && !currentbattleData.isGodsWarGroupFight && !currentbattleData.isOneOnOneBossFight)          //诸神战小组赛失败了也有奖励

        {
            int chapterType = 0;
            if (MissionInfoManager.Instance.mission != null)
            {
                chapterType = MissionInfoManager.Instance.mission.getChapterType();
            }

            //讨伐失败了没奖励的,提前出去
            if (FuBenManagerment.Instance.isWarAttackBoss)
            {
                FuBenManagerment.Instance.isWarAttackBossWin = false;
                popBattleStrengItem();
                yield break;
            }
            if (FuBenManagerment.Instance.isWarActiveFuben)
            {
                FuBenManagerment.Instance.isWarActiveWin = false;
                popBattleStrengItem();
                yield break;
            }

            //公会首领,修炼
            if ((GuildManagerment.Instance.isGuildBattle || chapterType == ChapterType.PRACTICE) && !BattleManager.battleData.isHeroRoad)
            {
                if (BattleManager.battleData.isPvP == false)
                {
                    yield return(new WaitForSeconds(3f));

                    //非pvp输了没奖励提前走掉
                    hideOther();
                    BattleManager.Instance.awardFinfish();
                    yield break;
                }
            }
            if (MissionInfoManager.Instance.isTowerFuben() && !BattleManager.battleData.isHeroRoad)
            {
                yield return(new WaitForSeconds(3f));

                hideOther();
                BattleManager.Instance.awardFinfish();
                if (MissionInfoManager.Instance.isTowerFuben())                    //判断是爬塔副本
                {
                    UiManager.Instance.openDialogWindow <MessageWindow>((win) => { //弹出卡片全部阵亡提示
                        win.initWindow(1, LanguageConfigManager.Instance.getLanguage("ladderButton"), "", LanguageConfigManager.Instance.getLanguage("towerShowWindow06"), (msgHandle) => {
                            UiManager.Instance.missionMainWindow.outTowerFuBen();
                        });
                    });
                }
                yield break;
            }
            else
            {
                popBattleStrengItem();
                yield break;
            }

            //if (chapterType == ChapterType.TOWER_FUBEN) {
            //    UiManager.Instance.openDialogWindow<MessageWindow>((win) => {
            //        win.initWindow(1, LanguageConfigManager.Instance.getLanguage("ladderButton"), "", LanguageConfigManager.Instance.getLanguage("towerShowWindow06"), (msgHandle) => {
            //            UiManager.Instance.missionMainWindow.outTowerFuBen();
            //        });
            //    });
            //    yield break;
            //}else {
            //    popBattleStrengItem ();
            //    yield break;
            //}
        }
        if (BattleManager.battleData.isPractice)
        {
            BattleManager.Instance.awardFinfish();
            yield break;
        }


        //建立奖励管理
        AwardDisplayCtrl ctrl = BattleManager.Instance.gameObject.AddComponent <AwardDisplayCtrl> ();

        //英雄之章直接战斗
        if (HeroRoadManagerment.Instance.isCurrentDirectFight())
        {
            yield return(new WaitForSeconds(3f));

            ctrl.Initialize(BattleManager.Instance.battleAwards, AwardManagerment.FB_END);
            BattleManager.Instance.playerTeam.hideAllParter();
            BattleManager.Instance.enemyTeam.hideAllParter();
//			ArmyManager.Instance.unActiveArmy ();
            yield break;
        }

        if (BattleManager.battleData.isPvP)
        {
            ctrl.Initialize(BattleManager.Instance.battleAwards, AwardManagerment.PVP);
        }
        else if (BattleManager.battleData.isArenaMass)
        {
            ctrl.Initialize(BattleManager.Instance.battleAwards, AwardManagerment.ARENA);
        }
        else if (BattleManager.battleData.isGodsWarGroupAward)
        {
            ctrl.Initialize(BattleManager.Instance.battleAwards, AwardManagerment.AWARDS_GODSWAR_GROUP);
        }
        else
        {
            ctrl.Initialize(BattleManager.Instance.battleAwards, AwardManagerment.PVE);
        }


        //yield return new WaitForSeconds (0.3f);



        //星星
        if (!BattleManager.battleData.isPvP && MissionInfoManager.Instance.mission != null)
        {
            if (MissionInfoManager.Instance.mission.getChapterType() == ChapterType.STORY)
            {
                yield return(new WaitForSeconds(showStar()));
            }
        }

        BattleManager.Instance.enemyTeam.hideAllParter();
        if (!BattleManager.battleData.isOneOnOneBossFight)
        {
            BattleManager.Instance.playerExpAdd(ctrl.activeAward);
        }
        float waitTime = 1.5f;

        if (UserManager.Instance.self.getVipLevel() > 0)
        {
            waitTime += 0.3f;
        }


        yield return(new WaitForSeconds(waitTime));

        bool isHaveBeast = false;        //是否有女神上阵并获得经验
        bool isBeastLvUp = false;        //女神是否升级

        BattleManager.Instance.playerTeam.hideAllParter();
        CharacterData tempGuardianForce = BattleManager.Instance.playerTeam.GuardianForce;

        if (tempGuardianForce != null && !BattleManager.Instance.playerTeam.GuardianForce.role.isMaxLevel())
        {
            EXPAward expAward = BattleManager.Instance.getEXPAwardByStoreID(tempGuardianForce, ctrl.activeAward);
            if (expAward != null)
            {
                isHaveBeast = true;
                //召唤兽进场
                BattleManager.Instance.playerTeam.showGuardianForce();
                //召唤兽exp
                yield return(new WaitForSeconds(0.5f));

                if (BattleManager.Instance.GuardianForceExpAdd(tempGuardianForce, expAward))
                {
                    isBeastLvUp = true;
                }
            }
        }

        hideOther();
        yield return(new WaitForSeconds(isHaveBeast ? (isBeastLvUp ? 2.5f : 1.5f) : 0.5f));

        BattleManager.Instance.EffectCamera.gameObject.SetActive(false);

        //讨伐战斗胜利结束处理,提前出去,不然会走AwardDisplayCtrl的openNextWindow,造成闪窗口现象
        if (FuBenManagerment.Instance.isWarAttackBoss && BattleManager.battleData.winnerID == TeamInfo.OWN_CAMP)
        {
            //赢了需要打通副本
            FuBenManagerment.Instance.completeMission(MissionInfoManager.Instance.mission.sid, MissionInfoManager.Instance.mission.getChapterType(), MissionInfoManager.Instance.mission.starLevel);
            //赢了需要扣除次数
            FuBenManagerment.Instance.intoMission(MissionInfoManager.Instance.mission.sid, MissionInfoManager.Instance.mission.starLevel);
            FuBenManagerment.Instance.warWinAward = ctrl.award;

            BattleManager.Instance.awardFinfish();
            if (MissionManager.instance != null)
            {
                MissionManager.instance.missionClean();
            }
            MissionInfoManager.Instance.clearMission();
            yield break;
        }
        //活动副本战斗胜利结束处理,提前出去,不然会走AwardDisplayCtrl的openNextWindow,造成闪窗口现象
        if (FuBenManagerment.Instance.isWarActiveFuben && BattleManager.battleData.winnerID == TeamInfo.OWN_CAMP)
        {
            //赢了需要扣除次数
            FuBenManagerment.Instance.intoMission(MissionInfoManager.Instance.mission.sid, MissionInfoManager.Instance.mission.starLevel);
            FuBenManagerment.Instance.ActiveWinAward = ctrl.award;

            BattleManager.Instance.awardFinfish();
            if (MissionManager.instance != null)
            {
                MissionManager.instance.missionClean();
            }
            MissionInfoManager.Instance.clearMission();
            yield break;
        }

        ctrl.openNextWindow();

        if (ctrl.award == null || ctrl.award.Length == 0)
        {
            yield return(new WaitForSeconds(3f));
        }
    }