protected override void HandleMsg(EPhotonMsg pReceivedMsg, object[] pParams, ByteBuffer bb) { switch (pReceivedMsg) { case EPhotonMsg.MainMenu_SyncGameInfo: GameInitInfoS infoS = GameInitInfoS.GetRootAsGameInitInfoS(bb); GameInitInfo gameInfo = GameInitInfo.Deserialize(infoS); Debug.Log(gameInfo); //reset current game info - DONT assign it //it will be set from UI elements brainiacs.GameInitInfo = new GameInitInfo(); mainMenu.GameSetup.OpenMain(gameInfo); break; case EPhotonMsg.MainMenu_SyncPlayerInfo: PlayerInitInfoS playerInfoS = PlayerInitInfoS.GetRootAsPlayerInitInfoS(bb); PlayerInitInfo playerInfo = PlayerInitInfo.Deserialize(playerInfoS); mainMenu.GameSetup.SetupMain.UpdatePlayer(playerInfo); break; case EPhotonMsg.None: default: Debug.LogError("Message not handled"); break; } }
internal static GameInitInfo Deserialize(GameInitInfoS pGameInfoS) { GameInitInfo gameInfo = new GameInitInfo(); gameInfo.Mode = (EGameMode)pGameInfoS.Mode; gameInfo.Map = (EMap)pGameInfoS.Map; gameInfo.GameModeValue = pGameInfoS.GameModeValue; for (int i = 0; i < pGameInfoS.PlayersLength; i++) { PlayerInitInfoS?playerS = pGameInfoS.Players(i); if (playerS != null) { gameInfo.AddPlayer(PlayerInitInfo.Deserialize((PlayerInitInfoS)playerS)); } } return(gameInfo); }