Exemplo n.º 1
0
        private void SetupTransition()
        {
            Service.UXController.HUD.Visible = false;
            if (this.battleData.BattleType == BattleType.PveDefend)
            {
                List <IAssetVO> battleProjectileAssets = ProjectileUtils.GetBattleProjectileAssets(Service.CurrentPlayer.Map, this.battleData.BattleVO, this.battleData.AttackerDeployableData, null, null, null, null, this.battleData.AttackerEquipment, this.battleData.DefenderEquipment);
                Service.SpecialAttackController.PreloadSpecialAttackMiscAssets();
                Service.ProjectileViewManager.LoadProjectileAssetsAndCreatePools(battleProjectileAssets);
                Service.GameStateMachine.SetState(this);
                this.OnWorldLoadComplete();
                Service.EventManager.SendEvent(EventId.BattleLoadedForDefend, this.battleData);
                this.OnWorldTransitionComplete();
                return;
            }
            IMapDataLoader mapDataLoader;

            if (this.battleData.PvpTarget != null)
            {
                mapDataLoader = Service.PvpMapDataLoader;
                ((PvpMapDataLoader)mapDataLoader).Initialize(this.battleData);
            }
            else if (this.battleData.MemberWarData != null)
            {
                mapDataLoader = Service.WarBaseMapDataLoader;
                ((WarBaseMapDataLoader)mapDataLoader).Initialize(this.battleData);
            }
            else
            {
                mapDataLoader = Service.NpcMapDataLoader;
                bool isPveBuffBase = this.battleData.BattleType == BattleType.PveBuffBase;
                ((NpcMapDataLoader)mapDataLoader).Initialize(this.battleData, isPveBuffBase);
            }
            EventManager eventManager = Service.EventManager;

            eventManager.RegisterObserver(this, EventId.MapDataProcessingStart, EventPriority.Default);
            eventManager.RegisterObserver(this, EventId.WorldLoadComplete, EventPriority.Default);
            WorldTransitioner worldTransitioner = Service.WorldTransitioner;

            if (worldTransitioner.IsSoftWiping())
            {
                worldTransitioner.ContinueWipe(this, mapDataLoader, new TransitionCompleteDelegate(this.OnWorldTransitionComplete));
            }
            else if (this.battleData.BattleType == BattleType.PvpAttackSquadWar || this.battleData.BattleType == BattleType.PveBuffBase)
            {
                worldTransitioner.StartTransition(new WarboardToWarbaseTransition(this, mapDataLoader, new TransitionCompleteDelegate(this.OnWorldTransitionComplete), false, false));
            }
            else
            {
                worldTransitioner.StartTransition(new WorldToWorldTransition(this, mapDataLoader, new TransitionCompleteDelegate(this.OnWorldTransitionComplete), false, false));
            }
        }
Exemplo n.º 2
0
        public void OnPvpGetNextTargetFailure()
        {
            IState            currentState      = Service.Get <GameStateMachine>().CurrentState;
            WorldTransitioner worldTransitioner = Service.Get <WorldTransitioner>();

            worldTransitioner.SetAlertMessage(Service.Get <Lang>().Get("GET_PVP_TARGET_FAILURE", new object[0]));
            if (worldTransitioner.IsSoftWiping())
            {
                worldTransitioner.FinishWipe();
            }
            if (!(currentState is HomeState))
            {
                if (currentState is GalaxyState)
                {
                    HomeState.GoToHomeState(null, false);
                }
                else
                {
                    worldTransitioner.SetTransitionInStartCallback(new TransitionInStartDelegate(this.OnTransitionInStartLoadHome));
                }
            }
            Service.Get <UserInputInhibitor>().AllowAll();
        }