コード例 #1
0
ファイル: MenuManager.cs プロジェクト: blastboy/PMD-Toolkit
        public static void ProcessMenus(Input input, ActiveChar character, ref bool moveMade)
        {
            //process most recent menu
            Menus[0].Process(input, character, ref moveMade);

            //send all menus to display
        }
コード例 #2
0
        /// <summary>Load resources here.</summary>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            TextureManager.InitBase();

            // Bind Input (refactor)
            input = new Logic.Gameplay.Input();

            KeyDown    += input.HandleKeyDown;
            MouseWheel += input.HandleMouseWheel;
            MouseDown  += input.HandleMouseDown;
            MouseMove  += input.HandleMouseMove;
            KeyUp      += input.HandleKeyUp;
            MouseUp    += input.HandleMouseUp;

            input.AreHandleBinded = true;

            GameLoaded = GameLoadState.Loading;

            Thread thread = new Thread(() => {
                AsyncLoad();
            });

            thread.IsBackground = true;
            thread.Start();
        }
コード例 #3
0
ファイル: SpellMenu.cs プロジェクト: blastboy/PMD-Toolkit
 public override void Process(Input input, ActiveChar character, ref bool moveMade)
 {
     if (input[Input.InputType.W] && !Processor.PrevInput[Input.InputType.W]) {
         MenuManager.Menus.RemoveAt(0);
     } else {
         base.Process(input, character, ref moveMade);
     }
 }
コード例 #4
0
 public override void Process(Input input, ActiveChar character, ref bool moveMade)
 {
     if (input[Input.InputType.Enter] && !Processor.PrevInput[Input.InputType.Enter]) {
         Choose(character, ref moveMade);
     } else if (input[Input.InputType.X] && !Processor.PrevInput[Input.InputType.X]) {
         Choose(character, ref moveMade);
     } else if (input[Input.InputType.Z] && !Processor.PrevInput[Input.InputType.Z]) {
         MenuManager.Menus.RemoveAt(0);
     } else {
         bool chooseDown = (input.Direction == Direction8.Down || input.Direction == Direction8.DownLeft || input.Direction == Direction8.DownRight);
         bool prevDown = (Processor.PrevInput.Direction == Direction8.Down || Processor.PrevInput.Direction == Direction8.DownLeft || Processor.PrevInput.Direction == Direction8.DownRight);
         bool chooseUp = (input.Direction == Direction8.Up || input.Direction == Direction8.UpLeft || input.Direction == Direction8.UpRight);
         bool prevUp = (Processor.PrevInput.Direction == Direction8.Up || Processor.PrevInput.Direction == Direction8.UpLeft || Processor.PrevInput.Direction == Direction8.UpRight);
         if (chooseDown && (!prevDown || Processor.InputTime >= RenderTime.FromMillisecs(40)))
         {
             currentChoice = (currentChoice + 1) % Choices.Count;
         } else if (chooseUp && (!prevUp || Processor.InputTime >= RenderTime.FromMillisecs(40))) {
             currentChoice = (currentChoice + Choices.Count - 1) % Choices.Count;
         }
     }
 }
コード例 #5
0
ファイル: ReplayMenu.cs プロジェクト: blastboy/PMD-Toolkit
 public override void Process(Input input, ActiveChar character, ref bool moveMade)
 {
     base.Process(input, character, ref moveMade);
 }
コード例 #6
0
ファイル: Processor.cs プロジェクト: blastboy/PMD-Toolkit
        public static void SetFrameInput(Input input, RenderTime elapsedTime, int ups)
        {
            if (input == CurrentInput)
            {
                InputTime += elapsedTime;
            }
            else
            {
                InputTime = RenderTime.FromMillisecs(0);
            }
            PrevInput = CurrentInput;
            CurrentInput = input;

            Display.Screen.UpdatesPerSecond = ups;
            ProcessMeta();
        }
コード例 #7
0
ファイル: Processor.cs プロジェクト: blastboy/PMD-Toolkit
        public static void Init()
        {
            //clean map pointer
            CurrentMapGroup = null;

            //clean player
            Players = new Player[MAX_TEAM_SLOTS];
            for (int i = 0; i < MAX_TEAM_SLOTS; i++)
            {
                Players[i] = new Player();
            }
            Inventory = new int[MAX_INV_SLOTS];
            for (int i = 0; i < MAX_INV_SLOTS; i++) {
                Inventory[i] = -1;
            }

            PrevInput = new Input();
            CurrentInput = new Input();
            InputTime = RenderTime.Zero;
            replayInputs = new List<Command>();
            Rand = new Random();
            isLogging = true;
            currentCharIndex = -MAX_TEAM_SLOTS;
            CurrentMapID = "";
        }
コード例 #8
0
        /// <summary>
        /// Called when it is time to setup the next frame. Add you game logic here.
        /// </summary>
        /// <param name="e">Contains timing information for framerate independent logic.</param>
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);

            if (Editors.MainPanel.GameNeedWait)
            {
                Editors.MainPanel.GameWaiting = true;

                while (Editors.MainPanel.GameNeedWait)
                {
                    Thread.Sleep(100);
                }

                Editors.MainPanel.GameWaiting = false;
            }

            if (GameLoaded == GameLoadState.Closing)
            {
                Close();
            }
            else if (GameLoaded == GameLoadState.PostLoading)
            {
                GameLoaded = GameLoadState.Finalizing;
            }
            else if (GameLoaded == GameLoadState.Finalizing)
            {
                TextureManager.PostInit();

                Logic.Gameplay.MenuManager.Init();
                Logic.Gameplay.Processor.Init();
                Logic.Display.Screen.Init();
                Logic.Gameplay.Processor.Restart();
                Logic.Display.Screen.ProcessTaskQueue(true);

                GameLoaded = GameLoadState.Loaded;
                while (!Editors.MainPanel.EditorLoaded)
                {
                    Thread.Sleep(100);
                }
            }
            else if (GameLoaded == GameLoadState.Loaded)
            {
                try
                {
                    TextureManager.Update();

                    RenderTime elapsedTime = new RenderTime((int)(e.Time * TextureManager.FPS_CAP * 1000));

                    //set this frame's input
                    Logic.Gameplay.Input input = new Logic.Gameplay.Input();
                    Logic.Gameplay.Processor.SetFrameInput(input, elapsedTime, (int)Math.Round(UpdateFrequency));

                    Logic.Display.Screen.Process(elapsedTime);
                    errorCount--;
                }
                catch (Exception ex)
                {
                    Logs.Logger.LogError(ex);
                    errorCount += 2;
                }
            }
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: blastboy/PMD-Toolkit
        /// <summary>
        /// Called when it is time to setup the next frame. Add you game logic here.
        /// </summary>
        /// <param name="e">Contains timing information for framerate independent logic.</param>
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);

            if (Editors.MainPanel.GameNeedWait)
            {
                Editors.MainPanel.GameWaiting = true;

                while (Editors.MainPanel.GameNeedWait)
                    Thread.Sleep(100);

                Editors.MainPanel.GameWaiting = false;
            }

            if (GameLoaded == GameLoadState.Closing)
                Close();
            else if (GameLoaded == GameLoadState.PostLoading)
                GameLoaded = GameLoadState.Finalizing;
            else if (GameLoaded == GameLoadState.Finalizing)
            {
                Graphics.TextureManager.PostInit();

                Logic.Gameplay.MenuManager.Init();
                Logic.Gameplay.Processor.Init();
                Logic.Display.Screen.Init();
                Logic.Gameplay.Processor.Restart();
                Logic.Display.Screen.ProcessTaskQueue(true);

                GameLoaded = GameLoadState.Loaded;
                while (!Editors.MainPanel.EditorLoaded)
                {
                    Thread.Sleep(100);
                }
            }
            else if (GameLoaded == GameLoadState.Loaded)
            {
                try
                {
                    Graphics.TextureManager.Update();

                    RenderTime elapsedTime = new RenderTime((int)(e.Time * Graphics.TextureManager.FPS_CAP * 1000));

                    //set this frame's input
                    Logic.Gameplay.Input input = new Logic.Gameplay.Input(Keyboard, Mouse);
                    Logic.Gameplay.Processor.SetFrameInput(input, elapsedTime, (int)Math.Round(UpdateFrequency));

                    Logic.Display.Screen.Process(elapsedTime);
                    errorCount--;
                }
                catch (Exception ex)
                {
                    Logs.Logger.LogError(ex);
                    errorCount += 2;
                }
            }
        }
コード例 #10
0
ファイル: MenuBase.cs プロジェクト: blastboy/PMD-Toolkit
 public abstract void Process(Input input, ActiveChar character, ref bool moveMade);