-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGreatStruct.cs
172 lines (144 loc) · 3.89 KB
/
GreatStruct.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GreatKingdomClient
{
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ReturnUserData
{
// if success 1, else 0
public int isSuccess;
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct SetClntIDData
{
public int clnt_id;
public SetClntIDData(int clnt_id)
{
this.clnt_id = clnt_id;
}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct GameRoomInfo
{
public int roomID;
public int player_num;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public int[] playerID;
//0 준비중, 1 시작, 2 종료 이런 느낌.
public int roomStatus;
public int roomStatusBefore;
//판 정보. 1차원 배열
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 9*9)]
public int[] panel;
public int passNum;
//두명 다 패스했는지
public int isCSP1;
public int isCSP2;
public override string ToString()
{
return base.ToString() + ": " + "\n{\nroomID: " + roomID + "\nplayer_num: " + player_num + "\nplayer1 ID: " + playerID[0] + "\nplayer2 ID: " + playerID[1] + "\n}\n";
}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct RoomDatas
{
public int roomNum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public GameRoomInfo[] roomInfo;
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ReturnRoomData
{
public int isSuccess;
public GameRoomInfo roomInfo;
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct BasePacketHeader
{
public UInt32 startCode;
UInt32 payloadLen;
UInt32 mainOp;
UInt32 subOP;
UInt32 flag;
UInt32 auth;
public BasePacketHeader(uint startCode, uint payloadLen, uint mainOp, uint subOP, uint flag, uint auth)
{
this.startCode = startCode;
this.payloadLen = payloadLen;
this.mainOp = mainOp;
this.subOP = subOP;
this.flag = flag;
this.auth = auth;
}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct BasePacketTrailer
{
public UInt32 endCode;
public BasePacketTrailer(uint endCode)
{
this.endCode = endCode;
}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct GetRoomData
{
Int32 offset;
public GetRoomData(int offset)
{
this.offset = offset;
}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct CreateRoomData
{
Int32 roomID;
public CreateRoomData(int roomID)
{
this.roomID = roomID;
}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct JoinRoomData
{
Int32 roomID;
public JoinRoomData(int roomID)
{
this.roomID = roomID;
}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct OutRoomData
{
Int32 roomID;
public OutRoomData(int roomID)
{
this.roomID = roomID;
}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct UpdateRoomData
{
public GameRoomInfo roomInfo;
public UpdateRoomData(GameRoomInfo roomInfo)
{
this.roomInfo = roomInfo;
}
}
}