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); } }
protected override void Start() { base.Start(); this.meatAnimationRootPosition = this.harvestAnimationRoot.transform.localPosition; this.harvestAnimationRoot.transform.localScale = Vector3.zero; if (!base.IsConstruction()) { UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.userFacilityID); if (userFacility != null && 0 < userFacility.level) { this.meatAnimation = base.StartCoroutine(this.DrawMeat()); } } GameObject meatIcon = GUIFaceIndicator.instance.GetMeatIcon(); if (null != meatIcon) { this.meatMain = meatIcon.GetComponent <UISprite>(); GameObject gameObject = base.transform.Find("Locator/ModelRoot/Meat/Meat1").gameObject; for (int i = 0; i < 6; i++) { GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject); Vector3 localScale = gameObject2.transform.localScale; gameObject2.transform.SetParent(this.meatMain.transform.parent); gameObject2.transform.localScale = localScale; gameObject2.transform.localRotation = Quaternion.Euler(30f, -130f, 0f); gameObject2.SetActive(false); gameObject2.layer = LayerMask.NameToLayer("UI"); gameObject2.GetComponent <MeshRenderer>().material.color = new Color(0.95f, 0.95f, 0.95f); this.meatList.Add(gameObject2); } } }
public FarmObjectSetting.ExtendBuildPositionSearchResult SearchExtendBuildGrid(FarmObject oneBeforeFarmObject) { FarmScenery scenery = FarmRoot.Instance.Scenery; FarmObjectSetting.PriorityDirection priorityDirection = FarmObjectSetting.PriorityDirection.FRONT; FarmObject farmObject = null; if (2 <= scenery.farmObjects.Count) { farmObject = scenery.farmObjects[scenery.farmObjects.Count - 2]; } UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(oneBeforeFarmObject.userFacilityID); if (null != farmObject && farmObject.facilityID == oneBeforeFarmObject.facilityID) { UserFacility userFacility2 = Singleton <UserDataMng> .Instance.GetUserFacility(farmObject.userFacilityID); int num = userFacility2.positionX - userFacility.positionX; int num2 = userFacility2.positionY - userFacility.positionY; bool flag = Mathf.Abs(num) > Mathf.Abs(num2); if (flag) { priorityDirection = ((0 <= num) ? FarmObjectSetting.PriorityDirection.LEFT : FarmObjectSetting.PriorityDirection.RIGHT); } else { priorityDirection = ((0 <= num2) ? FarmObjectSetting.PriorityDirection.REAR : FarmObjectSetting.PriorityDirection.FRONT); } } return(this.GetExtendBuildGrid(oneBeforeFarmObject, userFacility, priorityDirection)); }
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 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 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 List <EditStoreFacility> GetStoreFacilityButtonList() { List <EditStoreFacility> list = new List <EditStoreFacility>(); FarmEditFacilityButton[] componentsInChildren = base.GetComponentsInChildren <FarmEditFacilityButton>(); if (componentsInChildren != null) { for (int i = 0; i < componentsInChildren.Length; i++) { if (!componentsInChildren[i].IsEmpty()) { int userFacilityID = componentsInChildren[i].GetUserFacilityID(); UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(userFacilityID); EditStoreFacility item = new EditStoreFacility { facilityID = userFacility.facilityId, level = userFacility.level }; list.Add(item); } } } return(list); }
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 int CompareUserStockFacility(UserFacility x, UserFacility y) { int num = x.facilityId; int num2 = y.facilityId; if (num < num2) { return(-1); } if (num > num2) { return(1); } num = x.level; num2 = y.level; if (num > num2) { return(-1); } if (num < num2) { return(1); } return(0); }
private IEnumerator RequestUserFacility() { List <UserFacility> userFacilityList = new List <UserFacility>(); GameWebAPI.RequestFA_UserFacilityList requestFA_UserFacilityList = new GameWebAPI.RequestFA_UserFacilityList(); requestFA_UserFacilityList.SetSendData = delegate(GameWebAPI.FA_Req_RequestFA_UserFacilityList param) { param.userId = DataMng.Instance().RespDataCM_Login.playerInfo.UserId; }; requestFA_UserFacilityList.OnReceived = delegate(GameWebAPI.RespDataFA_GetFacilityList response) { for (int i = 0; i < response.userFacilityList.Length; i++) { UserFacility userFacility = response.userFacilityList[i]; if (userFacility.facilityId == 6) { userFacilityList.Add(userFacility); } } }; GameWebAPI.RequestFA_UserFacilityList request = requestFA_UserFacilityList; yield return(AppCoroutine.Start(request.Run(null, null, null), false)); Singleton <UserDataMng> .Instance.userFacilityList = userFacilityList; yield break; }
public IEnumerator RequestFirstTutorialFinish() { yield return(AppCoroutine.Start(this.RequestUserFacility(), false)); int meatFarmUserFacilityId = -1; for (int i = 0; i < Singleton <UserDataMng> .Instance.userFacilityList.Count; i++) { UserFacility userFacility = Singleton <UserDataMng> .Instance.userFacilityList[i]; if (userFacility.facilityId == 1) { meatFarmUserFacilityId = userFacility.userFacilityId; break; } } if (meatFarmUserFacilityId == -1) { yield return(AppCoroutine.Start(this.RequestBuildMeatFarm(delegate(int id) { meatFarmUserFacilityId = id; }), false)); } yield return(new WaitForSeconds(1f)); yield return(AppCoroutine.Start(this.RequestBuildCompletedMeatFarm(meatFarmUserFacilityId), false)); TutorialEnd request = new TutorialEnd(); yield return(AppCoroutine.Start(request.Run(null, null, null), false)); yield break; }
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 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 override void BuildComplete() { base.BuildComplete(); UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.userFacilityID); FacilityChipM facilityChipFarmMaster = FarmDataManager.GetFacilityChipFarmMaster(userFacility.level); DataMng.Instance().RespDataUS_PlayerInfo.playerInfo.chipLimitMax = int.Parse(facilityChipFarmMaster.maxChipNum); }
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"); } }
public IEnumerator SaveEdit(Action <bool> completed) { FarmRoot farmRoot = FarmRoot.Instance; FarmField farmField = farmRoot.Field; List <FacilityPosition> facilityPositions = new List <FacilityPosition>(); for (int i = 0; i < this.farmObjects.Count; i++) { FarmObject farmObject = this.farmObjects[i]; FarmGrid.GridPosition gridPosition = farmField.Grid.GetGridPosition(farmObject.GetBaseGridPosition3D()); FacilityPosition item = new FacilityPosition { userFacilityId = farmObject.userFacilityID, positionX = gridPosition.x, positionY = gridPosition.y }; facilityPositions.Add(item); } RestrictionInput.StartLoad(RestrictionInput.LoadType.LARGE_IMAGE_MASK_ON); RequestFA_FacilityAllArrangement request = new RequestFA_FacilityAllArrangement { SetSendData = delegate(FacilityAllArrangement param) { param.userFacilityList = facilityPositions.ToArray(); }, OnReceived = delegate(WebAPI.ResponseData response) { for (int j = 0; j < facilityPositions.Count; j++) { FacilityPosition facilityPosition = facilityPositions[j]; UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(facilityPosition.userFacilityId); if (userFacility != null) { userFacility.positionX = facilityPosition.positionX; userFacility.positionY = facilityPosition.positionY; } } if (completed != null) { completed(true); } } }; RequestBase request2 = request; if (FarmScenery.< > f__mg$cache0 == null) { FarmScenery.< > f__mg$cache0 = new Action(RestrictionInput.EndLoad); } yield return(base.StartCoroutine(request2.Run(FarmScenery.< > f__mg$cache0, null, null))); yield break; }
private void SuccessShortening() { UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID); userFacility.completeTime = null; userFacility.level++; this.farmObject.BuildCompleteEffect(); this.farmObject.ClearConstruction(); this.SetFacility(this.farmObject); this.SettingButton(); }
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); } }
public APIRequestTask SaveStockFarmObjectPosition(int userFacilityId, Action <int> complated) { RequestFA_FacilityStock request = new RequestFA_FacilityStock { SetSendData = delegate(FacilityStock param) { param.userFacilityId = userFacilityId; param.stockFlg = 0; }, OnReceived = delegate(FacilityStockResult response) { UserFacility userStockFacility = Singleton <UserDataMng> .Instance.GetUserStockFacility(userFacilityId); Singleton <UserDataMng> .Instance.DeleteUserStockFacility(userFacilityId); Singleton <UserDataMng> .Instance.AddUserFacility(userStockFacility); } }; RequestFA_FacilityMoving request2 = new RequestFA_FacilityMoving { SetSendData = delegate(FacilityMoving param) { FarmRoot instance = FarmRoot.Instance; FarmField field = instance.Field; FarmObjectSetting component = this.GetComponent <FarmObjectSetting>(); FarmGrid.GridPosition gridPosition = field.Grid.GetGridPosition(component.farmObject.GetBaseGridPosition3D()); param.userFacilityId = userFacilityId; param.positionX = gridPosition.x; param.positionY = gridPosition.y; }, OnReceived = delegate(WebAPI.ResponseData response) { FarmRoot instance = FarmRoot.Instance; FarmField field = instance.Field; FarmObjectSetting component = this.GetComponent <FarmObjectSetting>(); FarmGrid.GridPosition gridPosition = field.Grid.GetGridPosition(component.farmObject.GetBaseGridPosition3D()); UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(userFacilityId); userFacility.positionX = gridPosition.x; userFacility.positionY = gridPosition.y; this.SaveResponseToStockToFarmFacility(userFacilityId); if (complated != null) { complated(userFacilityId); } } }; APIRequestTask apirequestTask = new APIRequestTask(request, true); APIRequestTask task = new APIRequestTask(request2, true); apirequestTask.Add(task); return(apirequestTask); }
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 OnPushedShortCutYesButton() { UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID); if (userFacility.level == 0) { this.RequestBuildShortening(); } else { this.RequestUpgradeShortening(); } }
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); } }
public void AddStoreFacilityButton(FarmObject farmObject) { List <EditStoreFacility> storeFacilityButtonList = this.GetStoreFacilityButtonList(); UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(farmObject.userFacilityID); EditStoreFacility item = new EditStoreFacility { facilityID = userFacility.facilityId, level = userFacility.level }; storeFacilityButtonList.Add(item); this.CreateListItem(storeFacilityButtonList.ToArray(), false); }
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 static int GetBuildFacilityCount() { List<UserFacility> userFacilityList = Singleton<UserDataMng>.Instance.GetUserFacilityList(); int num = 0; for (int i = 0; i < userFacilityList.Count; i++) { UserFacility userFacility = userFacilityList[i]; if (userFacility != null && !string.IsNullOrEmpty(userFacility.completeTime)) { num++; } } return num; }
protected override void TaskSaveFarmObject(FarmScenery farmScenery) { int facilityID = base.GetFacilityID(); UserFacility stockFacilityByfacilityId = Singleton <UserDataMng> .Instance.GetStockFacilityByfacilityId(facilityID); int userFacilityId = stockFacilityByfacilityId.userFacilityId; APIRequestTask apirequestTask = farmScenery.SaveStockFarmObjectPosition(userFacilityId, new Action <int>(base.OnFinishedToSave)); TaskBase task = apirequestTask; if (StockFacilityConfirmation.< > f__mg$cache0 == null) { StockFacilityConfirmation.< > f__mg$cache0 = new Action(RestrictionInput.EndLoad); } base.StartCoroutine(task.Run(StockFacilityConfirmation.< > f__mg$cache0, null, null)); }
public override void BuildComplete() { base.BuildComplete(); UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.userFacilityID); FacilityRestaurantM facilityRestaurantMaster = FarmDataManager.GetFacilityRestaurantMaster(userFacility.level); DataMng.Instance().RespDataUS_PlayerInfo.playerInfo.staminaMax = facilityRestaurantMaster.maxStamina; int num = int.Parse(facilityRestaurantMaster.maxStamina); if (num > DataMng.Instance().RespDataUS_PlayerInfo.playerInfo.stamina) { Singleton <UserDataMng> .Instance.RecoveryUserStamina(num); } }
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; } }
private int GetLevel() { if (0 >= this.farmObjects.Count) { global::Debug.LogError("0 == this.farmObjects.Count"); return(-1); } UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObjects[0].userFacilityID); if (userFacility == null) { global::Debug.LogError(string.Format("FacilityID = {0}, UserFacilityID = {1}", this.farmObjects[0].facilityID, this.farmObjects[0].userFacilityID)); return(-1); } return(userFacility.level); }