/// <inheritdoc/> public void Initiate() { _entity = _plexgate.New <MissionEntity>(); _os.SessionStart += () => { _plexgate.GetLayer(LayerType.Foreground).AddEntity(_entity); _entity.NotifyOfNewMissions(); }; _os.SessionEnd += () => { if (_entity.IsPlayingMission) { _entity.AbandonMission(); } _plexgate.GetLayer(LayerType.Foreground).RemoveEntity(_entity); }; List <Mission> missions = new List <Mission>(); Logger.Log("Looking for mission objects..."); foreach (var type in ReflectMan.Types.Where(x => x.BaseType == typeof(Mission))) { var mission = (Mission)_plexgate.Inject(Activator.CreateInstance(type, null)); Logger.Log($"Found: {mission.Name} ({type.FullName})"); missions.Add(mission); } _missions = missions.ToArray(); }
public void Spawn() { _animReversed = false; _buttonState = ButtonState.Released; _buttonHovered = false; _textHeadAnim = 0; _textDescAnim = 0; _buttonAnim = 0; _plexgate.GetLayer(LayerType.Foreground).AddEntity(this); }
/// <inheritdoc/> public void Initiate() { Logger.Log("Peacenet is loading its theme now!"); _theme.Theme = _plexgate.New <PeacenetTheme>(); Logger.Log("And now for the save backend."); _save.SetBackend(_plexgate.New <ServerSideSaveBackend>()); #if DEBUG _plexgate.GetLayer(LayerType.NoDraw).AddEntity(_plexgate.New <DebugEntity>()); #endif }
private void startBoot() { updHostname(); SessionStart?.Invoke(); _osEntity = _plexgate.New <OSEntity>(); _plexgate.GetLayer(LayerType.Main).AddEntity(_osEntity); }
public void Update(GameTime time) { _ui.DoInput = false; if (_bgWipeAnim >= 1f) { _flashCounter += time.ElapsedGameTime.TotalMilliseconds; if (_flashCounter >= 50) { if (_flashes < 3) { _isTextShowing = !_isTextShowing; _flashes++; _flashCounter = 0; } } if (_flashes >= 3) { _despawnTime += time.ElapsedGameTime.TotalSeconds; if (_despawnTime >= 10) { _ui.DoInput = true; _plexgate.GetLayer(LayerType.Foreground).RemoveEntity(this); } } } else { _bgWipeAnim += (float)time.ElapsedGameTime.TotalSeconds / 2; } }
public void Update(GameTime time) { _timeout -= time.ElapsedGameTime.TotalSeconds; if (_timeout < 30) { if (_warnCount == 0) { _warnCount++; _beep.Play(); } } if (_timeout < 15) { if (_warnCount == 1) { _warnCount++; _beep.Play(); } } if (_timeout <= 11) { _warnTime += time.ElapsedGameTime.TotalSeconds; if (_warnTime >= ((_timeout < 5) ? 0.5 : 1)) { _warnTime = 0; _beep.Play(); } } if (_secondCounter >= 1) { _secondCounter = 0; switch (_tickTock) { case 0: _tick.Play(); _tickTock = 1; break; case 1: _tock.Play(); _tickTock = 0; break; } } _secondCounter += time.ElapsedGameTime.TotalSeconds; if (_timeout <= 0) { _plexgate.GetLayer(LayerType.Foreground).RemoveEntity(this); TimedOut?.Invoke(); } }
/// <inheritdoc/> public void Initiate() { _responses = new ConcurrentDictionary <string, PlexServerHeader>(); var entity = _plexgate.New <serverEntity>(); _plexgate.GetLayer(LayerType.NoDraw).AddEntity(entity); _savedServers = new List <SavedServer>(); if (File.Exists(Path.Combine(_appdata.GamePath, "servers.json"))) { _savedServers = JsonConvert.DeserializeObject <List <SavedServer> >(File.ReadAllText(Path.Combine(_appdata.GamePath, "servers.json"))); } }
/// <inheritdoc/> public void Initiate() { try { Logger.Log("Starting Rich Presence integration module"); _plebgate.GetLayer(LayerType.NoDraw).AddEntity(_plebgate.New <DiscordRPCEntity>()); _presence.startTimestamp = DateTime.UtcNow.Epoch(); } catch (Exception ex) { Logger.Log("Rich Presence has been disabled due to an error.", System.ConsoleColor.DarkYellow); Logger.Log(ex.Message, System.ConsoleColor.DarkYellow); } }
public void Initiate() { _server.BroadcastReceived += _server_BroadcastReceived; _plexgate.GetLayer(LayerType.Foreground).AddEntity(_plexgate.New <AlertBgmEntity>()); }
public void Update(GameTime time) { if (_current == null) { _discord.GameState = "In Singleplayer"; _discord.GameDetails = "Roaming the Peacenet"; } switch (_state) { case 0: if (_os.IsDesktopOpen) { var desk = _os.Desktop; if (!desk.Visible) { return; } if (_plexgate.GetLayer(LayerType.UserInterface).Entities.FirstOrDefault(x => x is TutorialInstructionEntity) != null) { return; } int count = _manager.Missions.Length; if (count > 0) { if (count == 1) { desk.ShowNotification("New mission available", "A new mission has been added to your Missions list for you to play. Press [F6] to see it."); } else { desk.ShowNotification("New missions available", $"There are {count} new missions in your Missions list available for you to play. Press [F6] to see them."); } } _state = -1; } break; case 1: _discord.GameDetails = $"{_current.Name}"; _discord.GameState = "In Mission"; var obj = _objectives[_currentObjective]; var objState = obj.Update(time); if (objState == ObjectiveState.Complete) { _current.OnObjectiveComplete(_currentObjective, _objectives[_currentObjective]); if (_animState == 10) { _animState = 11; } else if (_animState < 10) { _animState = 7; _objectiveNameFade = 0; _objectiveDescFade = 0; if (_currentObjective < _objectives.Length - 1) { _lastCheckpointSnapshotId = _save.CreateSnapshot(); _currentObjective++; _current.OnObjectiveStart(_currentObjective, _objectives[_currentObjective]); } else { _animState = 12; } } } else if (objState == ObjectiveState.Failed) { _current.OnObjectiveFail(_currentObjective, _objectives[_currentObjective]); _save.RestoreSnapshot(_preMissionSnapshotId); _currentObjective = 0; _current.OnEnd(); _current = null; _objectives = null; _preMissionSnapshotId = null; _lastCheckpointSnapshotId = null; _state = 0; _objectiveNameFade = 0; _objectiveDescFade = 0; _animState = -1; } break; } switch (_animState) { case 0: if (!string.IsNullOrWhiteSpace(_current.PrerollCutscene)) { _cutscene.Play(_current.PrerollCutscene, () => { _animState = 1; }); _animState--; } else { _animState++; } break; case 1: _shroudFade += (float)time.ElapsedGameTime.TotalSeconds * 2; if (_shroudFade >= 1) { _shroudFade = 1; _animState++; } break; case 2: _missionStartFade += (float)time.ElapsedGameTime.TotalSeconds * 2; if (_missionStartFade >= 1) { _missionStartFade = 1; _animState++; } break; case 3: _missionNameFade += (float)time.ElapsedGameTime.TotalSeconds * 2; if (_missionNameFade >= 1) { _missionNameFade = 1; _animState++; _missionStartRide = 0; } break; case 4: _missionStartRide += time.ElapsedGameTime.TotalSeconds; if (_missionStartRide >= 5) { _missionStartRide = 0; _animState++; } break; case 5: _missionStartFade -= (float)time.ElapsedGameTime.TotalSeconds * 2; if (_missionStartFade <= 0) { _missionStartFade = 0; _animState++; } break; case 6: _missionNameFade -= (float)time.ElapsedGameTime.TotalSeconds * 2; if (_missionNameFade <= 0) { _missionNameFade = 0; _animState++; } break; case 7: _shroudFade -= (float)time.ElapsedGameTime.TotalSeconds * 2; if (_shroudFade <= 0) { _shroudFade = 0; _animState++; _state = 1; _current.OnObjectiveStart(_currentObjective, _objectives[_currentObjective]); } break; case 8: _objectiveNameFade += (float)time.ElapsedGameTime.TotalSeconds * 2; if (_objectiveNameFade >= 1) { _objectiveNameFade = 1; _animState++; } break; case 9: _objectiveDescFade += (float)time.ElapsedGameTime.TotalSeconds * 2; if (_objectiveDescFade >= 1) { _objectiveDescFade = 1; _animState++; _objectiveRide = 0; } break; case 11: _objectiveDescFade -= (float)time.ElapsedGameTime.TotalSeconds * 2; if (_objectiveDescFade <= 0) { _objectiveDescFade = 0; _animState++; } break; case 12: _objectiveNameFade -= (float)time.ElapsedGameTime.TotalSeconds * 2; if (_objectiveNameFade <= 0) { _objectiveNameFade = 0; if (_currentObjective < _objectives.Length - 1) { _lastCheckpointSnapshotId = _save.CreateSnapshot(); _currentObjective++; _current.OnObjectiveStart(_currentObjective, _objectives[_currentObjective]); _animState = 8; } else { _save.SetValue("mission." + _current.Name.ToLower().Replace(" ", "_") + ".completed", true); _current.OnComplete(); _current.OnEnd(); _objectives = null; _currentObjective = 0; _animState++; NotifyOfNewMissions(); } } break; case 13: if (!string.IsNullOrWhiteSpace(_current.AfterCompleteCutscene)) { _cutscene.Play(_current.AfterCompleteCutscene, () => { _animState = 15; }); _animState++; } else { _animState = 15; } break; case 15: _infobox.Show("Mission complete.", "You have completed the mission successfully. Check the Missions list for new missions to play."); _animState = -1; break; } }
/// <inheritdoc/> public void Update(GameTime time) { bool isDesktopOpen = _os.IsDesktopOpen; _tutorialLabel.MaxWidth = _ui.ScreenWidth / 2; _tutorialDescription.MaxWidth = _tutorialLabel.MaxWidth; if (isDesktopOpen) { var desk = _os.Desktop; _ui.BringToFront(_hitbox); _ui.BringToFront(_tutorialLabel); _ui.BringToFront(_tutorialDescription); _ui.BringToFront(_tutorialButton); int height = 0; if (_tutorialLabel.Visible) { height += _tutorialLabel.Height; } if (_tutorialDescription.Visible) { height += 10 + _tutorialDescription.Height; } if (_tutorialButton.Visible) { height += 5 + _tutorialButton.Height; } _tutorialLabel.Y = (_ui.ScreenHeight - height) / 2; _tutorialLabel.X = (_ui.ScreenWidth - Math.Max(_tutorialLabel.Width, _tutorialDescription.Width)) / 2; //Get the window Y. int winY = (_terminal == null) ? 0 : _terminal.Parent.Y; int winX = (_terminal == null) ? 0 : _terminal.Parent.X; bool canFitAbove = (winY - height) - 30 >= height + 30; switch (_tutorialStage) { case -1: _os.AllowTerminalHotkey = false; _ui.Add(_tutorialLabel); _ui.Add(_tutorialDescription); _ui.Add(_tutorialButton); desk.AddChild(_hitbox); _tutorialStage++; break; case 0: desk.ShowPanels = false; _tutorialLabel.Text = "Welcome to Peacegate OS!"; _tutorialDescription.Text = "You are currently in the GUI Crash Course. This guide will teach you everything you need to know about your Peacegate OS GUI and how to use it. When you're ready, click Next."; _tutorialButton.Text = "Next"; _tutorialLabel.Visible = true; _tutorialDescription.Visible = true; _tutorialButton.Visible = true; _hitbox.Visible = false; break; case 1: _terminal = new Terminal(_windowSystem); _terminal.CanClose = false; _terminal.SetWindowStyle(WindowStyle.DialogNoDrag); _terminal.Show(); _terminal.Enabled = false; _tutorialStage++; break; case 2: if (canFitAbove) { _tutorialLabel.Y = (winY - height) - 30; } else { _tutorialLabel.Y = (winY + _terminal.Parent.Height) + 30; } _tutorialLabel.X = winX; _tutorialLabel.Text = "This is a window."; _tutorialDescription.Text = "Windows are draggable frames that contain program controls. In this case, this is a Terminal window."; break; case 3: if (canFitAbove) { _tutorialLabel.Y = (winY - height) - 30; } else { _tutorialLabel.Y = (winY + _terminal.Parent.Height) + 30; } _tutorialLabel.X = winX; _terminal.SetWindowStyle(WindowStyle.Dialog); _tutorialLabel.Text = "Try dragging this window around."; _tutorialDescription.Text = "You can drag windows by clicking on their titles and dragging the mouse as you hold down the button. Release the button to let it go. Drag the window so it fits within the highlighted area."; _hitbox.Visible = true; _tutorialButton.Visible = false; _hitbox.Width = _terminal.Parent.Width + 60; _hitbox.Height = _terminal.Parent.Height + 60; _hitbox.X = 30; _hitbox.Y = (_ui.ScreenHeight - _hitbox.Height) - 30; if (winX >= _hitbox.X && winX + _terminal.Parent.Width <= _hitbox.X + _hitbox.Width && winY >= _hitbox.Y && winY + _terminal.Parent.Height <= _hitbox.Y + _hitbox.Height) { _terminal.SetWindowStyle(WindowStyle.DialogNoDrag); _hitbox.Visible = false; _tutorialStage++; } break; case 4: _terminal.CanClose = true; if (canFitAbove) { _tutorialLabel.Y = (winY - height) - 30; } else { _tutorialLabel.Y = (winY + _terminal.Parent.Height) + 30; } _tutorialLabel.X = winX; _tutorialLabel.Text = "Close the window."; _tutorialDescription.Text = "When you're done with a program, close it to free memory. Click the circular 'X' button in the corner to close it."; if (_windowSystem.WindowList.FirstOrDefault(x => x.Border == _terminal.Parent) == null) { _terminal.Dispose(); _terminal = null; _tutorialStage++; } break; case 5: _os.AllowTerminalHotkey = true; _tutorialLabel.Text = "Open another Terminal."; _tutorialDescription.Text = "At any time, you may open a new Terminal window by pressing CTRL+T on your keyboard.\n\nPlease do this to continue."; var win = _windowSystem.WindowList.FirstOrDefault(x => x.Border.Window is Terminal); if (win != null) { _os.AllowTerminalHotkey = false; _terminal = win.Border.Window as Terminal; _terminal.CanClose = false; _terminal.Enabled = false; _terminal.SetWindowStyle(WindowStyle.Dialog); _tutorialStage++; } break; case 6: desk.ShowPanels = true; desk.ShowAppLauncherButton = false; _tutorialLabel.Text = "Welcome to Peacegate Desktop."; _tutorialDescription.Text = "These two panels at the top and bottom of your screen are part of the Peacegate Desktop.\n\nThey give you useful information about your environment - such as what windows are open, what time it is, and the notifications you have available to read."; _tutorialButton.Visible = true; break; case 7: desk.ShowAppLauncherButton = true; _tutorialLabel.X = 30; _tutorialLabel.Y = 54; _tutorialLabel.Text = "Open the Peacegate Menu."; _tutorialDescription.Text = "The Peacegate Menu allows you to open new programs, view and open folders in your environment, and end your Peacegate session.\n\nGo ahead and open it."; _tutorialButton.Visible = false; if (desk.IsAppLauncherOpen) { desk.CloseALOnFocusLoss = false; desk.ShowAppLauncherButton = false; desk.AppLauncher.AllowShutdown = false; _tutorialStage++; } break; case 8: _tutorialLabel.X = desk.AppLauncher.X + desk.AppLauncher.Width + 15; _tutorialLabel.Y = desk.AppLauncher.Parent.Y + 15; _tutorialLabel.Text = "The Peacegate Menu"; _tutorialDescription.Text = "The Peacegate Menu is a very simple interface that allows you to easily get to pretty much anywhere in Peacegate OS.\n\nOn the left column are all the programs available to you. On the right column, you will find storage volumes and useful folders. At the bottom, you can find buttons for actions such as ending your Peacegate session.\n\n"; _tutorialButton.Visible = true; _hitbox.Visible = true; _hitbox.X = desk.AppLauncher.Parent.X; _hitbox.Y = desk.AppLauncher.Parent.Y; _hitbox.Width = desk.AppLauncher.Width; _hitbox.Height = desk.AppLauncher.Height; break; case 9: _tutorialLabel.X = desk.AppLauncher.X + desk.AppLauncher.Width + 15; _tutorialLabel.Y = desk.AppLauncher.Parent.Y + 15; _tutorialLabel.Text = "Click on a program or folder to open it."; _tutorialDescription.Text = "Open a program or folder to close the Peacegate menu and end the GUI crash course.\n\nWe'll open up the rest of the UI once you do so. Go ahead and explore!"; _hitbox.Visible = false; _tutorialButton.Visible = false; if (_terminal != null) { _terminal.Close(); _terminal = null; } if (!desk.IsAppLauncherOpen) { _music.FadeToNextSection(); _tutorialStage++; } else { desk.CloseALOnFocusLoss = true; } break; case 10: _tutorialLabel.Visible = false; _tutorialDescription.Visible = false; _tutorialStage++; break; case 11: _tutorialLabel.Visible = true; _tutorialDescription.Visible = true; _tutorialLabel.Text = "Tutorial complete!"; _tutorialDescription.Text = "You have successfully finished the Peacegate OS GUI Crash Course!\n\nClick 'Finish' to continue to free-roam mode. Enjoy your new environment!"; _tutorialButton.Text = "Finish"; _tutorialButton.Visible = true; break; case 12: desk.ShowAppLauncherButton = true; _os.AllowTerminalHotkey = true; desk.CloseALOnFocusLoss = true; _ui.Remove(_tutorialLabel); _ui.Remove(_tutorialDescription); desk.RemoveChild(_hitbox); _ui.Remove(_tutorialButton); _tutorialLabel.Dispose(); _tutorialDescription.Dispose(); _hitbox.Dispose(); _tutorialButton.Dispose(); _save.SetValue("boot.hasDoneCmdTutorial", true); _plexgate.GetLayer(LayerType.UserInterface).RemoveEntity(this); this._music.StopNext(); _tutorialStage++; break; } _tutorialLabel.X = MathHelper.Clamp(_tutorialLabel.X, 45, (_ui.ScreenWidth - (Math.Max(_tutorialLabel.Width, _tutorialDescription.Width))) - 45); _tutorialLabel.Y = MathHelper.Clamp(_tutorialLabel.Y, 45, (_ui.ScreenHeight - height) - 45); _tutorialDescription.X = _tutorialLabel.X; _tutorialDescription.Y = _tutorialLabel.Y + _tutorialLabel.Height + 10; _tutorialButton.X = _tutorialDescription.X + ((_tutorialDescription.Width - _tutorialButton.Width) / 2); _tutorialButton.Y = _tutorialDescription.Y + _tutorialDescription.Height + 10; } else { _tutorialLabel.Visible = false; _tutorialDescription.Visible = false; _tutorialButton.Visible = false; _hitbox.Visible = false; } }
/// <inheritdoc/> protected override void OnUpdate(GameTime time) { switch (_animState) { case 0: _welcomeAnim += (float)time.ElapsedGameTime.TotalSeconds * 2; if (_welcomeAnim >= 1.0f) { _welcomeAnim = 1; _animState++; } break; case 1: _animRide += time.ElapsedGameTime.TotalSeconds; if (_animRide >= 0.5) { _animRide = 0; _animState++; } break; case 2: _cornerAnim += (float)time.ElapsedGameTime.TotalSeconds * 2; if (_cornerAnim >= 1.0f) { _cornerAnim = 1; _animState++; } break; case 3: _animState++; _resetUI(); break; case 4: _uiAnim += (float)time.ElapsedGameTime.TotalSeconds * 2; Invalidate(true); if (_uiAnim >= 1.0f) { _uiAnim = 1; _animState++; } break; case 6: _uiAnim -= (float)time.ElapsedGameTime.TotalSeconds * 2; Invalidate(true); if (_uiAnim <= 0f) { _uiAnim = 0; _animState = 3; } break; case 7: _cornerAnim -= (float)time.ElapsedGameTime.TotalSeconds * 2; if (_cornerAnim <= 0.0f) { _animRide = 0; _cornerAnim = 0; _animState++; } break; case 8: _tutorial.Next++; _animState++; break; case 9: _animState++; break; case 10: _welcomeAnim -= (float)time.ElapsedGameTime.TotalSeconds * 2; if (_welcomeAnim <= 0.0f) { _welcomeAnim = 0; _animState++; } break; case 11: _plexgate.GetLayer(LayerType.UserInterface).AddEntity((IEntity)_plexgate.Inject(new TutorialInstructionEntity(_tutorial))); _os.PreventStartup = false; Close(); break; } Width = (int)MathHelper.Lerp(WindowSystem.Width - 50, WindowSystem.Width, _welcomeAnim); Height = (int)MathHelper.Lerp(WindowSystem.Height - 50, WindowSystem.Height, _welcomeAnim); Parent.X = (int)MathHelper.Lerp(25, 0, _welcomeAnim); Parent.Y = (int)MathHelper.Lerp(25, 0, _welcomeAnim); _setupTitle.FontStyle = Plex.Engine.Themes.TextFontStyle.Header1; _setupTitle.AutoSize = true; //first we calculate where the title should ACTUALLY BE var titleLocMax = new Vector2(15, 15); var titleLocMin = new Vector2((Width - _setupTitle.Width) / 2, (Height - _setupTitle.Height) / 2); var titleLoc = Vector2.Lerp(titleLocMin, titleLocMax, this._cornerAnim); //Next, we calculate the proper Y coordinate. int titleLocY = (int)MathHelper.Lerp(titleLoc.Y + (Width * 0.25F), titleLoc.Y, _welcomeAnim); _setupTitle.X = (int)titleLoc.X; _setupTitle.Y = titleLocY; _setupTitle.Opacity = _welcomeAnim; //Align the setup category title. _setupMode.X = _setupMode.X; int setupModeYMax = _setupTitle.Y + _setupTitle.Height + 5; _setupMode.X = _setupTitle.X; _setupMode.Y = (int)MathHelper.Lerp(setupModeYMax + (WindowSystem.Height * 0.25f), setupModeYMax, _uiAnim); _setupMode.Opacity = _uiAnim; int buttonY = (Height - _next.Height) - 15; _next.Y = (int)MathHelper.Lerp(buttonY + (WindowSystem.Height * 0.25F), buttonY, _uiAnim); _back.Y = _next.Y; _next.Opacity = _uiAnim; _back.Opacity = _uiAnim; _next.X = (Width - _next.Width) - 15; _back.X = (_next.X - _back.Width) - 5; _setupMode.FontStyle = Plex.Engine.Themes.TextFontStyle.Header2; _mainView.X = 0; _mainView.Y = _setupMode.Y + _setupMode.Height + 25; _mainView.Opacity = _uiAnim; _mainView.Height = (_next.Y - 15) - _mainView.Y; _mainView.MinWidth = Width; _mainView.MaxWidth = Width; _mainView.Width = Width; Opacity = _welcomeAnim; switch (_uiState) { case 0: _introHeader.X = 30; _introHeader.Y = 30; _introHeader.MaxWidth = (_introPanel.Width - 60); _introText.X = 30; _introText.Y = _introHeader.Y + _introHeader.Height + 10; _introText.MaxWidth = _introHeader.MaxWidth; _introPanel.Width = Width; break; case 1: _desktopWallpaperPanel.Width = Width; _wallpapers.Width = Width - 30; _desktopHeader.X = 30; _desktopHeader.Y = 30; _desktopText.X = 30; _desktopText.Y = _desktopHeader.Y + _desktopHeader.Height + 10; _desktopText.MaxWidth = Width - 60; _desktopHeader.MaxWidth = _desktopText.MaxWidth; _wallpapers.X = 30; _wallpapers.Y = _desktopText.Y + _desktopText.Height + 30; _wallpapers.MaxWidth = Width - 30; break; case 2: _accentText.X = 30; _accentHeader.X = 30; _accentHeader.Y = 30; _accentText.Y = _accentHeader.Y + _accentHeader.Height + 10; _accentHeader.MaxWidth = (Width - 60); _accentText.MaxWidth = _accentHeader.MaxWidth; _accentPanel.Width = Width; _accentColors.Width = _accentHeader.MaxWidth; _accentColors.Y = _accentText.Y + _accentText.Height + 30; _accentColors.X = 30; break; case 3: _setupComplete.Width = Width; _setupComplete.AutoSize = true; _completeHead.MaxWidth = Width - 60; _completeText.MaxWidth = _completeHead.MaxWidth; _completeHead.X = 30; _completeText.X = 30; _completeHead.Y = 30; _completeText.Y = _completeHead.Y + _completeHead.Height + 10; break; } base.OnUpdate(time); }
public void Update(GameTime time) { switch (_splashState) { case 0: _splashProgress += time.ElapsedGameTime.TotalSeconds; if (_splashProgress >= _totalSplashLengthSeconds) { _warningOpacity = 0f; _splashState++; return; } _shroudOpacity = MathHelper.Lerp(1f, 0f, (float)(_splashProgress / _totalSplashLengthSeconds)); _warningOpacity = (((int)Math.Round(_splashProgress * 2) % 2) == 0) ? 1F : 0F; if (_textOpacity >= 1F) { if (_descOpacity <= 1F) { _descOpacity += (float)time.ElapsedGameTime.TotalSeconds * 4; } else { _descOpacity = 1f; } } else { _textOpacity = MathHelper.Clamp(_textOpacity + ((float)time.ElapsedGameTime.TotalSeconds * 2), 0, 1); } break; case 1: if (_descOpacity <= 0F) { if (_textOpacity >= 0F) { _textOpacity -= (float)time.ElapsedGameTime.TotalSeconds * 4; } else { if (_willShowHint) { _splashState++; } else { _plexgate.GetLayer(LayerType.Foreground).RemoveEntity(this); } _textOpacity = 0f; } } else { _descOpacity = MathHelper.Clamp(_descOpacity - ((float)time.ElapsedGameTime.TotalSeconds * 2), 0, 1); } break; case 2: _ui.DoInput = false; if (_tutorialShroudOpacity >= 1F) { if (_tutorialTextOpacity < 1F) { _tutorialTextOpacity = MathHelper.Clamp(_tutorialTextOpacity + ((float)time.ElapsedGameTime.TotalSeconds * 2), 0f, 1f); } } else { _tutorialShroudOpacity = MathHelper.Clamp(_tutorialShroudOpacity + ((float)time.ElapsedGameTime.TotalSeconds * 2), 0f, 1f); } break; case 3: if (_tutorialTextOpacity <= 0F) { if (_tutorialShroudOpacity > 0F) { _tutorialShroudOpacity = MathHelper.Clamp(_tutorialShroudOpacity - ((float)time.ElapsedGameTime.TotalSeconds * 2), 0f, 1f); } else { _ui.DoInput = true; _save.SetValue <bool>("hints.counterhack", true); _plexgate.GetLayer(LayerType.Foreground).RemoveEntity(this); } } else { _tutorialTextOpacity = MathHelper.Clamp(_tutorialTextOpacity - ((float)time.ElapsedGameTime.TotalSeconds * 2), 0f, 1f); } break; } }
/// <inheritdoc/> public void Update(GameTime time) { switch (_osIntroState) { case 0: _init = new Applications.SystemInitTerminal(_winmgr); _init.Show(); _discord.GameState = "Peacegate OS version 1.4"; _discord.GameDetails = "Starting kernel..."; _osIntroState++; break; case 1: if (_os.PreventStartup == false && (_init.Visible == false || _init.Disposed == true)) { _osIntroState++; } break; case 2: _peacegateIconOpacity += (float)time.ElapsedGameTime.TotalSeconds * 3; if (_peacegateIconOpacity >= 1F) { _peacegateRide = 0; _osIntroState++; _discord.GameState = "Peacegate OS version 1.4"; _discord.GameDetails = "System initializing."; } break; case 3: _peacegateRide += time.ElapsedGameTime.TotalSeconds; if (_peacegateRide >= 5) { _osIntroState++; } break; case 4: _peacegateIconOpacity -= (float)time.ElapsedGameTime.TotalSeconds * 3; if (_peacegateIconOpacity <= 0) { _osIntroState++; } break; case 5: _wgDeskOpen = true; var desk = new DesktopWindow(_winmgr); desk.Show(); _desktop = desk; _osIntroState = -1; break; case 7: if (_hackedBgmInstance.Pitch > -1F) { _hackedBgmInstance.Pitch = MathHelper.Clamp(_hackedBgmInstance.Pitch - ((float)time.ElapsedGameTime.TotalSeconds * 0.25f), -1, 0); } else { while (_windowSystem.WindowList.Length > 0) { _windowSystem.Close(_windowSystem.WindowList[0].WindowID); } _crash = _plexgate.New <CrashEntity>(); _wgDeskOpen = false; _desktop = null; _plexgate.GetLayer(LayerType.Foreground).AddEntity(_crash); _hackedBgmInstance.Stop(); _hackedBgmInstance.Pitch = 0; _hackedBgmInstance.Volume = 1; _osIntroState++; } break; case 8: if (!_plexgate.GetLayer(LayerType.Foreground).HasEntity(_crash)) { _crash = null; _osIntroState = 0; } break; } if (_anim == null) { return; } if (_anim.IsShowingTutorial) { _hackedBgmInstance.Volume = MathHelper.Clamp(_hackedBgmInstance.Volume - ((float)time.ElapsedGameTime.TotalSeconds * 3), 0.1F, 1F); } else { _hackedBgmInstance.Volume = MathHelper.Clamp(_hackedBgmInstance.Volume + ((float)time.ElapsedGameTime.TotalSeconds), 0.1F, 1F); } if (_isInConnection) { if (!_plexgate.GetLayer(LayerType.Foreground).HasEntity(_anim)) { if (!_plexgate.GetLayer(LayerType.Foreground).HasEntity(_countdown)) { _plexgate.GetLayer(LayerType.Foreground).AddEntity(_countdown); } } } }