Example #1
0
        /// <summary>
        /// 绑定item被点击事件 获取被点击物体index
        /// </summary>
        /// <param name="cmd"></param>
        public void OnSelectIndex(UniRx.ReactiveCommand <int> cmd)
        {
            var g = gObject;

            gObject.onClickItem.Add((ctx) => {
                var index = g.GetChildIndex(g.touchItem);
                cmd.Execute(index);
            });
        }
Example #2
0
        public void PlayVideo(UniRx.ReactiveCommand <bool> playCmd)
        {
            var g   = gObject;
            var sub = playCmd.Subscribe((play) =>
            {
                g.playing = play;
            });

            uiBase.AddDisposable(sub);
        }
Example #3
0
 public void Awake()
 {
     TestCommand = IntProp.Select(x => x > 0).ToReactiveCommand <int>();
     TestCommand.Subscribe(val =>
     {
         Debug.unityLogger.Log($"val = {val} IntProp.Value = {IntProp.Value}");
         IntProp.Value -= 1;
     });
     ChangeColor = Flagger.ToMVVMReactiveCommand();
     ChangeColor.Subscribe(_ => Color.Value = Random.ColorHSV());
 }