public TexturePostprocessor(AssaultWingCore game, Action render, Action<ICollection<Effect>> effectContainerUpdater) { _game = game; _render = render; Func<AutoRenderTarget2D.CreationData> getRenderTargetCreationData = () => new AutoRenderTarget2D.CreationData { Width = Gfx.Viewport.Width, Height = Gfx.Viewport.Height, DepthStencilState = DepthStencilState.Default, }; _targets = new[] { new AutoRenderTarget2D(Gfx, getRenderTargetCreationData), new AutoRenderTarget2D(Gfx, getRenderTargetCreationData) }; _effects = new List<Effect>(); _effectContainerUpdater = effectContainerUpdater; _vertexData = new[] { new VertexPositionTexture(new Vector3(-1, -1, 0), Vector2.UnitY), new VertexPositionTexture(new Vector3(-1, 1, 0), Vector2.Zero), new VertexPositionTexture(new Vector3(1, -1, 0), Vector2.One), new VertexPositionTexture(new Vector3(1, 1, 0), Vector2.UnitX) }; }
public StatsSender(AssaultWingCore game, int updateOrder) : base(game, updateOrder) { _connectTimer = new AWTimer(() => game.GameTime.TotalGameTime, TimeSpan.FromSeconds(5)) { SkipPastIntervals = true }; _sendTimer = new AWTimer(() => game.GameTime.TotalGameTime, TimeSpan.FromSeconds(1)) { SkipPastIntervals = true }; _sendQueue = new StringBuilder(2048); }
/// <summary> /// Creates an equipment selector for a player with an empty set of possible values. /// Subclasses should set the list of values. /// </summary> /// <param name="player">The player.</param> /// <param name="pos">Top left corner of the selector in menu system coordinates</param> protected EquipmentSelector(AssaultWingCore game, Player player, PlayerSettingsItem settings, Vector2 pos) { Values = new List<string>(); Game = game; Player = player; Settings = settings; Pos = pos; }
public Spectator(AssaultWingCore game, int connectionId = CONNECTION_ID_LOCAL, IPAddress ipAddress = null) { Game = game; ConnectionID = connectionId; ConnectionStatus = connectionId == CONNECTION_ID_LOCAL ? ConnectionStatusType.Local : ConnectionStatusType.Remote; IPAddress = ipAddress ?? IPAddress.Loopback; ArenaStatistics = new ArenaStatistics(); PreviousArenaStatistics = new ArenaStatistics(); StatsData = CreateStatsData(this); }
public EditableText(string content, int maxLength, CharacterSet allowedChars, AssaultWingCore game, Action changedCallback) { if (maxLength < 0) throw new ArgumentException("Maximum length cannot be negative"); if (content.Length > maxLength) throw new ArgumentException("Initial content is longer than maximum length"); MaxLength = maxLength; _allowedChars = allowedChars; _content = new StringBuilder(content, maxLength); _game = game; _changedCallback = changedCallback; WeakEventHandler<char>.Register(game.Window, (window, handler) => window.KeyPress += handler, (window, handler) => window.KeyPress -= handler, this, (self, sender, args) => self.KeyPressHandler(sender, args)); }
public static AWSettings FromFile(AssaultWingCore game, string directory) { var filename = GetSettingsFilename(directory); if (File.Exists(filename)) { var settings = (AWSettings)TypeLoader.LoadTemplate(filename, typeof(AWSettings), typeof(TypeParameterAttribute), true); if (settings != null) { settings.Filename = filename; settings.Validate(game); return settings; } Log.Write("Errors while reading settings from " + filename); } Log.Write("Creating a new settings file " + filename); var newSettings = new AWSettings { Filename = filename }; newSettings.ToFile(); return newSettings; }
/// <param name="onScreen">Where on screen is the viewport located.</param> protected AWViewport(AssaultWingCore game, Rectangle onScreen, Func<IEnumerable<CanonicalString>> getPostprocessEffectNames) { Game = game; _overlayComponents = new List<OverlayComponent>(); Viewport = new Viewport { X = onScreen.X, Y = onScreen.Y, Width = onScreen.Width, Height = onScreen.Height, MinDepth = 0f, MaxDepth = 1f }; _getPostprocessEffectNames = getPostprocessEffectNames; ZoomRatio = 1; LayerVisibleAreas = new List<RectangleSingle>(); UpdateLayerVisibleAreas(); // !!! GobDrawn += gob => game.DataEngine.Arena.DebugDrawGob(gob, ViewMatrix, GetProjectionMatrix(gob.Layer.Z)); }
public SoundEngineXNA(AssaultWingCore game, int updateOrder) : base(game, updateOrder) { }
public BotPlayer(AssaultWingCore game, int connectionID = Spectator.CONNECTION_ID_LOCAL, IPAddress ipAddress = null) : base(game, connectionID, ipAddress) { _bots = new List<Gob>(); }
public AWGameComponent(AssaultWingCore game, int updateOrder) { Game = game; UpdateOrder = updateOrder; }
/// <summary> /// Creates a new player who plays at a remote game instance. /// </summary> /// <param name="name">Name of the player.</param> /// <param name="shipTypeName">Name of the type of ship the player is flying.</param> /// <param name="weapon2Name">Name of the type of secondary weapon.</param> /// <param name="extraDeviceName">Name of the type of extra device.</param> /// <param name="connectionId">Identifier of the connection to the remote game instance /// at which the player lives.</param> /// <see cref="AW2.Net.Connection.ID"/> public Player(AssaultWingCore game, string name, CanonicalString shipTypeName, CanonicalString weapon2Name, CanonicalString extraDeviceName, int connectionId, IPAddress ipAddress) : this(game, name, shipTypeName, weapon2Name, extraDeviceName, new PlayerControls { Thrust = new RemoteControl(), Left = new RemoteControl(), Right = new RemoteControl(), Fire1 = new RemoteControl(), Fire2 = new RemoteControl(), Extra = new RemoteControl() }, connectionId, ipAddress) { }
public Weapon2Selector(AssaultWingCore game, Player player, PlayerSettingsItem settings, Vector2 pos) : base(game, player, settings, pos) { Values = game.DataEngine.GameplayMode.Weapon2Types; CurrentValue = Values.IndexOf(player.Weapon2Name); }
public ExtraDeviceSelector(AssaultWingCore game, Player player, PlayerSettingsItem settings, Vector2 pos) : base(game, player, settings, pos) { Values = game.DataEngine.GameplayMode.ExtraDeviceTypes; CurrentValue = Values.IndexOf(player.ExtraDeviceName); }
/// <summary> /// Loads an arena from file, or throws an exception on failure. /// </summary> public static Arena FromFile(AssaultWingCore game, string filename) { var arena = (Arena)TypeLoader.LoadTemplate(filename, typeof(Arena), typeof(TypeParameterAttribute), false); arena.Game = game; return arena; }
public WrappedTextList(AssaultWingCore game) { _game = game; _items = new Dictionary<float, List<Line>>(); }
/// <summary> /// Creates a new player who plays at the local game instance. /// </summary> /// <param name="name">Name of the player.</param> /// <param name="shipTypeName">Name of the type of ship the player is flying.</param> /// <param name="weapon2Name">Name of the type of secondary weapon.</param> /// <param name="extraDeviceName">Name of the type of extra device.</param> /// <param name="controls">Player's in-game controls.</param> public Player(AssaultWingCore game, string name, CanonicalString shipTypeName, CanonicalString weapon2Name, CanonicalString extraDeviceName, PlayerControls controls) : this(game, name, shipTypeName, weapon2Name, extraDeviceName, controls, CONNECTION_ID_LOCAL, null) { }
public static ShipDevice Create(AssaultWingCore game, CanonicalString typeName) { return (ShipDevice)Clonable.Instantiate(game, typeName); }
private Player(AssaultWingCore game, string name, CanonicalString shipTypeName, CanonicalString weapon2Name, CanonicalString extraDeviceName, PlayerControls controls, int connectionId, IPAddress ipAddress) : base(game, connectionId, ipAddress) { Name = name; ShipName = shipTypeName; Weapon2Name = weapon2Name; ExtraDeviceName = extraDeviceName; Controls = controls; Messages = new MessageContainer(Game); PostprocessEffectNames = new List<CanonicalString>(); GobTrackerItems = new List<GobTrackerItem>(); }
public GraphicsEngineImpl(AssaultWingCore game, int updateOrder) : base(game, updateOrder) { GameContent = new GameContent(game); }
/// <summary> /// Creates an instance of the specified type with its TypeParameter fields /// initialized like in the template with the <paramref name="typeName"/>. /// </summary> public static Clonable Instantiate(AssaultWingCore game, CanonicalString typeName) { var template = (Clonable)game.DataEngine.GetTypeTemplate(typeName); return template.Clone(); }
public MessageContainer(AssaultWingCore game) { _game = game; ChatItems = new List<Item>(); CombatLogItems = new List<Item>(); }
public ArenaSilhouette(AssaultWingCore game) { Game = game; }
public UIEngineImpl(AssaultWingCore game, int updateOrder) : base(game, updateOrder) { _exclusiveControls = new Stack<IEnumerable<Control>>(); UpdateInputState(); // to avoid null _oldState on first Update() }
public EditorSpectator(AssaultWingCore game) : base(game) { }
public StatsBase(AssaultWingCore game, int updateOrder) : base(game, updateOrder) { }
public MessageBeeper(AssaultWingCore game, string beepSoundName, Func<MessageContainer.Item> getLatestMessage) { _game = game; _beepSoundName = beepSoundName; GetLatestMessage = getLatestMessage; }
public WebData(AssaultWingCore game, int updateOrder) : base(game, updateOrder) { LoginErrors = new ThreadSafeWrapper<Queue<string>>(new Queue<string>()); }
public LogicEngine(AssaultWingCore game, int updateOrder) : base(game, updateOrder) { _gobsToKillOnClient = new List<GobKillData>(); _helpControl = new KeyboardKey(Keys.F1); }
public void Validate(AssaultWingCore game) { Graphics.Validate(); Players.Validate(game); }