示例#1
0
    public void DisplayWindow(GameObject window)
    {
        if (RockInfo == null)
        {
            RockInfo = window.transform.GetChild(3).gameObject;
        }
        if (addWorkers == null)
        {
            addWorkers = RockInfo.GetComponent <AddWorkers>();
        }

        if (HouseInfo == null)
        {
            HouseInfo = window.transform.GetChild(4).gameObject;
        }
        if (houseUI == null)
        {
            houseUI = HouseInfo.GetComponent <HouseUI>();
        }

        if (MultipleObjsInfo == null)
        {
            MultipleObjsInfo = window.transform.GetChild(5).gameObject;
        }

        if (windowTitle == null)
        {
            windowTitle = window.GetComponentInChildren <TextMeshProUGUI>();
        }

        eo = gameObject.GetComponent <EntityObject>();

        EntityType type = eo.Type;

        switch (type)
        {
        //@Gross
        case EntityType.ORE:
            windowTitle.text = "ROCK ";    // + eo.ID;
            MultipleObjsInfo.SetActive(false);
            HouseInfo.SetActive(false);

            RockInfo.SetActive(true);
            addWorkers.ore = gameObject;
            addWorkers.Refresh();
            break;

        case EntityType.HOUSE:
            windowTitle.text = "HOUSE ";    // + eo.ID;
            RockInfo.SetActive(false);
            MultipleObjsInfo.SetActive(false);

            HouseInfo.SetActive(true);
            houseUI.house = gameObject;
            break;
        }

        window.SetActive(true);
    }
示例#2
0
    public static void DisplayWindow(GameObject window, ArrayList selectedItems)
    {
        if (RockInfo == null)
        {
            RockInfo = window.transform.GetChild(3).gameObject;
        }
        if (addWorkers == null)
        {
            addWorkers = RockInfo.GetComponent <AddWorkers>();
        }

        if (HouseInfo == null)
        {
            HouseInfo = window.transform.GetChild(4).gameObject;
        }
        if (houseUI == null)
        {
            houseUI = HouseInfo.GetComponent <HouseUI>();
        }

        if (MultipleObjsInfo == null)
        {
            MultipleObjsInfo = window.transform.GetChild(5).gameObject;
        }

        if (windowTitle == null)
        {
            windowTitle = window.GetComponentInChildren <TextMeshProUGUI>();
        }


        windowTitle.text = selectedItems.Count + " ROCKS";// + eo.ID;
        RockInfo.SetActive(false);
        HouseInfo.SetActive(false);

        MultipleObjsInfo.SetActive(true);

        MultipleObjsInfo.GetComponent <MultipleObjsUI>().Entities = selectedItems;

        window.SetActive(true);
    }