Пример #1
0
 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)
     };
 }
Пример #2
0
 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);
 }
Пример #3
0
 /// <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;
 }
Пример #4
0
 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);
 }
Пример #5
0
 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));
 }
Пример #6
0
 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;
 }
Пример #7
0
 /// <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));
 }
Пример #8
0
 public SoundEngineXNA(AssaultWingCore game, int updateOrder)
     : base(game, updateOrder)
 {
 }
Пример #9
0
 public BotPlayer(AssaultWingCore game, int connectionID = Spectator.CONNECTION_ID_LOCAL, IPAddress ipAddress = null)
     : base(game, connectionID, ipAddress)
 {
     _bots = new List<Gob>();
 }
Пример #10
0
 public AWGameComponent(AssaultWingCore game, int updateOrder)
 {
     Game = game;
     UpdateOrder = updateOrder;
 }
Пример #11
0
 /// <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)
 {
 }
Пример #12
0
 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);
 }
Пример #13
0
 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);
 }
Пример #14
0
 /// <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;
 }
Пример #15
0
 public WrappedTextList(AssaultWingCore game)
 {
     _game = game;
     _items = new Dictionary<float, List<Line>>();
 }
Пример #16
0
 /// <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)
 {
 }
Пример #17
0
 public static ShipDevice Create(AssaultWingCore game, CanonicalString typeName)
 {
     return (ShipDevice)Clonable.Instantiate(game, typeName);
 }
Пример #18
0
 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>();
 }
Пример #19
0
 public GraphicsEngineImpl(AssaultWingCore game, int updateOrder)
     : base(game, updateOrder)
 {
     GameContent = new GameContent(game);
 }
Пример #20
0
 /// <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();
 }
Пример #21
0
 public MessageContainer(AssaultWingCore game)
 {
     _game = game;
     ChatItems = new List<Item>();
     CombatLogItems = new List<Item>();
 }
Пример #22
0
 public ArenaSilhouette(AssaultWingCore game)
 {
     Game = game;
 }
Пример #23
0
 public UIEngineImpl(AssaultWingCore game, int updateOrder)
     : base(game, updateOrder)
 {
     _exclusiveControls = new Stack<IEnumerable<Control>>();
     UpdateInputState(); // to avoid null _oldState on first Update()
 }
Пример #24
0
 public EditorSpectator(AssaultWingCore game)
     : base(game)
 {
 }
Пример #25
0
 public StatsBase(AssaultWingCore game, int updateOrder)
     : base(game, updateOrder)
 {
 }
Пример #26
0
 public MessageBeeper(AssaultWingCore game, string beepSoundName, Func<MessageContainer.Item> getLatestMessage)
 {
     _game = game;
     _beepSoundName = beepSoundName;
     GetLatestMessage = getLatestMessage;
 }
Пример #27
0
 public WebData(AssaultWingCore game, int updateOrder)
     : base(game, updateOrder)
 {
     LoginErrors = new ThreadSafeWrapper<Queue<string>>(new Queue<string>());
 }
Пример #28
0
 public LogicEngine(AssaultWingCore game, int updateOrder)
     : base(game, updateOrder)
 {
     _gobsToKillOnClient = new List<GobKillData>();
     _helpControl = new KeyboardKey(Keys.F1);
 }
Пример #29
0
 public void Validate(AssaultWingCore game)
 {
     Graphics.Validate();
     Players.Validate(game);
 }