Beispiel #1
0
 public void CollectCoin()
 {
     if (coinAmount.Value > 0 && !isPlaying)
     {
         MainSceneManager.Instance.coinAmount += coinAmount.Value;
         coinAmount.Update(_ => 0);
     }
 }
        void CloseClient(LocalSocketClient client)
        {
            client.Close();
            _clients.Update(l => l.Remove(client));

            ClientDisconnected.OnNext(client);
        }
Beispiel #3
0
        public static void Initialize(Dispatcher dispatcher)
        {
            var editingColorSubject = new BehaviorSubject <Optional <IProperty <Color> > >(Optional.None <IProperty <Color> >());

            var editingColor = editingColorSubject
                               .ReplaceNone(() => Property.AsProperty(Observable.Never <Color>()))
                               .Switch()
                               .PreventFeedback()
                               .AutoInvalidate(TimeSpan.FromMilliseconds(200));

            Fusion.Application.Desktop.CreateSingletonWindow(
                isVisible: editingColorSubject.Select(e => e.HasValue),
                window: window => new Window
            {
                Title      = Observable.Return("Color"),
                Closed     = editingColorSubject.Update(Optional.None <IProperty <Color> >()),
                Size       = Optional.Some(Property.Constant(Optional.Some(new Size <Points>(560, 300)))),
                Background = Color.FromRgb(0xFCFCFC),
                Foreground = Color.FromRgb(0x676767),
                Border     = Stroke.Create(1, Color.FromRgb(0xe0e0e0)),
                Content    = Control
                             .Create(self =>
                {
                    var dialog = new ColorPickerFullWithAlpha();

                    dialog.UserChangedColor
                    .Select(_ => dialog.SelectedColor.ToFusion())
                    .Subscribe(editingColor);

                    self.BindNativeProperty(dispatcher, "color", editingColor, c => dialog.SelectedColor = c.ToColor());
                    self.BindNativeDefaults(dialog, dispatcher);

                    return(dialog);
                })
                             .WithPadding(new Thickness <Points>(10))
                             .WithBackground(Color.FromRgb(0xFCFCFC)),
            });

            ColorPicker.Implementation.OpenCommand = (color) =>
                                                     editingColorSubject.Update(
                old =>
                old == Optional.Some(color)
                                                        ? Optional.None <IProperty <Color> >()
                                                        : Optional.Some(color));
        }
Beispiel #4
0
 // Start is called before the first frame update
 void Start()
 {
     subs.Add(
         Observable.Interval(System.TimeSpan.FromMilliseconds(100)).Subscribe(tick =>
     {
         if (CoinPoolIsFull)
         {
             return;
         }
         coinProgressCount.Update(c =>
         {
             var times  = MainSceneManager.Instance.Effeciency5Times ? 5 : 1;
             float step = ProgressMax / ((float)buildInfo.time * 10);
             var result = c + step * times;
             if (result >= ProgressMax)
             {
                 AddCoinToPool(buildInfo.productCoefficient * AwardRate);
                 result -= ProgressMax;
             }
             return(result);
         });
     })
         );
 }
Beispiel #5
0
 private void doUpgrade()
 {
     level.Update(_ => _ + 1);
     completeNow = false;
     IsUpgrading = false;
 }