-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathEngineTypes.cs
More file actions
183 lines (137 loc) · 4.2 KB
/
EngineTypes.cs
File metadata and controls
183 lines (137 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Engine.Networking {
// Enums
public enum EngineNetworkType {
NETWORK_ONLINE,
NETWORK_LOCAL
}
public enum EngineNetworkConnectionType {
NETWORK_CONNECTION_BROADBAND = 0,
NETWORK_CONNECTION_MOBILE = 1
}
// Data Classes
public class BaseData {
public string uuid { get; set; }
public BaseData() {
Reset();
}
public virtual void Reset() {
uuid = "";
}
}
public class BaseMeta : BaseData {
public string name { get; set; }
public string code { get; set; }
public string value { get; set; }
public BaseMeta() {
Reset();
}
public override void Reset() {
name = "";
code = "";
value = "";
base.Reset();
}
}
public class BaseMetaDetail : BaseMeta {
public string status { get; set; }
public DateTime dateModified { get; set; }
public DateTime dateCreated { get; set; }
public BaseMetaDetail() {
Reset();
}
public override void Reset() {
status = "";
dateModified = DateTime.Now;
dateCreated = DateTime.Now;
base.Reset();
}
}
/*
* useNat Does this server require NAT punchthrough?
gameType The type of the game (like "MyUniqueGameType")
gameName The name of the game (like John Doe's Game)
connectedPlayers Currently connected players
playerLimit Maximum players limit
ip Server IP address
port Server port
passwordProtected Does the server require a password?
comment A miscellaneous comment (can hold data)
guid The GUID of the host, needed when connecting with NAT punchthrough
* */
public class EngineNetworkSession {
public string useNat { get; set; }
public string gameType { get; set; }
public string gameName { get; set; }
public int connectedPlayers { get; set; }
public int playerLimit { get; set; }
public string serverEndpoint { get; set; }
public int serverPort { get; set; }
public string passwordProtected { get; set; }
public string comment { get; set; }
public string guid { get; set; }
public EngineNetworkSession() {
Reset();
}
public void Reset() {
useNat = "";
gameType = "";
gameName = "";
connectedPlayers = 0;
playerLimit = 0;
serverEndpoint = "";
serverPort = 0;
passwordProtected = "";
comment = "";
guid = "";
}
}
public class EngineNetworkPlayerAttribute : BaseMetaDetail {
public EngineNetworkPlayerAttribute() {
Reset();
}
public override void Reset() {
base.Reset();
}
}
public class EngineNetworkInfo {
public string endpointCode;
public string endpointPort;
public EngineNetworkInfo() {
Reset();
}
public void Reset() {
endpointCode = "";
endpointPort = "";
}
}
public class EngineNetworkId {
public string id;
public string username;
public string networkId;
public EngineNetworkId() {
Reset();
}
public void Reset() {
id = "";
username = "";
networkId = ""; // gamecenter, openfeint, facebook, blackbox, steam, etc...
}
}
public class EngineNetworkPlayer {
public EngineNetworkId networkId = new EngineNetworkId();
public EngineNetworkInfo networkInfo = new EngineNetworkInfo();
public Dictionary<string, EngineNetworkPlayerAttribute> playerAttributes = new Dictionary<string, EngineNetworkPlayerAttribute>();
public EngineNetworkPlayer() {
Reset();
}
public void Reset() {
networkId = new EngineNetworkId();
networkInfo = new EngineNetworkInfo();
playerAttributes.Clear();
}
}
}