Ejemplo n.º 1
0
        public virtual void Set(T item)
        {
            var index = IndexOf(item);

            Set(index);
            ChangedState?.Invoke();
        }
 public virtual void Remove()
 {
     Remove(this[Index]);
     Index = Math.Max(0, Math.Min(Index, this.Count - 1));
     Accessed?.Invoke();
     ChangedState?.Invoke();
 }
 public virtual void Next()
 {
     if (this.Count > 0)
     {
         Index = (Index + 1 + Count) % Count;
         Accessed?.Invoke();
         ChangedState?.Invoke();
     }
 }
 public virtual void Back()
 {
     Index = (Index - 1 + Count) % Count;
     if (Index < 0)
     {
         Index = this.Count - 1;
     }
     Accessed?.Invoke();
     ChangedState?.Invoke();
 }
Ejemplo n.º 5
0
        public void RemoveAction(PlayerAction action)
        {
            var actions = _actions.FirstOrDefault(x => x == action);

            if (actions == default(PlayerAction))
            {
                return;
            }
            _actions.Remove(actions);
            ChangedState.Invoke(this, null);
            Passing = false;
        }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        // If we press space
        if (Input.GetKeyDown(KeyCode.Space) && active)
        {
            if (writer.IsWorking()) // If working, skip the working text
            {
                writer.Skip();
            }
            else                    // Otherwise we go to the next text chunk
            {
                textIter++;
                if (textIter < text.Length)                // If we're within our bounds still, then write!
                {
                    writer.SetTextToWrite(text[textIter]); // Set the next line to write
                    if (!writer.AutoStartWriting)          // Start writing if the writer is set to auto
                    {
                        writer.StartWriting();
                    }
                }
                else                                     // Otherwise we should close this UI
                {
                    TimeTicker.Instance.SetTimeScale(1); // Set to regular time scale
                    EnableOnComplete.ForEach(obj => obj.GetComponent <IHideableUI>()?.Show());
                    DisableOnComplete.GetComponent <IHideableUI>()?.Hide();
                    OnEnd?.Invoke();
                    active = false;

                    if (GameStateManager.Instance.DayCycleNumber < 1)
                    {
                        GameStateManager.Instance.SetNight(); //TODO I don't like this here... too coupled
                    }
                }
            }
        }
    }
 private void ChangeStateThisInMonitoring(SerialPortWorkerState workerState)
 {
     CurrentState = workerState;
     ChangedState?.Invoke(this, new ChangedStateEventArgs(CurrentState));
     Helper.NLogger.Debug($"Zmieniono stan na: {CurrentState}");
 }
 public virtual void Set(int index)
 {
     Index = Mathf.Clamp(index, 0, Count - 1);
     Accessed?.Invoke();
     ChangedState?.Invoke();
 }
Ejemplo n.º 9
0
 public virtual void SetLast()
 {
     Index = Count - 1;
     Accessed?.Invoke();
     ChangedState?.Invoke();
 }
Ejemplo n.º 10
0
 public void Reset()
 {
     State = false;
     ChangedState?.Invoke(State);
 }
Ejemplo n.º 11
0
 public void Click()
 {
     State = true;
     ChangedState?.Invoke(State);
     StartCoroutine(FlickBack());
 }
Ejemplo n.º 12
0
 public void FlickOn()
 {
     State = true;
     ChangedState?.Invoke(State);
 }