public static WorkstationStatusUI Instantiate(Workstation workstation)
    {
        var instance = Instantiate(ResourceLoader.GetInstance().TimerCirclePreab, MainCanvas.Get().transform);

        instance.transform.SetAsFirstSibling();
        instance.GetComponent <AttachUIToTarget>().SetTarget(workstation.transform);
        instance.workstation = workstation;
        instance.assignable  = workstation.GetComponent <Assignable>();
        return(instance);
    }
Example #2
0
    public static TutorialPopup Instantiate(RectTransform target, string text, UnityAction onClose = null, bool faceDown = false)
    {
        var prefab   = faceDown ? ResourceLoader.GetInstance().TutorialPopupDown : ResourceLoader.GetInstance().TutorialPopup;
        var instance = Instantiate(prefab, MainCanvas.Get().transform);

        instance.message.text = text;
        instance.doneButton.onClick.AddListener(() => {
            Destroy(instance.gameObject);
        });
        if (onClose != null)
        {
            instance.doneButton.onClick.AddListener(onClose);
        }
        if (target != null)
        {
            instance.GetComponent <RectTransform>().position = target.position;
        }
        return(instance);
    }