示例#1
0
    public void OnButtonExit()
    {
        var msg = new CSBattlePveFinishMsg
        {
            Uuid = BattleModelLocator.Instance.Uuid,
            BattleResult = 0,
            Star = 0,
            CheckCode = BattleModelLocator.Instance.RaidID.ToString(),
        };

        PersistenceHandler.IsRaidFinish = true;

        //Battle persistence
        PersistenceHandler.Instance.Mode = PersistenceHandler.PersistenceMode.Normal;
        PersistenceHandler.Instance.Cleanup();

        NetManager.SendMessage(msg);
        MtaManager.TrackEndPage(MtaType.BattleScreen);

        //Battle persistence:Check battle end succeed.

        gameObject.SetActive(false);
        MissionModelLocator.Instance.ShowRaidWindow();
    }
示例#2
0
    /// <summary>
    /// Show record of battle ending.
    /// </summary>
    /// <param name="battleEndRecord">Battle end record</param>
    public void showBattleEndRecord(BattleEndRecord battleEndRecord)
    {
        Logger.Log("[-----RECORD-----] showBattleEndRecord: " + battleEndRecord);

        switch (battleEndRecord.EndType)
        {
            case BattleRecordConstants.BATTLE_SCENE_END:
                if (characterValue > 0)
                {
                    StartCoroutine(GotoNextScene());
                }
                else
                {
                    recordIndex++;
                    DealWithRecord();
                }
                break;
            case BattleRecordConstants.BATTLE_ALL_END:
                {
                    if (BattleModelLocator.Instance.BattleType == BattleType.GREENHANDPVE.Index)
                    {
                        GreenHandGuideHandler.Instance.SendEndMessage(1);

                        //ResetAll();

                        WindowManager.Instance.Show<GreenHandGuideWindow>(false);
                    }
                    else
                    {
                        PersistenceHandler.IsRaidFinish = false;

                        var k = battleEndRecord.getIntProp(BattleRecordConstants.BATTLE_END_WIN_SIDE);

                        var msg = new CSBattlePveFinishMsg
                        {
                            Uuid = BattleModelLocator.Instance.Uuid
                        };

                        if (k == BattleRecordConstants.TARGET_SIDE_LEFT)
                        {
                            msg.BattleResult = 1;
                            if (MissionModelLocator.Instance.RaidLoadingAll != null)
                            {
                                MissionModelLocator.Instance.AddStar(starController.CurrentStar);
                                MissionModelLocator.Instance.AddFinishTime(MissionModelLocator.Instance.BattleStageTemplate.Id);
                            }
                        }
                        else
                        {
                            PersistenceHandler.IsRaidFinish = true;

                            WindowManager.Instance.Show(typeof(BattleLostWindow), true);
                            msg.BattleResult = 0;
                        }

                        PersistenceHandler.Instance.Mode = PersistenceHandler.PersistenceMode.Normal;

                        recordIndex++;
                        DealWithRecord();

                        MissionModelLocator.Instance.OldExp = PlayerModelLocator.Instance.Exp;
                        MissionModelLocator.Instance.OldLevel = PlayerModelLocator.Instance.Level;
                        MissionModelLocator.Instance.StarCount = starController.CurrentStar;

                        msg.Star = (sbyte)starController.CurrentStar;
                        //增加回传数据
                        msg.ResultCode =
                            BattleModelLocator.Instance.MainBattle.StoreData.toStoreStr(
                                BattleStoreConstants.BATTLE_RESULT_STORE_DATA);

                        msg.CheckCode = BattleModelLocator.Instance.MainBattle.BattleSource.RaidStageId.ToString();

                        //Battle persistence
                        PersistenceHandler.Instance.StoreBattleEndMessage(msg);

                        NetManager.SendMessage(msg);
                        MtaManager.TrackEndPage(MtaType.BattleScreen);

                        //Battle persistence:Check battle end succeed.
                        StartCoroutine(PersistenceHandler.Instance.CheckBattleEndSucceed(msg));
                    }
                }
                break;
            default:
                recordIndex++;
                DealWithRecord();
                break;
        }
    }