} // end of EditWorldParametersUpdateObj Activate() public override void Deactivate() { if (active) { shared.editWorldParameters.Deactivate(false); HelpOverlay.Pop(); if (EditWorldParameters.CameraSetMode) { parent.CurrentUpdateMode = UpdateMode.EditObject; } else if (EditWorldParameters.NextLevelMode) { parent.CurrentUpdateMode = UpdateMode.SelectNextLevel; } else if (shared.editWorldParameters.IsInProgrammingTileMode()) { parent.CurrentUpdateMode = UpdateMode.EditObject; } else { parent.CurrentUpdateMode = UpdateMode.ToolMenu; } Instrumentation.StopTimer(timerInstrument); base.Deactivate(); } }
} // end of Activate() public void Deactivate() { if (Active) { if (prevLanguage != XmlOptionsData.Language) { changeLanguageMessage.Activate(useRtCoords: true); grid.Active = true; // Keep grid active. return; } grid.Active = false; HelpOverlay.Pop(); // Pop off the help overlay for the current options element. CommandStack.Pop(commandMap); HelpOverlay.Pop(); // Pop off the help for the options menu. // Prevent the button pressed from leaking into runtime. GamePadInput.IgnoreUntilReleased(Buttons.B); active = false; touched = (PlayerIndex)(-1); GamePadInput.ClearAllWasPressedState(); MainMenu.Instance.LiveFeedDirty = true; } } // end of Deactivate()
} // and of Activate() public void Deactivate() { active = false; diffuse = null; HelpOverlay.Pop(); CommandStack.Pop(commandMap); } // end of Deactivate()
} // end of Activate() /// <summary> /// /// </summary> /// <param name="saveChanges">Should the updated values be saved out to the reflex?</param> public void Deactivate(bool saveChanges) { if (active) { brightnessSlider.Selected = false; durationSlider.Selected = true; ledGrid.Selected = false; bar.Selected = false; rightStickPosition = rightStickPositionBrightness; // Copy changes to reflex? if (saveChanges) { // Push the current pattern back to the reflex. pattern.LEDs = ledGrid.LEDs; reflex.microbitPatterns[modifierIndex] = (MicroBitPattern)pattern.Clone(); // TODO Copy the duration to all the other pattern modifiers? } HelpOverlay.Pop(); active = false; } } // end of Deactivate()
} // end of HandleMouseInput() public override void Update(PerspectiveUICamera camera) { if (Active) { if (Hidden) { if (HelpOverlay.Peek() == (UseAltOverlay ? altHelpOverlay : helpOverlay)) { HelpOverlay.Pop(); } } else { if (Actions.MaterialFabric.WasPressed) { Actions.MaterialFabric.ClearAllWasPressedState(); FabricMode = true; RefreshPositions(); } if (Actions.MaterialCubic.WasPressed) { Actions.MaterialCubic.ClearAllWasPressedState(); FabricMode = false; RefreshPositions(); } HelpOverlay.ReplaceTop(UseAltOverlay ? altHelpOverlay : helpOverlay); } } base.Update(camera); }
} // end of OnCancel() public void Activate() { if (!active) { // Do stack handling here. If we do it in the update object we have no // clue which order things get pushed and popped and madness ensues. CommandStack.Push(commandMap); HelpOverlay.Push(@"ToolMenu"); active = true; grid.Active = true; grid.RenderWhenInactive = false; // Never allow the Play button to be the default. if (grid.SelectionIndex.X == 0) { // Default to object edit. grid.SelectionIndex = new Point(2, 0); } // Reset all the tiles to the origin so they spring out nicely. for (int i = 0; i < grid.ActualDimensions.X; i++) { UIGrid2DTextureElement e = (UIGrid2DTextureElement)grid.Get(i, 0); e.Position = Vector3.Zero; } grid.Dirty = true; // Force the grid to update the positions before getting rendered. grid.Update(ref worldMatrix); lastChangedTime = Time.WallClockTotalSeconds; curIndex = grid.SelectionIndex.X; InGame.inGame.StopAllSounds(); } }
} // end of EditTextureUpdateObj Update() public override void Activate() { base.Activate(); HelpOverlay.Push("TextureEdit"); parent.cursor3D.Deactivate(); } // end of EditTextureUpdateObj Activate()
/// <summary> /// /// </summary> /// <param name="userRtCoords">Are we rendering on a rendertarget?</param> public void Activate(bool useRtCoords = false) { if (!active) { this.useRtCoords = useRtCoords; // We rely on this render target to get fully running. Refuse // to activate until it's available. if (UI2D.Shared.RenderTarget512_302 != null) { // If we're still dirty, someone is trying to activate us before the system // is loaded enough to support us. So refuse to activate until we have everything // we need. active = true; RefreshTexture(); HelpOverlay.Push("ModularMessageDialog"); // Force a re-render of the texture. dirty = true; CommandStack.Push(commandMap); } } } // and of Activate()
} // end of TopLevelPaletteUpdateObj Update() private void SetHelpOverlay() { HelpOverlay.Pop(); switch (curMode) { case UpdateMode.RunSim: HelpOverlay.Push("TopLevelPaletteRunSim"); break; case UpdateMode.EditObject: HelpOverlay.Push("TopLevelPaletteEditObject"); break; case UpdateMode.ToolBox: HelpOverlay.Push("TopLevelPaletteToolBox"); break; case UpdateMode.EditWorldParameters: HelpOverlay.Push("TopLevelPaletteEditWorldParameters"); break; case UpdateMode.EditObjectParameters: HelpOverlay.Push("TopLevelPaletteEditObjectParameters"); break; } } // end of TopLevelPalette SetHelpOverlay()
public override void Activate() { parent.noCommunityMessage.Deactivate(); // Do this here so that it happens after the previous object // has had a chance to deactivate. HelpOverlay.Push("MiniHub"); }
/// <summary> /// Initialize any components required by this state. /// </summary> public override void Initialize() { ServiceManager.Game.FormManager.ClearWindow(); Options options = ServiceManager.Game.Options; RendererAssetPool.DrawShadows = GraphicOptions.ShadowMaps; mouseCursor = new MouseCursor(options.KeySettings.Pointer); mouseCursor.EnableCustomCursor(); renderer = ServiceManager.Game.Renderer; fps = new FrameCounter(); Chat = new ChatArea(); Projectiles = new ProjectileManager(); Tiles = new TexturedTileGroupManager(); Utilities = new UtilityManager(); cd = new Countdown(); Lazers = new LazerBeamManager(this); Scene.Add(Lazers, 0); Players = new PlayerManager(); currentGameMode = ServiceManager.Theater.GetCurrentGameMode(); Flags = new FlagManager(); Bases = new BaseManager(); EnvironmentEffects = new EnvironmentEffectManager(); buffbar = new BuffBar(); Scores = new ScoreBoard(currentGameMode, Players); input = new ChatInput(new Vector2(5, ServiceManager.Game.GraphicsDevice.Viewport.Height), 300);//300 is a magic number...Create a chat width variable. input.Visible = false; hud = HUD.GetHudForPlayer(Players.GetLocalPlayer()); localPlayer = Players.GetLocalPlayer(); Scene.MainEntity = localPlayer; sky = ServiceManager.Resources.GetTexture2D("textures\\misc\\background\\sky"); tips = new GameTips(new GameContext(CurrentGameMode, localPlayer)); helpOverlay = new HelpOverlay(); }
public override void Activate() { if (!active) { active = true; CommandStack.Push(commandMap); HelpOverlay.Push("RunSimulation"); // Wake everything up. parent.ActivateAllGameThings(); // This is commented out since it was removing Creatables from the level // when it shouldn't. In particular if you restart Kodu, find a level in // the LoadLevelMenu, and choose Edit, it would remove all the creatables. // Running and then editing would restore them so it's not peristing the // removal. // Normally I'd just delete the line but if this change starts causing issues // it might help to know this was here. If it's now 2019 or later you can // probably feel free to remove this. :-) //parent.RemoveCreatablesFromScene(); timerInstrument = Instrumentation.StartTimer(Instrumentation.TimerId.InGameRunSim); #if !NETFX_CORE // Refresh the list of attached microbits. { System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(MicrobitManager.RefreshWorker)); t.Start(); } #endif // Be sure all Auth UI is hidden. AuthUI.HideAllDialogs(); base.Activate(); } if (Program2.CmdLine.Exists("analytics")) { #if !NETFX_CORE Console.WriteLine("Begin Analytics"); #endif ObjectAnalysis oa = new ObjectAnalysis(); oa.beginAnalysis(MainMenu.StartupWorldFilename.ToString()); // GamePadInput.stopActiveInputTimer(); //deactivate the menu on exit to stop the timer Deactivate(); // Wave bye, bye. #if NETFX_CORE Windows.UI.Xaml.Application.Current.Exit(); #else BokuGame.bokuGame.Exit(); #endif } } // end of RunSimUpdateObj Activate()
/// <summary> /// Override this to provide a place to clean up /// anything that needs it on a per-use basis. /// </summary> public virtual void OnDeactivate() { prevBrushIndex = shared.editBrushIndex; // Deactivate any pickers. if (PickerX != null) { PickerX.Active = false; PickerX = null; } if (PickerY != null) { PickerY.Active = false; PickerY = null; } inGame.ShowCursor(); inGame.Cursor3D.Rep = Cursor3D.Visual.Edit; inGame.Cursor3D.DiffuseColor = new Vector4(0.5f, 0.9f, 0.8f, 0.3f); inGame.Terrain.EndSelection(); VirtualMap.SuppressWaterUpdate = false; shared.editBrushSizeActive = false; HelpOverlay.Pop(); // Shut down all the terrain editing sounds just to be sure. Foley.StopPaint(); Foley.StopEarthDown(); Foley.StopEarthUp(); Foley.StopEraseLand(); Foley.StopLowerWater(); Foley.StopRaiseWater(); }
public void Activate(OnEditDone doneCallback, string original, ValidateText validateTextCallback = null) { SetText(original); shared.blob.End(); // Start with cursor at end of existing string. if (state != States.Active) { shared.onEditDone = doneCallback; shared.validateTextCallback = validateTextCallback; //------------------ Copied from other implementation -------------- // Do stack handling here. If we do it in the update object we have no // clue which order things get pushed and popped and madness ensues. CommandStack.Push(commandMap); HelpOverlay.Push(@"TextLineEditor"); //------------------ Copied from other implementation END -------------- state = States.Active; //shared.blob.s updateObj.Activate(); } }
} // end of RunSimUpdateObj Activate() public override void Deactivate() { if (active) { active = false; if (parent.cursorClone != null) { parent.cursorClone.Deactivate(); parent.cursorClone = null; } // Deactivate the PreGame if any. if (parent.PreGame != null) { parent.PreGame.Active = false; } CommandStack.Pop(commandMap); HelpOverlay.Pop(); Instrumentation.StopTimer(timerInstrument); #if !NETFX_CORE MicrobitManager.ReleaseDevices(); #endif base.Deactivate(); // ObjectAnalysis oa = new ObjectAnalysis(); //oa.beginAnalysis("out.txt"); } } // end of RunSimUpdateObj Deactivate()
protected void SetOverlay(string overlay) { if (HelpOverlay.Peek() != overlay) { HelpOverlay.Pop(); HelpOverlay.Push(overlay); } }
} // end of TexturePickerUpdateObj Update() public override void Activate() { base.Activate(); HelpOverlay.Push("TexturePicker"); parent.cursor3D.Deactivate(); shared.texturePicker.Activate(); } // end of TexturePickerUpdateObj Activate()
} // end of EditHeightMapUpdateObj Update() public override void Activate() { base.Activate(); HelpOverlay.Push("HeightMapEdit"); parent.cursor3D.Deactivate(); starting = true; } // end of EditHeightMapUpdateObj Activate()
} // end of PreGameDesc c'tor public override void Update() { if (Active) { // If we're in tutorial mode, don't keep showing pregame to user. // We do, however, let it be shown right at the beginning, hence the // test of the CurStepIndex. if (TutorialManager.Active && TutorialManager.CurStepIndex > 2) { Active = false; } if (Actions.Select.WasPressed || Actions.X.WasPressed) { Actions.Select.ClearAllWasPressedState(); Actions.X.ClearAllWasPressedState(); Active = false; // Don't let current pressed state leak into game. Actions.Select.IgnoreUntilReleased(); Actions.X.IgnoreUntilReleased(); } // Exit pre-game mode. if (KeyboardInput.WasPressed(Keys.Escape)) { KeyboardInput.ClearAllWasPressedState(Keys.Escape); Active = false; } if (Actions.ToolMenu.WasPressed) { Actions.ToolMenu.ClearAllWasPressedState(); Active = false; InGame.inGame.CurrentUpdateMode = UpdateMode.ToolMenu; } if (Actions.MiniHub.WasPressed) { Actions.MiniHub.ClearAllWasPressedState(); // Leave active so when we come out of the mini-hub we know to re-start pregame. //Active = false; InGame.inGame.SwitchToMiniHub(); } // Check if user click on bottom text. if (MouseInput.Left.WasPressed && HelpOverlay.MouseHitBottomText(MouseInput.Position)) { Active = false; MouseInput.Left.ClearAllWasPressedState(); } } } // end of PreGameDesc Update()
} // end of EditWorldParametersUpdateObj Update() public override void Activate() { if (!active) { base.Activate(); HelpOverlay.Push("SelectNextLevel"); parent.cursor3D.Deactivate(); } } // end of EditWorldParametersUpdateObj Activate()
override public void Deactivate() { if (state != States.Inactive) { HelpOverlay.Pop(); pendingState = States.Inactive; BokuGame.objectListDirty = true; } }
} // end of PreGameDesc Activate() protected override void Deactivate() { // Restart the game clock. //Time.Paused = false; Time.ClockRatio = 1.0f; HelpOverlay.Pop(); base.Deactivate(); } // end of PreGameDesc Deactivate()
} // end of PreGameBase Activate() protected virtual void Deactivate() { CommandStack.Pop(commandMap); if (HelpOverlay.Peek() == "PreGame") { HelpOverlay.Pop(); } // If the pre-game has messed with the clock, restore it. Time.ClockRatio = 1.0f; } // end of PreGameBase Deactivate()
} // end of GetHelpDescription() /// <summary> /// Activates the AddItem help card. /// </summary> /// <param name="parent">Parent pie selector.</param> /// <param name="typeName">This is the string that identifies the type of the object we're getting help for. This is used to get the correct help data from the Help class.</param> /// <param name="objectName">This the displayed name of the object/actor. This comes from the Strings class and may be localized.</param> public void Activate(PieSelector parent, string typeName, string objectName) { ToolTipManager.Clear(); if (typeName == null || objectName == null) { return; } this.parent = parent; if (state != States.Active) { // Ensure we have valid help before activating. shared.actorHelp = Help.GetActorHelp(typeName); if (shared.actorHelp == null || shared.actorHelp.upid == null) { return; } // Do stack handling here. If we do it in the update object we have no // clue which order things get pushed and popped and madness ensues. CommandStack.Push(commandMap); state = States.Active; shared.curActorName = objectName; if (shared.actorHelp.description != null) { shared.descBlob.RawText = shared.actorHelp.description.Trim(); } shared.SetUpGrid(); if (shared.examplesGrid != null) { shared.examplesGrid.Active = true; } // Always start the description at the beginning. shared.topLine = 0; shared.descOffset = 0; // Get the current scene thumbnail. shared.thumbnail = InGame.inGame.SmallThumbNail; // Tell InGame we're using the thumbnail so no need to do full render. InGame.inGame.RenderWorldAsThumbnail = true; HelpOverlay.Push(@"HelpCardAddItem"); timerInstrument = Instrumentation.StartTimer(Instrumentation.TimerId.AddItemHelpCards); } } // end of Activate
} // end of TopLevelPalette SetHelpOverlay() public override void Activate() { base.Activate(); BokuGame.Audio.GetCue("programming move out").Play(); shared.topLevelPalette.Open = true; shared.topLevelPalette.Select = curMode; HelpOverlay.Push("TopLevelPalette"); SetHelpOverlay(); } // end of TopLevelPaletteUpdateObj Activate()
public void Activate(string gamepadText, string mouseText, string touchText, bool useBackgroundThumbnail, bool useOverscanForHitTesting) { this.gamepadText = gamepadText; this.mouseText = mouseText; this.touchText = touchText; if (gamepadText == null && mouseText == null && touchText == null) { Debug.Assert(false, "What are you trying to do?"); return; } if (state != States.Active) { this.useBackgroundThumbnail = useBackgroundThumbnail; this.useRtCoords = useOverscanForHitTesting; // Do stack handling here. If we do it in the update object we have no // clue which order things get pushed and popped and madness ensues. CommandStack.Push(commandMap); state = States.Active; // Get the current scene thumbnail. If we're using this from the main menu (options) // then use the title screen image instead. if (InGame.inGame.State == InGame.States.Inactive) { thumbnail = BokuGame.bokuGame.mainMenu.BackgroundTexture; } else { thumbnail = InGame.inGame.SmallThumbNail; } // Tell InGame we're using the thumbnail so no need to do full render. prevRenderWorldAsThumbnail = InGame.inGame.RenderWorldAsThumbnail; if (!prevRenderWorldAsThumbnail) { InGame.inGame.RenderWorldAsThumbnail = true; } Time.Paused = true; HelpOverlay.Push(@"ScrollableTextDisplay"); // Get text string. blob = new TextBlob(UI2D.Shared.GetGameFont20, mouseText, textWidth); blob.LineSpacingAdjustment = 6; // Taller lines to make programming tiles fit better. topLine = 0; textOffset = 0; PreRender(); // Set up text rendering for first frame. } } // end of Activate
} // end of EditWorldParametersUpdateObj Activate() public override void Deactivate() { if (active) { HelpOverlay.Pop(); parent.CurrentUpdateMode = UpdateMode.EditWorldParameters; base.Deactivate(); } }
public override void Activate() { base.Activate(); if (parent.State != States.Paused) { HelpOverlay.Push("ObjectTweak"); } parent.cursor3D.Activate(); RemoveAura(); shared.editWayPoint.Clear(); } // end of TweakObjectUpdateObj Activate()
} // end of RoadTool Update() #endregion Public #region Internal protected override void SelectOverlay() { if (StretchGoing && rightTriggered) { HelpOverlay.Pop(); HelpOverlay.Push(@"RoadToolRightTrig"); } else { base.SelectOverlay(); } }
public override void Activate() { if (!active) { base.Activate(); HelpOverlay.Push("EditWorldParameters"); parent.cursor3D.Deactivate(); shared.editWorldParameters.Activate(); timerInstrument = Instrumentation.StartTimer(Instrumentation.TimerId.InGameEditWorldParameters); } } // end of EditWorldParametersUpdateObj Activate()
public void InitializeObjects() { this.helpLastSimState = this.sim.IsRunning; this.menuBg = new RectangleShape { FillColor = new Color(0, 0, 0, 128), Position = new Vector2f(0, 0) }; this.helpText = new Text("[F1] - Help", Resources.DefaultFont, 12) { Color = Color.White, Position = new Vector2f(5, 2) }; this.fpsText = new Text("FPS: ?", Resources.DefaultFont, 12) { Color = Color.White }; this.simStateText = new Text("", Resources.DefaultFont, 12) { Color = Color.White }; this.helpOverlay = new HelpOverlay(this); this.helpOverlay.InitializeObjects(); this.simView = new SimView(this); this.simView.InitializeObjects(); this.simTex = new RenderTexture( (uint) this.simView.Width, (uint) this.simView.Height); }