2022-10-23 19:02:39 +08:00
|
|
|
|
using GTA;
|
|
|
|
|
using RageCoop.Core;
|
|
|
|
|
using RageCoop.Core.Scripting;
|
2022-07-01 12:22:31 +08:00
|
|
|
|
|
|
|
|
|
namespace RageCoop.Client.Scripting
|
2022-05-31 02:16:12 -08:00
|
|
|
|
{
|
2022-05-31 19:35:01 -08:00
|
|
|
|
/// <summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
/// Inherit from this class, constructor will be called automatically, but other scripts might have yet been loaded,
|
|
|
|
|
/// you should use <see cref="OnStart" />. to initiate your script.
|
2022-05-31 19:35:01 -08:00
|
|
|
|
/// </summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
public abstract class ClientScript : Script
|
2022-05-31 02:16:12 -08:00
|
|
|
|
{
|
2022-06-12 15:39:32 +08:00
|
|
|
|
/// <summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
/// Get the <see cref="ResourceFile" /> instance where this script is loaded from.
|
2022-06-12 15:39:32 +08:00
|
|
|
|
/// </summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
public ResourceFile CurrentFile { get; internal set; }
|
2022-06-12 15:39:32 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
/// Get the <see cref="ClientResource" /> that this script belongs to.
|
2022-06-12 15:39:32 +08:00
|
|
|
|
/// </summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
public ClientResource CurrentResource { get; internal set; }
|
2022-07-01 12:22:31 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
/// Eqivalent of <see cref="ClientResource.Logger" /> in <see cref="CurrentResource" />
|
2022-07-01 12:22:31 +08:00
|
|
|
|
/// </summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
public Logger Logger => CurrentResource.Logger;
|
2022-06-12 15:39:32 +08:00
|
|
|
|
|
2022-07-02 11:23:12 +08:00
|
|
|
|
/// <summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
/// This method would be called from main thread, right after all script constructors are invoked.
|
2022-07-02 11:23:12 +08:00
|
|
|
|
/// </summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
public abstract void OnStart();
|
2022-07-02 11:23:12 +08:00
|
|
|
|
|
2022-07-14 16:44:35 +08:00
|
|
|
|
/// <summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
/// This method would be called from main thread right before the whole <see cref="System.AppDomain" /> is unloded but
|
|
|
|
|
/// prior to <see cref="GTA.Script.Aborted" />.
|
2022-07-14 16:44:35 +08:00
|
|
|
|
/// </summary>
|
2022-10-23 19:02:39 +08:00
|
|
|
|
public abstract void OnStop();
|
2022-05-31 02:16:12 -08:00
|
|
|
|
}
|
2022-10-23 19:02:39 +08:00
|
|
|
|
}
|