Move PlayerData to RageCoop.Client, remove RageCoop.Core.Logging

This commit is contained in:
Sardelka
2022-06-22 08:58:36 +08:00
parent 1a5f594b36
commit a15785a02f
9 changed files with 39 additions and 43 deletions

View File

@ -33,7 +33,7 @@ namespace RageCoop.Client
#endif #endif
internal static Chat MainChat = null; internal static Chat MainChat = null;
internal static Stopwatch Counter = new Stopwatch(); internal static Stopwatch Counter = new Stopwatch();
internal static Core.Logging.Logger Logger = null; internal static Logger Logger = null;
internal static ulong Ticked = 0; internal static ulong Ticked = 0;
internal static Scripting.Resources Resources=null; internal static Scripting.Resources Resources=null;
@ -44,7 +44,7 @@ namespace RageCoop.Client
public Main() public Main()
{ {
Settings = Util.ReadSettings(); Settings = Util.ReadSettings();
Logger=new Core.Logging.Logger() Logger=new Logger()
{ {
LogPath=$"RageCoop\\RageCoop.Client.log", LogPath=$"RageCoop\\RageCoop.Client.log",
UseConsole=false, UseConsole=false,

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using RageCoop.Core;
using GTA; using GTA;
using GTA.Math;
using GTA.Native; using GTA.Native;
namespace RageCoop.Client namespace RageCoop.Client
@ -93,4 +93,29 @@ namespace RageCoop.Client
} }
} }
public class PlayerData
{
public string Username { get; internal set; }
/// <summary>
/// Universal character ID.
/// </summary>
public int PedID
{
get; internal set;
}
/// <summary>
/// The ID of player's last vehicle.
/// </summary>
public int VehicleID { get; internal set; }
public Vector3 Position { get; internal set; }
/// <summary>
/// Player Latency in second.
/// </summary>
public float Latency { get; internal set; }
public int Health { get; internal set; }
}
} }

View File

@ -120,7 +120,7 @@ namespace RageCoop.Client.Scripting
/// Get a <see cref="Core.Logging.Logger"/> that RAGECOOP is currently using. /// Get a <see cref="Core.Logging.Logger"/> that RAGECOOP is currently using.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static Core.Logging.Logger GetLogger() public static Logger GetLogger()
{ {
return Main.Logger; return Main.Logger;
} }

View File

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using System.Threading; using System.Threading;
using System.Diagnostics; using System.Diagnostics;
namespace RageCoop.Core.Logging namespace RageCoop.Core
{ {
public class Logger :IDisposable public class Logger :IDisposable
{ {

View File

@ -1,33 +0,0 @@
using System.Linq;
using System.Runtime.CompilerServices;
using GTA.Math;
[assembly: InternalsVisibleTo("RageCoop.Server")]
[assembly: InternalsVisibleTo("RageCoop.Client")]
namespace RageCoop.Core
{
public class PlayerData
{
public string Username { get; internal set; }
/// <summary>
/// Universal character ID.
/// </summary>
public int PedID
{
get; internal set;
}
/// <summary>
/// The ID of player's last vehicle.
/// </summary>
public int VehicleID { get; internal set; }
public Vector3 Position { get;internal set; }
/// <summary>
/// Player Latency in second.
/// </summary>
public float Latency { get; internal set; }
public int Health { get; internal set; }
}
}

View File

@ -32,6 +32,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Logging\" />
<Folder Include="Scripting\Events\" /> <Folder Include="Scripting\Events\" />
</ItemGroup> </ItemGroup>

View File

@ -4,7 +4,10 @@ using System.Text;
using System.Reflection; using System.Reflection;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("RageCoop.Server")]
[assembly: InternalsVisibleTo("RageCoop.Client")]
namespace RageCoop.Core.Scripting namespace RageCoop.Core.Scripting
{ {
internal class Resource internal class Resource
@ -24,8 +27,8 @@ namespace RageCoop.Core.Scripting
}; };
protected List<Resource> LoadedResources = new List<Resource>(); protected List<Resource> LoadedResources = new List<Resource>();
private string BaseScriptType; private string BaseScriptType;
public Logging.Logger Logger { get; set; } public Logger Logger { get; set; }
public ResourceLoader(string baseType,Logging.Logger logger) public ResourceLoader(string baseType,Logger logger)
{ {
BaseScriptType = baseType; BaseScriptType = baseType;
Logger = logger; Logger = logger;

View File

@ -9,10 +9,10 @@ namespace RageCoop.Server
class Program class Program
{ {
public static bool ReadyToStop = false; public static bool ReadyToStop = false;
public static Core.Logging.Logger Logger; public static Core.Logger Logger;
static void Main(string[] args) static void Main(string[] args)
{ {
Logger=new Core.Logging.Logger() Logger=new Core.Logger()
{ {
LogPath="RageCoop.Server.log", LogPath="RageCoop.Server.log",
UseConsole=true, UseConsole=true,

View File

@ -259,7 +259,7 @@ namespace RageCoop.Server.Scripting
handlers.Add(handler); handlers.Add(handler);
} }
} }
public static Core.Logging.Logger GetLogger() public static Logger GetLogger()
{ {
return Program.Logger; return Program.Logger;
} }