Ejemplo n.º 1
0
    private void OnPushedYesButton()
    {
        int level = this.userFacility.level + 1;
        FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(this.userFacility.facilityId, level);

        if (FarmUtility.IsShortage(facilityUpgradeMaster.upgradeAssetCategoryId1, facilityUpgradeMaster.upgradeAssetNum1))
        {
            this.OpenModalShortageMessage(facilityUpgradeMaster.upgradeAssetCategoryId1);
        }
        else if (2 <= FarmUtility.GetBuildFacilityCount())
        {
            CMD_ModalMessage cmd_ModalMessage = GUIMain.ShowCommonDialog(null, "CMD_ModalMessage", null) as CMD_ModalMessage;
            cmd_ModalMessage.Title = StringMaster.GetString("FacilityUpgradeBuildTitle");
            cmd_ModalMessage.Info  = StringMaster.GetString("FacilityUpgradeBuildInfo");
        }
        else
        {
            FarmFacilityData.FacilityID facilityId = (FarmFacilityData.FacilityID) this.userFacility.facilityId;
            FacilityUpgradeConfirm      facilityUpgradeConfirm;
            if (facilityId != FarmFacilityData.FacilityID.MEAT_FARM)
            {
                facilityUpgradeConfirm = new FacilityUpgradeConfirm(this, this.userFacility);
            }
            else
            {
                facilityUpgradeConfirm = new FacilityUpgradeConfirm_MeatFarm(this, this.userFacility);
            }
            facilityUpgradeConfirm.Upgrade();
        }
    }
Ejemplo n.º 2
0
    protected virtual bool CheckExtendBuild()
    {
        FarmRoot instance = FarmRoot.Instance;

        if (!(instance != null))
        {
            return(false);
        }
        int num = instance.Scenery.GetFacilityCount(this.farmObject.facilityID);
        List <UserFacility> stockFacilityListByfacilityIdAndLevel = Singleton <UserDataMng> .Instance.GetStockFacilityListByfacilityIdAndLevel(this.farmObject.facilityID);

        int count = stockFacilityListByfacilityIdAndLevel.Count;

        num += count;
        FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(this.farmObject.facilityID);

        if (FarmUtility.IsShortage(facilityMaster.buildingAssetCategoryId1, facilityMaster.buildingAssetNum1))
        {
            this.ShowExtendBuildErrorDialog("C-FA01", true);
            return(false);
        }
        if (int.Parse(facilityMaster.maxNum) <= num)
        {
            this.ShowExtendBuildErrorDialog("E-FA03", false);
            return(false);
        }
        return(true);
    }
Ejemplo n.º 3
0
    private void OnTapMeatShortCut(int idx)
    {
        if (idx == 0)
        {
            bool flag = FarmUtility.IsShortage(2.ToString(), ConstValue.MEAT_SHORTCUT_DEGISTONE_NUM.ToString());
            if (flag)
            {
                CMD_Confirm cmd_Confirm = GUIMain.ShowCommonDialog(new Action <int>(this.OnCloseConfirmShop), "CMD_Confirm", null) as CMD_Confirm;
                cmd_Confirm.Title      = string.Format(StringMaster.GetString("SystemShortage"), "デジストーン");
                cmd_Confirm.Info       = string.Format(StringMaster.GetString("FacilityShortcutShortage"), "デジストーン");
                cmd_Confirm.BtnTextYes = StringMaster.GetString("SystemButtonGoShop");
                cmd_Confirm.BtnTextNo  = StringMaster.GetString("SystemButtonClose");
            }
            else
            {
                UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.userFacilityID);

                int          cropCount      = this.GetCropCount(this.GetPassSeconds(), userFacility.level);
                UserFacility userStorehouse = Singleton <UserDataMng> .Instance.GetUserStorehouse();

                FacilityMeatFieldM facilityMeatFarmMaster = FarmDataManager.GetFacilityMeatFarmMaster(userFacility.level);
                int num = int.Parse(facilityMeatFarmMaster.maxMeatNum);
                if (cropCount >= num)
                {
                    CMD_ModalMessage cmd_ModalMessage = GUIMain.ShowCommonDialog(null, "CMD_ModalMessage", null) as CMD_ModalMessage;
                    cmd_ModalMessage.Title   = StringMaster.GetString("MeatShortCutTitle3");
                    cmd_ModalMessage.Info    = StringMaster.GetString("MeatShortCutText3");
                    cmd_ModalMessage.BtnText = "OK";
                }
                else if (!this.IsOverMeatNum(num, userStorehouse))
                {
                    this.MeatShortCutSelect(0);
                }
                else
                {
                    CMD_Confirm cmd_Confirm2 = GUIMain.ShowCommonDialog(new Action <int>(this.MeatShortCutSelect), "CMD_Confirm", null) as CMD_Confirm;
                    cmd_Confirm2.Title = StringMaster.GetString("MeatShortCutTitle2");
                    cmd_Confirm2.Info  = StringMaster.GetString("MeatShortCutText2");
                }
            }
        }
        else if (idx == 1)
        {
        }
    }
    protected virtual void OnPushedShortCutButton(Touch touch, Vector2 pos, bool touchOver)
    {
        if (!touchOver)
        {
            return;
        }
        UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID);

        FacilityM facilityMaster            = FarmDataManager.GetFacilityMaster(userFacility.facilityId);
        string    shorteningAssetCategoryId = facilityMaster.shorteningAssetCategoryId1;

        GameWebAPI.RespDataMA_GetAssetCategoryM.AssetCategoryM assetCategory = MasterDataMng.Instance().RespDataMA_AssetCategoryM.GetAssetCategory(shorteningAssetCategoryId);
        FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(userFacility.facilityId, userFacility.level);

        GameWebAPI.RespDataMA_GetAssetCategoryM.AssetCategoryM assetCategoryM = (facilityUpgradeMaster == null) ? null : MasterDataMng.Instance().RespDataMA_AssetCategoryM.GetAssetCategory(facilityUpgradeMaster.shorteningAssetCategoryId1);
        bool   flag = false;
        string arg  = string.Empty;

        if (userFacility.level == 0)
        {
            flag = FarmUtility.IsShortage(facilityMaster.shorteningAssetCategoryId1, this.buildCostLabel.GetCost().ToString());
            arg  = assetCategory.assetTitle;
        }
        else if (facilityUpgradeMaster != null)
        {
            flag = FarmUtility.IsShortage(facilityUpgradeMaster.shorteningAssetCategoryId1, this.buildCostLabel.GetCost().ToString());
            arg  = assetCategoryM.assetTitle;
        }
        if (flag)
        {
            CMD_Confirm cmd_Confirm = GUIMain.ShowCommonDialog(new Action <int>(this.OnCloseConfirmShop), "CMD_Confirm", null) as CMD_Confirm;
            cmd_Confirm.Title      = string.Format(StringMaster.GetString("SystemShortage"), arg);
            cmd_Confirm.Info       = string.Format(StringMaster.GetString("FacilityShortcutShortage"), arg);
            cmd_Confirm.BtnTextYes = StringMaster.GetString("SystemButtonGoShop");
            cmd_Confirm.BtnTextNo  = StringMaster.GetString("SystemButtonClose");
        }
        else
        {
            this.OpenShortCutDialog(userFacility);
        }
    }
Ejemplo n.º 5
0
    public void SetDetail(FacilityM facilityMaster, FacilityConditionM[] facilityConditionMaster, bool[] isClearConditions, Action <FacilityShopItem> touchEvent)
    {
        this.facilityID        = int.Parse(facilityMaster.facilityId);
        this.onPushedBuyButton = touchEvent;
        FacilityM facilityMaster2 = FarmDataManager.GetFacilityMaster(this.facilityID);

        NGUIUtil.ChangeUITextureFromFile(this.facilityIcon, facilityMaster2.GetIconPath(), false);
        if (isClearConditions.Any((bool x) => !x))
        {
            this.DetailSetActive(false);
            this.lockDetail.SetActive(true);
            this.conditionTitle.text       = string.Format(StringMaster.GetString("FacilityShopConditionTitle"), facilityMaster.facilityName);
            this.buildCountTitle.text      = StringMaster.GetString("FacilityShopBuildNum");
            this.buildTimeTitle.text       = StringMaster.GetString("FarmEditStockTime");
            this.eventBuildCountTitle.text = StringMaster.GetString("FacilityShopBuildNum");
            this.eventBuildTimeTitle.text  = StringMaster.GetString("FarmEditStockTime");
            for (int i = 0; i < facilityConditionMaster.Length; i++)
            {
                if (!(null == this.conditionTexts[i]))
                {
                    FacilityConditionM facilityConditionM = facilityConditionMaster[i];
                    if (string.IsNullOrEmpty(facilityConditionM.description))
                    {
                        this.conditionTexts[i].text = StringMaster.GetString("FacilityShopConditionUnknow");
                    }
                    else
                    {
                        this.conditionTexts[i].text = facilityConditionM.description;
                    }
                    if (!isClearConditions[i])
                    {
                        this.conditionTexts[i].color = this.nonClearColor;
                    }
                }
            }
            for (int j = facilityConditionMaster.Length; j < this.conditionTexts.Length; j++)
            {
                if (!(null == this.conditionTexts[j]))
                {
                    this.conditionTexts[j].gameObject.SetActive(false);
                }
            }
            if (facilityConditionMaster.Length == 1 && null != this.conditionLine)
            {
                this.conditionLine.SetActive(false);
            }
            if (0 < facilityConditionMaster.Length && facilityConditionMaster[0].conditionType == 5.ToString())
            {
                this.ChangeEventItemMode();
            }
        }
        else
        {
            this.DetailSetActive(true);
            this.lockDetail.SetActive(false);
            UILabel uilabel = this.facilityName;
            string  text    = facilityMaster.facilityName;
            this.eventFacilityName.text = text;
            uilabel.text = text;
            int nowCount = this.GetNowCount();
            int num      = int.Parse(facilityMaster.maxNum);
            if (nowCount != -1)
            {
                UILabel uilabel2 = this.buildCount;
                text = string.Format(StringMaster.GetString("SystemFraction"), nowCount, facilityMaster.maxNum);
                this.eventBuildCount.text = text;
                uilabel2.text             = text;
            }
            this.buildTime.text = facilityMaster.buildingTime.ToBuildTime();
            if (int.Parse(facilityMaster.buildingAssetCategoryId1) == 4)
            {
                this.buyTypeTip.gameObject.SetActive(true);
                this.price.text = StringFormat.Cluster(facilityMaster.buildingAssetNum1);
            }
            else
            {
                this.buyTypeStone.gameObject.SetActive(true);
                this.price.text = facilityMaster.buildingAssetNum1;
            }
            if (FarmUtility.IsShortage(facilityMaster.buildingAssetCategoryId1, facilityMaster.buildingAssetNum1))
            {
                this.SetButtonGrayout();
            }
            if (nowCount >= num)
            {
                this.SetButtonLimit();
            }
            if (0 < facilityConditionMaster.Length && facilityConditionMaster[0].conditionType == 5.ToString())
            {
                this.BuildEventItemMode();
            }
        }
    }