protected override void handleSessionMessage(PartyGameSessionMessageTypes type, string data) { switch (type) { case PartyGameSessionMessageTypes.SetGameState: { PartyGameSessionMessages.SetGameState setGameState = jsonService.Deserialize <PartyGameSessionMessages.SetGameState>(data); FishBucketState gameStateId = (FishBucketState)setGameState.GameStateId; changeState(gameStateId); break; } case PartyGameSessionMessageTypes.SetGameStartPositions: handleSetGameStartPositions(jsonService.Deserialize <PartyGameSessionMessages.SetGameStartData>(data)); break; case PartyGameSessionMessageTypes.ShowTurnOutput: handleShowTurnOutput(jsonService.Deserialize <PartyGameSessionMessages.ShowTurnOutput>(data)); break; case PartyGameSessionMessageTypes.PlayerTurnStart: handlePlayerTurnStart(jsonService.Deserialize <PartyGameSessionMessages.PlayerTurnStart>(data)); break; case PartyGameSessionMessageTypes.PlayerLeftGame: handlePlayerLeftGame(jsonService.Deserialize <PartyGameSessionMessages.PlayerLeftGame>(data)); break; case PartyGameSessionMessageTypes.AddItem: case PartyGameSessionMessageTypes.RemoveItem: break; } }
private void changeState(FishBucketState newState) { currentState = newState; switch (newState) { case FishBucketState.AwaitingPositions: startAwaitingPositions(); break; case FishBucketState.Intro: startIntro(); break; case FishBucketState.Game: hudUI.SetState(FishBucketHud.FishBucketHudState.InGame); break; } }
protected override void destroy() { PartyGameUtils.RemoveParticipationFilter(localPlayerParticipationController); PartyGameUtils.RemoveActionConfirmationFilter(); PartyGameUtils.EnableMainNavigation(); PartyGameUtils.EnableLocomotionControls(); animationController.Destroy(); removeListeners(); ResetCamera(); UnityEngine.Object.Destroy(hudUI.gameObject); UnityEngine.Object.Destroy(cannonGameObject); if (animationController != null) { FishBucketAnimationController fishBucketAnimationController = animationController; fishBucketAnimationController.CannonRotationCompleteAction = (System.Action)Delegate.Remove(fishBucketAnimationController.CannonRotationCompleteAction, new System.Action(onCannonRotationComplete)); } CoroutineRunner.StopAllForOwner(this); currentState = FishBucketState.Finished; PartyGameUtils.EnableCellPhoneButton(); Service.Get <EventDispatcher>().DispatchEvent(new PartyGameEvents.PartyGameEnded(partyGameDefinition)); }