2023-08-17 17:16:32 -04:00
|
|
|
using BattleBitAPI.Common;
|
2023-08-14 13:15:32 -04:00
|
|
|
using BattleBitAPI.Server;
|
2023-08-14 05:43:58 -04:00
|
|
|
|
|
|
|
namespace BattleBitAPI.Server
|
2023-08-01 15:11:52 -04:00
|
|
|
{
|
2023-08-11 04:04:47 -04:00
|
|
|
public class GamemodeRotation<TPlayer> where TPlayer : Player<TPlayer>
|
2023-08-01 15:11:52 -04:00
|
|
|
{
|
2023-08-11 04:04:47 -04:00
|
|
|
private GameServer<TPlayer>.Internal mResources;
|
|
|
|
public GamemodeRotation(GameServer<TPlayer>.Internal resources)
|
2023-08-01 15:11:52 -04:00
|
|
|
{
|
|
|
|
mResources = resources;
|
|
|
|
}
|
|
|
|
|
|
|
|
public IEnumerable<string> GetGamemodeRotation()
|
|
|
|
{
|
2023-08-11 04:04:47 -04:00
|
|
|
lock (mResources._GamemodeRotation)
|
|
|
|
return new List<string>(mResources._GamemodeRotation);
|
2023-08-01 15:11:52 -04:00
|
|
|
}
|
|
|
|
public bool InRotation(string gamemode)
|
|
|
|
{
|
2023-08-11 04:04:47 -04:00
|
|
|
lock (mResources._GamemodeRotation)
|
|
|
|
return mResources._GamemodeRotation.Contains(gamemode);
|
2023-08-01 15:11:52 -04:00
|
|
|
}
|
|
|
|
public bool RemoveFromRotation(string gamemode)
|
|
|
|
{
|
2023-08-11 04:04:47 -04:00
|
|
|
lock (mResources._GamemodeRotation)
|
|
|
|
if (!mResources._GamemodeRotation.Remove(gamemode))
|
2023-08-01 15:11:52 -04:00
|
|
|
return false;
|
2023-08-11 07:44:54 -04:00
|
|
|
mResources.IsDirtyGamemodeRotation = true;
|
2023-08-01 15:11:52 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
public bool AddToRotation(string gamemode)
|
|
|
|
{
|
2023-08-11 04:04:47 -04:00
|
|
|
lock (mResources._GamemodeRotation)
|
|
|
|
if (!mResources._GamemodeRotation.Add(gamemode))
|
2023-08-01 15:11:52 -04:00
|
|
|
return false;
|
2023-08-11 07:44:54 -04:00
|
|
|
mResources.IsDirtyGamemodeRotation = true;
|
2023-08-01 15:11:52 -04:00
|
|
|
return true;
|
|
|
|
}
|
2023-08-14 05:43:58 -04:00
|
|
|
public void SetRotation(params string[] gamemodes)
|
|
|
|
{
|
|
|
|
lock (mResources._GamemodeRotation)
|
|
|
|
{
|
|
|
|
mResources._GamemodeRotation.Clear();
|
|
|
|
foreach (var item in gamemodes)
|
|
|
|
mResources._GamemodeRotation.Add(item);
|
|
|
|
}
|
|
|
|
mResources.IsDirtyGamemodeRotation = true;
|
|
|
|
}
|
|
|
|
public void ClearRotation()
|
|
|
|
{
|
|
|
|
lock (mResources._GamemodeRotation)
|
|
|
|
{
|
|
|
|
if (mResources._GamemodeRotation.Count == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
mResources._GamemodeRotation.Clear();
|
|
|
|
}
|
|
|
|
mResources.IsDirtyGamemodeRotation = true;
|
|
|
|
}
|
2023-08-11 04:04:47 -04:00
|
|
|
|
|
|
|
public void Reset()
|
|
|
|
{
|
|
|
|
}
|
2023-08-01 15:11:52 -04:00
|
|
|
}
|
|
|
|
}
|