private bool OpenShortCutDialog(UserFacility userFacility)
    {
        bool flag = null != this.buildCostLabel;

        if (flag)
        {
            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);
            CMD_ChangePOP_STONE cmd_ChangePOP_STONE = GUIMain.ShowCommonDialog(null, "CMD_ChangePOP_STONE", null) as CMD_ChangePOP_STONE;
            cmd_ChangePOP_STONE.Title             = StringMaster.GetString("FacilityShortcutTitle");
            cmd_ChangePOP_STONE.OnPushedYesAction = new Action(this.OnPushedShortCutYesButton);
            int point = DataMng.Instance().RespDataUS_PlayerInfo.playerInfo.point;
            if (userFacility.level == 0)
            {
                cmd_ChangePOP_STONE.Info = string.Format(StringMaster.GetString("FacilityShortcutBuild"), assetCategory.assetTitle);
            }
            else if (facilityUpgradeMaster != null)
            {
                cmd_ChangePOP_STONE.Info = string.Format(StringMaster.GetString("FacilityShortcutUpgrage"), assetCategoryM.assetTitle);
            }
            cmd_ChangePOP_STONE.SetDigistone(point, this.buildCostLabel.GetCost());
        }
        return(flag);
    }
    private void OnSuccessedShortening(WebAPI.ResponseData response)
    {
        int num = 0;
        FacilityBuildShorteningResult facilityBuildShorteningResult = response as FacilityBuildShorteningResult;

        if (facilityBuildShorteningResult != null)
        {
            num = facilityBuildShorteningResult.num;
            UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID);

            FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(userFacility.facilityId);
            FarmUtility.PayCost(facilityMaster.shorteningAssetCategoryId1, num.ToString());
        }
        else
        {
            FacilityUpgradeShorteningResult facilityUpgradeShorteningResult = response as FacilityUpgradeShorteningResult;
            if (facilityUpgradeShorteningResult != null)
            {
                num = facilityUpgradeShorteningResult.num;
                UserFacility userFacility2 = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID);

                FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(userFacility2.facilityId, userFacility2.level);
                FarmUtility.PayCost(facilityUpgradeMaster.shorteningAssetCategoryId1, num.ToString());
            }
        }
        if (0 >= num)
        {
            CMD_ChangePOP_STONE cmd_ChangePOP_STONE = UnityEngine.Object.FindObjectOfType <CMD_ChangePOP_STONE>();
            if (null != cmd_ChangePOP_STONE)
            {
                cmd_ChangePOP_STONE.SetCloseAction(new Action <int>(this.OpenNoNeedShortening));
            }
        }
        this.SuccessShortening();
    }
    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);
        }
    }
    private void Start()
    {
        FarmRoot instance = FarmRoot.Instance;

        if (null == instance)
        {
            return;
        }
        this.farmCamera = instance.Camera;
        UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID);

        if (string.IsNullOrEmpty(userFacility.completeTime))
        {
            this.complateTime = ServerDateTime.Now;
        }
        else
        {
            this.complateTime = DateTime.Parse(userFacility.completeTime);
        }
        if (userFacility.level == 0 || (userFacility.level == 1 && string.IsNullOrEmpty(userFacility.completeTime)))
        {
            FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(userFacility.facilityId);
            this.totalComplateSeconds = int.Parse(facilityMaster.buildingTime);
        }
        else
        {
            FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(userFacility.facilityId, userFacility.level + 1);
            this.totalComplateSeconds = int.Parse(facilityUpgradeMaster.upgradeTime);
        }
        this.OnUpdate();
    }
Esempio n. 5
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();
        }
    }
Esempio n. 6
0
    public void SetUpgradeCostDetail(int userFacilityID)
    {
        UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(userFacilityID);

        FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(userFacility.facilityId, userFacility.level + 1);

        this.SetCostIcon(facilityUpgradeMaster.upgradeAssetCategoryId1);
        this.costValue = 0;
        if (int.TryParse(facilityUpgradeMaster.upgradeAssetNum1, out this.costValue))
        {
            this.SetCostLabel(facilityUpgradeMaster.upgradeAssetCategoryId1, this.costValue);
        }
    }
    private void SetButtonEnabled()
    {
        UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID);

        FacilityM        facilityMaster        = FarmDataManager.GetFacilityMaster(this.farmObject.facilityID);
        FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(userFacility.facilityId, userFacility.level);
        bool             flag = !string.IsNullOrEmpty(userFacility.completeTime);

        DrawFacilityButton[] componentsInChildren = base.GetComponentsInChildren <DrawFacilityButton>(true);
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            bool active;
            if (flag)
            {
                if (userFacility.level == 0)
                {
                    active = componentsInChildren[i].build;
                }
                else
                {
                    active = componentsInChildren[i].upgrade;
                }
            }
            else if (facilityUpgradeMaster != null && int.Parse(facilityMaster.maxLevel) <= userFacility.level)
            {
                active = componentsInChildren[i].levelMax;
            }
            else
            {
                active = componentsInChildren[i].usually;
            }
            componentsInChildren[i].gameObject.SetActive(active);
        }
        if (this.shortCutButton.gameObject.activeSelf)
        {
            if (userFacility.level == 0)
            {
                this.shortCutButton.gameObject.SetActive(facilityMaster.shorteningFlg == "1");
            }
            else
            {
                this.shortCutButton.gameObject.SetActive(facilityUpgradeMaster.shorteningFlg == "1");
            }
        }
        if (null != this.stockButton && null != this.stockButton.gameObject)
        {
            bool active2 = facilityMaster.stockFlg == "1" && !flag;
            this.stockButton.gameObject.SetActive(active2);
        }
    }
    public void SetFacility(FarmObject facility)
    {
        this.farmObject = facility;
        FacilityM        facilityMaster        = FarmDataManager.GetFacilityMaster(this.farmObject.facilityID);
        FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(this.farmObject.facilityID, 1);
        UserFacility     userFacility          = Singleton <UserDataMng> .Instance.GetUserFacility(facility.userFacilityID);

        if (userFacility.level != 0 && int.Parse(facilityMaster.type) == 1 && facilityUpgradeMaster != null)
        {
            this.facilityName.text = string.Format(StringMaster.GetString("FacilityInfoLv"), facilityMaster.facilityName, userFacility.level);
        }
        else
        {
            this.facilityName.text = facilityMaster.facilityName;
        }
    }
Esempio n. 9
0
    public void SetUserFacility(UserFacility userFacility)
    {
        this.userFacility = userFacility;
        int              num                   = userFacility.level + 1;
        FacilityM        facilityMaster        = FarmDataManager.GetFacilityMaster(userFacility.facilityId);
        FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(userFacility.facilityId, num);

        this.SetPossessionMoney(facilityUpgradeMaster);
        this.detail.text       = FarmDataManager.GetFacilityDescription(userFacility.facilityId, userFacility.level);
        this.timeDetail.text   = facilityUpgradeMaster.upgradeTime.ToBuildTime();
        this.facilityName.text = string.Format(StringMaster.GetString("FacilityInfoLv"), facilityMaster.facilityName, num);
        NGUIUtil.ChangeUITextureFromFile(this.thumbnail, facilityMaster.GetIconPath(), false);
        string facilityEffectDetail = FarmDataManager.GetFacilityEffectDetail(userFacility.facilityId, num);

        this.effectTitle.text  = facilityMaster.popDescription;
        this.effectDetail.text = string.Format(facilityMaster.popDetails, facilityEffectDetail);
    }
Esempio n. 10
0
    public void SetDetail(EditStoreFacility storeFacility)
    {
        FarmRoot instance = FarmRoot.Instance;

        if (null == instance)
        {
            return;
        }
        FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(storeFacility.facilityID);
        bool      flag           = 1 == int.Parse(facilityMaster.type);

        FarmObject[] array = instance.Scenery.farmObjects.Where((FarmObject x) => x.facilityID == storeFacility.facilityID && x.IsStore()).ToArray <FarmObject>();
        if (flag)
        {
            for (int i = 0; i < array.Length; i++)
            {
                UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(array[i].userFacilityID);

                if (userFacility.level == storeFacility.level)
                {
                    this.farmObjects.Add(array[i]);
                }
            }
            FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(storeFacility.facilityID, storeFacility.level);
            if (facilityUpgradeMaster != null)
            {
                this.levelLabel.text = string.Format(StringMaster.GetString("FarmEditButtonLevel"), storeFacility.level.ToString());
            }
            else if (storeFacility.level == 0)
            {
                this.levelLabel.text = StringMaster.GetString("FarmEditButtonLevelZero");
            }
            else
            {
                this.levelLabel.text = string.Empty;
            }
        }
        else
        {
            this.farmObjects.AddRange(array);
            this.levelLabel.text = string.Empty;
        }
        this.countLabel.text = string.Format(StringMaster.GetString("FarmEditButtonCount"), this.farmObjects.Count.ToString());
        NGUIUtil.ChangeUITextureFromFile(this.iconTexture, facilityMaster.GetIconPath(), false);
    }
    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);
        }
    }
Esempio n. 12
0
    public void StartUpgrade(UserFacility userFacility)
    {
        FarmRoot         instance = FarmRoot.Instance;
        FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(userFacility.facilityId, userFacility.level + 1);

        FarmUtility.PayCost(facilityUpgradeMaster.upgradeAssetCategoryId1, facilityUpgradeMaster.upgradeAssetNum1);
        int num = 0;

        if (int.TryParse(facilityUpgradeMaster.upgradeTime, out num))
        {
            DateTime time = ServerDateTime.Now.AddSeconds((double)(num + 1));
            userFacility.completeTime = FarmUtility.GetDateString(time);
            FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(userFacility.facilityId);
            if (facilityMaster.levelUpFlg == "1")
            {
                this.ReBuildEventItem(userFacility);
            }
            this.StartConstruction(userFacility.userFacilityId);
            instance.ClearSettingFarmObject();
        }
    }
Esempio n. 13
0
    public void SetShortCutCostDetail(int userFacilityID)
    {
        UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(userFacilityID);

        string text = string.Empty;
        string num  = string.Empty;

        if (userFacility.level == 0)
        {
            FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(userFacility.facilityId);
            text = facilityMaster.shorteningAssetCategoryId1;
            num  = facilityMaster.shorteningAssetNum1;
        }
        else
        {
            FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(userFacility.facilityId, userFacility.level);
            text = facilityUpgradeMaster.shorteningAssetCategoryId1;
            num  = facilityUpgradeMaster.shorteningAssetNum1;
        }
        this.SetCostIcon(text);
        this.costValue = FarmUtility.GetShortCutDigiStoneCost(text, num, userFacility.completeTime);
        this.SetCostLabel(text, this.costValue);
    }
Esempio n. 14
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);
    }
Esempio n. 15
0
    private GameObject LoadFarmModel(int facilityID)
    {
        FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(facilityID);

        if (facilityMaster == null)
        {
            global::Debug.LogError("施設のリソース名が見つからない : 施設ID = " + facilityID);
            return(null);
        }
        string text = "Farm/Builds/" + facilityMaster.modelResource;

        if (facilityMaster.levelUpFlg == "1")
        {
            List <UserFacility> userFacilityList = Singleton <UserDataMng> .Instance.GetUserFacilityList();

            FacilityUpgradeM facilityUpgradeMaster;
            if (userFacilityList.Any((UserFacility x) => x.facilityId == facilityID))
            {
                UserFacility userFacility = userFacilityList.Find((UserFacility x) => x.facilityId == facilityID);
                facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(facilityID, ((!string.IsNullOrEmpty(userFacility.completeTime)) ? 1 : 0) + userFacility.level);
            }
            else
            {
                facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(facilityID, 1);
            }
            text = "Farm/Builds/" + facilityUpgradeMaster.modelResource;
        }
        GameObject gameObject = AssetDataMng.Instance().LoadObject(text, null, true) as GameObject;

        if (null == gameObject)
        {
            global::Debug.LogError("施設のモデルが見つからない : " + text);
            return(null);
        }
        return(UnityEngine.Object.Instantiate <GameObject>(gameObject));
    }