示例#1
0
    private void RefreshUI()
    {
        buildingName.text = m_currentBuilding.GetName();
        buildingDesc.text = m_currentBuilding.GetDesc();

        if (m_currentBuilding is IBuildingProduction)
        {
            IBuildingProduction prod = (IBuildingProduction)m_currentBuilding;
            foodPerDay.text     = string.Format(FORMAT_PER_DAY, prod.GetProducedFood());
            researchPerDay.text = string.Format(FORMAT_PER_DAY, prod.GetProducedResearch());
            if (prod.GetWorker() != Guid.Empty)
            {
                workerImage.sprite = M_SettlersManager.SGetPortraitOfSettler(prod.GetWorker());
                workerName.text    = M_SettlersManager.SGetNameOfSettler(prod.GetWorker());

                employButton.gameObject.SetActive(false);
                removeButton.gameObject.SetActive(true);
                infoButtonProd.gameObject.SetActive(true);
            }
            else
            {
                workerImage.sprite = defaultWorkerImg;
                workerName.text    = "None";

                employButton.gameObject.SetActive(true);
                removeButton.gameObject.SetActive(false);
                infoButtonProd.gameObject.SetActive(false);
            }
        }
    }