Ejemplo n.º 1
0
        private async void Start()
        {
            _cancellationToken = this.GetCancellationTokenOnDestroy();
            _flowingTextPool   = new FlowingTextPool(_flowingTextPrefab, _rootCanvas.transform);

            _flowingTextSettings = await ServiceLocator.GetServiceAsync <IFlowingTextSettings>(_cancellationToken);

            _flowingTextSettings.OnFontSizeChange()
            .Subscribe(x => { _fontSize = x; }).AddTo(this);

            var server = await ServiceLocator.GetServiceAsync <IServer <string> >(_cancellationToken);

            try
            {
                _messageReceiver = await server.GetMessageReceiverAsync(_cancellationToken);

                _messageReceiver
                .OnMessage()
                .ObserveOnMainThread()
                .Subscribe(x => { this.FlowMessage(x).Forget(); })
                .AddTo(this);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }