Ejemplo n.º 1
0
        public override void OnEnter()
        {
            TutorialManager          = new Tutorial.TutorialManager();
            IsInitialized            = true;
            DwarfTime.LastTime.Speed = 1.0f;

            IndicatorManager.SetupStandards();

            DwarfGame.GumInputMapper.GetInputQueue();
            GuiRoot = new Gui.Root(DwarfGame.GuiSkin);

            Tip = GuiRoot.RootItem.AddChild(new Gui.Widget
            {
                Font                = "font10",
                TextColor           = new Vector4(1, 1, 1, 1),
                MinimumSize         = new Point(0, 64),
                TextHorizontalAlign = Gui.HorizontalAlign.Center,
                TextVerticalAlign   = Gui.VerticalAlign.Center,
                Text                = "Press any key to jump!",
                AutoLayout          = Gui.AutoLayout.DockBottom,
                Background          = new Gui.TileReference("basic", 0),
                BackgroundColor     = new Vector4(0, 0, 0, 0.5f),
                InteriorMargin      = new Gui.Margin(0, 0, 15, 15)
            });

            LoadTicker = GuiRoot.RootItem.AddChild(new Gui.Widgets.InfoTicker
            {
                Font       = "font8",
                AutoLayout = Gui.AutoLayout.DockFill,
                TextColor  = new Vector4(1, 1, 1, 1)
            }) as Gui.Widgets.InfoTicker;

            GuiRoot.RootItem.Layout();

            if (Settings.GenerateFromScratch)
            {
                Generator = new WorldGenerator(Settings)
                {
                    Seed = MathFunctions.Random.Next()
                };
                Generator.Generate();
            }
            else
            {
                CreateWorld();
            }

            base.OnEnter();
        }
Ejemplo n.º 2
0
        public override void OnEnter()
        {
            IsInitialized = true;

            IndicatorManager.SetupStandards();

            // TODO: Had to copy static state over from DwarfGame here. Shouldn't be necessary.
            // instead these functions should be instantiated inside LoadState.
            World = new WorldManager(Game)
            {
                WorldOrigin   = Settings.WorldOrigin,
                WorldScale    = Settings.WorldScale,
                WorldSize     = Settings.ColonySize,
                InitialEmbark = Settings.InitalEmbarkment,
                ExistingFile  = Settings.ExistingFile,
                SeaLevel      = Settings.SeaLevel,
                Natives       = Settings.Natives
            };
            World.WorldScale            = Settings.WorldScale;
            World.WorldGenerationOrigin = Settings.WorldGenerationOrigin;

            World.OnLoadedEvent += World_OnLoadedEvent;

            // Todo - Save gui creation for play state. We're only creating it here so we can give it to
            //      the world class. The world doesn't need it until after loading.
            GUI = new DwarfGUI(Game, Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default),
                               Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Title),
                               Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Small), Input);

            GUI.ToolTipManager.InfoLocation = new Point(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height);
            GUI.MouseMode = GUISkin.MousePointer.Pointer;

            World.Setup(GUI);

            DwarfGame.GumInputMapper.GetInputQueue();
            GuiRoot = new Gum.Root(new Point(640, 480), DwarfGame.GumSkin);

            Tip = GuiRoot.RootItem.AddChild(new Gum.Widget
            {
                Font                = "outline-font",
                TextColor           = new Vector4(1, 1, 1, 1),
                MinimumSize         = new Point(0, 128),
                TextHorizontalAlign = Gum.HorizontalAlign.Center,
                TextVerticalAlign   = Gum.VerticalAlign.Center,
                Text                = "Press any key to jump!",
                AutoLayout          = Gum.AutoLayout.DockBottom
            });

            LoadTicker = GuiRoot.RootItem.AddChild(new NewGui.InfoTicker
            {
                Font       = "outline-font",
                AutoLayout = Gum.AutoLayout.DockFill,
                TextColor  = new Vector4(1, 1, 1, 1)
            }) as NewGui.InfoTicker;

            World.OnSetLoadingMessage = (s) => LoadTicker.AddMessage(s);

            GuiRoot.RootItem.Layout();

            base.OnEnter();
        }