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
internal static Chat MainChat = null;
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 Scripting.Resources Resources=null;
@ -44,7 +44,7 @@ namespace RageCoop.Client
public Main()
{
Settings = Util.ReadSettings();
Logger=new Core.Logging.Logger()
Logger=new Logger()
{
LogPath=$"RageCoop\\RageCoop.Client.log",
UseConsole=false,

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using RageCoop.Core;
using GTA;
using GTA.Math;
using GTA.Native;
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.
/// </summary>
/// <returns></returns>
public static Core.Logging.Logger GetLogger()
public static Logger GetLogger()
{
return Main.Logger;
}

View File

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using System.Threading;
using System.Diagnostics;
namespace RageCoop.Core.Logging
namespace RageCoop.Core
{
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>
<Folder Include="Logging\" />
<Folder Include="Scripting\Events\" />
</ItemGroup>

View File

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

View File

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

View File

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