Пример #1
0
        public void OnToggle(IToggleable toggleable)
        {
            var disabled = DisabledFunc?.Invoke();

            if (disabled.HasValue && disabled.Value)
            {
                return;
            }

            var id = toggleable.GetInstanceID();

            foreach (var pair in _idAndToggleablePairs.Where(pair => pair.Key != id && pair.Value.IsToggledOn))
            {
                pair.Value.SetToggledOff();
                OnToggledOff.OnNext(pair.Value);
            }

            if (toggleable.IsToggledOn)
            {
                toggleable.SetToggledOff();
                OnToggledOff.OnNext(toggleable);
            }
            else
            {
                toggleable.SetToggledOn();
                OnToggledOn.OnNext(toggleable);
            }
        }
Пример #2
0
 public void RequestToggledOn(IToggleable toggleable)
 {
     toggleable.SetToggledOn();
     if ((ToggleableButton)toggleable == repeatButton)
     {
         Game.Game.instance.Stage.repeatStage = true;
         SetExitButtonToggledOff();
     }
 }
Пример #3
0
        public void SetToggledOn(IToggleable toggleable)
        {
            var id = toggleable.GetInstanceID();

            foreach (var pair in _idAndToggleablePairs.Where(pair => pair.Key != id))
            {
                pair.Value.SetToggledOff();
            }

            toggleable.SetToggledOn();
        }