Esempio n. 1
0
        public static async UniTask <SignalRClientContext> CreateInstance()
        {
            if (Instance != null)
            {
                return(Instance);
            }
            _instance      = new SignalRClientContext();
            _hubConnection = new HubConnection("http://localhost:8080/boards");
            _hub           = _hubConnection.CreateHubProxy("BoardHub");
            await _hubConnection.Start().ConfigureAwait(false);

            _positionUpdateStream =
                _hub.On <float, float, float>("SendPositionFromServer", _instance.GetPositionFromServer);
            _lockStream = _hub.On <bool>("SendLockStatuesFromServer", _instance.GetLockStatusFromServer);
            return(_instance);
        }
Esempio n. 2
0
 // Start is called before the first frame update
 async UniTask Awake()
 {
     _clientContext = await SignalRClientContext.CreateInstance();
 }