public FlashOverlay(double duration) : base(nameof(FlashOverlay))
 {
     _timer          = IoCManager.Resolve <IGameTiming>();
     _displayManager = IoCManager.Resolve <IClyde>();
     StartTime       = _timer.CurTime;
     Duration        = duration;
 }
Example #2
0
        public DebugNetBandwidthPanel(IClientNetManager netMan, IGameTiming gameTiming)
        {
            _netManager = netMan;
            _gameTiming = gameTiming;

            _contents = new Label();

            SizeFlagsHorizontal = SizeFlags.None;

            _contents = new Label
            {
                FontColorShadowOverride = Color.Black,
            };
            AddChild(_contents);

            PanelOverride = new StyleBoxFlat
            {
                BackgroundColor           = new Color(255, 105, 67, 138),
                ContentMarginLeftOverride = 5,
                ContentMarginTopOverride  = 5
            };

            MouseFilter = _contents.MouseFilter = MouseFilterMode.Ignore;
            Visible     = false;
        }
Example #3
0
        public FrameGraph(IGameTiming gameTiming)
        {
            _gameTiming = gameTiming;

            SizeFlagsHorizontal = SizeFlags.None;
            MouseFilter         = MouseFilterMode.Ignore;
        }
Example #4
0
        public DebugTimePanel(IResourceCache resourceCache, IGameTiming gameTiming)
        {
            _resourceCache = resourceCache;
            _gameTiming    = gameTiming;

            PerformLayout();
        }
 public IntegrationGameLoop(IGameTiming gameTiming, ChannelWriter <object> channelWriter,
                            ChannelReader <object> channelReader)
 {
     _gameTiming    = gameTiming;
     _channelWriter = channelWriter;
     _channelReader = channelReader;
 }
Example #6
0
        public void Update(TouchStateBase touchState, MouseStateBase mouseState, IGameTiming gameTime)
        {
            if (this.touchAction != null &&
                touchState.Touches.Any(t => this.Rectangle.Intercept(t.Position)))
            {
                this.touchAction.Invoke(gameTime);
            }

            if (this.hoverAction != null &&
                this.Rectangle.Intercept(mouseState.Position))
            {
                this.hoverAction.Invoke(gameTime);
            }

            if (this.clickAction != null)
            {
                if (this.mappingGestures.Any(g => (g & touchState.CurrentGesture.GestureType) == g)
                    && this.Rectangle.Intercept(touchState.CurrentGesture.Position))
                {
                    this.clickAction.Invoke(gameTime);
                }

                if (this.mappingMouseButtons.Any(mouseState.IsButtonDown)
                    && this.Rectangle.Intercept(mouseState.Position))
                {
                    this.clickAction.Invoke(gameTime);
                }
            }
        }
Example #7
0
        public DebugNetPanel(IClientNetManager netMan, IGameTiming gameTiming, IResourceCache resCache)
        {
            NetManager    = netMan;
            GameTiming    = gameTiming;
            resourceCache = resCache;

            PerformLayout();
        }
Example #8
0
        public FpsCounter(IGameTiming gameTiming)
        {
            _gameTiming = gameTiming;

            FontColorShadowOverride = Color.Black;
            ShadowOffsetXOverride   = 1;
            ShadowOffsetYOverride   = 1;
        }
 public void Update(IGameTiming gameTiming)
 {
     if (this.Sprite != null)
     {
         var updatable = this.Sprite as IUpdatable;
         if (updatable != null) updatable.Update(gameTiming);
     }
 }
Example #10
0
 public GunSpreadOverlay(IEntityManager entManager, IEyeManager eyeManager, IGameTiming timing, IInputManager input, IPlayerManager player, GunSystem system)
 {
     _entManager = entManager;
     _eye        = eyeManager;
     _input      = input;
     _timing     = timing;
     _player     = player;
     _guns       = system;
 }
 public CargoShuttleMenu(IGameTiming timing, IPrototypeManager protoManager, SpriteSystem spriteSystem)
 {
     RobustXamlLoader.Load(this);
     _timing       = timing;
     _protoManager = protoManager;
     _spriteSystem = spriteSystem;
     ShuttleCallButton.OnPressed   += OnCallPressed;
     ShuttleRecallButton.OnPressed += OnRecallPressed;
     Title = Loc.GetString("cargo-shuttle-console-menu-title");
 }
Example #12
0
        public FpsCounter(IGameTiming gameTiming)
        {
            _gameTiming = gameTiming;

            FontColorShadowOverride = Color.Black;
            ShadowOffsetXOverride   = 1;
            ShadowOffsetYOverride   = 1;

            MouseFilter = MouseFilterMode.Ignore;
        }
Example #13
0
        public override void Update(IGameTiming gameTime)
        {
            Func<Samples, Color> colorFunc = sample =>
                this.hoveringSample == sample ? Color.Blue : this.currentSample == sample ? Color.Red : Color.White;

            this.sandboxRectangle.Color = colorFunc(Samples.Sandbox);
            this.shootEmUpRectangle.Color = colorFunc(Samples.ShootEmUp);
            this.tiledRectangle.Color = colorFunc(Samples.Tiled);
            this.touchRectangle.Color = colorFunc(Samples.Touch);
        }
Example #14
0
        public override void Update(IGameTiming gameTime)
        {
            var colorLayer = this.Scene.Children.OfType<ColorLayer>().FirstOrDefault();
            if (colorLayer != null)
                colorLayer.Color = Color.CornflowerBlue.ChangeAlpha((int)(255 * Math.Min(this.range, 1.0f)));

            var updatable = this.linkMouseFollow as IUpdatable;
            if (updatable != null) updatable.Update(gameTime);

            this.sleep01.Color = new Color(255, 255, 255, (int)((gameTime.TotalSeconds % 10) / 10.0f * 255.0f));
        }
            public SolarControlWindow(IGameTiming igt)
            {
                Title = "Solar Control Window";

                var rows = new GridContainer();
                rows.Columns = 2;

                // little secret: the reason I put the values
                // in the first column is because otherwise the UI
                // layouter autoresizes the window to be too small
                rows.AddChild(new Label {Text = "Output Power:"});
                rows.AddChild(new Label {Text = ""});

                rows.AddChild(OutputPower = new Label {Text = "?"});
                rows.AddChild(new Label {Text = "W"});

                rows.AddChild(new Label {Text = "Sun Angle:"});
                rows.AddChild(new Label {Text = ""});

                rows.AddChild(SunAngle = new Label {Text = "?"});
                rows.AddChild(new Label {Text = "°"});

                rows.AddChild(new Label {Text = "Panel Angle:"});
                rows.AddChild(new Label {Text = ""});

                rows.AddChild(PanelRotation = new LineEdit());
                rows.AddChild(new Label {Text = "°"});

                rows.AddChild(new Label {Text = "Panel Angular Velocity:"});
                rows.AddChild(new Label {Text = ""});

                rows.AddChild(PanelVelocity = new LineEdit());
                rows.AddChild(new Label {Text = "°/min."});

                rows.AddChild(new Label {Text = "Press Enter to confirm."});
                rows.AddChild(new Label {Text = ""});

                PanelRotation.SizeFlagsHorizontal = SizeFlags.FillExpand;
                PanelVelocity.SizeFlagsHorizontal = SizeFlags.FillExpand;
                rows.SizeFlagsHorizontal = SizeFlags.Fill;
                rows.SizeFlagsVertical = SizeFlags.Fill;

                NotARadar = new SolarControlNotARadar(igt);

                var outerColumns = new HBoxContainer();
                outerColumns.AddChild(rows);
                outerColumns.AddChild(NotARadar);
                outerColumns.SizeFlagsHorizontal = SizeFlags.Fill;
                outerColumns.SizeFlagsVertical = SizeFlags.Fill;
                Contents.AddChild(outerColumns);
                Resizable = false;
            }
        public void Update(IGameTiming gameTime)
        {
            if (this.isActive)
            {
                var gameAreaClampRectangle = Rectangle.FromBound(100, 10, 700, 480 - 32);

                var actualVelocity = this.velocity.Scale(gameTime.ElapsedSeconds);
                this.position = this.position.Translate(actualVelocity);

                this.SpriteReference.Position = this.position;

                this.isActive = gameAreaClampRectangle.Intercept(this.position);
            }
        }
Example #17
0
        public async Task Setup()
        {
            var options = new ServerIntegrationOptions {
                ExtraPrototypes = Prototypes
            };

            _server = StartServerDummyTicker(options);

            await _server.WaitIdleAsync();

            _mapManager    = _server.ResolveDependency <IMapManager>();
            _entityManager = _server.ResolveDependency <IEntityManager>();
            _gameTiming    = _server.ResolveDependency <IGameTiming>();
        }
Example #18
0
        public void Update(KeyboardStateBase keyboardState, MouseStateBase mouseState, IGameTiming gameTime)
        {
            var previousDown = this.isDown;

            this.isDown = this.mappingKeys.Any(keyboardState.IsKeyDown)
                || this.mappingButtons.Any(mouseState.IsButtonDown);

            if (this.isDown && this.buttonDownAction != null) this.buttonDownAction.Invoke(gameTime);
            if (!this.isDown && this.buttonUpAction != null) this.buttonUpAction.Invoke(gameTime);

            if (this.buttonClickAction != null && previousDown && !this.isDown) this.buttonClickAction.Invoke(gameTime);

            if (this.buttonStateAction != null) this.buttonStateAction.Invoke(this.isDown, gameTime);
        }
Example #19
0
        public async Task Setup()
        {
            var options = new ServerIntegrationOptions {
                ExtraPrototypes = Prototypes
            };

            _server = StartServer(options);

            await _server.WaitIdleAsync();

            _mapManager           = _server.ResolveDependency <IMapManager>();
            _entityManager        = _server.ResolveDependency <IEntityManager>();
            _gameTiming           = _server.ResolveDependency <IGameTiming>();
            _extensionCableSystem = _entityManager.EntitySysManager.GetEntitySystem <ExtensionCableSystem>();
        }
Example #20
0
        public DebugTimePanel(IGameTiming gameTiming)
        {
            _gameTiming = gameTiming;

            _contents = new Label
            {
                FontColorShadowOverride = Color.Black,
                MarginTop  = 5,
                MarginLeft = 5
            };
            AddChild(_contents);

            PanelOverride = new StyleBoxFlat
            {
                BackgroundColor = new Color(67, 105, 255, 138),
            };

            MouseFilter = _contents.MouseFilter = MouseFilterMode.Ignore;

            SizeFlagsHorizontal = SizeFlags.None;
        }
Example #21
0
        public DebugTimePanel(IGameTiming gameTiming, IClientGameStateManager gameState)
        {
            _gameTiming = gameTiming;
            _gameState  = gameState;

            _contents = new Label
            {
                FontColorShadowOverride = Color.Black,
            };
            AddChild(_contents);

            PanelOverride = new StyleBoxFlat
            {
                BackgroundColor           = new Color(35, 134, 37, 138),
                ContentMarginLeftOverride = 5,
                ContentMarginTopOverride  = 5
            };

            MouseFilter = _contents.MouseFilter = MouseFilterMode.Ignore;

            HorizontalAlignment = HAlignment.Left;
        }
        public DebugNetPanel(IClientNetManager netMan, IGameTiming gameTiming)
        {
            NetManager = netMan;
            GameTiming = gameTiming;

            contents = new Label();

            HorizontalAlignment = HAlignment.Left;

            contents = new Label
            {
                FontColorShadowOverride = Color.Black,
            };
            AddChild(contents);

            PanelOverride = new StyleBoxFlat
            {
                BackgroundColor           = new Color(255, 105, 67, 138),
                ContentMarginLeftOverride = 5,
                ContentMarginTopOverride  = 5
            };

            MouseFilter = contents.MouseFilter = MouseFilterMode.Ignore;
        }
Example #23
0
        public DebugNetPanel(IClientNetManager netMan, IGameTiming gameTiming)
        {
            NetManager = netMan;
            GameTiming = gameTiming;

            contents = new Label();

            SizeFlagsHorizontal = SizeFlags.None;

            contents = new Label
            {
                FontColorShadowOverride = Color.Black,
                MarginTop  = 5,
                MarginLeft = 5
            };
            AddChild(contents);

            PanelOverride = new StyleBoxFlat
            {
                BackgroundColor = new Color(255, 105, 67, 138),
            };

            MouseFilter = contents.MouseFilter = MouseFilterMode.Ignore;
        }
        public NavigatorMessage Update(IGameTiming gameTiming)
        {
            this.frameCounter++;

            this.UpdateFps = "Updt:" + gameTiming.UpdateFps;
            this.DrawFps = "Draw:" + gameTiming.DrawFps;
            this.FrameCount = "#" + this.frameCounter;
            this.GameTime = gameTiming.TotalSeconds.ToString("f2");

            if (gameTiming.TotalSeconds - this.lastTimeUpdateInspector > 1)
            {
                this.OnRefreshInspector();
                this.lastTimeUpdateInspector = gameTiming.TotalSeconds;
            }

            var result = new NavigatorMessage
            {
                ShouldPlay = !this.shouldPause || this.shouldPlayOneFrame,
                ShouldExit = this.shouldExit
            };

            this.shouldPlayOneFrame = false;

            return result;
        }
Example #25
0
        public void Update(IGameTiming gameTiming)
        {
            this.currentGameTime = gameTiming;

            var finalList = new List<LineConfiguration>();
            if (this.ViewState == DiagnosticViewState.FpsOnly || this.ViewState == DiagnosticViewState.Full)
            {
                finalList.Add(this.fpsLine);

                if (this.ViewState == DiagnosticViewState.Full)
                    finalList.AddRange(this.configuration.CustomLines);
            }

            this.finalLines.Clear();
            foreach (var line in finalList)
            {
                var parameters = line.ParameterProviders.Select(parameterProvider => parameterProvider.Invoke()).ToArray();
                this.finalLines.Add(string.Format(line.Template, parameters));
            }
        }
Example #26
0
        public FrameGraph(IGameTiming gameTiming)
        {
            _gameTiming = gameTiming;

            HorizontalAlignment = HAlignment.Left;
        }
 public void Update(KeyboardStateBase keyboardStateState, IGameTiming gameTime)
 {
     this.keyboardTrackingAction.Invoke(keyboardStateState, gameTime);
 }
        public void Update(IGameTiming gameTime)
        {
            var velocityClampRectangle = Rectangle.FromBound(-8, -5, 8, 5);
            var gameAreaClampRectangle = Rectangle.FromBound(100, 10, 700, 480 - 32);

            this.shipVelocity = this.shipVelocity.Clamp(velocityClampRectangle);
            this.shipPosition = this.shipPosition.Translate(this.shipVelocity).Clamp(gameAreaClampRectangle);

            this.SpriteReference.Position = this.shipPosition;

            this.shipVelocity = Vector.Zero;

            foreach (var bullet in bullets)
            {
                bullet.Update(gameTime);
            }
        }
        void IScreen.Update(InputContext inputContext, IGameTiming gameTime)
        {
            this.InputConfiguration.Update(inputContext, gameTime);
            this.Scene.Update(gameTime);

            this.Update(gameTime);
        }
Example #30
0
 public GameLoop(IGameTiming timing)
 {
     _timing     = timing;
     _runtimeLog = IoCManager.Resolve <IRuntimeLog>();
 }
 public IntegrationGameLoop(IGameTiming gameTiming, Channel toInstanceChannel, Channel fromInstanceChannel)
 {
     _gameTiming          = gameTiming;
     _toInstanceChannel   = toInstanceChannel;
     _fromInstanceChannel = fromInstanceChannel;
 }
Example #32
0
        public ActionsUI(ClientActionsComponent actionsComponent)
        {
            SetValue(LayoutContainer.DebugProperty, true);
            _actionsComponent = actionsComponent;
            _actionManager    = IoCManager.Resolve <ActionManager>();
            _entityManager    = IoCManager.Resolve <IEntityManager>();
            _gameTiming       = IoCManager.Resolve <IGameTiming>();
            _gameHud          = IoCManager.Resolve <IGameHud>();
            _menu             = new ActionMenu(_actionsComponent, this);

            LayoutContainer.SetGrowHorizontal(this, LayoutContainer.GrowDirection.End);
            LayoutContainer.SetGrowVertical(this, LayoutContainer.GrowDirection.Constrain);
            LayoutContainer.SetAnchorTop(this, 0f);
            LayoutContainer.SetAnchorBottom(this, 0.8f);
            LayoutContainer.SetMarginLeft(this, 13);
            LayoutContainer.SetMarginTop(this, 110);

            HorizontalAlignment = HAlignment.Left;
            VerticalExpand      = true;

            var resourceCache = IoCManager.Resolve <IResourceCache>();

            // everything needs to go within an inner panel container so the panel resizes to fit the elements.
            // Because ActionsUI is being anchored by layoutcontainer, the hotbar backing would appear too tall
            // if ActionsUI was the panel container

            var panelContainer = new PanelContainer()
            {
                StyleClasses        = { StyleNano.StyleClassHotbarPanel },
                HorizontalAlignment = HAlignment.Left,
                VerticalAlignment   = VAlignment.Top
            };

            AddChild(panelContainer);

            var hotbarContainer = new BoxContainer
            {
                Orientation         = LayoutOrientation.Vertical,
                SeparationOverride  = 3,
                HorizontalAlignment = HAlignment.Left
            };

            panelContainer.AddChild(hotbarContainer);

            var settingsContainer = new BoxContainer
            {
                Orientation      = LayoutOrientation.Horizontal,
                HorizontalExpand = true
            };

            hotbarContainer.AddChild(settingsContainer);

            settingsContainer.AddChild(new Control {
                HorizontalExpand = true, SizeFlagsStretchRatio = 1
            });
            _lockTexture   = resourceCache.GetTexture("/Textures/Interface/Nano/lock.svg.192dpi.png");
            _unlockTexture = resourceCache.GetTexture("/Textures/Interface/Nano/lock_open.svg.192dpi.png");
            _lockButton    = new TextureButton
            {
                TextureNormal         = _unlockTexture,
                HorizontalAlignment   = HAlignment.Center,
                VerticalAlignment     = VAlignment.Center,
                SizeFlagsStretchRatio = 1,
                Scale        = (0.5f, 0.5f),
                ToolTip      = Loc.GetString("ui-actionsui-function-lock-action-slots"),
                TooltipDelay = CustomTooltipDelay
            };
            settingsContainer.AddChild(_lockButton);
            settingsContainer.AddChild(new Control {
                HorizontalExpand = true, SizeFlagsStretchRatio = 2
            });
            _settingsButton = new TextureButton
            {
                TextureNormal         = resourceCache.GetTexture("/Textures/Interface/Nano/gear.svg.192dpi.png"),
                HorizontalAlignment   = HAlignment.Center,
                VerticalAlignment     = VAlignment.Center,
                SizeFlagsStretchRatio = 1,
                Scale        = (0.5f, 0.5f),
                ToolTip      = Loc.GetString("ui-actionsui-function-open-abilities-menu"),
                TooltipDelay = CustomTooltipDelay
            };
            settingsContainer.AddChild(_settingsButton);
            settingsContainer.AddChild(new Control {
                HorizontalExpand = true, SizeFlagsStretchRatio = 1
            });

            // this allows a 2 column layout if window gets too small
            _slotContainer = new GridContainer
            {
                MaxGridHeight = CalcMaxHeight()
            };
            hotbarContainer.AddChild(_slotContainer);

            _loadoutContainer = new BoxContainer
            {
                Orientation      = LayoutOrientation.Horizontal,
                HorizontalExpand = true,
                MouseFilter      = MouseFilterMode.Stop
            };
            hotbarContainer.AddChild(_loadoutContainer);

            _loadoutContainer.AddChild(new Control {
                HorizontalExpand = true, SizeFlagsStretchRatio = 1
            });
            var previousHotbarIcon = new TextureRect()
            {
                Texture               = resourceCache.GetTexture("/Textures/Interface/Nano/left_arrow.svg.192dpi.png"),
                HorizontalAlignment   = HAlignment.Center,
                VerticalAlignment     = VAlignment.Center,
                SizeFlagsStretchRatio = 1,
                TextureScale          = (0.5f, 0.5f)
            };

            _loadoutContainer.AddChild(previousHotbarIcon);
            _loadoutContainer.AddChild(new Control {
                HorizontalExpand = true, SizeFlagsStretchRatio = 2
            });
            _loadoutNumber = new Label
            {
                Text = "1",
                SizeFlagsStretchRatio = 1
            };
            _loadoutContainer.AddChild(_loadoutNumber);
            _loadoutContainer.AddChild(new Control {
                HorizontalExpand = true, SizeFlagsStretchRatio = 2
            });
            var nextHotbarIcon = new TextureRect
            {
                Texture               = resourceCache.GetTexture("/Textures/Interface/Nano/right_arrow.svg.192dpi.png"),
                HorizontalAlignment   = HAlignment.Center,
                VerticalAlignment     = VAlignment.Center,
                SizeFlagsStretchRatio = 1,
                TextureScale          = (0.5f, 0.5f)
            };

            _loadoutContainer.AddChild(nextHotbarIcon);
            _loadoutContainer.AddChild(new Control {
                HorizontalExpand = true, SizeFlagsStretchRatio = 1
            });

            _slots = new ActionSlot[ClientActionsComponent.Slots];

            _dragShadow = new TextureRect
            {
                MinSize = (64, 64),
                Stretch = TextureRect.StretchMode.Scale,
                Visible = false,
                SetSize = (64, 64)
            };
            UserInterfaceManager.PopupRoot.AddChild(_dragShadow);

            for (byte i = 0; i < ClientActionsComponent.Slots; i++)
            {
                var slot = new ActionSlot(this, _menu, actionsComponent, i);
                _slotContainer.AddChild(slot);
                _slots[i] = slot;
            }

            DragDropHelper = new DragDropHelper <ActionSlot>(OnBeginActionDrag, OnContinueActionDrag, OnEndActionDrag);

            MinSize = (10, 400);
        }
Example #33
0
 public override void Update(IGameTiming gameTime)
 {
     this.visualBackButtonElement.Color = this.isHoveringBackButton ? Color.Red : Color.Blue;
     this.isHoveringBackButton = false;
 }
        public void Update(IGameTiming gameTiming)
        {
            if (this.AnimationState == AnimationState.Starting)
            {
                this.animationStartTime = gameTiming.TotalSeconds;
                this.AnimationState = AnimationState.Running;
            }

            this.AnimationTime = gameTiming.TotalSeconds - this.animationStartTime;

            this.currentFrame = this.GetCurrentAnimationFrame(this.AnimationTime % this.TotalAnimationTime);
        }
Example #35
0
 public PredictionGuard(IGameTiming gameTiming)
 {
     _gameTiming = gameTiming;
 }
Example #36
0
 /// <see cref="FromNow"/>
 public static (TimeSpan start, TimeSpan end) SecondsFromNow(double seconds, IGameTiming gameTiming = null)
 {
     return(FromNow(TimeSpan.FromSeconds(seconds), gameTiming));
 }
 public virtual void Update(IGameTiming gameTiming)
 {
 }
 public void Update(IGameTiming gameTiming)
 {
     foreach (var updatable in this.sprites.OfType<IUpdatable>())
         updatable.Update(gameTiming);
 }
 public NavigatorMessage Update(IGameTiming gameTiming)
 {
     return this.service.Update(gameTiming);
 }
Example #40
0
        public FrameGraph(IGameTiming gameTiming)
        {
            _gameTiming = gameTiming;

            SizeFlagsHorizontal = SizeFlags.None;
        }
Example #41
0
 /// <summary>
 ///     Creates an instance of this LogicProcessor.
 /// </summary>
 public AimShootLifeProcessor()
 {
     _physMan = IoCManager.Resolve <ICollisionManager>();
     _entMan  = IoCManager.Resolve <IServerEntityManager>();
     _timeMan = IoCManager.Resolve <IGameTiming>();
 }
Example #42
0
 public void Update(TouchStateBase touchState, IGameTiming gameTime)
 {
     if (this.touchAction != null && this.mappingGestures.Any(g => (g & touchState.CurrentGesture.GestureType) == g))
         this.touchAction.Invoke(gameTime);
 }
Example #43
0
        public ActionsUI(ClientActionsComponent actionsComponent)
        {
            _actionsComponent = actionsComponent;
            _actionManager    = IoCManager.Resolve <ActionManager>();
            _entityManager    = IoCManager.Resolve <IEntityManager>();
            _gameTiming       = IoCManager.Resolve <IGameTiming>();
            _gameHud          = IoCManager.Resolve <IGameHud>();
            _menu             = new ActionMenu(_actionsComponent, this);

            LayoutContainer.SetGrowHorizontal(this, LayoutContainer.GrowDirection.End);
            LayoutContainer.SetGrowVertical(this, LayoutContainer.GrowDirection.End);
            LayoutContainer.SetAnchorTop(this, 0f);
            LayoutContainer.SetAnchorBottom(this, 0.8f);
            LayoutContainer.SetMarginLeft(this, 13);
            LayoutContainer.SetMarginTop(this, 110);

            SizeFlagsHorizontal = SizeFlags.None;
            SizeFlagsVertical   = SizeFlags.FillExpand;

            var resourceCache = IoCManager.Resolve <IResourceCache>();

            // everything needs to go within an inner panel container so the panel resizes to fit the elements.
            // Because ActionsUI is being anchored by layoutcontainer, the hotbar backing would appear too tall
            // if ActionsUI was the panel container

            var panelContainer = new PanelContainer()
            {
                StyleClasses        = { StyleNano.StyleClassHotbarPanel },
                SizeFlagsHorizontal = SizeFlags.None,
                SizeFlagsVertical   = SizeFlags.None
            };

            AddChild(panelContainer);

            var hotbarContainer = new VBoxContainer
            {
                SeparationOverride  = 3,
                SizeFlagsHorizontal = SizeFlags.None
            };

            panelContainer.AddChild(hotbarContainer);

            var settingsContainer = new HBoxContainer
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand
            };

            hotbarContainer.AddChild(settingsContainer);

            settingsContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1
            });
            _lockTexture   = resourceCache.GetTexture("/Textures/Interface/Nano/lock.svg.192dpi.png");
            _unlockTexture = resourceCache.GetTexture("/Textures/Interface/Nano/lock_open.svg.192dpi.png");
            _lockButton    = new TextureButton
            {
                TextureNormal         = _unlockTexture,
                SizeFlagsHorizontal   = SizeFlags.ShrinkCenter,
                SizeFlagsVertical     = SizeFlags.ShrinkCenter,
                SizeFlagsStretchRatio = 1,
                Scale = (0.5f, 0.5f)
            };
            settingsContainer.AddChild(_lockButton);
            settingsContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2
            });
            _settingsButton = new TextureButton
            {
                TextureNormal         = resourceCache.GetTexture("/Textures/Interface/Nano/gear.svg.192dpi.png"),
                SizeFlagsHorizontal   = SizeFlags.ShrinkCenter,
                SizeFlagsVertical     = SizeFlags.ShrinkCenter,
                SizeFlagsStretchRatio = 1,
                Scale = (0.5f, 0.5f)
            };
            settingsContainer.AddChild(_settingsButton);
            settingsContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1
            });

            // this allows a 2 column layout if window gets too small
            _slotContainer = new GridContainer
            {
                MaxHeight = CalcMaxHeight()
            };
            hotbarContainer.AddChild(_slotContainer);

            _loadoutContainer = new HBoxContainer
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                MouseFilter         = MouseFilterMode.Stop
            };
            hotbarContainer.AddChild(_loadoutContainer);

            _loadoutContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1
            });
            var previousHotbarIcon = new TextureRect()
            {
                Texture               = resourceCache.GetTexture("/Textures/Interface/Nano/left_arrow.svg.192dpi.png"),
                SizeFlagsHorizontal   = SizeFlags.ShrinkCenter,
                SizeFlagsVertical     = SizeFlags.ShrinkCenter,
                SizeFlagsStretchRatio = 1,
                TextureScale          = (0.5f, 0.5f)
            };

            _loadoutContainer.AddChild(previousHotbarIcon);
            _loadoutContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2
            });
            _loadoutNumber = new Label
            {
                Text = "1",
                SizeFlagsStretchRatio = 1
            };
            _loadoutContainer.AddChild(_loadoutNumber);
            _loadoutContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2
            });
            var nextHotbarIcon = new TextureRect
            {
                Texture               = resourceCache.GetTexture("/Textures/Interface/Nano/right_arrow.svg.192dpi.png"),
                SizeFlagsHorizontal   = SizeFlags.ShrinkCenter,
                SizeFlagsVertical     = SizeFlags.ShrinkCenter,
                SizeFlagsStretchRatio = 1,
                TextureScale          = (0.5f, 0.5f)
            };

            _loadoutContainer.AddChild(nextHotbarIcon);
            _loadoutContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1
            });

            _slots = new ActionSlot[ClientActionsComponent.Slots];

            _dragShadow = new TextureRect
            {
                CustomMinimumSize = (64, 64),
                Stretch           = TextureRect.StretchMode.Scale,
                Visible           = false
            };
            UserInterfaceManager.PopupRoot.AddChild(_dragShadow);
            LayoutContainer.SetSize(_dragShadow, (64, 64));

            for (byte i = 0; i < ClientActionsComponent.Slots; i++)
            {
                var slot = new ActionSlot(this, _menu, actionsComponent, i);
                _slotContainer.AddChild(slot);
                _slots[i] = slot;
            }

            DragDropHelper = new DragDropHelper <ActionSlot>(OnBeginActionDrag, OnContinueActionDrag, OnEndActionDrag);
        }
Example #44
0
        public void Update(TouchStateBase touchState, IGameTiming gameTime)
        {
            var cameraAdjutedMouseState = touchState.AdjustToCamera(this.camera);

            this.touchAction.Invoke(cameraAdjutedMouseState, gameTime);
        }
        public NavigatorMessage Update(IGameTiming gameTiming)
        {
            if (this.navigatorWindow != null)
            {
                NavigatorMessage result = null;

                this.navigatorWindow.Dispatcher.Invoke(() =>
                {
                    result = this.navigatorViewModel.Update(gameTiming);
                    this.navigatorWindow.Title = "Navigator" + (result.ShouldPlay ? string.Empty : " - Pause");
                });

                return result;
            }

            return new NavigatorMessage();
        }
        private void FireWeapon(IGameTiming gameTime)
        {
            if (gameTime.TotalSeconds - this.lastFiringTime > 0.05f)
            {
                this.bullets.Add(BulletEntity.Create(this.entityLayer, shipSheet, this.shipPosition, new Vector(0, -500)));

                this.lastFiringTime = gameTime.TotalSeconds;
            }
        }
 public SolarControlNotARadar(IGameTiming igt)
 {
     _gameTiming = igt;
 }
Example #48
0
 public FrameGraph(IGameTiming gameTiming)
 {
     _gameTiming = gameTiming;
 }
Example #49
0
 public FPSCounter(IGameTiming gameTiming)
 {
     _gameTiming = gameTiming;
 }
        public void Update(InputContext inputContext, IGameTiming gameTime)
        {
            var keyState = inputContext.KeyboardGetState();
            var mouseState = inputContext.MouseGetState();
            var touchState = inputContext.TouchGetState();

            foreach (var keyboardTracking in this.keyboardTrackings)
            {
                keyboardTracking.Update(keyState, gameTime);
            }

            foreach (var mouseTracking in this.mouseTrackings)
            {
                mouseTracking.Update(mouseState, gameTime);
            }

            foreach (var digitalButton in this.digitalButtons.Values)
            {
                digitalButton.Update(keyState, mouseState, gameTime);
            }

            foreach (var visualButton in this.visualButtons.Values)
            {
                visualButton.Update(touchState, mouseState, gameTime);
            }

            foreach (var touchTracking in this.touchTrackings)
            {
                touchTracking.Update(touchState, gameTime);
            }

            foreach (var inputEvent in this.inputEvents.Values)
            {
                inputEvent.Update(touchState, gameTime);
            }
        }
Example #51
0
        /// <param name="gameTiming">game timing to use, otherwise will resolve using IoCManager.</param>
        /// <returns>a cooldown interval starting at GameTiming.Curtime and ending at (offset) from CurTime.
        /// For example, passing TimeSpan.FromSeconds(5) will create an interval
        /// from now to 5 seconds from now.</returns>
        public static (TimeSpan start, TimeSpan end) FromNow(TimeSpan offset, IGameTiming gameTiming = null)
        {
            var now = (gameTiming ?? IoCManager.Resolve <IGameTiming>()).CurTime;

            return(now, now + offset);
        }
Example #52
0
        public void Update(MouseStateBase mouseState, IGameTiming gameTime)
        {
            var cameraAdjutedMouseState = mouseState.AdjustToCamera(this.camera);

            this.mouseMoveAction.Invoke(cameraAdjutedMouseState, gameTime);
        }