public void SetLastViewed(AbstractHolonetTab tab) { string text = string.Empty; if (tab is CommandCenterHolonetTab) { text = "hn_ts_c"; } else if (tab is DevNotesHolonetTab) { text = "hn_ts_d"; } else if (tab is TransmissionsHolonetTab) { text = "hn_ts_t"; } if (string.IsNullOrEmpty(text)) { Service.Logger.ErrorFormat("Cannot find a prefname for tab {0}", new object[] { tab.GetType().ToString() }); return; } int serverTime = (int)Service.ServerAPI.ServerTime; Service.SharedPlayerPrefs.SetPref(text, serverTime.ToString()); tab.SetBadgeCount(0); this.tabCounts[tab.HolonetControllerType] = 0; }
protected override void OnScreenLoaded() { this.anims = new HolonetAnimationController(this); this.eventManager = Service.Get <EventManager>(); this.InitButtons(); this.tabs = new List <AbstractHolonetTab>(); this.incomingTransmissionsGroup = base.GetElement <UXElement>("IncomingTransmissionsGroup"); this.incomingTransmissionsGroup.Visible = false; this.NavTable = base.GetElement <UXTable>("NavTable"); this.NavTable.SetTemplateItem("NavItem"); this.commandCenterTab = new CommandCenterHolonetTab(this, HolonetControllerType.CommandCenter); this.tabs.Add(this.commandCenterTab); if (GameConstants.IsMakerVideoEnabled()) { this.videosTab = new VideosHolonetTab(this, HolonetControllerType.Videos, this.anims); this.tabs.Add(this.videosTab); } else { this.videosTab = new DeadHolonetTab(this, HolonetControllerType.Videos, "MakerTab"); } this.devNotesTab = new DevNotesHolonetTab(this, HolonetControllerType.DevNotes); this.tabs.Add(this.devNotesTab); this.transmissionsTab = new TransmissionsHolonetTab(this, HolonetControllerType.Transmissions); this.tabs.Add(this.transmissionsTab); this.commandCenterTab.SetBadgeCount(this.commandCenterCount); if (GameConstants.IsMakerVideoEnabled()) { this.videosTab.SetBadgeCount(this.videosCount); } this.devNotesTab.SetBadgeCount(this.devNotesCount); this.transmissionsTab.SetBadgeCount(this.transmissionsCount); Service.Get <EventManager>().RegisterObserver(this, EventId.GameStateChanged, EventPriority.Default); HolonetController holonetController = Service.Get <HolonetController>(); int inCommingTransmissionCount = holonetController.TransmissionsController.GetInCommingTransmissionCount(); bool flag = inCommingTransmissionCount > 0; if (!holonetController.CommandCenterController.HasNewPromoEntry() && (flag || holonetController.HasNewBattles())) { holonetController.SetLastViewed(this.transmissionsTab); this.incommingTransmissions = new TransmissionsHolonetPopupView(this); this.anims.OpenToIncomingTransmission(); } else { this.ShowDefaultTabs(); this.anims.OpenToCommandCenter(); } this.eventManager.SendEvent(EventId.HolonetOpened, null); this.allowClose = true; }
public void OpenTab(HolonetControllerType tabType) { if (this.tabs == null) { return; } if (this.currentTab != null && this.currentTab.HolonetControllerType != tabType) { this.PreviousTab = this.currentTab; } int i = 0; int count = this.tabs.Count; while (i < count) { if (this.currentTab == null || (this.tabs[i].HolonetControllerType == tabType && this.tabs[i].HolonetControllerType != this.currentTab.HolonetControllerType)) { this.currentTab = this.tabs[i]; this.currentTab.OnTabOpen(); if (this.PreviousTab != null && this.PreviousTab != this.currentTab) { this.eventManager.SendEvent(EventId.HolonetTabClosed, this.PreviousTab.GetBITabName()); } this.eventManager.SendEvent(EventId.HolonetTabOpened, this.currentTab.GetBITabName()); } i++; } if (this.PreviousTab != null && this.PreviousTab != this.currentTab) { this.PreviousTab.OnTabClose(); } if (this.currentTab == this.commandCenterTab) { this.anims.ShowCommandCenter(); return; } if (this.currentTab == this.devNotesTab) { this.anims.ShowDevNotes(); return; } if (this.currentTab == this.videosTab) { this.anims.ShowVideos(); return; } if (this.currentTab == this.transmissionsTab) { this.anims.ShowTransmissionLog(); } }