private void OpenUpgradeDialog()
    {
        FacilityM    facilityMaster = FarmDataManager.GetFacilityMaster(this.farmObject.facilityID);
        UserFacility userFacility   = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID);

        if (userFacility != null && !string.IsNullOrEmpty(userFacility.completeTime))
        {
            return;
        }
        if (int.Parse(facilityMaster.maxLevel) <= userFacility.level)
        {
            return;
        }
        int level = userFacility.level + 1;
        FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(userFacility.facilityId, level);

        MasterDataMng.AssetCategory assetCategory = (MasterDataMng.AssetCategory)facilityUpgradeMaster.upgradeAssetCategoryId1.ToInt32();
        if (assetCategory == MasterDataMng.AssetCategory.TIP)
        {
            CMD_UpgradeConfirmation cmd_UpgradeConfirmation = GUIMain.ShowCommonDialog(null, "CMD_UpgradeConfirmation", null) as CMD_UpgradeConfirmation;
            cmd_UpgradeConfirmation.SetUserFacility(userFacility);
        }
        else
        {
            CMD_UpgradeConfirmationDigistone cmd_UpgradeConfirmationDigistone = GUIMain.ShowCommonDialog(null, "CMD_UpgradeConfirm_STONE", null) as CMD_UpgradeConfirmationDigistone;
            cmd_UpgradeConfirmationDigistone.SetUserFacility(userFacility);
        }
    }
    public FacilityUpgradeConfirm_MeatFarm(CMD_UpgradeConfirmation upgradeConfirmationUI, UserFacility userFacility) : base(upgradeConfirmationUI, userFacility)
    {
        this.storehouse = Singleton <UserDataMng> .Instance.GetUserStorehouse();

        if (this.storehouse != null && 0 < this.storehouse.level)
        {
            this.masterStorehouse = FarmDataManager.GetFacilityStorehouseMaster(this.storehouse.level);
        }
    }
    public FacilityUpgradeConfirm(CMD_UpgradeConfirmation upgradeConfirmationUI, UserFacility userFacility)
    {
        this.parentUI     = upgradeConfirmationUI;
        this.userFacility = userFacility;
        FarmRoot instance = FarmRoot.Instance;

        if (null != instance)
        {
            this.targetFarmObject = instance.Scenery.farmObjects.SingleOrDefault((FarmObject x) => x.userFacilityID == userFacility.userFacilityId);
        }
    }
Beispiel #4
0
    private void OnPushedUpgradeButton()
    {
        FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(this.userFacility.facilityId);

        if (!string.IsNullOrEmpty(this.userFacility.completeTime) || int.Parse(facilityMaster.maxLevel) <= this.userFacility.level)
        {
            return;
        }
        int level = this.userFacility.level + 1;
        FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(this.userFacility.facilityId, level);
        int num = facilityUpgradeMaster.upgradeAssetCategoryId1.ToInt32();

        if (num == 4)
        {
            CMD_UpgradeConfirmation cmd_UpgradeConfirmation = GUIMain.ShowCommonDialog(null, "CMD_UpgradeConfirmation", null) as CMD_UpgradeConfirmation;
            cmd_UpgradeConfirmation.SetUserFacility(this.userFacility);
        }
        else
        {
            CMD_UpgradeConfirmationDigistone cmd_UpgradeConfirmationDigistone = GUIMain.ShowCommonDialog(null, "CMD_UpgradeConfirm_STONE", null) as CMD_UpgradeConfirmationDigistone;
            cmd_UpgradeConfirmationDigistone.SetUserFacility(this.userFacility);
        }
        this.ClosePanel(true);
    }