示例#1
0
    //private string getSerializablePlayerList(PlayerState[] playerStateList)
    //{
    //    if(playerStateList == null)
    //    {
    //        Debug.LogError("Player State list is null!");
    //        return null;
    //    }

    //    SerializedPlayerList list = new SerializedPlayerList();

    //    for(int i = 0; i < playerStateList.Length; ++i)
    //    {
    //        if(playerStateList[i] != null)
    //        {
    //            list.list[i] = PlayerStateSerializable.Create(playerStateList[i]);
    //        }
    //        else
    //        {
    //            list.list[i] = null;
    //        }
    //    }
    //    return JsonUtility.ToJson(list);
    //}

    //private PlayerState[] getPlayerList(string serialList)
    //{
    //    if (string.IsNullOrEmpty(serialList))
    //    {
    //        Debug.LogError("Serial State list is null!");
    //        return null;
    //    }

    //    SerializedPlayerList serialPlayerList = JsonUtility.FromJson<SerializedPlayerList>(serialList);
    //    PlayerState[] list = new PlayerState[serialPlayerList.list.Length];
    //    for (int i = 0; i < serialPlayerList.list.Length; ++i)
    //    {
    //        if(serialPlayerList.list[i] != null)
    //        {
    //            PlayerStateSerializable serial = serialPlayerList.list[i];
    //            list[i] = PlayerState.Create(serial);
    //        }
    //        else
    //        {
    //            list[i] = null;
    //        }
    //    }
    //    return list;
    //}

    //private GameContext _createGameContext(CardDeck customerDeck, CardDeck ingredientDeck, PlayerState[] playerList)
    //{
    //    GameContext context = GameContext.Create(GameMode.ONLINE, playerList);
    //    context.isMasterClient = PhotonNetwork.isMasterClient;
    //    context.ingredientDeck = ingredientDeck;
    //    context.customerDeck = customerDeck;
    //    return context;
    //}

    private void onLeaveRoom()
    {
        _roomController.RemoveView();

        _lobbyController = new MultiplayerLobbyController();
        _lobbyController.Start(onJoinRoom, onGoToMainMenu);
    }
示例#2
0
    public void Init(GameStateMachine stateMachine, object changeStateData = null)
    {
        _stateMachine = stateMachine;

        _fader = Singleton.instance.gui.screenFader;
        _fader.FadeIn(0.35f);

        _networkManager = Singleton.instance.networkManager;
        _networkManager.onCustomEvent += onCustomEvent;
        _networkManager.Connect();

        _lobbyController = new MultiplayerLobbyController();
        _lobbyController.Start(onJoinRoom, onGoToMainMenu);
    }