コード例 #1
0
ファイル: TestViewModel.cs プロジェクト: rzvxa/MVVM.Binding
 public void Start()
 {
     ChangeColor = FlagProp.ToMVVMReactiveCommand();
     ChangeColor.Subscribe(_ => Color.Value = Random.ColorHSV());
     Text.Value = DateTime.Now.ToShortTimeString();
     CoExecute.Execute(ChangeRoutine);
     CoExecute.Execute(UnityUpdate);
 }
コード例 #2
0
ファイル: TestViewModel.cs プロジェクト: rzvxa/MVVM.Binding
 private IEnumerator ChangeRoutine()
 {
     while (true)
     {
         FlagProp.Value       = !FlagProp.Value;
         VisabilityProp.Value = !VisabilityProp.Value;
         if (TestCollection.Count > 0)
         {
             TestCollection.RemoveAt(Random.Range(0, TestCollection.Count - 1));
         }
         for (var i = 0; i < 2; i++)
         {
             TestCollection.Add(new TestDataViewModel()
             {
                 Message = Random.Range(0, 1000).ToString(), Color = Random.ColorHSV()
             });
         }
         yield return(new UnityEngine.WaitForSeconds(3f));
     }
 }