コード例 #1
0
ファイル: EditorConsole.cs プロジェクト: tarsupin/Nexus
        public static void LoadLevelEditor()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.possibleTabs = "Example: `load-level QCALQOD16`";
            ConsoleTrack.helpText     = "The level ID of the level to load.";

            if (ConsoleTrack.activate)
            {
                SceneTransition.ToLevelEditor("", currentIns);
            }
        }
コード例 #2
0
        public static void ToEditor()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.possibleTabs = "Example: `editor 10`";
            ConsoleTrack.helpText     = "Load the level editor for one of your levels.";

            if (ConsoleTrack.activate)
            {
                // Prepare the current level as the default option.
                string levelId = currentIns == "" ? Systems.handler.levelContent.levelId : currentIns;

                // Transition to an Editor Scene
                SceneTransition.ToLevelEditor("", levelId);
            }
        }
コード例 #3
0
        public void CheckPlanetHover()
        {
            // Reset Mouse Highlight Positions
            this.mouseHighX = 0;
            this.mouseHighY = 0;

            short posX = 100 - 200;
            short posY = 150;

            int mouseX = Cursor.MouseX;
            int mouseY = Cursor.MouseY;

            // Draw Planets
            for (short i = this.paging.MinVal; i < this.paging.MaxVal; i++)
            {
                // Update Next Position
                posX += 200;
                if (posX >= 1380)
                {
                    posY += 200; posX = 100;
                }

                if (mouseX < posX - 60 || mouseX > posX + 95 || mouseY < posY - 60 || mouseY > posY + 135)
                {
                    continue;
                }

                this.mouseHighX = posX;
                this.mouseHighY = posY;

                // Activate Level
                if (Cursor.LeftMouseState == Cursor.MouseDownState.Clicked)
                {
                    SceneTransition.ToLevelEditor("", "__" + i.ToString(), i);
                    return;
                }
            }
        }
コード例 #4
0
        public override void RunTick()
        {
            // Update Timer
            Systems.timer.RunTick();

            // Loop through every player and update inputs for this frame tick:
            foreach (var player in Systems.localServer.players)
            {
                //player.Value.input.UpdateKeyStates(Systems.timer.Frame);
                player.Value.input.UpdateKeyStates(0);                 // TODO: Update LocalServer so frames are interpreted and assigned here.
            }

            // Paging Input (only when in the paging area)
            InputClient input = Systems.input;

            // Update UI
            UIComponent.ComponentWithFocus = null;
            Cursor.UpdateMouseState();
            UIHandler.cornerMenu.RunTick();

            // Playing State
            if (UIHandler.uiState == UIState.Playing)
            {
                PagingPress pageInput = this.paging.PagingInput(playerInput);

                if (pageInput != PagingPress.None)
                {
                    Systems.sounds.click2.Play(0.5f, 0, 0.5f);

                    if (pageInput == PagingPress.PageChange)
                    {
                        // Apply New Level Data
                        for (short i = this.paging.MinVal; i < this.paging.MaxVal; i++)
                        {
                            this.ApplyLevelDataByNumber(i);
                        }
                    }
                }

                // Check if the mouse is hovering over a planet (and draw accordingly if so)
                this.CheckPlanetHover();

                // Activate Level
                if (playerInput.isPressed(IKey.AButton) == true)
                {
                    short curVal = this.paging.CurrentSelectionVal;
                    SceneTransition.ToLevelEditor("", "__" + curVal.ToString(), curVal);
                    return;
                }

                // Open Menu
                if (input.LocalKeyPressed(Keys.Escape) || playerInput.isPressed(IKey.Start) || playerInput.isPressed(IKey.Select))
                {
                    UIHandler.SetMenu(UIHandler.mainMenu, true);
                }
            }

            // Menu State
            else
            {
                UIHandler.menu.RunTick();
            }
        }