コード例 #1
0
        private static void ReturnToEditorAction()
        {
            System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Reload map to state before playtesting?", "Reload map?", System.Windows.Forms.MessageBoxButtons.YesNo);
            if (dialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                MapBuilder.ReloadMap();
            }
            else if (dialogResult == System.Windows.Forms.DialogResult.No)
            {
            }

            MapBuilder.bPlayTest = false;
            ResolutionUtility.AdjustResolution(Form1.editorRes.X, Form1.editorRes.Y, Game1.graphics);
            GameProcessor.bIsInGame = false;
        }
コード例 #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //  Console.WriteLine(SteamFriends.GetPersonaName());


            base.Initialize();
            initiateActions();

            ResolutionUtility.bMouseIsVisible = this.IsMouseVisible;
            hitboxHelp       = Content.Load <Texture2D>(@"Graphics\HitBoxHelp");
            selectionTexture = Content.Load <Texture2D>(@"Graphics\MainMenu\TestRectangle");
            mapBorderHelp    = Content.Load <Texture2D>(@"Graphics\Tiles\Basic\BorderTest");
            WhiteTex         = Content.Load <Texture2D>(@"White");
            scenes.Insert((int)(Screens.MainMenu), new MainMenu());
            scenes.Insert((int)(Screens.MainGameStart), new NewGameScene());
            scenes.Insert((int)(Screens.MainGameContinue), new ContinueGameScene());
            scenes.Insert((int)(Screens.OWGame), new OWGame());
            scenes.Insert((int)(Screens.BGame), new MainGame());
            scenes.Insert((int)(Screens.Options), new Options());
            scenes.Insert((int)(Screens.ExitGame), new Scene());
            scenes.Insert((int)(Screens.Editor), new Editor());


            CursorUtility.Initialize(this);
            MainGUI.Initialize(this);


            if (!bRunEditMode)
            {
                scenes[SceneUtility.currentScene].Initialize(this);
            }



            graphics.PreferMultiSampling       = true;
            graphics.PreferredBackBufferWidth  = this.GraphicsDevice.DisplayMode.Width;
            graphics.PreferredBackBufferHeight = this.GraphicsDevice.DisplayMode.Height;
            //   this.Window.Position = new Point(100, 100);
            //graphics.IsFullScreen = true;
            this.IsMouseVisible = false;
            graphics.ApplyChanges();
            LoadAssets();
            this.Window.AllowUserResizing = false;
            //Window.IsBorderless = true;
            Window.AllowAltF4 = true;
            //Window.Location = Point.Zero;
            //900,506
            ResolutionUtility.WindowSizeBeforeFullScreen = new Vector2(1366, 768);
            ResolutionUtility.AdjustResolution(1366, 768, graphics);
            gameRender  = new RenderTarget2D(GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            gameRender  = new RenderTarget2D(GraphicsDevice, 1366, 768);
            UIRender    = new RenderTarget2D(GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            monitorSize = new Vector2(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
            Console.WriteLine("Primary Monitor Size: " + monitorSize);

            EditorFileWriter.LoadSaveSettings();
            startScreen = new StartScreen();
#if !DEBUG
            // GameProcessor.Launch();
#endif
            // GameProcessor.Launch();
        }
コード例 #3
0
        internal void Load()
        {
            GameProcessor.bShadowsEnabled         = bShadowGeneration;
            GameProcessor.bWaterReflectionEnabled = bReflectionGeneration;
            GameProcessor.shadowQualityPercentage = (float)((float)shadowPercentage / 100f);

            if (resolution.X < 100 && resolution.Y < 100)
            {
                resolution = new Vector2(1366, 768);
            }
            ResolutionUtility.AdjustResolution(resolution.X, resolution.Y, Game1.graphics);
            if (bFullScreen)
            {
                ResolutionUtility.toggleFullscreen();
            }

            speedMod       = battleSpeed;
            speedModCamera = battleCameraSpeed;

            if (Math.Abs(MasterVolume) > 100)
            {
                MasterVolume = Math.Abs(MasterVolume) % 100;
            }
            SceneUtility.masterVolume = MasterVolume;

            if (Math.Abs(SoundEffectVolume) > 100)
            {
                SoundEffectVolume = Math.Abs(SoundEffectVolume) % 100;
            }
            SceneUtility.soundEffectsVolume = SoundEffectVolume;

            if (Math.Abs(MusicVolume) > 100)
            {
                MusicVolume = Math.Abs(MusicVolume) % 100;
            }
            SceneUtility.musicVolume = MusicVolume;

            List <ActionKey> lak = new List <ActionKey>();

            if (controls.Count != 0)
            {
                foreach (var item in Game1.actionKeyList)
                {
                    if (controls.Find(ak => ak.actionIndentifierString.Equals(item.actionIndentifierString) && ak.column == item.column) != null)
                    {
                        lak.Add(controls.Find(ak => ak.actionIndentifierString.Equals(item.actionIndentifierString) && ak.column == item.column));
                    }
                    else
                    {
                        lak.Add(item);
                    }
                }
                Game1.actionKeyList = lak;
            }
            else
            {
                controls = Game1.actionKeyList;
            }

            foreach (var act in Game1.actionList)
            {
                for (int i = 0; i < act.whatKeysIsActionAssignedTo.Length; i++)
                {
                    var k = Game1.actionKeyList.Find(ak => ak.actionIndentifierString.Equals(act.actionIndentifierString) && ak.column == i);
                    act.whatKeysIsActionAssignedTo[i] = k;
                }
            }
        }
コード例 #4
0
        private void videoOptionHandle()
        {
            bDrawOptionsScreen = true;
            if ((buttonPressUtility.isPressed(Game1.confirmString) || (Game1.bIsActive && Mouse.GetState().LeftButton == ButtonState.Pressed && !KeyboardMouseUtility.bMousePressed && Game1.graphics.GraphicsDevice.Viewport.Bounds.Contains(CursorUtility.trueCursorPos))))
            {
                switch ((int)cursorPosition.X)
                {
                case 8:
                    ResolutionUtility.toggleFullscreen();
                    bSubMenu         = false;
                    cursorPosition.X = 0;
                    cursorPosition.Y = 0;
                    break;
                }
            }
            if (SceneUtility.prevScene != 5)
            {
                bDrawOptionsScreen = true;
                if ((buttonPressUtility.isPressed(Game1.confirmString) || (Game1.bIsActive && Mouse.GetState().LeftButton == ButtonState.Pressed && !KeyboardMouseUtility.bMousePressed)))
                {
                    switch ((int)cursorPosition.X)
                    {
                    case 1:
                        ResolutionUtility.AdjustResolution(1024, 768, Game1.graphics);
                        break;

                    case 2:
                        ResolutionUtility.AdjustResolution(1280, 800, Game1.graphics);
                        break;

                    case 3:
                        ResolutionUtility.AdjustResolution(1280, 1024, Game1.graphics);
                        break;

                    case 4:
                        ResolutionUtility.AdjustResolution(1366, 768, Game1.graphics);
                        break;

                    case 5:
                        ResolutionUtility.AdjustResolution(1440, 900, Game1.graphics);
                        break;

                    case 6:
                        ResolutionUtility.AdjustResolution(1600, 900, Game1.graphics);
                        break;

                    case 7:
                        ResolutionUtility.AdjustResolution(1920, 1080, Game1.graphics);
                        break;

                    case 8:
                        ResolutionUtility.toggleFullscreen();
                        bSubMenu         = false;
                        cursorPosition.X = 0;
                        cursorPosition.Y = 0;
                        break;
                    }
                }
                if (buttonPressUtility.isPressed(Game1.moveLeftString))
                {
                    bEditingSubMenu = false;
                }
            }
        }