예제 #1
0
 public LoseState(DwarfGame game, GameStateManager stateManager, PlayState play)
     : base(game, "EconomyState", stateManager)
 {
     Input = new InputManager();
     PlayState = play;
     EnableScreensaver = false;
 }
예제 #2
0
파일: Economy.cs 프로젝트: scorvi/dwarfcorp
        public Economy(Faction faction, float currentMoney, PlayState state, string companyName, string companyMotto, NamedImageFrame companyLogo, Color companyColor)
        {
            PlayState = state;
            Company = Company.GenerateRandom(currentMoney, 1.0f, Company.Sector.Exploration);
            Company.Name = companyName;
            Company.SecondaryColor = Color.White;
            Company.Logo = companyLogo;
            Company.Motto = companyMotto;
            Company.Assets = currentMoney;
            Company.BaseColor = companyColor;

            CurrentMoney = currentMoney;
            Faction = faction;
            Market  = new List<Company>
            {
                Company,
                Company.GenerateRandom(1000, 1.0f, Company.Sector.Exploration),
                Company.GenerateRandom(1200, 5.0f, Company.Sector.Exploration),
                Company.GenerateRandom(1500, 10.0f, Company.Sector.Exploration),
                Company.GenerateRandom(1300, 10.0f, Company.Sector.Manufacturing),
                Company.GenerateRandom(1200, 10.0f, Company.Sector.Manufacturing),
                Company.GenerateRandom(1500, 15.0f, Company.Sector.Military),
                Company.GenerateRandom(1300, 10.0f, Company.Sector.Military),
                Company.GenerateRandom(1200, 15.0f, Company.Sector.Military),
                Company.GenerateRandom(1500, 25.0f, Company.Sector.Magic),
                Company.GenerateRandom(1200, 30.0f, Company.Sector.Magic),
                Company.GenerateRandom(1300, 40.0f, Company.Sector.Magic),
                Company.GenerateRandom(1500, 50.0f, Company.Sector.Finance),
                Company.GenerateRandom(1800, 60.0f, Company.Sector.Finance)
            };

            PlayState.Time.NewDay += Time_NewDay;
        }
예제 #3
0
 public EconomyState(DwarfGame game, GameStateManager stateManager, PlayState play)
     : base(game, "EconomyState", stateManager)
 {
     EdgePadding = 32;
     Input = new InputManager();
     PlayState = play;
     EnableScreensaver = false;
     InputManager.KeyReleasedCallback += InputManager_KeyReleasedCallback;
 }
예제 #4
0
 public DiplomacyState(DwarfGame game, GameStateManager stateManager, PlayState play, Faction faction)
     : base(game, "DiplomacyState", stateManager)
 {
     EdgePadding = 32;
     Input = new InputManager();
     PlayState = play;
     EnableScreensaver = false;
     InputManager.KeyReleasedCallback += InputManager_KeyReleasedCallback;
     Faction = faction;
 }
예제 #5
0
파일: Minimap.cs 프로젝트: scorvi/dwarfcorp
        public Minimap(DwarfGUI gui, GUIComponent parent, int width, int height, PlayState playState, Texture2D colormap, Texture2D frame)
            : base(gui, parent, new ImageFrame())
        {
            Frame = frame;
            SuppressClick = false;
            ColorMap = colormap;

            RenderWidth = width;
            RenderHeight = height;
            RenderTarget = new RenderTarget2D(GameState.Game.GraphicsDevice, RenderWidth, RenderHeight, false, SurfaceFormat.Color, DepthFormat.Depth24);
            Image.Image = RenderTarget;
            Image.SourceRect = new Rectangle(0, 0, RenderWidth, RenderHeight);
            PlayState = playState;

            ConstrainSize = true;

            Camera = new OrbitCamera(0, 0, 0.01f, new Vector3(0, 0, 0), new Vector3(0, 0, 0),  2.5f, 1.0f, 0.1f, 1000.0f)
            {
                Projection = global::DwarfCorp.Camera.ProjectionMode.Orthographic
            };

            ZoomInButton = new Button(GUI, this, "", GUI.SmallFont, Button.ButtonMode.ImageButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.ZoomIn))
            {
                LocalBounds = new Rectangle(1, 1, 32, 32),
                ToolTip =  "Zoom in"
            };

            ZoomInButton.OnClicked += zoomInButton_OnClicked;

            ZoomOutButton = new Button(GUI, this, "", GUI.SmallFont, Button.ButtonMode.ImageButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.ZoomOut))
            {
                LocalBounds = new Rectangle(33, 1, 32, 32),
                ToolTip =  "Zoom out"
            };

            ZoomOutButton.OnClicked += zoomOutButton_OnClicked;

            ZoomHomeButton = new Button(GUI, this, "", GUI.SmallFont, Button.ButtonMode.ImageButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.ZoomHome))
            {
                LocalBounds = new Rectangle(65, 1, 32, 32),
                ToolTip =  "Home camera"
            };

            ZoomHomeButton.OnClicked +=ZoomHomeButton_OnClicked;

            MinimizeButton = new Button(GUI, this, "", GUI.SmallFont, Button.ButtonMode.ImageButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.SmallArrowDown))
            {
                LocalBounds = new Rectangle(width - 32, 0, 32, 32),
                ToolTip = "Show/Hide Map"
            };

            MinimizeButton.OnClicked += MinimizeButton_OnClicked;

            OnClicked += Minimap_OnClicked;
        }
예제 #6
0
        public void DrawRefractionMap(DwarfTime gameTime, PlayState game, float waterHeight, Matrix viewMatrix, Effect effect, GraphicsDevice device)
        {
            Plane refractionPlane = CreatePlane(waterHeight, new Vector3(0, -1, 0), viewMatrix, false);

            effect.Parameters["ClipPlane0"].SetValue(new Vector4(refractionPlane.Normal, refractionPlane.D));
            effect.Parameters["Clipping"].SetValue(1);
            effect.Parameters["GhostMode"].SetValue(0);
            device.SetRenderTarget(refractionRenderTarget);
            device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1.0f, 0);

            if(DrawTerrainRefracted)
            {
                game.Draw3DThings(gameTime, effect, viewMatrix);
            }
            else
            {
                game.DrawSky(gameTime, viewMatrix, 0.25f);
            }

            Drawer3D.Render(device, effect, false);

            if(DrawComponentsRefracted)
            {
                game.DrawComponents(gameTime, effect, viewMatrix, ComponentManager.WaterRenderType.Refractive, waterHeight);
            }
            else
            {
                game.DrawSky(gameTime, viewMatrix, 0.25f);
            }

            device.SetRenderTarget(null);
            effect.Parameters["Clipping"].SetValue(0);
            RefractionMap = refractionRenderTarget;
        }
예제 #7
0
        public void Initialize(PlayState state, string name, string motto, NamedImageFrame logo, Color color)
        {
            Races = new Dictionary<string, Race>();
            /*
            Races["Dwarf"] = new Race()
            {
                Name = "Dwarf",
                CreatureTypes = new List<string> {"Dwarf", "AxeDwarf"},
                IsIntelligent = true,
                IsNative = false,
                FactionNameFile = ContentPaths.Text.Templates.nations_dwarf,
                NameFile = ContentPaths.Text.Templates.names_dwarf,
                FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_dwarf)
            };

            Races["Goblins"] = new Race()
            {
                Name = "Goblins",
                CreatureTypes = new List<string> { "Goblin"},
                IsIntelligent = true,
                IsNative = true,
                FactionNameFile = ContentPaths.Text.Templates.nations_dwarf,
                NameFile = ContentPaths.Text.Templates.names_goblin,
                FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_goblin)
            };

            Races["Molemen"] = new Race()
            {
                Name = "Molemen",
                CreatureTypes = new List<string> { "Moleman" },
                IsIntelligent = true,
                IsNative = true,
                FactionNameFile = ContentPaths.Text.Templates.nations_dwarf,
                NameFile = ContentPaths.Text.Templates.names_dwarf,
                FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_goblin)
            };

            Races["Elf"] = new Race()
            {
                Name = "Elf",
                CreatureTypes = new List<string> { "Elf" },
                IsIntelligent = true,
                IsNative = true,
                FactionNameFile = ContentPaths.Text.Templates.nations_elf,
                NameFile = ContentPaths.Text.Templates.names_elf,
                FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_elf)
            };

            Races["Undead"] = new Race()
            {
                Name = "Undead",
                CreatureTypes = new List<string> { "Necromancer", "Skeleton" },
                IsIntelligent = true,
                IsNative = true,
                FactionNameFile = ContentPaths.Text.Templates.nations_undead,
                NameFile = ContentPaths.Text.Templates.names_undead,
                FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_undead)
            };

            Races["Herbivore"] = new Race()
            {
                Name = "Herbivore",
                CreatureTypes = new List<string> { "Bird", "Deer" },
                IsIntelligent = false,
                IsNative = true,
                FactionNameFile = ContentPaths.Text.Templates.nations_dwarf,
                NameFile = ContentPaths.Text.Templates.names_dwarf,
            };
             */
            Races = ContentPaths.LoadFromJson<Dictionary<string, Race>>(ContentPaths.World.races);

            Factions = new Dictionary<string, Faction>();
            Factions["Player"] = new Faction
            {
                Name = "Player",
                Race = Races["Dwarf"]
            };
            Factions["Player"].Economy = new Economy(Factions["Player"], 300.0f, state, name, motto, logo, color);

            Factions["Goblins"] = new Faction
            {
                Name = "Goblins",
                Race = Races["Goblins"]
            };

            Factions["Elf"] = new Faction
            {
                Name = "Elf",
                Race = Races["Elf"]
            };

            Factions["Undead"] = new Faction
            {
                Name = "Undead",
                Race = Races["Undead"]
            };

            Factions["Herbivore"] = new Faction
            {
                Name = "Herbivore",
                Race = Races["Herbivore"]
            };

            Factions["Molemen"] = new Faction
            {
                Name = "Molemen",
                Race = Races["Molemen"]
            };
        }
예제 #8
0
        public void Initialize(PlayState state, string name, string motto, NamedImageFrame logo, Color color)
        {
            if (Races == null)
            {
                InitializeRaces();
            }

            if (Factions == null)
            {
                Factions = new Dictionary<string, Faction>();
                Factions["Player"] = new Faction
                {
                    Name = "Player",
                    Race = Races["Dwarf"]
                };
            }

            Factions["Goblins"] = new Faction
            {
                Name = "Goblins",
                Race = Races["Goblins"],
                IsRaceFaction = true
            };

            Factions["Elf"] = new Faction
            {
                Name = "Elf",
                Race = Races["Elf"],
                IsRaceFaction = true
            };

            Factions["Undead"] = new Faction
            {
                Name = "Undead",
                Race = Races["Undead"],
                IsRaceFaction = true
            };

            Factions["Herbivore"] = new Faction
            {
                Name = "Herbivore",
                Race = Races["Herbivore"],
                IsRaceFaction = true
            };

            Factions["Molemen"] = new Faction
            {
                Name = "Molemen",
                Race = Races["Molemen"],
                IsRaceFaction = true
            };

            Factions["Player"].Economy = new Economy(Factions["Player"], 300.0f, state, name, motto, logo, color);
        }
예제 #9
0
        protected override void LoadContent()
        {
            PlayState playState = new PlayState(this, StateManager);
            BiomeLibrary.InitializeStatics();
            StateManager.States["IntroState"] = new IntroState(this, StateManager);
            StateManager.States["PlayState"] = playState;
            StateManager.States["MainMenuState"] = new MainMenuState(this, StateManager);
            StateManager.States["WorldSetupState"] = new WorldSetupState(this, StateManager);
            StateManager.States["WorldGeneratorState"] = new WorldGeneratorState(this, StateManager);
            StateManager.States["OptionsState"] = new OptionsState(this, StateManager);
            StateManager.States["EconomyState"] = new EconomyState(this, StateManager, playState);
            StateManager.States["CompanyMakerState"] = new CompanyMakerState(this, StateManager);
            StateManager.States["WorldLoaderState"] = new WorldLoaderState(this, StateManager);
            StateManager.States["GameLoaderState"] = new GameLoaderState(this, StateManager);
            StateManager.States["LoseState"] = new LoseState(this, StateManager, playState);

            if(GameSettings.Default.DisplayIntro)
            {
                StateManager.PushState("IntroState");
            }
            else
            {
                StateManager.PushState("MainMenuState");
            }

            StateManager.States["IntroState"].OnEnter();
            StateManager.States["MainMenuState"].OnEnter();
            StateManager.States["OptionsState"].OnEnter();
            StateManager.States["CompanyMakerState"].OnEnter();

            //TestBehaviors.RunTests();

            base.LoadContent();
        }
예제 #10
0
파일: Economy.cs 프로젝트: scorvi/dwarfcorp
 private void OnDeserialized(StreamingContext context)
 {
     PlayState = GameState.Game.StateManager.GetState<PlayState>("PlayState");
 }