/// <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); }); }
public void PlayVideo(UniRx.ReactiveCommand <bool> playCmd) { var g = gObject; var sub = playCmd.Subscribe((play) => { g.playing = play; }); uiBase.AddDisposable(sub); }
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()); }