コード例 #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);
        }
コード例 #2
0
 // Start is called before the first frame update
 async UniTask Awake()
 {
     _clientContext = await SignalRClientContext.CreateInstance();
 }