public void CheckForNewMissions(ref bool newChapterMission) { IDataController dataController = Service.Get <IDataController>(); foreach (string current in this.missions.Keys) { Mission mission = this.missions[current]; if (mission.Status == MissionStatus.Default) { CampaignMissionVO optional = dataController.GetOptional <CampaignMissionVO>(mission.Uid); if (optional != null) { CampaignVO optional2 = dataController.GetOptional <CampaignVO>(optional.CampaignUid); if (optional2 != null) { if (!optional2.Timed) { newChapterMission = true; } if (newChapterMission) { break; } } } } } }
public void CollectCampaign(CampaignVO campaignType, CampaignMissionVO lastMissionCompleted) { this.rm.TryAndGrantReward(campaignType.Reward, new RewardManager.SuccessCallback(this.OnCampaignCollectSuccess), campaignType); ClaimCampaignRequest request = new ClaimCampaignRequest(campaignType.Uid, lastMissionCompleted.Uid); Service.ServerAPI.Enqueue(new ClaimCampaignCommand(request)); }
public void CompleteMission(CampaignMissionVO missionType, int earnedStars) { if (this.progress.CompleteMission(missionType, earnedStars)) { if (missionType == this.GetLastMission(missionType.CampaignUid) && !this.progress.CompleteCampaign(missionType.CampaignUid)) { Service.Logger.WarnFormat("Unable to complete campaign {0}", new object[] { missionType.CampaignUid }); } this.UnlockNextMission(missionType); if (!string.IsNullOrEmpty(missionType.Rewards) && this.rm.IsRewardOnlySoftCurrency(missionType.Rewards)) { this.CollectMission(missionType); } } Service.EventManager.SendEvent(EventId.MissionCompleted, missionType); if (missionType.CampaignUid != null) { CampaignVO campaignVO = this.sdc.Get <CampaignVO>(missionType.CampaignUid); if (!this.progress.IsCampaignCollected(campaignVO.Uid)) { int totalCampaignStarsEarned = this.progress.GetTotalCampaignStarsEarned(campaignVO); if (totalCampaignStarsEarned >= campaignVO.TotalMasteryStars) { this.CollectCampaign(campaignVO, missionType); } } } this.RemoveActiveMissionConductors(missionType); }
public void OnScreenLoaded() { this.chapterActionButtonLabel = this.screen.GetElement <UXLabel>("LabelBtnChapterAction"); this.pveMeshTexture = this.screen.GetElement <UXMeshRenderer>("MeshPVEImage"); this.chapterJewel = this.screen.GetElement <UXElement>("ContainerJewelChapter"); this.chapterButtonBackground = this.screen.GetElement <UXSprite>("SpriteBkgBtnChapterAction"); this.chapterStarsSprite = this.screen.GetElement <UXSprite>("SpriteChapterSelectionStar"); this.chapterLabel = this.screen.GetElement <UXLabel>("LabelChapterNumber"); this.nameLabel = this.screen.GetElement <UXLabel>("LabelChapterTitle"); this.nameLabel.Visible = false; this.nameLabelOperationsLocked = this.screen.GetElement <UXLabel>("LabelOperationsLocked"); this.nameLabelOperationsLocked.Visible = false; this.progressLabel = this.screen.GetElement <UXLabel>("LabelChapterSelectionProgress"); this.starsLabel = this.screen.GetElement <UXLabel>("LabelChapterSelectionStars"); this.progressSlider = this.screen.GetElement <UXSlider>("ChapterSelectionPbar"); this.pveContinueButton = this.screen.GetElement <UXButton>("BtnChapterAction"); this.pveContinueButton.Enabled = true; CampaignVO highestUnlockedCampaign = GameUtils.GetHighestUnlockedCampaign(); this.alternateBackground = this.screen.GetElement <UXTexture>("TextureChapterBg"); this.alternateBackground.LoadTexture("chap_btn_" + highestUnlockedCampaign.Uid); this.alternateButton = this.screen.GetElement <UXButton>("BtnChapterActionTop"); this.alternateButton.Enabled = true; this.alternateButton.OnClicked = new UXButtonClickedDelegate(this.OnPveButtonClicked); this.screen.GetElement <UXLabel>("LabelBtnChapterActionTop").Text = Service.Get <Lang>().Get("LABEL_CAMPAIGNS", new object[0]); this.alternateGroup = this.screen.GetElement <UXElement>("ChapterButtonTop"); UXElement element = this.screen.GetElement <UXElement>("ContainerJewelChapterTop"); element.Visible = false; this.RefreshScreenForPlanetChange(); }
public EatResponse OnEvent(EventId id, object cookie) { if (id <= EventId.HomeStateTransitionComplete) { if (id == EventId.WorldInTransitionComplete || id == EventId.HomeStateTransitionComplete) { if (Service.Get <GameStateMachine>().CurrentState is HomeState) { Service.Get <EventManager>().UnregisterObserver(this, EventId.WorldInTransitionComplete); Service.Get <EventManager>().UnregisterObserver(this, EventId.HomeStateTransitionComplete); if (!this.MissionVO.IsRaidDefense()) { Service.Get <ScreenController>().AddScreen(new MissionCompleteScreen(this.MissionVO)); } } } } else if (id != EventId.StoryChainCompleted) { if (id == EventId.MissionCompleteScreenDisplayed) { Service.Get <EventManager>().UnregisterObserver(this, EventId.MissionCompleteScreenDisplayed); CampaignVO meta = Service.Get <IDataController>().Get <CampaignVO>(this.MissionVO.CampaignUid); Service.Get <ScreenController>().AddScreen(new CampaignCompleteScreen(meta)); } } else { ActionChain chain = cookie as ActionChain; this.CompleteChain(chain); } return(EatResponse.NotEaten); }
public CampaignCompleteScreen(CampaignVO meta) : base("gui_chapter_complete") { this.meta = meta; this.cp = Service.CurrentPlayer; this.nextMeta = this.GetNextCampaign(meta); this.earnedStars = this.cp.CampaignProgress.GetTotalCampaignStarsEarned(meta); this.totalStars = meta.TotalMasteryStars; }
public void RefreshScreenForPlanetChange() { bool flag = this.IsViewingDefaultPlanet(); bool flag2 = this.IsBasedOnDefaultPlanet(); bool flag3 = Service.ObjectiveController.ShouldShowObjectives(); CampaignVO highestUnlockedCampaign = GameUtils.GetHighestUnlockedCampaign(); if (flag3 || !flag || highestUnlockedCampaign == null) { this.chapterLabel.Visible = false; this.nameLabelOperationsLocked.Visible = false; this.chapterStarsSprite.Visible = false; this.chapterJewel.Visible = false; this.pveMeshTexture.LoadTexture("PlanetPanelLocked"); this.pveMeshTexture.SetShader("Unlit/Premultiplied Colored"); this.progressSlider.Visible = false; this.progressLabel.Visible = false; this.starsLabel.Visible = false; this.pveContinueButton.Visible = false; this.alternateGroup.Visible = flag; } else { this.chapterLabel.Visible = true; this.chapterStarsSprite.Visible = false; this.chapterJewel.Visible = false; this.progressSlider.Visible = true; this.progressLabel.Visible = true; this.starsLabel.Visible = false; this.pveContinueButton.Visible = true; this.alternateGroup.Visible = flag3; this.chapterLabel.Text = LangUtils.GetCampaignTitle(highestUnlockedCampaign); int totalCampaignMissionsCompleted = base.Player.CampaignProgress.GetTotalCampaignMissionsCompleted(highestUnlockedCampaign); int totalMissions = highestUnlockedCampaign.TotalMissions; this.progressSlider.Value = ((totalMissions != 0) ? ((float)totalCampaignMissionsCompleted / (float)totalMissions) : 0f); this.progressLabel.Text = base.LangController.Get("PERCENT_COMPLETE", new object[] { (int)Mathf.Floor(this.progressSlider.Value * 100f) }); this.starsLabel.Text = base.LangController.Get("LABEL_CAMPAIGN_STARS", new object[] { base.Player.CampaignProgress.GetTotalCampaignStarsEarned(highestUnlockedCampaign), highestUnlockedCampaign.TotalMasteryStars }); this.pveMeshTexture.LoadTexture(highestUnlockedCampaign.Uid); this.pveMeshTexture.SetShader("Unlit/Premultiplied Colored"); this.pveContinueButton.OnClicked = new UXButtonClickedDelegate(this.OnPveButtonClicked); if (flag && flag2) { this.chapterActionButtonLabel.Text = base.LangController.Get("CONTINUE", new object[0]); } else { this.chapterActionButtonLabel.Text = base.LangController.Get("Planets_Chapter_Preview", new object[0]); this.chapterButtonBackground.SpriteName = "BtnBlue"; } } }
private void CompleteChain(ActionChain chain) { Service.Get <EventManager>().UnregisterObserver(this, EventId.StoryChainCompleted); if (chain == this.introChain) { this.processor.OnIntroHookComplete(); return; } if (chain == this.successChain) { this.processor.OnSuccessHookComplete(); if (Service.Get <CurrentPlayer>().CampaignProgress.FueInProgress) { return; } CampaignVO campaignVO = Service.Get <IDataController>().Get <CampaignVO>(this.MissionVO.CampaignUid); CampaignMissionVO lastMission = Service.Get <CampaignController>().GetLastMission(this.MissionVO.CampaignUid); bool flag = this.MissionVO == lastMission; bool flag2 = Service.Get <CurrentPlayer>().CampaignProgress.GetTotalCampaignStarsEarned(campaignVO) >= campaignVO.TotalMasteryStars; if (flag | flag2) { if (Service.Get <GameStateMachine>().CurrentState is HomeState) { Service.Get <ScreenController>().AddScreen(new CampaignCompleteScreen(campaignVO)); } else { Service.Get <EventManager>().RegisterObserver(this, EventId.MissionCompleteScreenDisplayed, EventPriority.Default); } } if (!(Service.Get <GameStateMachine>().CurrentState is HomeState)) { Service.Get <EventManager>().RegisterObserver(this, EventId.WorldInTransitionComplete, EventPriority.Default); Service.Get <EventManager>().RegisterObserver(this, EventId.HomeStateTransitionComplete, EventPriority.Default); return; } if (!lastMission.IsRaidDefense()) { Service.Get <ScreenController>().AddScreen(new MissionCompleteScreen(this.MissionVO)); return; } } else { if (chain == this.failureChain) { this.processor.OnFailureHookComplete(); return; } if (chain == this.GoalFailureChain) { this.processor.OnGoalFailureHookComplete(); } } }
private CampaignVO GetNextCampaign(CampaignVO prev) { foreach (CampaignVO current in Service.Get <IDataController>().GetAll <CampaignVO>()) { if (current.Faction == this.meta.Faction && !current.Timed && current.UnlockOrder == prev.UnlockOrder + 1) { return(current); } } return(prev); }
public void SelectCampaign(CampaignVO campaignType) { Service.UXController.HUD.SetSquadScreenVisibility(false); this.screen.currentSection = CampaignScreenSection.Campaign; this.screen.CurrentBackDelegate = new UXButtonClickedDelegate(this.BackButtonClickedHelper); this.selectedCampaign = campaignType; this.planetDetailsTop.Visible = false; this.planetDetailsBottom.Visible = false; this.campaignDetailsGroup.Visible = true; this.eventInfoGroup.Visible = false; this.InitCampaignDetailScreen(); }
public void ReturnToMainSelect() { this.screen.currentSection = CampaignScreenSection.Main; this.chapterJewel.Visible = false; this.selectedCampaign = null; this.selectedMission = null; this.selectedMissionCheckbox = null; this.eventInfoGroup.Visible = true; this.closeButton.Visible = true; this.screen.GoToMainSelectScreen(); this.screen.AnimateShowUI(); this.screen.InitDefaultBackDelegate(); }
private void OnPveButtonClicked(UXButton button) { this.screen.currentSection = CampaignScreenSection.PvE; this.screen.AnimateHideUI(); base.CampController.HasNewChapterMission = false; CampaignVO highestUnlockedCampaign = GameUtils.GetHighestUnlockedCampaign(); if (highestUnlockedCampaign != null) { this.screen.SelectCampaign(highestUnlockedCampaign); } string planetStatus = Service.Get <CurrentPlayer>().GetPlanetStatus(this.screen.viewingPlanetVO.Uid); base.EvtManager.SendEvent(EventId.UIAttackScreenSelection, new ActionMessageBIData("PvE", planetStatus)); }
public int GetTotalCampaignMissionsCompleted(CampaignVO campaignType) { if (!this.campaigns.ContainsKey(campaignType.Uid)) { return(0); } int num = 0; foreach (Mission current in this.missions.Values) { if (current.CampaignUid == campaignType.Uid && current.Completed) { num++; } } return(num); }
public int GetTotalCampaignStarsEarned(CampaignVO campaignType) { if (!this.campaigns.ContainsKey(campaignType.Uid)) { return(0); } int num = 0; foreach (Mission current in this.missions.Values) { if (current.CampaignUid == campaignType.Uid) { num += current.EarnedStars; } } return(num); }
public bool IsNewSpecOp(CampaignVO vo) { if (!this.HasCampaign(vo)) { return(true); } IDataController dataController = Service.Get <IDataController>(); foreach (Mission current in this.missions.Values) { CampaignMissionVO optional = dataController.GetOptional <CampaignMissionVO>(current.Uid); if (current.CampaignUid == vo.Uid && optional != null && optional.UnlockOrder == 1) { return(false); } } return(true); }
private void UnlockNextMission(CampaignMissionVO missionType) { CampaignVO campaignVO = this.sdc.Get <CampaignVO>(missionType.CampaignUid); CampaignVO campaignVO2 = null; CampaignMissionVO campaignMissionVO = null; CampaignMissionVO campaignMissionVO2 = null; foreach (CampaignVO current in this.sdc.GetAll <CampaignVO>()) { if (current.UnlockOrder == campaignVO.UnlockOrder + 1 && current.Faction == campaignVO.Faction) { campaignVO2 = current; break; } } foreach (CampaignMissionVO current2 in this.sdc.GetAll <CampaignMissionVO>()) { if (campaignVO2 != null && current2.CampaignUid == campaignVO2.Uid && current2.UnlockOrder == 1) { campaignMissionVO2 = current2; } if (current2.CampaignUid == missionType.CampaignUid && current2.UnlockOrder == missionType.UnlockOrder + 1) { campaignMissionVO = current2; break; } } if (campaignMissionVO != null) { Service.Logger.Debug("Unlocking next mission in current campaign!"); this.UnlockMission(campaignMissionVO); } else if (campaignMissionVO2 != null) { Service.Logger.Debug("Unlocking first mission in next campaign!"); this.UnlockMission(campaignMissionVO2); } else { Service.Logger.Debug("All missions for all campaigns are unlocked!"); } }
public int GetTotalAttackDefendCampaignStarsEarned(CampaignVO campaignType) { if (!this.campaigns.ContainsKey(campaignType.Uid)) { return(0); } int num = 0; foreach (Mission current in this.missions.Values) { if (current.CampaignUid == campaignType.Uid) { CampaignMissionVO campaignMissionVO = Service.Get <IDataController>().Get <CampaignMissionVO>(current.Uid); if (campaignMissionVO.MissionType == MissionType.Attack || campaignMissionVO.MissionType == MissionType.Defend) { num += current.EarnedStars; } } } return(num); }
public EatResponse OnEvent(EventId id, object cookie) { switch (id) { case EventId.WorldInTransitionComplete: case EventId.HomeStateTransitionComplete: if (Service.GameStateMachine.CurrentState is HomeState) { Service.EventManager.UnregisterObserver(this, EventId.WorldInTransitionComplete); Service.EventManager.UnregisterObserver(this, EventId.HomeStateTransitionComplete); if (!this.MissionVO.IsRaidDefense()) { Service.ScreenController.AddScreen(new MissionCompleteScreen(this.MissionVO)); } } return(EatResponse.NotEaten); case EventId.WorldOutTransitionComplete: case EventId.WorldReset: { IL_19: if (id == EventId.StoryChainCompleted) { ActionChain chain = cookie as ActionChain; this.CompleteChain(chain); return(EatResponse.NotEaten); } if (id != EventId.MissionCompleteScreenDisplayed) { return(EatResponse.NotEaten); } Service.EventManager.UnregisterObserver(this, EventId.MissionCompleteScreenDisplayed); CampaignVO meta = Service.StaticDataController.Get <CampaignVO>(this.MissionVO.CampaignUid); Service.ScreenController.AddScreen(new CampaignCompleteScreen(meta)); return(EatResponse.NotEaten); } } goto IL_19; }
public void OnCampaignCollectSuccess(object cookie) { CampaignVO campaignVO = (CampaignVO)cookie; this.progress.CollectCampaign(campaignVO.Uid); }
public bool HasCampaign(CampaignVO campaignType) { return(this.campaigns.ContainsKey(campaignType.Uid)); }
public static string GetCampaignTitle(CampaignVO campaignType) { return(Service.Get <Lang>().Get("cmp_title_" + campaignType.Uid, new object[0])); }
public void SelectCampaign(CampaignVO campaignType) { this.pveView.SelectCampaign(campaignType); }
public static string GetCampaignDescription(CampaignVO campaignType) { return(Service.Get <Lang>().Get("cmp_desc_" + campaignType.Uid, new object[0])); }