Exemplo n.º 1
0
    private void DrawActiveJobs(int i, int j)
    {
        // Get active jobs
        List <JobObj> activeJobs = jobManager.ByLocation(i, j).ToList();

        Vector3 location = new Vector3(-200, -670);

        foreach (JobObj job in activeJobs)
        {
            if (job.toDelete == true)
            {
                Debug.Log("Skipping job to be deleted");
                continue;
            }
            ResourceDropdown resourceDropdown;
            if (job.GetInputResources().rqqList.Count == 0)
            {
                resourceDropdown = ResourceDropdownCreator.CreateNoResourceStaticView(tileDetailUiPanel.transform, location, job.jobDef.name, ManagerBase.domain, job.GetSprite());
            }
            else
            {
                resourceDropdown = ResourceDropdownCreator.CreateResourceStaticView(tileDetailUiPanel.transform, location, job.GetInputResources(), job.jobDef.name, ManagerBase.domain, job.GetSprite());
            }
            activeJobDisplays.Add(resourceDropdown);
            location.y += 100;
        }
    }
Exemplo n.º 2
0
    public void DemolishActionSelected(string s)
    {
        //Debug.Log("DemolishActionSelected");
        // Delete buttons
        //Debug.Log("Clear UI");
        ClearUIObjects();

        string txt = "Demolition\nTears down the current structure\n";

        if (jobDescriptionText == null)
        {
            jobDescriptionText = UIElementFunctions.TextOnly(jobsPanel.transform, txt, new Vector3(180, -50), new Vector2(300, 100));
        }
        else
        {
            jobDescriptionText.textGo.text = txt;
        }
        // Add prerequisites, colored, here

        // Buttons to make it go
        //Debug.Log("ResourceDropdownCreator");
        resourceChoiceDropdown = ResourceDropdownCreator.CreateNoResourceDropdown(tileDetailUiPanel.transform, new Vector3(-200, -185), "Demolition", ManagerBase.domain, null);
        resourceChoiceDropdown.jobStartButton.buttonGo.onClick.AddListener(delegate() { StartDemolitionJobButton(); });
        //Debug.Log("Done DemolishActionSelected");
    }
Exemplo n.º 3
0
    public void BuildActionSelected(string s)
    {
        // Delete buttons
        ClearUIObjects();

        BuildingDef buildingSelected = ManagerBase.buildingDefinitions[ManagerBase.buildingIndexOf[s]];

        if (buildingSelected == null)
        {
            Debug.LogError("Should not have an unbuildable building here: " + s);
        }

        string txt = buildingSelected.name + "\n" + buildingSelected.description + "\n";

        if (jobDescriptionText == null)
        {
            jobDescriptionText = UIElementFunctions.TextOnly(jobsPanel.transform, txt, new Vector3(180, -50), new Vector2(300, 100));
        }
        else
        {
            jobDescriptionText.textGo.text = txt;
        }
        // Add prerequisites, colored, here

        // Figure out what the building needs
        resourceChoiceDropdown = ResourceDropdownCreator.CreateResourceChoiceDropdown(tileDetailUiPanel.transform, new Vector3(-200, -185), buildingSelected.resourcesToBuild, buildingSelected.name, ManagerBase.domain, buildingSelected.sprite);

        resourceChoiceDropdown.jobStartButton.buttonGo.onClick.AddListener(delegate() { StartConstructionJobButton(); });
    }
Exemplo n.º 4
0
    public void NewJobActionSelected(System.Guid jobGuid)
    {
        JobDef jobSelected = JobQueries.ByGuid(ManagerBase.jobDefinitions, jobGuid);

        if (jobSelected == null)
        {
            Debug.LogError("Should not have an empty job here");
        }

        string txt = jobSelected.name + "\n" + jobSelected.description + "\n";

        if (jobDescriptionText == null)
        {
            jobDescriptionText = UIElementFunctions.TextOnly(jobsPanel.transform, txt, new Vector3(180, -50), new Vector2(300, 100));
        }
        else
        {
            jobDescriptionText.textGo.text = txt;
        }
        // Add prerequisites, colored, here

        // Figure out what the building needs
        Sprite output1Sprite = ManagerBase.resourceDefinitions[ManagerBase.resourceIndexOf[jobSelected.outputName[0]]].image;

        if (jobSelected.inputResources.rqqList.Count > 0) // Has inputs
        {
            resourceChoiceDropdown = ResourceDropdownCreator.CreateResourceChoiceDropdown(tileDetailUiPanel.transform, new Vector3(-200, -185), jobSelected.inputResources, jobSelected.name, ManagerBase.domain, output1Sprite);
        }
        else
        {
            resourceChoiceDropdown = ResourceDropdownCreator.CreateNoResourceDropdown(tileDetailUiPanel.transform, new Vector3(-200, -185), jobSelected.name, ManagerBase.domain, output1Sprite);
        }


        resourceChoiceDropdown.jobStartButton.buttonGo.onClick.AddListener(delegate() { StartJobButton(jobSelected); });
    }