예제 #1
0
    private void OnReadyToConnect()
    {
        PlayerPrefs.SetString(NAME_PREFS, PlayerName);
        PlayerPrefs.Save();

        _connectionHandle.IsHost     = _isHost;
        _connectionHandle.PlayerName = PlayerName;

        _connectionHandle.AddTask(onClose, TaskHandle.PRIORITY_UI_EFFECTS);
        _connectionHandle.ReadyToConnect();
    }
예제 #2
0
    private void StartSession()
    {
        _synchronizationData.myName.Value = _connectionHandle.PlayerName;

        var clientConnection = UDPConnection.CreateClient();

        _clientApplication = new ClientApplication(clientConnection, _synchronizationData);

        if (_connectionHandle.IsHost)
        {
            _serverApplication = new ServerApplication(UDPConnection.CreateServer(), _localSession);
            _serverApplication.matchCreated += OnSessionStart;

            _connectionHandle.AddTask(_serverApplication.WaitForClientsToBeReady(), TaskHandle.PRIORITY_NETWORK);
        }
        else
        {
            _clientApplication.connected += OnSessionStart;
        }

        _connectionHandle.AddTask(_clientApplication.NotifyClientIsReady(), TaskHandle.PRIORITY_NETWORK);
    }
예제 #3
0
 private void Start()
 {
     InitialAnimation();
     _connectionHandle.AddTask(new FadeOutTask(_globalCanvasGroup, _globalFadeDuration), TaskHandle.PRIORITY_UI_EFFECTS);
 }