public TriggeredCallback(Control control, Action callback)
 {
     if (control == null) throw new ArgumentNullException("control");
     if (callback == null) throw new ArgumentNullException("callback");
     Control = control;
     _callback = callback;
 }
Beispiel #2
0
        public PlayerChat(AssaultWing game, int updateOrder)
            : base(game, updateOrder)
        {
            g_cursorBlinkCurve = new Curve();
            g_cursorBlinkCurve.Keys.Add(new CurveKey(0, 1));
            g_cursorBlinkCurve.Keys.Add(new CurveKey(0.5f, 0));
            g_cursorBlinkCurve.Keys.Add(new CurveKey(1, 1));
            g_cursorBlinkCurve.PreLoop = CurveLoopType.Cycle;
            g_cursorBlinkCurve.PostLoop = CurveLoopType.Cycle;

            g_scrollArrowBlinkCurve = new Curve();
            g_scrollArrowBlinkCurve.Keys.Add(new CurveKey(0, 1));
            g_scrollArrowBlinkCurve.Keys.Add(new CurveKey(0.75f, 0));
            g_scrollArrowBlinkCurve.Keys.Add(new CurveKey(1.5f, 1));
            g_scrollArrowBlinkCurve.PreLoop = CurveLoopType.Cycle;
            g_scrollArrowBlinkCurve.PostLoop = CurveLoopType.Cycle;

            _game = game;
            _chatSendControl = new KeyboardKey(Keys.Enter);
            _escapeControl = new KeyboardKey(Keys.Escape);
            _scrollUpControl = new KeyboardKey(Keys.Up);
            _scrollDownControl = new KeyboardKey(Keys.Down);
            _cursorBlinkStartTime = _game.GameTime.TotalRealTime;
            _scrollArrowGlowStartTime = _game.GameTime.TotalRealTime;
            _messageBeeper = new MessageBeeper(game, "PlayerMessage", () => Messages.FirstOrDefault());
        }
Beispiel #3
0
 public ChatTab(EquipMenuComponent menuComponent)
     : base(menuComponent)
 {
     _sendControl = new KeyboardKey(Keys.Enter);
     _message = new EditableText("", 1000, new CharacterSet(Content.FontChat.Characters), MenuEngine.Game, () => { });
     _messageBeeper = new MessageBeeper(MenuEngine.Game, "PlayerMessage", () => Messages.FirstOrDefault());
     _cursorBlinkStartTime = MenuEngine.Game.GameTime.TotalRealTime;
 }
Beispiel #4
0
        public AssaultWing(GraphicsDeviceService graphicsDeviceService, CommandLineOptions args)
            : base(graphicsDeviceService, args)
        {
            CustomControls = new List<Tuple<Control, Action>>();
            MessageHandlers = new Net.MessageHandling.MessageHandlers(this);
            if (CommandLineOptions.DedicatedServer)
                Logic = new DedicatedServerLogic(this);
            else if (CommandLineOptions.QuickStart != null)
                Logic = new QuickStartLogic(this, CommandLineOptions.QuickStart);
            else
                Logic = new UserControlledLogic(this);
            ArenaLoadTask = new BackgroundTask();
            NetworkingErrors = new Queue<string>();
            _gameSettingsSendTimer = new AWTimer(() => GameTime.TotalRealTime, TimeSpan.FromSeconds(2)) { SkipPastIntervals = true };
            _arenaStateSendTimer = new AWTimer(() => GameTime.TotalRealTime, TimeSpan.FromSeconds(2)) { SkipPastIntervals = true };
            _frameNumberSynchronizationTimer = new AWTimer(() => GameTime.TotalRealTime, TimeSpan.FromSeconds(1)) { SkipPastIntervals = true };

            NetworkEngine = new NetworkEngine(this, 30);
            WebData = new WebData(this, 21);
            Components.Add(NetworkEngine);
            Components.Add(WebData);
            ChatStartControl = Settings.Controls.Chat.GetControl();
            _frameStepControl = new KeyboardKey(Keys.F8);
            _frameRunControl = new KeyboardKey(Keys.F7);
            _frameStep = false;
            _debugPrintLagTimer = new AWTimer(() => GameTime.TotalRealTime, TimeSpan.FromSeconds(1)) { SkipPastIntervals = true };
            DataEngine.SpectatorAdded += SpectatorAddedHandler;
            DataEngine.SpectatorRemoved += SpectatorRemovedHandler;
            NetworkEngine.Enabled = true;
            AW2.Graphics.PlayerViewport.CustomOverlayCreators.Add(viewport => new SystemStatusOverlay(viewport));

            // Replace the dummy StatsBase by a proper StatsSender.
            Components.Remove(comp => comp is StatsBase);
            Stats = new StatsSender(this, 7);
            Components.Add(Stats);
            Stats.Enabled = true;
        }
Beispiel #5
0
 public LogicEngine(AssaultWingCore game, int updateOrder)
     : base(game, updateOrder)
 {
     _gobsToKillOnClient = new List<GobKillData>();
     _helpControl = new KeyboardKey(Keys.F1);
 }
Beispiel #6
0
 public void TryFire(ShipDevice.OwnerHandleType ownerHandleType, Control control)
 {
     DeviceUsagesToClients[ownerHandleType] = GetDevice(ownerHandleType).TryFire(control.State);
 }
Beispiel #7
0
 public override void Initialize()
 {
     base.Initialize();
     _skipControl = new KeyboardKey(Microsoft.Xna.Framework.Input.Keys.Escape);
 }
Beispiel #8
0
 public Directions(Control up, Control down, Control left, Control right)
 {
     Up = up; Down = down; Left = left; Right = right;
 }