Ejemplo n.º 1
0
    /// <summary>
    /// Once the Job Picker scene is loaded, the manager finds all UI, creates buttons for each job, and adds listeners to them
    /// </summary>
    /// <returns></returns>
    private IEnumerator UpdateJobList()
    {
        yield return(new WaitUntil(() => SceneManager.GetSceneByName("Interface_JobList").isLoaded));

        jobListUI = FindObjectOfType <JobListUI>();
        jobUI     = FindObjectOfType <JobUI>();

        for (var i = 0; i < campaignManager.GetAvailableJobs().Count; i++)
        {
            Job thisJob = campaignManager.GetAvailableJobs()[i];
            // Show available job currently handles both primary and side jobs,
            // might need to change when side jobs are added

            if (thisJob.campaignIndexAvailable ==
                campaignManager.GetCurrentJobIndex() ||
                thisJob.isSideJob)
            {
                jobListUI.ShowAvailableJob(thisJob, i);
                jobUI.JobSelected();
                jobListUI.jobUIList[i].GetComponent <Button>().interactable = false;
            }
        }

        jobListUI.continueButton.onClick.AddListener(FinalizeJobSelection);
    }
Ejemplo n.º 2
0
    void Awake()
    {
        GameObject globalUis = GameObject.Find(Global.UI_CONTAINER);

        if (globalUis == null)
        {
            throw new System.Exception($"Can't find global UIs Game Object named : {Global.UI_CONTAINER}");
        }
        this.jobUI = globalUis.GetComponentsInChildren <JobUI>().First();
    }
Ejemplo n.º 3
0
    // ======================================
    public void RemoveJob(Job j)
    {
        JobUI jobUI = this.internalList[j];

        this.internalList.Remove(j);

        Destroy(jobUI.gameObject);

        RectTransform trans = this.GetComponent <RectTransform>();

        trans.sizeDelta = new Vector2(trans.sizeDelta.x, this.jobUIHeight * this.internalList.Count);
    }
Ejemplo n.º 4
0
    // ======================================
    public void AddJob(Job j)
    {
        GameObject go = Instantiate(this.jobUIPrefab);

        go.transform.SetParent(this.transform);

        JobUI jobUI = go.GetComponent <JobUI>();

        jobUI.SetJob(j);
        this.internalList.Add(j, jobUI);

        RectTransform trans = this.GetComponent <RectTransform>();

        trans.sizeDelta = new Vector2(trans.sizeDelta.x, this.jobUIHeight * this.internalList.Count);
    }
Ejemplo n.º 5
0
 void Start()
 {
     jobUI = GameObject.Find("JobUI").GetComponent<JobUI>();
 }