Beispiel #1
0
    public void DeleteConstructionDetail(int userFacilityID)
    {
        ConstructionDetail constructionDetail = this.GetConstructionDetail(userFacilityID);

        if (null != constructionDetail)
        {
            constructionDetail.Close();
        }
    }
Beispiel #2
0
    public void CreateConstructionDetail(FarmObject farmObject)
    {
        ConstructionDetail constructionDetail = this.GetConstructionDetail(farmObject.userFacilityID);

        if (null == constructionDetail)
        {
            GameObject gameObject = this.CreateFarmObjectUI("Farm/ConstructionDetail", "ConstructionDetail", farmObject.userFacilityID);
            if (null != gameObject)
            {
                constructionDetail            = gameObject.GetComponent <ConstructionDetail>();
                constructionDetail.farmObject = farmObject;
            }
        }
    }
    private void SetCostInfo()
    {
        DrawFacilityButton[] componentsInChildren = base.GetComponentsInChildren <DrawFacilityButton>();
        if (componentsInChildren == null || null == this.buildCostLabel)
        {
            return;
        }
        this.buildCostLabel.gameObject.SetActive(false);
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            Transform transform = componentsInChildren[i].transform;
            if ("UpgradeButton" == transform.name)
            {
                this.buildCostLabel.SetUpgradeCostDetail(this.farmObject.userFacilityID);
                this.buildCostLabel.gameObject.SetActive(true);
                this.SetBuildCostLabelPosition(transform.parent.gameObject);
                break;
            }
            if ("ShortCutButton" == transform.name)
            {
                if (this.farmObject.IsTutorialFacility())
                {
                    FarmUI             componentInParent  = base.GetComponentInParent <FarmUI>();
                    ConstructionDetail constructionDetail = componentInParent.GetConstructionDetail(this.farmObject.userFacilityID);
                    int          complateSeconds          = constructionDetail.GetComplateSeconds();
                    UserFacility userFacility             = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID);

                    userFacility.completeTime = FarmUtility.GetDateString(ServerDateTime.Now.AddSeconds((double)complateSeconds));
                }
                this.buildCostLabel.SetShortCutCostDetail(this.farmObject.userFacilityID);
                this.buildCostLabel.gameObject.SetActive(true);
                this.SetBuildCostLabelPosition(transform.parent.gameObject);
                break;
            }
        }
    }