/// <inheritdoc/> public void DeactivateUnlockable(string id, bool storeChanges = true) { if (string.IsNullOrWhiteSpace(id)) { throw new ArgumentException(nameof(id)); } MilestoneData data = m_Milestones.GetDataById(id); if (data == null) { Debug.LogError($"Milestone with id {id} does not exist. Could not deactivate unlockable!"); return; } if (data.hasUnlockableContent) { MilestoneCommand command = UnityEngine.Object.Instantiate(data.unlockable.command); m_DiContainer.Inject(command); command.OnBecameDeactivated(); } m_UserManager.CurrentUser.RemoveActivatedMilestone(data.id); if (storeChanges) { m_UserManager.SaveUser(); } }
/// <inheritdoc/> public IDialog DisplayMilestoneAchieved(MilestoneData milestoneData) { DialogComponent dialogComponent = m_PopupFactory.Create(milestoneData); DialogRequest request = DialogRequest.Create(dialogComponent, DialogPriority.Low); m_DialogService.SendRequest(request); return(dialogComponent); }
protected override void onOpen() { base.onOpen(); this.currentMilestone = this.world.milestones.getCurrent(); if (this.currentMilestone != null) { // Create progress bars for each of the requirements foreach (MilestoneRequirerment r in this.currentMilestone.requirements) { if (r == null) { continue; } MilestoneProgressSlider slider = GameObject.Instantiate( this.prefabMilestoneProgressSlider, this.milestoneBtnArea).GetComponent <MilestoneProgressSlider>(); slider.setRequirement(r, this.world); } // Show what the Milestone unlocks foreach (BuildableBase buildable in this.currentMilestone.unlockedBuildables) { if (buildable == null) { continue; } GameObject obj = GameObject.Instantiate( this._prefabBuildablePreviw, this.unlockedArea); obj.GetComponent <BuildableUiRenderer>().setBuildable(buildable); obj.GetComponent <Tooltip>().text = buildable.getName(); } foreach (WorkerType type in this.currentMilestone.unlockedWorkerTypes) { if (type == null) { continue; } GameObject obj = GameObject.Instantiate( this._prefabWorkerTypePreview, this.unlockedArea); obj.GetComponent <FaceUiPreview>().setTarget(type); obj.GetComponentInChildren <Tooltip>().text = type.typeName; } } }
private void Update() { if (!Pause.isPaused()) { // Check if the next milestone is unlocked MilestoneData current = this.getCurrent(); if (current != null && current.allRequiermentMet(this.world)) { this.unlock(current, true); } } }
/// <summary> /// Unlocks the passed milestone. Safe to pass null. /// </summary> public void unlock(MilestoneData milestone, bool openPopup) { if (milestone == null) { return; } if (openPopup) { PopupMilestones popup = Main.instance.findPopup <PopupMilestones>(); if (popup != null) { popup.open(); popup.playUnlockEffect(); } } milestone.isUnlocked = true; }
public async Task <GetQuotationStatus> GetQuotationStatusForEdit(NullableIdDto input) { var output = new GetQuotationStatus { }; var QuotationStatus = _QuotationStatusRepository .GetAll().Where(p => p.Id == input.Id).FirstOrDefault(); output.quotationStatus = QuotationStatus.MapTo <CreateQuotationStatusInput>(); if (QuotationStatus.MileStoneId > 0) { var data = _MileStoneRepository.GetAll().Where(p => p.Id == QuotationStatus.MileStoneId).FirstOrDefault(); var mile = new MilestoneData { Id = data.Id, Name = data.Name }; output.Milestone = mile; } return(output); }
private void createBuildableListButton(BuildableBase buildable, MilestoneData unlockingMilestone) { BuildableListEntry btn = GameObject.Instantiate( this._entryBtnPrefab, this._buildableBtnArea).GetComponent <BuildableListEntry>(); btn.setStructureData(buildable, unlockingMilestone); // Add the Button to the list if (buildable.tab == null || buildable.tab == this._miscellaneousTab) { this.tabs[0].addButton(btn); // 0 is the miscellaneous tab } else { bool added = false; foreach (TabContents tc in this.tabs) { if (buildable.tab == tc.tab) { tc.addButton(btn); added = true; break; } } if (!added) { // Create a new tab. TabContents newTab = this.createTab(buildable.tab); newTab.addButton(btn); } } this.buildableListButton.Add(btn); }
public void ReadMilestonesSuccess_Callback(string responseData, object cbObject) { GDebug.Log(string.Format("Success | {0}", responseData)); Dictionary <string, object> response = (Dictionary <string, object>)BrainCloud.JsonFx.Json.JsonReader.Deserialize(responseData); Dictionary <string, object> data = (Dictionary <string, object>)response[BrainCloudConsts.JSON_DATA]; if (data.ContainsKey(BrainCloudConsts.JSON_MILESTONES)) { object[] milestones = ((object[])data[BrainCloudConsts.JSON_MILESTONES]); if (milestones.Length > 0) { m_milestones.Clear(); MilestoneData milestoneData = null; for (int i = 0; i < milestones.Length; ++i) { Dictionary <string, object> milestone = (Dictionary <string, object>)milestones[i]; Dictionary <string, object> thresholds = (Dictionary <string, object>)milestone[BrainCloudConsts.JSON_MILESTONES_THRESHOLDS]; Dictionary <string, object> rewards = milestone.ContainsKey(BrainCloudConsts.JSON_MILESTONES_REWARDS) ? (Dictionary <string, object>)milestone[BrainCloudConsts.JSON_MILESTONES_REWARDS] : null; milestoneData = new MilestoneData(milestone[BrainCloudConsts.JSON_MILESTONES_TITLE].ToString(), milestone[BrainCloudConsts.JSON_MILESTONES_ID].ToString(), milestone[BrainCloudConsts.JSON_MILESTONES_DESCRIPTION] == null ? "" : milestone[BrainCloudConsts.JSON_MILESTONES_DESCRIPTION].ToString(), milestone[BrainCloudConsts.JSON_MILESTONES_STATUS].ToString(), milestone[BrainCloudConsts.JSON_MILESTONES_CATEGORY].ToString(), milestone[BrainCloudConsts.JSON_MILESTONES_GAMEID].ToString(), milestone[BrainCloudConsts.JSON_MILESTONES_QUESTID] == null ? "" : milestone[BrainCloudConsts.JSON_MILESTONES_QUESTID].ToString(), milestone[BrainCloudConsts.JSON_MILESTONES_EXTRA_DATA] == null ? "" : milestone[BrainCloudConsts.JSON_MILESTONES_EXTRA_DATA].ToString(), thresholds, rewards); m_milestones.Add(milestoneData); } } } }
internal Milestone(MilestoneData data, Repository repo) { this.data = data; this.repo = repo; }