This repository has been archived by the owner on Dec 18, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
877aca5
commit 1e44d1a
Showing
24 changed files
with
223 additions
and
123 deletions.
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace NextShip.Manager; | ||
|
||
public class BanManager : Manager<BanManager> | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using NextShip.RPC; | ||
using NextShip.Utilities; | ||
|
||
/* using static NextShip.Roles.RoleInfo; */ | ||
namespace NextShip.Manager; | ||
|
||
namespace NextShip.HistoryManager; | ||
|
||
public static class HistoryInfoManager | ||
{ | ||
public static Dictionary<byte, List<HistoryInfo>> HistoryInfoDc = new(); | ||
public static Dictionary<byte, int> SerialNumber = new(); | ||
|
||
public static void Add(this PlayerControl player, RoleTeam team, RoleId roleId, bool isRpc, int number = 0) | ||
{ | ||
if (!HistoryInfoDc.ContainsKey(player.PlayerId) && number != 0) SerialNumber[player.PlayerId] = 0; | ||
if (number != 0) SerialNumber[player.PlayerId] = number; | ||
if (!isRpc) | ||
RPCUtils.Create((byte)CustomRPC.HistorySynchronization, | ||
new[] { player.PlayerId, (byte)roleId, (byte)team }, new[] { SerialNumber[player.PlayerId] }); | ||
var info = new HistoryInfo(SerialNumber[player.PlayerId], team, roleId, DateTime.Now); | ||
HistoryInfoDc[player.PlayerId].Add(info); | ||
SerialNumber[player.PlayerId]++; | ||
} | ||
|
||
public class HistoryInfo | ||
{ | ||
public static int Number; | ||
public static RoleTeam Team; | ||
public static RoleId Role; | ||
public static DateTime Time; | ||
|
||
public HistoryInfo(int number, RoleTeam team, RoleId role, DateTime time) | ||
{ | ||
Number = number; | ||
Team = team; | ||
Role = role; | ||
Time = time; | ||
} | ||
} | ||
} | ||
|
||
public class TeamHistoryManager | ||
{ | ||
public static RoleTeam OldTeam; | ||
public static RoleTeam NewTeam; | ||
|
||
/* public static void Start() | ||
{ | ||
OldTeam = RoleHelpers.GetRoleInfo(CachedPlayer.LocalPlayer.PlayerControl).team; | ||
NewTeam = OldTeam; | ||
} */ | ||
|
||
public static void Update() | ||
{ | ||
if (NewTeam != OldTeam) CachedPlayer.LocalPlayer.PlayerControl.Add(NewTeam, RoleHistoryManager.NewRole, false); | ||
} | ||
} | ||
|
||
public class RoleHistoryManager | ||
public class HistoryInfoManager : Manager<HistoryInfoManager> | ||
{ | ||
public static RoleId OldRole; | ||
public static RoleId NewRole; | ||
|
||
/* public static void Start() | ||
{ | ||
OldRole = RoleHelpers.GetRoleInfo(CachedPlayer.LocalPlayer.PlayerControl).roleId; | ||
NewRole = OldRole; | ||
} */ | ||
|
||
public static void Update() | ||
{ | ||
if (NewRole != OldRole) CachedPlayer.LocalPlayer.PlayerControl.Add(TeamHistoryManager.NewTeam, NewRole, false); | ||
} | ||
|
||
} | ||
|
||
public class DeathInfoManager | ||
{ | ||
public class DeadPlayer | ||
{ | ||
public DeathReason DeathReason; | ||
public PlayerControl Murderer; | ||
public PlayerControl player; | ||
public DateTime TimeOfDeath; | ||
|
||
public DeadPlayer(PlayerControl player, DateTime TimeOfDeath, DeathReason DeathReason, PlayerControl Murderer) | ||
{ | ||
this.player = player; | ||
this.TimeOfDeath = TimeOfDeath; | ||
this.DeathReason = DeathReason; | ||
this.Murderer = Murderer; | ||
} | ||
|
||
private enum CustomDeathReason | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace NextShip.Manager; | ||
|
||
public class HistoryManager : Manager<HistoryManager> | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace NextShip.Manager; | ||
|
||
public class Manager<T> where T : new() | ||
{ | ||
protected static T _instance; | ||
|
||
public static T Instance => Get(); | ||
|
||
public static T Get() => _instance ??= new T(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace NextShip.Manager; | ||
|
||
public class VersionManager : Manager<VersionManager> | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using UnityEngine; | ||
|
||
namespace NextShip; | ||
|
||
public class ShipVersion | ||
{ | ||
public int Major { get; protected set; } | ||
public int Minor { get; protected set; } | ||
public int Info { get; protected set; } | ||
|
||
public string StringText { get; protected set; } | ||
|
||
internal ShipVersion() { } | ||
|
||
public ShipVersion(int major, int minor, int info) | ||
{ | ||
Major = major; | ||
Minor = minor; | ||
Info = info; | ||
} | ||
|
||
public void set(int major, int minor, int info) | ||
{ | ||
Major = major; | ||
Minor = minor; | ||
Info = info; | ||
} | ||
} | ||
|
||
public class AmongUsVersion : ShipVersion | ||
{ | ||
public int Year { get; protected set; } | ||
public int Month { get; protected set; } | ||
public int Day { get; protected set; } | ||
public int Revision { get; protected set; } | ||
|
||
public AmongUsVersion(int major, int minor, int info) : base(major, minor, info) | ||
{ | ||
} | ||
|
||
internal AmongUsVersion() {} | ||
|
||
internal AmongUsVersion Form() | ||
{ | ||
return new AmongUsVersion(); | ||
} | ||
|
||
public AmongUsVersion AmongUsSet(int year, int month, int day, int revision = 0) | ||
{ | ||
Year = year; | ||
Month = month; | ||
Day = day; | ||
Revision = revision; | ||
return this; | ||
} | ||
|
||
internal static AmongUsVersion GetFormConstants() => | ||
new AmongUsVersion().AmongUsSet(Constants.Year, Constants.Month, Constants.Day, Constants.Revision); | ||
|
||
internal static string GetBuildVersion() => Application.version; | ||
|
||
public static int GetVersion(int year, int month, int day, int rev) => | ||
year * 25000 + month * 1800 + day * 50 + rev; | ||
|
||
public static explicit operator string(AmongUsVersion Ver) | ||
{ | ||
if (Ver.Major == 0 || Ver.Minor == 0 || Ver.Info == 0) return string.Empty; | ||
return $"{Ver.Major}.{Ver.Minor}.{Ver.Day}"; | ||
} | ||
|
||
public static explicit operator int(AmongUsVersion Ver) | ||
{ | ||
if (Ver.Year == 0 || Ver.Month == 0 || Ver.Day == 0) return 0; | ||
return GetVersion(Ver.Year, Ver.Month, Ver.Day, Ver.Revision); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.