コード例 #1
0
    public void ChangeSelectedProcess(int processIndex)
    {
        if (foregroundProcess != null)
        {
            foregroundProcess.inputEntities.ChangeAny    -= UpdateUI;
            foregroundProcess.nonHumanEntities.ChangeAny -= UpdateUI;
            foregroundProcess.OnFinishProgressEvent      -= UpdateUI;
        }


        foregroundProcess = GetConnected <Processor>().GetProcess(processIndex);

        SubscribableList <UseableEntity> input  = foregroundProcess.inputEntities;
        SubscribableList <UseableEntity> output = foregroundProcess.nonHumanEntities;

        inputListUI.Init(input);
        nonHumanListUI.Init(output);

        input.ChangeAny  += UpdateUI;
        output.ChangeAny += UpdateUI;
        foregroundProcess.OnFinishProgressEvent += UpdateUI;

        progressBarUI.Init(foregroundProcess);

        startButton.onClick.RemoveAllListeners();
        startButton.onClick.AddListener(TryStartCurrentProcess);

        loopToggle.onValueChanged.RemoveAllListeners();
        loopToggle.onValueChanged.AddListener(foregroundProcess.SetLoop);

        uIHeaderProcesses.HighlightElement = processIndex;
        UpdateUI();
    }
コード例 #2
0
    /// <summary>
    /// Initialize the visualization by saving the list and subscribing to change events.
    /// </summary>
    /// <param name="obj">the object to connect with.</param>
    public virtual void Init(SubscribableList <T> obj)
    {
        //hide visualized elements that were there before
        HideAll();

        connectedList = obj;

        connectedList.Change       += OnChange;
        connectedList.ChangeAdd    += OnChangeAdd;
        connectedList.ChangeRemove += OnChangeRemove;

        foreach (T item in connectedList)
        {
            OnChangeAdd(item);
        }
    }
コード例 #3
0
    public void InitToList(SubscribableList <T> list, T source, System.Action <UIListElement <T> > clickAction, params IUIConnectable[] connectables)
    {
        Debug.Log("create new element with " + connectables.Length + " connectables.");

        List    = list;
        OnClick = clickAction;

        foreach (IUIConnectable connectable in connectables)
        {
            connectable.UpdateUI(source);

            if (connectable as IUIClickable != null)
            {
                (connectable as IUIClickable).SetClickMethod(ClickedOn);
            }

            this.connectables.Add(connectable);
        }

        Source = source;
    }
コード例 #4
0
    public UseableEntity[] GetToRemove(SubscribableList <UseableEntity> inputEntities)
    {
        List <UseableEntity> toRemove      = new List <UseableEntity>();
        List <string>        inputToRemove = new List <string>();

        foreach (var item in input.Where(d => !d.allwaysOutput))
        {
            inputToRemove.Add(item.entity.type);
        }

        foreach (UseableEntity input in inputEntities)
        {
            string inputType = input.GetData().type;
            if (inputToRemove.Contains(inputType))
            {
                inputToRemove.Remove(inputType);
                toRemove.Add(input);
            }
        }

        return(toRemove.ToArray());
    }
コード例 #5
0
 public bool IsDifferentList(SubscribableList <T> list)
 {
     return(connectedList != list);
 }