示例#1
0
文件: Program.cs 项目: DagonGD/Game3
 private static Settings CreateSettings()
 {
     Settings settings = new Settings()
     {
         ScreenWidth = 800,
         ScreenHeight = 600,
         FullScreen = false,
         IsFixedTimeStep = true,
         SynchronizeWithVerticalRetrace = true,
         MouseSpeedX = 4,
         MouseSpeedY = 4,
         DebugMode = true
     };
     settings.Save(Path.Combine(OutPath, "Settings.xml"));
     return settings;
 }
示例#2
0
文件: Program.cs 项目: DagonGD/Game3
        private static Workarea CreateWorkarea(Settings settings)
        {
            Workarea workarea = new Workarea {Settings = settings};
            Workarea.Current = workarea;

            workarea.UnitTypes.Add(new UnitType
            {
                Name = "Игрок",
                Code = "PLAYER",
                HealthMax = 100f,
                DamageMin = 20f,
                DamageMax = 30f,
                Speed = 3f,
                VisibilityRange = 10f,
                AttackRange = 10f,
                AttackDelay = 1f,
            });
            workarea.UnitTypes.Add(new UnitType
            {
                Name = "Крепостной",
                Code = "PEASANT",
                HealthMax = 100f,
                DamageMin = 1f,
                DamageMax = 30f,
                Speed = 0.1f,
                VisibilityRange = 10f,
                AttackRange = 1f,
                AttackDelay = 1f
            });
            workarea.UnitTypes.Add(new UnitType
            {
                Name = "Воин",
                Code = "WARRIOR",
                HealthMax = 300f,
                DamageMin = 10f,
                DamageMax = 20f,
                Speed = 1f,
                VisibilityRange = 10f,
                AttackRange = 1f,
                AttackDelay = 1f
            });
            workarea.UnitTypes.Add(new UnitType
            {
                Name = "Самолет",
                Code = "PLANE1",
                HealthMax = 100f,
                DamageMin = 0f,
                DamageMax = 10f,
                Speed = 1f,
                VisibilityRange = 5f,
                AttackRange = 2f,
                AttackDelay = 1f,
                World = Matrix.CreateScale(0.001f)/*Matrix.CreateRotationY((float)(-Math.PI/2))*/* Matrix.CreateTranslation(0f, 1f, 0f),
                IsFlyable = true
            });
            workarea.UnitTypes.Add(new UnitType
            {
                Name = "Призрак1",
                Code = "GHOST1",
                HealthMax = 70f,
                DamageMin = 0f,
                DamageMax = 15f,
                Speed = 1f,
                VisibilityRange = 5f,
                AttackRange = 2f,
                AttackDelay = 3f,
                //World = Matrix.CreateScale(0.001f)/*Matrix.CreateRotationY((float)(-Math.PI/2))*/* Matrix.CreateTranslation(0f, 1f, 0f),
                IsFlyable = true
            });
            workarea.UnitTypes.Add(new UnitType
            {
                Name = "Призрак2",
                Code = "GHOST2",
                HealthMax = 100f,
                DamageMin = 0f,
                DamageMax = 30f,
                Speed = 2f,
                VisibilityRange = 7f,
                AttackRange = 3f,
                AttackDelay = 3f,
                //World = Matrix.CreateScale(0.001f)/*Matrix.CreateRotationY((float)(-Math.PI/2))*/* Matrix.CreateTranslation(0f, 1f, 0f),
                IsFlyable = true
            });
            workarea.UnitTypes.Add(new UnitType
            {
                Name = "Дом",
                Code = "HOUSE1",
                HealthMax = 300f,
                IsBreakable = false,
                BoundingBox = new BoundingBox(new Vector3(0f, 0f, -3f), new Vector3(7f, 4.35f, 0f))
            });
            workarea.UnitTypes.Add(new UnitType
            {
                Name = "Могила",
                Code = "GRAVE1",
                HealthMax = 300f,
                BoundingBox = new BoundingBox(new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.9f, 1f, 0.3f))
            });
            workarea.Save(Path.Combine(OutPath, "Workarea.xml"));
            return workarea;
        }
示例#3
0
        public void Load(Type sType, Vector2 screenCenter, Settings settings)
        {
            int buttony = 64;
            int buttonspace = 8;
            int buttonheight = 48;
            this.Input = false;

            this.SType = sType;
            switch (sType) {
                case Screen.Type.MainMenu:
                    this.Size = new Vector2(512, 512);
                    this.Origin = screenCenter - (this.Size / 2);
                    this.Buttons = new List<Button>();
                    this.Sliders = new List<Slider>();
                    this.Labels = new List<Label>();
                    this.MethodForInput = String.Empty;
                    this.Input = false;
                    this.Background = Textures.MenuBackground1;
                    this.Buttons.Add(new Button("NEW GAME...", "NewGameClicked", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("LOAD GAME...", "LoadGameClicked", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("OPTIONS", "OptionsClicked", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("BUILDER", "BuilderClicked", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("QUIT", "Exit", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));

                    break;
                case Screen.Type.Options:
                    this.Size = new Vector2(512, 512);
                    this.Origin = screenCenter - (this.Size / 2);
                    this.Buttons = new List<Button>();
                    this.Sliders = new List<Slider>();
                    this.Labels = new List<Label>();
                    this.MethodForInput = String.Empty;
                    this.Input = false;
                    this.Background = Textures.MenuBackground1;
                    this.Buttons.Add(new Button("AUDIO", "AudioOptionsClicked", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("VIDEO", "VideoOptionsClicked", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("GAME", "GameOptionsClicked", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("BACK", "GoToMainMenu", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));

                    break;
                case Screen.Type.OptionsAudio:
                    this.Size = new Vector2(512, 512);
                    this.Origin = screenCenter - (this.Size / 2);
                    this.Buttons = new List<Button>();
                    this.Sliders = new List<Slider>();
                    this.Labels = new List<Label>();
                    this.MethodForInput = String.Empty;
                    this.Input = false;
                    this.Background = Textures.MenuBackground1;
                    this.Buttons.Add(new Button("MUSIC: " + (settings.MusicOn?"ON":"OFF"), "ToggleMusic", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Sliders.Add(new Slider("MUSIC VOLUME: " + settings.MusicVolume.ToString(), "SetMusicVolume", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin, settings.MusicVolume));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("SOUND EFFECTS: " + (settings.SoundEffectsOn ? "ON" : "OFF"), "ToggleSoundEffects", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Sliders.Add(new Slider("SOUND EFFECTS VOLUME " + settings.SoundEffectsVolume.ToString(), "SetSFXVolume", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin, settings.SoundEffectsVolume));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("VOICES: " + (settings.VoicesOn ? "ON" : "OFF"), "ToggleVoice", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Sliders.Add(new Slider("VOICE VOLUME: " + settings.VoicesVolume.ToString(), "SetVoiceVolume", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin, settings.VoicesVolume));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("BACK", "OptionsClicked", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));

                    break;
                case Screen.Type.OptionsVideo:
                    this.Size = new Vector2(512, 512);
                    this.Origin = screenCenter - (this.Size / 2);
                    this.Buttons = new List<Button>();
                    this.Sliders = new List<Slider>();
                    this.Labels = new List<Label>();
                    this.MethodForInput = String.Empty;
                    this.Input = false;
                    this.Background = Textures.MenuBackground1;
                    this.Buttons.Add(new Button("FULLSCREEN: " + (settings.Fullscreen ? "ON" : "OFF"), "ToggleFullscreen", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("RESOLUTION: " + settings.Resolution.X.ToString() + "x" + settings.Resolution.Y.ToString(), "CycleResolution", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("APPLY", "SetResolution", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("BACK", "OptionsClicked", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));

                    break;
                case Screen.Type.OptionsGame:
                    this.Size = new Vector2(512, 512);
                    this.Origin = screenCenter - (this.Size / 2);
                    this.Buttons = new List<Button>();
                    this.Sliders = new List<Slider>();
                    this.Labels = new List<Label>();
                    this.MethodForInput = String.Empty;
                    this.Input = false;
                    this.Background = Textures.MenuBackground1;
                    this.Buttons.Add(new Button("RUN TIME ON GAME LOAD: " + (settings.UpdateOnLoad ? "ON" : "OFF"), "ToggleUpdateOnLoad", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));
                    buttony += buttonheight + buttonspace;
                    this.Buttons.Add(new Button("BACK", "OptionsClicked", 48, buttony, 432, 48, Fonts.Fant16, Color.White, 13, Textures.Button1, Color.White, this.Origin));

                    break;
                case Screen.Type.NewGame:
                    this.Size = new Vector2(512, 512);
                    this.Origin = screenCenter - (this.Size / 2);
                    this.Buttons = new List<Button>();
                    this.Sliders = new List<Slider>();
                    this.Labels = new List<Label>();
                    this.MethodForInput = "CreateGame";
                    this.Input = true;
                    this.Background = Textures.MenuBackground1;
                    this.Labels.Add(new Label("Please enter a name for your world.", 48, buttony, 432, 48, Fonts.Fant16, Color.White, Color.White, this.Origin));

                    break;
            }
        }
示例#4
0
 public Screen(Type sType, Microsoft.Xna.Framework.Content.ContentManager content, Vector2 screenCenter, Settings settings)
 {
     this.Textures = new TexturePalette(content);
     this.Fonts = new FontPalette(content);
     Load(sType, screenCenter, settings);
 }