コード例 #1
0
        void Start()
        {
            // Code Here

            CounterModel.Subject
            .StartWith(CounterModel.State)
            .Subscribe(state => { Number.text = state.Count.ToString(); });


            BtnAdd.onClick.AddListener(() => { CounterModel.Dispatch("increase"); });

            BtnSub.onClick.AddListener(() => { CounterModel.Dispatch("decrease"); });
        }
コード例 #2
0
        void Start()
        {
            // 初始化从服务器拉取数据
            CounterModel.Effects.PullDataFromNetwork();

            // Code Here

            CounterModel.Subject
            .StartWith(CounterModel.State)
            .Subscribe(state => { Number.text = state.Count.ToString(); });


            BtnAdd.onClick.AddListener(() => { CounterModel.Dispatch("increase"); });

            BtnSub.onClick.AddListener(() => { CounterModel.Dispatch("decrease"); });
        }