private void setRewards() { ProgressionService progressionService = Service.Get <ProgressionService>(); YourRewardsText.text = Service.Get <Localizer>().GetTokenTranslation("PartyGames.ScavengerHunt.YourRewards"); CPRewardDefinition cPRewardDefinition = (isWinner ? ((CPRewardDefinition)scavengerHuntData.WinRewardDefinition) : ((CPRewardDefinition)scavengerHuntData.LoseRewardDefinition)); CoinText.text = cPRewardDefinition.Coins.Amount.ToString(); bool flag = false; int num = 0; MascotXPRewardDefinition[] mascotXP = cPRewardDefinition.MascotXP; for (int i = 0; i < mascotXP.Length; i++) { num += mascotXP[i].XP; MascotDefinition mascot = mascotXP[i].Mascot; flag = progressionService.IsMascotMaxLevel(mascot.name); } if (num > 0) { if (flag) { XPText.gameObject.SetActive(value: false); MaxLevelText.SetActive(value: true); } else { XPText.text = num.ToString(); } } else { XPPanel.SetActive(value: false); } }
private void skinForMascot() { string name = Service.Get <QuestService>().ActiveQuest.Mascot.Name; MascotDefinition definition = Service.Get <MascotService>().GetMascot(name).Definition; CoroutineRunner.Start(loadImage(definition.CommunicatorIconContentKey, CommunicatorIcon), this, "QuestHud.loadImage"); CommunicatorBG.color = definition.CommunicatorBGColor; CommunicatorBGShadow.color = definition.CommunicatorBGShadowColor; }
private void Start() { mascotDefinition = Service.Get <MascotService>().GetMascot(MascotKey.Id).Definition; DRewardPopup popupData = GetComponentInParent <RewardPopupController>().PopupData; if (!string.IsNullOrEmpty(popupData.MascotName) && mascotDefinition != null) { toggleForMascot(popupData.MascotName); } }
public MascotService(Manifest manifest) { ScriptableObject[] assets = manifest.Assets; foreach (ScriptableObject scriptableObject in assets) { MascotDefinition mascotDefinition = (MascotDefinition)scriptableObject; mascots[mascotDefinition.name] = new Mascot(mascotDefinition); } Service.Get <EventDispatcher>().AddListener <SessionEvents.SessionEndedEvent>(onSessionEnded); Service.Get <EventDispatcher>().AddListener <SessionEvents.SessionTerminatedEvent>(onSessionTerminated); Service.Get <EventDispatcher>().AddListener <SceneTransitionEvents.TransitionStart>(onTransitionStart); }
public void LoadChapterData(MascotDefinition.QuestChapterData data, MascotDefinition mascotData) { chapterData = data; this.mascotData = mascotData; setBreadcrumbId(); TitleText.text = Service.Get <Localizer>().GetTokenTranslation(chapterData.Name); setAvailability(isChapterAvailable(chapterData.Number)); if (FeatureLabel != null) { FeatureLabel.TypeId = $"{mascotData.name}{chapterData.Number}"; FeatureLabel.SetBreadcrumbVisibility(); } }
private int getSelectedIndexForMascot(MascotDefinition mascot) { int result = 0; for (int i = 0; i < MascotsToSelectorIndexs.Count; i++) { if (MascotsToSelectorIndexs[i].Mascot == mascot) { result = MascotsToSelectorIndexs[i].SelectorIndex; break; } } return(result); }
private string getTipForMascot(MascotDefinition mascot) { string result = ""; for (int i = 0; i < definition.TipsData.Count; i++) { if (definition.TipsData[i].Mascot == mascot) { if (definition.TipsData[i].Tips.Length > 0) { result = definition.TipsData[i].Tips[UnityEngine.Random.Range(0, definition.TipsData[i].Tips.Length)]; } break; } } return(result); }
private bool onSubtaskTextSet(HudEvents.SetSubtaskText evt) { QuestSubtask questSubtask = null; if (SubtaskCount > 0) { QuestSubtask[] componentsInChildren = SubtaskDropDownPanel.GetComponentsInChildren <QuestSubtask>(); for (int i = 0; i < componentsInChildren.Length; i++) { if (componentsInChildren[i].ID == evt.ID) { questSubtask = componentsInChildren[i]; break; } } } if (questSubtask == null) { GameObject gameObject = UnityEngine.Object.Instantiate(SubtaskTickPanelPrefab, SubtaskDropDownPanel.transform, worldPositionStays: false); questSubtask = gameObject.GetComponentInChildren <QuestSubtask>(); questSubtask.ID = evt.ID; MascotDefinition definition = Service.Get <QuestService>().ActiveQuest.Mascot.Definition; if (definition != null) { Color navigationArrowColor = definition.NavigationArrowColor; questSubtask.SetTickColor(navigationArrowColor); questSubtask.SetTickOutlineColor(navigationArrowColor); } SubtaskCount++; } questSubtask.SubtaskText.text = evt.SubtaskText; if (questSubtask.TickToggle != null) { Service.Get <iOSHapticFeedback>().TriggerNotificationFeedback(iOSHapticFeedback.NotificationFeedbackType.Success); questSubtask.TickToggle.isOn = evt.IsComplete; } if (this.SubtasksChanged != null) { this.SubtasksChanged(); } return(false); }
public int SetUpMascotLevel(bool isLocalPlayer, ProfileData profileData = null, long mascotXPLevel = -1L) { MascotDefinition definition = Service.Get <MascotService>().GetMascot(MascotKey.Id).Definition; ProgressionService progressionService = Service.Get <ProgressionService>(); int result = 0; float num = 0f; bool flag = false; if (isLocalPlayer) { if (mascotXPLevel > -1) { result = ProgressionService.GetMascotLevelFromXP(mascotXPLevel); num = ProgressionService.GetMascotLevelPercentFromXP(mascotXPLevel); flag = progressionService.IsMascotMaxLevel(definition.name, mascotXPLevel); } else { result = progressionService.MascotLevel(definition.name); num = progressionService.MascotLevelPercent(definition.name); flag = progressionService.IsMascotMaxLevel(definition.name); } } else { if (profileData == null) { throw new ArgumentNullException("profileData", "Profile data cannot be null if we are not viewing the local player"); } if (MaxLevelText != null) { MaxLevelText.SetActive(value: false); } if (profileData.MascotXP != null && profileData.MascotXP.TryGetValue(definition.name, out var value)) { result = ProgressionService.GetMascotLevelFromXP(value); num = ProgressionService.GetMascotLevelPercentFromXP(value); flag = progressionService.IsMascotMaxLevel(definition.name, value); } } if (MaxLevelText != null && ProgressBarGraphic != null) { if (flag) { MaxLevelText.SetActive(value: true); ProgressBarGraphic.color = new Color(1f, 1f, 1f, 0.4f); } else { MaxLevelText.SetActive(value: false); ProgressBarGraphic.color = new Color(1f, 1f, 1f, 1f); } } LevelText.text = result.ToString(); if (ExperienceProgressBar != null) { if (num >= 0.95f && num < 1f) { ExperienceProgressBar.AnimateProgress(0.95f); } else { ExperienceProgressBar.AnimateProgress(num); } } return(result); }
public Mascot(MascotDefinition definition) { Definition = definition; InteractionBehaviours.Reset(); }