protected override void Setup()
        {
            CreateInputKeywordAsObservable("isono")
            .Subscribe(_ =>
            {
                IsActive = !IsActive;
                DrawText("Isono:" + IsActive);
                if (IsActive)
                {
                    IsonoTcpClient.Connect();
                }
                else
                {
                    IsonoTcpClient.Disconnect();
                }
            });

            IsonoTcpClient.OnRecievedMessageAsObservable
            .Subscribe(x =>
            {
                InfernoCore.Publish(new IsonoMessage(x));
            });
        }
Exemple #2
0
        public InfernoCore()
        {
            Instance = this;

            _debugLogger = new DebugLogger(@"InfernoScript.log");

            //100ms周期でイベントを飛ばす
            Interval = 100;
            Observable.FromEventPattern <EventHandler, EventArgs>(h => h.Invoke, h => Tick += h, h => Tick -= h)
            .Select(_ => Unit.Default)
            .Multicast(OnTickSubject)
            .Connect();

            //キー入力
            Observable.FromEventPattern <KeyEventHandler, KeyEventArgs>(h => h.Invoke, h => KeyDown += h,
                                                                        h => KeyDown -= h)
            .Select(e => e.EventArgs)
            .Multicast(OnKeyDownSubject)
            .Connect();

            //市民と車両の更新
            OnTickAsObservable
            .Subscribe(_ => UpdatePedsAndVehiclesList());
        }