Skip to content

Commit 9c94ee2

Browse files
committed
Update
1 parent 9b62418 commit 9c94ee2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+5752
-400
lines changed

.gitignore

Lines changed: 4 additions & 398 deletions
Large diffs are not rendered by default.

AcPlugins/AcServerPlugin.cs

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
using System;
2+
using AcTools.ServerPlugin.DynamicConditions.AcPlugins.Info;
3+
using AcTools.ServerPlugin.DynamicConditions.AcPlugins.Messages;
4+
5+
namespace AcTools.ServerPlugin.DynamicConditions.AcPlugins {
6+
public interface IAcServerPlugin : IDisposable {
7+
string GetName();
8+
9+
void OnInit(AcServerPluginManager manager);
10+
11+
void OnConnected();
12+
13+
void OnDisconnected();
14+
15+
/// <summary>
16+
/// Handler for commands.
17+
/// </summary>
18+
/// <returns>Returns true if command was handled.</returns>
19+
bool OnCommandEntered(string cmd);
20+
21+
#region Handlers for raw acServer messages
22+
void OnSessionInfo(MsgSessionInfo msg);
23+
24+
void OnNewSession(MsgSessionInfo msg);
25+
26+
void OnSessionEnded(MsgSessionEnded msg);
27+
28+
void OnNewConnection(MsgNewConnection msg);
29+
30+
void OnConnectionClosed(MsgConnectionClosed msg);
31+
32+
void OnCarInfo(MsgCarInfo msg);
33+
34+
void OnCarUpdate(MsgCarUpdate msg);
35+
36+
void OnCollision(MsgClientEvent msg);
37+
38+
void OnLapCompleted(MsgLapCompleted msg);
39+
40+
void OnClientLoaded(MsgClientLoaded msg);
41+
42+
void OnChatMessage(MsgChat msg);
43+
44+
void OnProtocolVersion(MsgVersionInfo msg);
45+
46+
void OnServerError(MsgError msg);
47+
#endregion Event handlers for raw acServer messages
48+
49+
#region Handlers for events refined by PluginManager
50+
/// <summary>
51+
/// This is triggered after all realtime reports per interval have arrived - they are now
52+
/// up-to-date and can be accessed via the DriverInfo mechanics
53+
/// </summary>
54+
void OnBulkCarUpdateFinished();
55+
56+
void OnLapCompleted(LapInfo msg);
57+
58+
void OnCollision(IncidentInfo msg);
59+
60+
void OnCarUpdate(DriverInfo driverInfo);
61+
62+
void OnAcServerTimeout();
63+
64+
void OnAcServerAlive();
65+
#endregion Handlers for events refined by PluginManager
66+
}
67+
68+
public class AcServerPlugin : IAcServerPlugin {
69+
protected AcServerPluginManager PluginManager { get; private set; }
70+
71+
public virtual string GetName() {
72+
return GetType().Name;
73+
}
74+
75+
void IAcServerPlugin.OnInit(AcServerPluginManager manager) {
76+
PluginManager = manager;
77+
OnInit();
78+
}
79+
80+
public virtual void OnInit() { }
81+
82+
public virtual void OnConnected() { }
83+
84+
public virtual void OnDisconnected() { }
85+
86+
public virtual bool OnCommandEntered(string cmd) {
87+
return false;
88+
}
89+
90+
public virtual void OnSessionInfo(MsgSessionInfo msg) { }
91+
92+
public virtual void OnNewSession(MsgSessionInfo msg) { }
93+
94+
public virtual void OnSessionEnded(MsgSessionEnded msg) { }
95+
96+
public virtual void OnNewConnection(MsgNewConnection msg) { }
97+
98+
public virtual void OnConnectionClosed(MsgConnectionClosed msg) { }
99+
100+
public virtual void OnCarInfo(MsgCarInfo msg) { }
101+
102+
public virtual void OnCarUpdate(MsgCarUpdate msg) { }
103+
104+
public virtual void OnCollision(MsgClientEvent msg) { }
105+
106+
public virtual void OnLapCompleted(MsgLapCompleted msg) { }
107+
108+
public virtual void OnClientLoaded(MsgClientLoaded msg) { }
109+
110+
public virtual void OnChatMessage(MsgChat msg) { }
111+
112+
public virtual void OnProtocolVersion(MsgVersionInfo msg) { }
113+
114+
public virtual void OnServerError(MsgError msg) { }
115+
116+
public virtual void OnBulkCarUpdateFinished() { }
117+
118+
public virtual void OnLapCompleted(LapInfo msg) { }
119+
120+
public virtual void OnCollision(IncidentInfo msg) { }
121+
122+
public virtual void OnCarUpdate(DriverInfo driverInfo) { }
123+
124+
public virtual void OnAcServerTimeout() { }
125+
126+
public virtual void OnAcServerAlive() { }
127+
128+
public virtual void Dispose() { }
129+
}
130+
}

0 commit comments

Comments
 (0)