Skip to content

Commit

Permalink
chore: converts client framework namespaces to file-scoped namespaces (
Browse files Browse the repository at this point in the history
  • Loading branch information
Arufonsu authored Jul 7, 2024
1 parent f3157a0 commit bd4aea8
Show file tree
Hide file tree
Showing 191 changed files with 23,779 additions and 24,115 deletions.
64 changes: 31 additions & 33 deletions Intersect.Client.Framework/Audio/GameAudioInstance.cs
Original file line number Diff line number Diff line change
@@ -1,57 +1,55 @@
namespace Intersect.Client.Framework.Audio
namespace Intersect.Client.Framework.Audio;


public abstract partial class GameAudioInstance
{

public abstract partial class GameAudioInstance
public enum AudioInstanceState
{

public enum AudioInstanceState
{

Stopped = 0,
Stopped = 0,

Playing = 1,
Playing = 1,

Paused = 2,
Paused = 2,

Disposed = 3,
Disposed = 3,

}
}

private bool mIsLooping;
private bool mIsLooping;

protected GameAudioInstance(GameAudioSource source)
{
Source = source;
}
protected GameAudioInstance(GameAudioSource source)
{
Source = source;
}

public GameAudioSource Source { get; }
public GameAudioSource Source { get; }

public bool IsLooping
public bool IsLooping
{
get => mIsLooping;
set
{
get => mIsLooping;
set
{
mIsLooping = value;
InternalLoopSet();
}
mIsLooping = value;
InternalLoopSet();
}
}

public abstract AudioInstanceState State { get; }

protected abstract void InternalLoopSet();
public abstract AudioInstanceState State { get; }

public abstract void Play();
protected abstract void InternalLoopSet();

public abstract void Pause();
public abstract void Play();

public abstract void Stop();
public abstract void Pause();

public abstract void SetVolume(int volume, bool isMusic = false);
public abstract void Stop();

public abstract int GetVolume();
public abstract void SetVolume(int volume, bool isMusic = false);

public abstract void Dispose();
public abstract int GetVolume();

}
public abstract void Dispose();

}
12 changes: 5 additions & 7 deletions Intersect.Client.Framework/Audio/GameAudioSource.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
using Intersect.Client.Framework.Content;

namespace Intersect.Client.Framework.Audio
{
namespace Intersect.Client.Framework.Audio;

public abstract partial class GameAudioSource : IAsset
{
public string Name { get; set; }

public abstract GameAudioInstance CreateInstance();
public abstract partial class GameAudioSource : IAsset
{
public string Name { get; set; }

}
public abstract GameAudioInstance CreateInstance();

}
103 changes: 51 additions & 52 deletions Intersect.Client.Framework/Audio/IAudioManager.cs
Original file line number Diff line number Diff line change
@@ -1,65 +1,64 @@
using Intersect.Client.Framework.Core.Sounds;
using Intersect.Client.Framework.Entities;

namespace Intersect.Client.Framework.Audio
namespace Intersect.Client.Framework.Audio;

/// <summary>
/// Manages game audio for the client instance.
/// </summary>
public interface IAudioManager
{
/// <summary>
/// Manages game audio for the client instance.
/// Start playing a map sound.
/// </summary>
public interface IAudioManager
{
/// <summary>
/// Start playing a map sound.
/// </summary>
/// <param name="filename">The sound file name to start playing.</param>
/// <param name="x">The X location to start playing this sound at.</param>
/// <param name="y">The Y location to start playing this sound at.</param>
/// <param name="mapId">The map Id to start playing this song on.</param>
/// <param name="loop">Determines whether the sound loops once it's over or not.</param>
/// <param name="loopInterval">The time (in ms) between the sound stopping and starting again once it loops.</param>
/// <param name="distance">The maximum distance from which the sound can still be heard.</param>
/// <param name="parent">The <see cref="IEntity"/> this sound belongs to.</param>
/// <returns>Returns a new instance of <see cref="IMapSound"/> for the sound that will be played.</returns>
IMapSound PlayMapSound(string filename, int x, int y, Guid mapId, bool loop, int loopInterval, int distance, IEntity parent = null);
/// <param name="filename">The sound file name to start playing.</param>
/// <param name="x">The X location to start playing this sound at.</param>
/// <param name="y">The Y location to start playing this sound at.</param>
/// <param name="mapId">The map Id to start playing this song on.</param>
/// <param name="loop">Determines whether the sound loops once it's over or not.</param>
/// <param name="loopInterval">The time (in ms) between the sound stopping and starting again once it loops.</param>
/// <param name="distance">The maximum distance from which the sound can still be heard.</param>
/// <param name="parent">The <see cref="IEntity"/> this sound belongs to.</param>
/// <returns>Returns a new instance of <see cref="IMapSound"/> for the sound that will be played.</returns>
IMapSound PlayMapSound(string filename, int x, int y, Guid mapId, bool loop, int loopInterval, int distance, IEntity parent = null);

/// <summary>
/// Start playing a sound effect.
/// </summary>
/// <param name="filename">The sound file name to start playing.</param>
/// <param name="loop">Determines whether the sound loops once it's over or not.</param>
/// <returns>Returns a new instance of <see cref="ISound"/> for the sound that will be played.</returns>
ISound PlaySound(string filename, bool loop);
/// <summary>
/// Start playing a sound effect.
/// </summary>
/// <param name="filename">The sound file name to start playing.</param>
/// <param name="loop">Determines whether the sound loops once it's over or not.</param>
/// <returns>Returns a new instance of <see cref="ISound"/> for the sound that will be played.</returns>
ISound PlaySound(string filename, bool loop);

/// <summary>
/// Stop a sound effect.
/// </summary>
/// <param name="sound">The sound to stop playing.</param>
void StopSound(ISound sound);
/// <summary>
/// Stop a sound effect.
/// </summary>
/// <param name="sound">The sound to stop playing.</param>
void StopSound(ISound sound);

/// <summary>
/// Stop a sound effect.
/// </summary>
/// <param name="sound">The sound to stop playing.</param>
void StopSound(IMapSound sound);
/// <summary>
/// Stop a sound effect.
/// </summary>
/// <param name="sound">The sound to stop playing.</param>
void StopSound(IMapSound sound);

/// <summary>
/// Stop all currently playing sound effects.
/// </summary>
void StopAllSounds();
/// <summary>
/// Stop all currently playing sound effects.
/// </summary>
void StopAllSounds();

/// <summary>
/// Play a music track, automatically fading out the old track with the configured values.
/// </summary>
/// <param name="filename">The song file name to start playing. A blank filename will only stop the currently playing music track.</param>
/// <param name="fadein">The time (in ms) it should take to fade in the new music track.</param>
/// <param name="fadeout">The time (in ms) it should take to fade out the current music track.</param>
/// <param name="loop">Determines whether the song loops once it's over or not.</param>
void PlayMusic(string filename, int fadeout = 0, int fadein = 0, bool loop = false);
/// <summary>
/// Play a music track, automatically fading out the old track with the configured values.
/// </summary>
/// <param name="filename">The song file name to start playing. A blank filename will only stop the currently playing music track.</param>
/// <param name="fadein">The time (in ms) it should take to fade in the new music track.</param>
/// <param name="fadeout">The time (in ms) it should take to fade out the current music track.</param>
/// <param name="loop">Determines whether the song loops once it's over or not.</param>
void PlayMusic(string filename, int fadeout = 0, int fadein = 0, bool loop = false);

/// <summary>
/// Stops the current playing music track.
/// </summary>
/// <param name="fadeout">The time (in ms) it should take to fade out the current music track.</param>
void StopMusic(int fadeout = 0);
}
/// <summary>
/// Stops the current playing music track.
/// </summary>
/// <param name="fadeout">The time (in ms) it should take to fade out the current music track.</param>
void StopMusic(int fadeout = 0);
}
32 changes: 15 additions & 17 deletions Intersect.Client.Framework/Content/AssetTypeAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
namespace Intersect.Client.Framework.Content
namespace Intersect.Client.Framework.Content;


[AttributeUsage(AttributeTargets.Field)]
public partial class AssetTypeAttribute : Attribute
{

[AttributeUsage(AttributeTargets.Field)]
public partial class AssetTypeAttribute : Attribute
public AssetTypeAttribute(Type type)
{

public AssetTypeAttribute(Type type)
if (!typeof(IAsset).IsAssignableFrom(type))
{
if (!typeof(IAsset).IsAssignableFrom(type))
{
throw new ArgumentException($@"Invalid asset type {type.FullName}. Must inherit from {nameof(IAsset)}.", nameof(type));
}

if (!type.IsClass)
{
throw new ArgumentException($@"Invalid asset type {type.FullName}. Must be a class (abstract is acceptable).", nameof(type));
}

Type = type;
throw new ArgumentException($@"Invalid asset type {type.FullName}. Must inherit from {nameof(IAsset)}.", nameof(type));
}

public Type Type { get; }
if (!type.IsClass)
{
throw new ArgumentException($@"Invalid asset type {type.FullName}. Must be a class (abstract is acceptable).", nameof(type));
}

Type = type;
}

public Type Type { get; }

}
78 changes: 38 additions & 40 deletions Intersect.Client.Framework/Content/ContentTypes.cs
Original file line number Diff line number Diff line change
@@ -1,64 +1,62 @@
using Intersect.Client.Framework.Audio;
using Intersect.Client.Framework.Graphics;

namespace Intersect.Client.Framework.Content
{
namespace Intersect.Client.Framework.Content;

public enum ContentTypes
{
[AssetType(typeof(GameTexture))]
Animation,

[AssetType(typeof(GameTexture))]
Entity,
public enum ContentTypes
{
[AssetType(typeof(GameTexture))]
Animation,

[AssetType(typeof(GameTexture))]
Face,
[AssetType(typeof(GameTexture))]
Entity,

[AssetType(typeof(GameTexture))]
Fog,
[AssetType(typeof(GameTexture))]
Face,

[AssetType(typeof(GameFont))]
Font,
[AssetType(typeof(GameTexture))]
Fog,

[AssetType(typeof(GameTexture))]
Image,
[AssetType(typeof(GameFont))]
Font,

[AssetType(typeof(GameTexture))]
Interface,
[AssetType(typeof(GameTexture))]
Image,

[AssetType(typeof(GameTexture))]
Item,
[AssetType(typeof(GameTexture))]
Interface,

[AssetType(typeof(GameTexture))]
Miscellaneous,
[AssetType(typeof(GameTexture))]
Item,

[AssetType(typeof(GameAudioSource))]
Music,
[AssetType(typeof(GameTexture))]
Miscellaneous,

[AssetType(typeof(GameTexture))]
Paperdoll,
[AssetType(typeof(GameAudioSource))]
Music,

[AssetType(typeof(GameTexture))]
Resource,
[AssetType(typeof(GameTexture))]
Paperdoll,

[AssetType(typeof(GameShader))]
Shader,
[AssetType(typeof(GameTexture))]
Resource,

[AssetType(typeof(GameAudioSource))]
Sound,
[AssetType(typeof(GameShader))]
Shader,

[AssetType(typeof(GameTexture))]
Spell,
[AssetType(typeof(GameAudioSource))]
Sound,

[AssetType(typeof(GameTexture))]
TexturePack,
[AssetType(typeof(GameTexture))]
Spell,

[AssetType(typeof(GameTexture))]
TileSet,
[AssetType(typeof(GameTexture))]
TexturePack,

[Obsolete] Gui = Interface
[AssetType(typeof(GameTexture))]
TileSet,

}
[Obsolete] Gui = Interface

}
Loading

0 comments on commit bd4aea8

Please sign in to comment.