Esempio n. 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();
    }
Esempio n. 2
0
    IEnumerator MoveResultsRoutine(UseableEntity[] useableEntities, Transform origin)
    {
        UIUseableEntityList listUI = Instantiate(useableEntityListPrefab, Game.UIHandler.InWorldCanvas.transform);

        listUI.Init(new SubscribableList <UseableEntity>(useableEntities));

        float duration             = lerpToDockCurve.keys[lerpToDockCurve.length - 1].time;
        float dockOffsetLerpAmount = Game.Dock.GetFilledFloat();
        float t = 0;

        while ((t += Time.deltaTime) < duration)
        {
            DockLocation dockL = Game.Camera.GetDockLocationInWorld();
            listUI.transform.position = Vector3.Lerp(origin.position + SpawnOffsetFromOrigin, Vector3.Lerp(dockL.LeftBot, dockL.RightBot, dockOffsetLerpAmount), lerpToDockCurve.Evaluate(t));
            yield return(null);
        }

        Game.Dock.Add(useableEntities);
        Destroy(listUI.gameObject);
    }
Esempio n. 3
0
    public void CreateUI(Dock dock)
    {
        UIUseableEntityList instance = Instantiate(uIdockPrefab, UICanvas.transform);

        instance.Init(dock.GetUseableEntityList());
    }