private bool Setup(TransitionCompleteDelegate onComplete) { this.pendingCompletion = onComplete; HomeMapDataLoader homeMapDataLoader = Service.HomeMapDataLoader; GameStateMachine gameStateMachine = Service.GameStateMachine; bool flag = gameStateMachine.CurrentState is WarBoardState; this.transitionToHomeState = (!Service.WorldTransitioner.IsCurrentWorldHome() || flag); if (this.transitionToHomeState) { AbstractTransition transition; if (flag) { transition = new WarboardToBaseTransition(this, homeMapDataLoader, this.pendingCompletion); } else { transition = new WorldToWorldTransition(this, homeMapDataLoader, this.pendingCompletion, false, true); } Service.WorldTransitioner.StartTransition(transition); this.pendingCompletion = null; } else { gameStateMachine.SetState(this); } return(this.transitionToHomeState); }
public void PurchaseNextBattle() { HomeMapDataLoader homeMapDataLoader = Service.Get <HomeMapDataLoader>(); WorldToWorldTransition transition = new WorldToWorldTransition(null, homeMapDataLoader, null, false, false); Service.Get <WorldTransitioner>().StartWipe(transition, homeMapDataLoader.GetPlanetData()); this.KillTimer(); PvpGetNextTargetRequest request = new PvpGetNextTargetRequest(); this.nextTargetCommand = new PvpGetNextTargetCommand(request); this.nextTargetCommand.AddSuccessCallback(new AbstractCommand <PvpGetNextTargetRequest, PvpTarget> .OnSuccessCallback(this.OnPvpTargetFound)); this.nextTargetCommand.AddFailureCallback(new AbstractCommand <PvpGetNextTargetRequest, PvpTarget> .OnFailureCallback(this.OnPvpError)); Service.Get <ServerAPI>().Sync(this.nextTargetCommand); this.StartSearchTimer(); Service.Get <TournamentController>().EnterPlanetConflict(); Service.Get <UserInputInhibitor>().DenyAll(); }
private void OnVisitNeighborSuccess(VisitNeighborResponse response, object cookie) { ProcessingScreen.Hide(); if (response == null) { this.processing = false; return; } this.NeighborPlayer = new GamePlayer(); this.NeighborPlayer.PlayerName = response.Name; this.NeighborPlayer.Faction = response.Faction; this.NeighborPlayer.Map = response.MapData; this.NeighborPlayer.Inventory = response.InventoryData; this.NeighborPlayer.AttackRating = response.AttackRating; this.NeighborPlayer.DefenseRating = response.DefenseRating; this.NeighborPlayer.AttacksWon = response.AttacksWon; this.NeighborPlayer.DefensesWon = response.DefensesWon; this.NeighborPlayer.Squad = response.Squad; this.NeighborPlayer.UnlockedLevels = response.UpgradesData; this.NeighborSquadTroops = response.SquadTroops; NeighborMapDataLoader mapDataLoader = new NeighborMapDataLoader(response); IState currentState = Service.Get <GameStateMachine>().CurrentState; AbstractTransition transition; if (currentState is GalaxyState) { transition = new GalaxyMapToBaseTransition(new NeighborVisitState(), mapDataLoader, new TransitionCompleteDelegate(this.OnTransitionComplete), false, false); } else if (currentState is WarBoardState) { transition = new WarboardToWarbaseTransition(new NeighborVisitState(), mapDataLoader, new TransitionCompleteDelegate(this.OnTransitionComplete), false, false); } else { transition = new WorldToWorldTransition(new NeighborVisitState(), mapDataLoader, new TransitionCompleteDelegate(this.OnTransitionComplete), false, true); } Service.Get <WorldTransitioner>().StartTransition(transition); }