Ejemplo n.º 1
0
        public override void OnEnter()
        {
            // Clear the input queue... cause other states aren't using it and it's been filling up.
            DwarfGame.GumInputMapper.GetInputQueue();

            GuiRoot = new Gum.Root(new Point(640, 480), DwarfGame.GumSkin);
            GuiRoot.MousePointer = new Gum.MousePointer("mouse", 4, 0);

            var dialoguePanel = GuiRoot.RootItem.AddChild(new Gum.Widget
            {
                Font           = "outline-font",
                TextColor      = new Vector4(1, 1, 1, 1),
                MinimumSize    = new Point(256, 0),
                MaximumSize    = new Point(256, Int32.MaxValue),
                AutoLayout     = Gum.AutoLayout.DockRight,
                Border         = "border-fancy",
                InteriorMargin = new Gum.Margin(128, 0, 0, 0)
            });

            GuiRoot.RootItem.Layout();

            SpeakerAnimation = new Animation(DialogueContext.Envoy.OwnerFaction.Race.TalkAnimation);
            DialogueContext.SpeakerAnimation = SpeakerAnimation;


            DialogueContext.Panel = dialoguePanel;
            DialogueContext.Transition(DialogueTree.ConversationRoot);



            IsInitialized = true;
            base.OnEnter();
        }
Ejemplo n.º 2
0
        public override void OnEnter()
        {
            // Clear the input queue... cause other states aren't using it and it's been filling up.
            DwarfGame.GumInputMapper.GetInputQueue();
            GuiRoot = new Gum.Root(new Point(640, 480), DwarfGame.GumSkin);
            GuiRoot.MousePointer = new Gum.MousePointer("mouse", 4, 0);
            MakeMenu();
            IsInitialized = true;

            base.OnEnter();
        }
Ejemplo n.º 3
0
        public override void OnEnter()
        {
            // Clear the input queue... cause other states aren't using it and it's been filling up.
            DwarfGame.GumInput.GetInputQueue();

            GuiRoot = new Gum.Root(new Point(640, 480), DwarfGame.GumSkin);
            GuiRoot.MousePointer = new Gum.MousePointer("mouse", 4, 0);

            // CONSTRUCT GUI HERE...

            // Must be true or Render will not be called.
            IsInitialized = true;

            base.OnEnter();
        }
Ejemplo n.º 4
0
        public void FireActions(Gum.Root Gui, Action <Gum.InputEvents, Gum.InputEventArgs> MouseHandler)
        {
            var queue = Mapper.GetInputQueue();

            foreach (var @event in queue)
            {
                if (Gui != null)
                {
                    Gui.HandleInput(@event.Message, @event.Args);
                }

                if ([email protected])
                {
                    if (@event.Message == Gum.InputEvents.MouseClick ||
                        @event.Message == Gum.InputEvents.MouseMove ||
                        @event.Message == Gum.InputEvents.MouseDown ||
                        @event.Message == Gum.InputEvents.MouseUp)
                    {
                        if (MouseHandler != null)
                        {
                            MouseHandler(@event.Message, @event.Args);
                        }
                    }
                    else if (@event.Message == Gum.InputEvents.KeyUp)
                    {
                        foreach (var binding in InputActions.Where(ia => ia.Value.Keys.Contains((Keys)@event.Args.KeyValue) && ia.Value.Type == KeyBindingType.Pressed))
                        {
                            if (binding.Value.Handler != null)
                            {
                                binding.Value.Handler();
                            }
                        }
                    }
                }
            }

            // Check 'Held' actions
            var kbState = Keyboard.GetState();

            foreach (var binding in InputActions.Where(ia => ia.Value.Type == KeyBindingType.Held))
            {
                if (binding.Value.Keys.Count(k => kbState.IsKeyDown(k)) > 0 && binding.Value.Handler != null)
                {
                    binding.Value.Handler();
                }
            }
        }
Ejemplo n.º 5
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();
        }