Ejemplo n.º 1
0
        }   // and of Activate()

        public void Deactivate()
        {
            active  = false;
            diffuse = null;
            HelpOverlay.Pop();
            CommandStack.Pop(commandMap);
        }   // end of Deactivate()
Ejemplo n.º 2
0
            }   // 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()
Ejemplo n.º 3
0
        }   // end of MainMenu Activate()

        override public void Deactivate()
        {
            if (state != States.Inactive)
            {
                // 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.
                shared.menu.Active = false;
                CommandStack.Pop(commandMap);

                shared.menu.DeleteText(Strings.Localize("mainMenu.resume"));
                shared.menu.Active = false;

                // Just to be sure.
                shared.optionsMenu.Deactivate();

                pendingState             = States.Inactive;
                BokuGame.objectListDirty = true;

                GamePadInput.IgnoreUntilReleased(Buttons.A);

                Instrumentation.StopTimer(timerInstrument);

                Foley.StopMenuLoop();
            }
        }   // end of MainMenu Deactivate()
    public void Undo(CharacterObservable caller, CharacterObservable personaeToInteracWith, GameManager gm)
    {
        PreviousAction = (ICharacterActionCommand)CommandStack.Pop();

        if (PreviousAction is AttackCommand && LastCharacterAttacked != null)
        {
            var attackStrenght = caller.Stats.GetAttackStrenght(caller, LastCharacterAttacked);
            LastCharacterAttacked.Health.RaiseHealth(caller);
            ((AttackCommand)PreviousAction).IsExecuted = false;
            return;
        }
        if (PreviousAction is DefendCommand)
        {
            caller.Stats.DefenseBonusActivated = false;
            caller.Stats.ResetTemporaryBonus();
            ((DefendCommand)PreviousAction).IsExecuted = false;
            return;
        }
        if (PreviousAction is MoveCommand)
        {
            //caller.CurrentCoordinates = caller.OldCoordinates;
            //((MoveCommand)PreviousAction).Execute(caller.CurrentCoordinates);
            //((MoveCommand)PreviousAction).IsExecuted = false;
        }
        PreviousAction.Execute(caller);
    }
Ejemplo n.º 5
0
            }   // end of ToolBoxUpdateObj c'tor

            /// <summary>
            /// ToolBoxUpdateObj Update()
            /// </summary>
            /// <param name="camera"></param>
            public override void Update()
            {
                base.Update();

                // No need to check for input focus or anything.  If
                // we're active then the ToolBox object has focus.

                shared.ToolBox.Update();

                // If the ToolBox is no longer active we're done.
                if (!shared.ToolBox.Active)
                {
                    return;
                }

                // Do the common bits of the Update().
                // The actual input focus is in the currently active tool so
                // temporarily push ourselves onto the command stack so we
                // can still steal camera control input.
                // TODO (****) Move this up above the tool update to remove a frame of lag?  Will this cause other problems?
                CommandStack.Push(commandMap);

                // No need to lock the zoom any more since we're using the trigger buttons for grid selection.
                bool lockZoom = false;

                UpdateCamera(lockZoom);
                UpdateWorld();
                UpdateEditBrush();
                CommandStack.Pop(commandMap);
            }   // end of ToolBoxUpdateObj Update()
Ejemplo n.º 6
0
        }   // 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()
Ejemplo n.º 7
0
            public override void Deactivate()
            {
                CommandStack.Pop(commandMap);

                KeyboardInput.OnChar = null;
                KeyboardInput.OnKey  = null;
#if !NETFX_CORE
                BokuGame.bokuGame.winKeyboard.CharacterEntered = null;
#endif
            }
Ejemplo n.º 8
0
            }   // 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()
Ejemplo n.º 9
0
            }   // end of BaseEditUpdateObj Activate()

            public override void Deactivate()
            {
                if (active)
                {
                    CommandStack.Pop(commandMap);

                    active = false;

                    base.Deactivate();
                }
            } // end of BaseEditUpdateObj Deactivate()
Ejemplo n.º 10
0
        }   // end of Activate

        public void Deactivate()
        {
            if (state != States.Inactive)
            {
                // 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.Pop(commandMap);

                state = States.Inactive;
            }
        }
Ejemplo n.º 11
0
        }   // end of Deactivate()

        /// <summary>
        /// Called once per frame by the
        /// </summary>
        public void Update()
        {
            if (Active)
            {
                /// Don't let anyone else grab focus, if anyone has, grab it back.
                if (CommandStack.Peek() != commandMap)
                {
                    CommandStack.Pop(commandMap);
                    CommandStack.Push(commandMap);
                }
                // Check if we have input focus.
                if (CommandStack.Peek() == commandMap)
                {
                    GamePadInput pad = GamePadInput.GetGamePad0();

                    if (handlerA != null && (pad.ButtonA.WasPressed || KeyboardInput.WasPressed(Keys.A)))
                    {
                        GamePadInput.ClearAllWasPressedState();
                        GamePadInput.IgnoreUntilReleased(Buttons.A);
                        handlerA(this);
                    }

                    if (handlerB != null && (pad.ButtonB.WasPressed || KeyboardInput.WasPressed(Keys.B)))
                    {
                        GamePadInput.ClearAllWasPressedState();
                        GamePadInput.IgnoreUntilReleased(Buttons.B);
                        handlerB(this);
                    }

                    if (handlerX != null && (pad.ButtonX.WasPressed || KeyboardInput.WasPressed(Keys.X)))
                    {
                        GamePadInput.ClearAllWasPressedState();
                        GamePadInput.IgnoreUntilReleased(Buttons.X);
                        handlerX(this);
                    }

                    if (handlerY != null && (pad.ButtonY.WasPressed || KeyboardInput.WasPressed(Keys.Y)))
                    {
                        GamePadInput.ClearAllWasPressedState();
                        GamePadInput.IgnoreUntilReleased(Buttons.Y);
                        handlerY(this);
                    }
                }   // end if we have input focus.

                if (dirty)
                {
                    // Calc max width for text string.
                    maxWidth = (int)(width - 2.0f * margin);

                    RefreshTexture();
                }
            }
        }   // end of Update()
Ejemplo n.º 12
0
    public void UndoWrapper()
    {
        if (!commandStack.isAtStart)
        {
            undoRedoSnapInfo = null;

            commandStack.Pop();
            groupSelect.reset();

            ApplyUndoRedoSnapInfo();
            undoRedoSnapInfo = null;
        }
    }
        }   // end of Activate()

        public void Deactivate()
        {
            if (active)
            {
                active = false;

                HelpOverlay.Pop();
                CommandStack.Pop(commandMap);
                if (onExit != null)
                {
                    onExit(this);
                }
            }
        }   // end of Deactivate()
Ejemplo n.º 14
0
            }   // end of ToolMenuUpdateObj c'tor

            /// <summary>
            /// ToolMenuUpdateObj Update()
            /// </summary>
            /// <param name="camera"></param>
            public override void Update()
            {
                base.Update();

                // No need to check for input focus or anything.  If
                // we're active then the ToolMenu object has focus.

                shared.ToolMenu.Update();

                // If the ToolMenu is no longer active we're done.
                if (!shared.ToolMenu.Active)
                {
                    return;
                }

                // Do the common bits of the Update().  If our child is active we
                // can temporarily push/pop our commandMap to grab input focus.
                if (shared.ToolMenu.Active)
                {
                    CommandStack.Push(commandMap);
                }
                UpdateCamera(false);
                if (shared.ToolMenu.Active)
                {
                    CommandStack.Pop(commandMap);
                }
                UpdateWorld();
                // TODO (****) Should this only be called for tools that use the edit brush?
                // TODO (****) How do we turn off the edit brush rendering if we don't need it?
                UpdateEditBrush();

                GamePadInput pad = GamePadInput.GetGamePad0();

                // Run!
                if (pad.Back.WasPressed)
                {
                    // TODO (****) Transition to RunSim.
                    // Or is this already done in the base class???
                }

                // MiniHub!
                if (pad.Start.WasPressed)
                {
                    // TODO (****) Transition to MinHub.
                    // Or is this already done in the base class???
                }

                ToolTipManager.Update();
                ThoughtBalloonManager.Update(shared.camera);
            }   // end of ToolMenuUpdateObj Update()
Ejemplo n.º 15
0
        public static void UnregisterOperation(ProgressOperation op)
        {
            if (instance != null)
            {
                if (instance.operations.Contains(op))
                {
                    instance.operations.Remove(op);
                }

                if (instance.operations.Count == 0)
                {
                    CommandStack.Pop(instance.commandMap);
                }
            }
        }
Ejemplo n.º 16
0
        public override void Deactivate()
        {
            // 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.Pop(commandMap);

            if (state != States.Inactive)
            {
                shared.Deactivate();

                pendingState             = States.Inactive;
                BokuGame.objectListDirty = true;

                DeactivateMessages();
            }
        }
Ejemplo n.º 17
0
        public void Deactivate()
        {
            if (active)
            {
                grid.Active = false;

                // 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.Pop(commandMap);
                HelpOverlay.Pop();

                InGame.inGame.RenderWorldAsThumbnail = false;

                active = false;
            }
        }
Ejemplo n.º 18
0
 public void Deactivate()
 {
     if (active)
     {
         if (GamePadInput.ActiveMode == GamePadInput.InputMode.Touch)
         {
             if (TouchInput.TouchCount == 1 && TouchInput.GetOldestTouch().TouchedObject == null)
             {
                 TouchInput.GetOldestTouch().TouchedObject = this;
             }
         }
         active = false;
         CommandStack.Pop(commandMap);
         Boku.Common.HelpOverlay.Pop();
     }
 }
Ejemplo n.º 19
0
        public void Deactivate()
        {
            if (active)
            {
                if (activeTool != null)
                {
                    activeTool.Active = false;
                }

                // 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.Pop(commandMap);
                HelpOverlay.Pop();
                active = false;
            }
        }
Ejemplo n.º 20
0
        override public void Deactivate()
        {
            if (state != States.Inactive)
            {
                // 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.Pop(commandMap);

                UIGrid grid = shared.GetGridFromCurTab();
                if (grid != null)
                {
                    grid.Active = false;
                }

                pendingState             = States.Inactive;
                BokuGame.objectListDirty = true;
            }
        }
Ejemplo n.º 21
0
        override public void Deactivate()
        {
            if (state != States.Inactive)
            {
                // Make sure VirutalKeyboard is also shut down.
                VirtualKeyboard.Deactivate();

                // 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.Pop(commandMap);

                state = States.Inactive;

                HelpOverlay.Pop();

                updateObj.Deactivate();
            }
        }
Ejemplo n.º 22
0
        public override bool Refresh(List <UpdateObject> updateList, List <RenderObject> renderList)
        {
            bool result = false;

            if (state != pendingState)
            {
                if (pendingState == States.Active)
                {
                    updateList.Add(updateObj);
                    updateObj.Activate();
                    renderList.Add(renderObj);
                    renderObj.Activate();

                    // 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.
                    // If we do this in the Activate/Deactivate calls then we get garbaged
                    // handling if we're polling.  What can happen is that we pop ourselves
                    // because of a 'B' button that we polled but then we no longer have input
                    // focus and the next object in the update list may also look for and
                    // find the B button being pressed.
                    CommandStack.Push(commandMap);
                }
                else
                {
                    renderObj.Deactivate();
                    renderList.Remove(renderObj);
                    updateObj.Deactivate();
                    updateList.Remove(updateObj);

                    // 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.
                    // If we do this in the Activate/Deactivate calls then we get garbaged
                    // handling if we're polling.  What can happen is that we pop ourselves
                    // because of a 'B' button that we polled but then we no longer have input
                    // focus and the next object in the update list may also look for and
                    // find the B button being pressed.
                    CommandStack.Pop(commandMap);
                }

                state = pendingState;
            }

            return(result);
        }
Ejemplo n.º 23
0
        }   // end of HelpScreens Activate()

        override public void Deactivate()
        {
            if (state != States.Inactive)
            {
                // 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.Pop(commandMap);

                pendingState             = States.Inactive;
                BokuGame.objectListDirty = true;

                GamePadInput.ClearAllWasPressedState();

                Foley.StopMenuLoop();

                // Exiting, restart the main menu.
                BokuGame.bokuGame.mainMenu.Activate();
            }
        }   // end of HelpScreens Deactivate()
Ejemplo n.º 24
0
        public void Deactivate()
        {
            if (active)
            {
                grid0.Active = false;
                grid1.Active = false;
                grid2.Active = false;
                grid3.Active = false;

                grid0.RenderWhenInactive = false;
                grid1.RenderWhenInactive = false;
                grid2.RenderWhenInactive = false;
                grid3.RenderWhenInactive = false;

                // 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.Pop(commandMap);
                active = false;
            }
        }
Ejemplo n.º 25
0
        }                    // end of Activate

        public void Deactivate()
        {
            if (state != States.Inactive)
            {
                // 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.Pop(commandMap);

                state = States.Inactive;

                HelpOverlay.Pop();

                // Turn off thumbnail rendering if needed.
                if (!prevRenderWorldAsThumbnail)
                {
                    InGame.inGame.RenderWorldAsThumbnail = false;
                }
                Time.Paused = false;
            }
        }
Ejemplo n.º 26
0
        public void Deactivate()
        {
            if (active)
            {
                if (activeTool != null)
                {
                    activeTool.Active = false;
                }

                // 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.Pop(commandMap);
                active = false;
            }

            // Ensure that all of the pickers have been deactivated.
            brushPicker.Hidden    = true;
            materialPicker.Hidden = true;
            waterPicker.Hidden    = true;
        }
Ejemplo n.º 27
0
        }   // end of Activate

        override public void Deactivate()
        {
            if (state != States.Inactive)
            {
                // 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.Pop(commandMap);

                state = States.Inactive;
                if (shared.examplesGrid != null)
                {
                    shared.examplesGrid.Active = false;
                }

                InGame.inGame.RenderWorldAsThumbnail = false;

                HelpOverlay.Pop();

                Instrumentation.StopTimer(timerInstrument);
            }
        }
Ejemplo n.º 28
0
        }   // end of VideoOutput Activate()

        override public void Deactivate()
        {
            if (state != States.Inactive)
            {
                // Release file list.
                shared.filenames    = null;
                shared.curFileIndex = 0;

                // Release the memeory buffer.
                shared.data = null;
                BokuGame.Release(ref shared.texture);
                shared.colors = null;

                // 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.Pop(commandMap);

                pendingState             = States.Inactive;
                BokuGame.objectListDirty = true;
            }
        }   // end of VideoOutput Deactivate()
    //TODO: Update method's signature
    public void Undo(CharacterObservable caller, CharacterObservable active)
    {
        if (!Equals(caller, active))
        {
            throw new Exception("Cannot Undo on non-active character");
        }

        PreviousAction = (ICharacterActionCommand)CommandStack.Pop();
        if (PreviousAction is AttackCommand && LastCharacterAttacked != null)
        {
            var attackStrenght = caller.Stats.GetAttackStrenght(caller, LastCharacterAttacked);
            LastCharacterAttacked.Health.RaiseHealth(caller);
            LastCharacterAttacked.healthWasRaised = true;
            LastCharacterAttacked.Notify();
            LastCharacterAttacked.healthWasRaised      = false;
            ((AttackCommand)PreviousAction).IsExecuted = false;
            return;
        }
        if (PreviousAction is DefendCommand)
        {
            caller.Stats.DefenseBonusActivated = false;
            caller.Stats.ResetTemporaryBonus();
            ((DefendCommand)PreviousAction).IsExecuted = false;
            return;
        }
        //Implementation to come
        if (PreviousAction is MoveCommand)
        {
            //caller.CurrentCoordinates = caller.OldCoordinates;
            //((MoveCommand)PreviousAction).Execute(caller.CurrentCoordinates);
            //((MoveCommand)PreviousAction).IsExecuted = false;
        }

        if (PreviousAction is RotateCommand)
        {
        }
    }
Ejemplo n.º 30
0
        override public void Deactivate()
        {
            if (state != States.Inactive && pendingState != States.Inactive)
            {
                // 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.Pop(commandMap);
                HelpOverlay.Pop();
                shared.menu.Active = false;

                pendingState             = States.Inactive;
                BokuGame.objectListDirty = true;

                InGame.inGame.RenderWorldAsThumbnail = false;

                Instrumentation.StopTimer(timerInstrument);

                Foley.StopMenuLoop();

                Time.Paused = false;

                AuthUI.HideAllDialogs();
            }
        }