Пример #1
0
        public LocalPlayer(World world, PlayerInformation playerInfo)
            : base(world, playerInfo)
        {
            // set our update frequency
            this.msgUpdateFrequency = new TimeSpan(0, 0, 0, 0, (int)(1000 / (UInt16)World.VarDB["updatesPerSecond"].Value));

            // TODO support if these variables change
            this.maxVelocity = (Single)World.VarDB["tankSpeed"].Value;
            this.maxAngularVelocity = (Single)World.VarDB["tankAngVel"].Value;

            inputService = (IInputService)World.IService.GetService(typeof(IInputService));
            inputService.GetKeyboard().KeyPressed += KeyPressed;
        }
Пример #2
0
        public GameConsole(Game game, Vector2 position, Vector2 size, Vector2 margin, Vector2 padding, Color backgroundColor)
            : base(game)
        {
            this.Position = position;
            this.Size     = size;
            this.Margin   = margin;
            this.Padding  = padding;
            this.BackgroundColor = backgroundColor;

            this.Opened = true;
            this.PromptPrefix = new ConsoleMessagePart("# ", Color.Yellow);
            this.PromptActive = false;
            this.PromptBlinkRate = 300; // 300 ms prompt blink rate

            this.PromptCursor = "|";

            // register ourselves as a service
            if (Game.Services != null)
                Game.Services.AddService(typeof(IGameConsole), this);

            inputService = (IInputService)Game.Services.GetService(typeof(IInputService));

            inputService.GetKeyboard().CharacterEntered += CharacterEntered;
            inputService.GetKeyboard().KeyPressed += KeyPressed;
        }
Пример #3
0
        public TextBox(Game game, Vector2 position, Vector2 size, Vector2 margin, Vector2 padding, Color backgroundColor)
            : base(game)
        {
            this.Position = position;
            this.Size = size;
            this.Margin = margin;
            this.Padding = padding;
            this.BackgroundColor = backgroundColor;

            this.Opened = true;
            this.PromptPrefix = new ConsoleMessagePart("", Color.Black);
            this.PromptActive = false;
            this.PromptBlinkRate = 0; // 0 ms prompt blink rate

            this.PromptCursor = ""; // no prompt

            inputService = (IInputService)Game.Services.GetService(typeof(IInputService));

            inputService.GetKeyboard().CharacterEntered += CharacterEntered;
            inputService.GetKeyboard().KeyPressed += KeyPressed;
        }