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 IEnumerator RequestBuildMeatFarm(Action <int> completed) { FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(1); int userFacilityId = 0; RequestFA_FacilityBuild request = new RequestFA_FacilityBuild { SetSendData = delegate(FacilityBuild param) { param.facilityId = 1; param.positionX = facilityMaster.initialX.ToInt32(); param.positionY = facilityMaster.initialX.ToInt32(); }, OnReceived = delegate(FacilityBuildResult response) { userFacilityId = response.userFacilityId; } }; yield return(AppCoroutine.Start(request.Run(null, null, null), false)); if (completed != null) { completed(userFacilityId); } yield break; }
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); }
private void OnPushedBuyButton() { int nowCount = this.GetNowCount(); if (nowCount != -1) { FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(this.facilityID); if (int.Parse(facilityMaster.maxNum) <= nowCount) { CMD_ModalMessage cmd_ModalMessage = GUIMain.ShowCommonDialog(null, "CMD_ModalMessage", null) as CMD_ModalMessage; cmd_ModalMessage.Title = StringMaster.GetString("FacilityShopBuildMaxTitle"); cmd_ModalMessage.Info = StringMaster.GetString("FacilityShopMuxNumInfo"); } else if (2 <= FarmUtility.GetBuildFacilityCount()) { CMD_ModalMessage cmd_ModalMessage2 = GUIMain.ShowCommonDialog(null, "CMD_ModalMessage", null) as CMD_ModalMessage; cmd_ModalMessage2.Title = StringMaster.GetString("FacilityShopBuildMaxNumTitle"); cmd_ModalMessage2.Info = StringMaster.GetString("FacilityShopBuildMaxNumInfo"); } else if (this.onPushedBuyButton != null) { this.onPushedBuyButton(this); } } }
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(); }
public void SetFacilityInfo(UserFacility userFacility) { this.userFacility = userFacility; FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(userFacility.facilityId); this.detail.text = facilityMaster.description; if (int.Parse(facilityMaster.maxLevel) > userFacility.level) { this.facilityName.text = string.Format(StringMaster.GetString("FacilityInfoLv"), facilityMaster.facilityName, userFacility.level); } else { this.facilityName.text = string.Format(StringMaster.GetString("FacilityInfoLvMax"), facilityMaster.facilityName, userFacility.level); } string facilityEffectDetail = FarmDataManager.GetFacilityEffectDetail(userFacility.facilityId, userFacility.level); this.effectInfo.text = facilityMaster.popDescription; this.effectDetail.text = string.Format(facilityMaster.popDetails, facilityEffectDetail); NGUIUtil.ChangeUITextureFromFile(this.thumbnail, facilityMaster.GetIconPath(), false); if (!string.IsNullOrEmpty(this.userFacility.completeTime) || int.Parse(facilityMaster.maxLevel) <= this.userFacility.level) { this.upgradeButton.gameObject.SetActive(false); this.closeButton.gameObject.SetActive(false); this.centerCloseButton.gameObject.SetActive(true); } }
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 static int CompareFacility(FacilityM x, FacilityM y) { int num = int.Parse(x.sort); int num2 = int.Parse(y.sort); return((num <= num2) ? ((num >= num2) ? 0 : -1) : 1); }
private UserFacility StartBuild(FarmObject farmObject, FarmGrid.GridPosition gridPosition) { FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(farmObject.facilityID); int num = int.Parse(facilityMaster.buildingTime); string text = null; if (facilityMaster.autoBuildingFlg == "0") { text = ServerDateTime.Now.ToString(); } if (0 < num) { DateTime time = ServerDateTime.Now.AddSeconds((double)num + 1.0); text = FarmUtility.GetDateString(time); } return(new UserFacility { userFacilityId = farmObject.userFacilityID, facilityId = farmObject.facilityID, positionX = gridPosition.x, positionY = gridPosition.y, level = ((text != null) ? 0 : 1), completeTime = text }); }
public void SaveResponseToFacilityBuild(int userFacilityID) { FarmRoot instance = FarmRoot.Instance; FarmObjectSetting component = base.GetComponent <FarmObjectSetting>(); instance.ResetSettingMark(); component.farmObject.DisplayFloorObject(); instance.SetActiveNotTouchObject(true); FarmObject farmObject = component.farmObject; FarmGrid.GridPosition gridPosition = component.ComplatedSetting(); farmObject.userFacilityID = userFacilityID; UserFacility facility = this.StartBuild(farmObject, gridPosition); Singleton <UserDataMng> .Instance.AddUserFacility(facility); this.farmObjects.Add(farmObject); FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(farmObject.facilityID); FarmUtility.PayCost(facilityMaster.buildingAssetCategoryId1, facilityMaster.buildingAssetNum1); if (0 < int.Parse(facilityMaster.buildingTime) || int.Parse(facilityMaster.autoBuildingFlg) == 0) { this.StartConstruction(userFacilityID); } else { farmObject.BuildComplete(); } }
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(); }
public void SetNoticeMessage(LimitOverNoticeType type) { int num = 7; FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(num); bool flag = false; for (int i = 0; i < Singleton <UserDataMng> .Instance.userFacilityList.Count; i++) { UserFacility userFacility = Singleton <UserDataMng> .Instance.userFacilityList[i]; if (userFacility.facilityId == num) { int num2 = 0; if (int.TryParse(facilityMaster.maxLevel, out num2)) { flag = (num2 <= userFacility.level); } break; } } if (flag) { if (type != LimitOverNoticeType.GASHA) { if (type != LimitOverNoticeType.PRESENTS) { if (type == LimitOverNoticeType.QUEST) { this.message.text = StringMaster.GetString("PossessionOverQuest"); } } else { this.message.text = StringMaster.GetString("PossessionOverPresent"); } } else { this.message.text = StringMaster.GetString("PossessionOverGasha"); } } else if (type != LimitOverNoticeType.GASHA) { if (type != LimitOverNoticeType.PRESENTS) { if (type == LimitOverNoticeType.QUEST) { this.message.text = StringMaster.GetString("PossessionOverQuestUpgrade"); } } else { this.message.text = StringMaster.GetString("PossessionOverPresentUpgrade"); } } else { this.message.text = StringMaster.GetString("PossessionOverGashaUpgrade"); } }
public void SetFacilityInfo(int facilityId) { FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(facilityId); this.detail.text = facilityMaster.description; this.facilityName.text = facilityMaster.facilityName; NGUIUtil.ChangeUITextureFromFile(this.thumbnail, facilityMaster.GetIconPath(), false); }
public static bool IsWalkBuild(int facilityID) { bool result = false; FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(facilityID); if (facilityMaster != null && "0" != facilityMaster.isWalk) { result = true; } return result; }
public void SetType(CMD_UpperLimit.MessageType type) { int facilityID = 7; FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(facilityID); bool flag = false; for (int i = 0; i < Singleton <UserDataMng> .Instance.userFacilityList.Count; i++) { UserFacility userFacility = Singleton <UserDataMng> .Instance.userFacilityList[i]; if (userFacility.facilityId == int.Parse(facilityMaster.facilityId)) { flag = (userFacility.level >= int.Parse(facilityMaster.maxLevel)); break; } } if (flag) { if (type != CMD_UpperLimit.MessageType.GASHA) { if (type != CMD_UpperLimit.MessageType.PRESENTS) { if (type == CMD_UpperLimit.MessageType.QUEST) { this.message.text = StringMaster.GetString("PossessionOverQuest"); } } else { this.message.text = StringMaster.GetString("PossessionOverPresent"); } } else { this.message.text = StringMaster.GetString("PossessionOverGasha"); } } else if (type != CMD_UpperLimit.MessageType.GASHA) { if (type != CMD_UpperLimit.MessageType.PRESENTS) { if (type == CMD_UpperLimit.MessageType.QUEST) { this.message.text = StringMaster.GetString("PossessionOverQuestUpgrade"); } } else { this.message.text = StringMaster.GetString("PossessionOverPresentUpgrade"); } } else { this.message.text = StringMaster.GetString("PossessionOverGashaUpgrade"); } }
private void OnClickedSell() { FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(this.StockFacility.facilityId); if (facilityMaster.sellFlg == "1") { CMD_Confirm cmd_Confirm = GUIMain.ShowCommonDialog(new Action <int>(this.OnPushedSellYesButton), "CMD_Confirm", null) as CMD_Confirm; cmd_Confirm.Title = StringMaster.GetString("SystemConfirm"); cmd_Confirm.Info = string.Format(StringMaster.GetString("FacilitySaleComfirmInfo"), facilityMaster.facilityName, facilityMaster.sellPrice); } }
protected void OnPushedInfoButton(Touch touch, Vector2 pos, bool touchOver) { if (!touchOver) { return; } UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID); FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(this.farmObject.facilityID); this.DrawInfo(facilityMaster, userFacility); }
private void GetCacheFacilityObject(Transform sceneryTransform, List <GameObject> facilityList, List <GameObject> decorationList) { List <int> list = new List <int>(); List <int> list2 = new List <int>(); List <GameObject> list3 = new List <GameObject>(); for (int i = 0; i < sceneryTransform.childCount; i++) { Transform child = sceneryTransform.GetChild(i); if (!(null == child)) { FarmObject component = child.GetComponent <FarmObject>(); if (null == component) { list3.Add(child.gameObject); } else { FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(component.facilityID); if (facilityMaster != null) { if (facilityMaster.IsFacility()) { if (!list.Contains(component.facilityID) && component.facilityID != 1) { list.Add(component.facilityID); facilityList.Add(component.gameObject); } else { list3.Add(component.gameObject); } } else if (!list2.Contains(component.facilityID)) { list2.Add(component.facilityID); decorationList.Add(component.gameObject); } else { list3.Add(component.gameObject); } } } } } for (int j = 0; j < list3.Count; j++) { UnityEngine.Object.Destroy(list3[j]); } }
public void SetDetail(Action <int> _actCallBackPlace) { this.tagStockCount.text = StringMaster.GetString("FarmEditStockCount"); this.tagBuildTime.text = StringMaster.GetString("FarmEditStockTime"); this.labelBtnSell.text = StringMaster.GetString("SystemButtonSell"); this.labelBtnPlace.text = StringMaster.GetString("SystemButtonPlace"); this.actCallBackPlace = _actCallBackPlace; FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(this.StockFacility.facilityId); NGUIUtil.ChangeUITextureFromFile(this.facilityIcon, facilityMaster.GetIconPath(), false); this.facilityName.text = facilityMaster.facilityName; this.stockCount.text = this.StockFacility.userFacilityIdList.Count.ToString(); this.buildTime.text = facilityMaster.buildingTime.ToBuildTime(); }
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); } }
protected virtual void OnPushedStockButton(Touch touch, Vector2 pos, bool touchOver) { if (!touchOver) { return; } FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(this.farmObject.facilityID); if (facilityMaster.stockFlg == "1") { CMD_Confirm cmd_Confirm = GUIMain.ShowCommonDialog(new Action <int>(this.OnPushedStockYesButton), "CMD_Confirm", null) as CMD_Confirm; cmd_Confirm.Title = StringMaster.GetString("SystemConfirm"); cmd_Confirm.Info = string.Format(StringMaster.GetString("FacilityStockConfirmInfo"), facilityMaster.facilityName); } }
public void SetParam(FacilityConditionM data, string assetValue, FacilityM faciltyData) { FacilityKeyM facilityKeyMaster = FarmDataManager.GetFacilityKeyMaster(assetValue); if (facilityKeyMaster != null) { this.titleLabel.text = facilityKeyMaster.facilityKeyName; } this.textLabel.text = faciltyData.description; FacilityM facilityMasterByReleaseId = FarmDataManager.GetFacilityMasterByReleaseId(data.releaseId); string iconPath = facilityMasterByReleaseId.GetIconPath(); this.iconSprite.gameObject.SetActive(false); this.iconTexture.gameObject.SetActive(true); NGUIUtil.ChangeUITextureFromFile(this.iconTexture, iconPath, false); }
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; } }
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); }
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); }
private void DeleteStoreFacilityButton(FarmObject farmObject) { UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(farmObject.userFacilityID); FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(farmObject.facilityID); List <EditStoreFacility> storeFacilityButtonList = this.GetStoreFacilityButtonList(); EditStoreFacility[] storeFacilities; if (int.Parse(facilityMaster.type) == 1) { storeFacilities = storeFacilityButtonList.Where((EditStoreFacility x) => x.facilityID != farmObject.facilityID || (x.facilityID == farmObject.facilityID && x.level != userFacility.level)).ToArray <EditStoreFacility>(); } else { storeFacilities = storeFacilityButtonList.Where((EditStoreFacility x) => x.facilityID != farmObject.facilityID).ToArray <EditStoreFacility>(); } this.CreateListItem(storeFacilities, false); }
protected virtual void Start() { Animator component = base.GetComponent <Animator>(); if (null != component && null == component.runtimeAnimatorController) { component.runtimeAnimatorController = FarmDataManager.FacilityAnimator; component.enabled = true; } if (!this.IsConstruction()) { FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(this.facilityID); if (ConstValue.BUILDING_TYPE_FACILITY == facilityMaster.type) { this.SetNamePlate(true); } } }
private string GetTexturePath(MasterDataMng.AssetCategory assetCategoryId, string objectId) { string result = string.Empty; switch (assetCategoryId) { case MasterDataMng.AssetCategory.SOUL: result = ClassSingleton <EvolutionData> .Instance.GetEvolveItemIconPathByID(objectId); break; default: if (assetCategoryId == MasterDataMng.AssetCategory.ITEM) { GameWebAPI.RespDataMA_GetItemM.ItemM itemM = MasterDataMng.Instance().RespDataMA_ItemM.GetItemM(objectId); if (itemM != null) { result = itemM.GetLargeImagePath(); } } break; case MasterDataMng.AssetCategory.FACILITY_KEY: { FacilityConditionM[] facilityCondition = FarmDataManager.GetFacilityCondition(objectId); FacilityConditionM facilityConditionM = facilityCondition.FirstOrDefault((FacilityConditionM x) => int.Parse(x.conditionType) == 1); FacilityM facilityMasterByReleaseId = FarmDataManager.GetFacilityMasterByReleaseId(facilityConditionM.releaseId); result = facilityMasterByReleaseId.GetIconPath(); break; } case MasterDataMng.AssetCategory.DUNGEON_TICKET: { GameWebAPI.RespDataMA_DungeonTicketMaster.DungeonTicketM dungeonTicketM = MasterDataMng.Instance().RespDataMA_DungeonTicketMaster.dungeonTicketM.FirstOrDefault((GameWebAPI.RespDataMA_DungeonTicketMaster.DungeonTicketM x) => objectId == x.dungeonTicketId); if (dungeonTicketM != null) { result = dungeonTicketM.img; } break; } } return(result); }
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); } }
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(); } }