Skip to content

Commit a64ac3c

Browse files
committed
feat: Rename socket classes
1 parent 70d35ee commit a64ac3c

File tree

13 files changed

+32
-33
lines changed

13 files changed

+32
-33
lines changed

Assets/JCSUnity/Scripts/Managers/JCS_NetworkManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private void Test()
6363
bytesSend[2] = (byte)'l';
6464
bytesSend[3] = (byte)'L';
6565
bytesSend[4] = (byte)'o';
66-
JCS_NetworkSettings.GetGameSocket().SendPacket(bytesSend);
66+
JCS_NetworkSettings.GetSocket().SendPacket(bytesSend);
6767
}
6868

6969
if (JCS_Input.GetKeyDown(KeyCode.O))
@@ -79,7 +79,7 @@ private void Test()
7979
bytesSend[7] = (byte)',';
8080
bytesSend[8] = (byte)'.';
8181
bytesSend[9] = (byte)'/';
82-
JCS_NetworkSettings.GetGameSocket().SendPacket(bytesSend);
82+
JCS_NetworkSettings.GetSocket().SendPacket(bytesSend);
8383
}
8484

8585
}

Assets/JCSUnity/Scripts/Network/Interface/JCS_GameSocket.cs renamed to Assets/JCSUnity/Scripts/Network/Interface/JCS_Socket.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* $File: JCS_GameSocket.cs $
2+
* $File: JCS_Socket.cs $
33
* $Date: 2017-08-31 16:01:58 $
44
* $Revision: $
55
* $Creator: Jen-Chieh Shen $
@@ -12,7 +12,7 @@ namespace JCSUnity
1212
/// <summary>
1313
/// Socket Interface.
1414
/// </summary>
15-
public interface JCS_GameSocket
15+
public interface JCS_Socket
1616
{
1717
/// <summary>
1818
/// Connect to the server.

Assets/JCSUnity/Scripts/Network/Interface/JCS_GameSocket.cs.meta renamed to Assets/JCSUnity/Scripts/Network/Interface/JCS_Socket.cs.meta

File renamed without changes.

Assets/JCSUnity/Scripts/Network/JCS_PacketLostPreventer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ protected override void TransferData(JCS_PacketLostPreventer _old, JCS_PacketLos
161161
/// </summary>
162162
private void TrackPacket()
163163
{
164-
if (JCS_NetworkSettings.GetGameSocket() != null &&
165-
!JCS_NetworkSettings.GetGameSocket().IsConnected())
164+
if (JCS_NetworkSettings.GetSocket() != null &&
165+
!JCS_NetworkSettings.GetSocket().IsConnected())
166166
return;
167167

168168
mResendTimer += Time.unscaledDeltaTime;
@@ -200,7 +200,7 @@ already responded. */
200200
JCS_Packet packet = mWaitingPackets[index];
201201

202202
// re-send the packet
203-
JCS_NetworkSettings.GetGameSocket().SendPacket(packet.GetBytes());
203+
JCS_NetworkSettings.GetSocket().SendPacket(packet.GetBytes());
204204
}
205205
}
206206

Assets/JCSUnity/Scripts/Network/JCS_TCPGameSocket.cs renamed to Assets/JCSUnity/Scripts/Network/JCS_TCPSocket.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* $File: JCS_TCPGameSocket.cs $
2+
* $File: JCS_TCPSocket.cs $
33
* $Date: 2017-08-21 16:38:46 $
44
* $Revision: $
55
* $Creator: Jen-Chieh Shen $
@@ -16,7 +16,7 @@ namespace JCSUnity
1616
/// <summary>
1717
/// Socket Descriptor holder.
1818
/// </summary>
19-
public class JCS_TCPGameSocket : JCS_GameSocket
19+
public class JCS_TCPSocket : JCS_Socket
2020
{
2121
/* Variables */
2222

@@ -43,7 +43,7 @@ public void SetHandler(JCS_ClientHandler handler)
4343

4444
/* Functions */
4545

46-
public JCS_TCPGameSocket(JCS_ClientHandler handler = null)
46+
public JCS_TCPSocket(JCS_ClientHandler handler = null)
4747
{
4848
if (handler != null)
4949
SetHandler(handler);

Assets/JCSUnity/Scripts/Network/JCS_TCPGameSocket.cs.meta renamed to Assets/JCSUnity/Scripts/Network/JCS_TCPSocket.cs.meta

File renamed without changes.

Assets/JCSUnity/Scripts/Network/JCS_UDPGameSocket.cs renamed to Assets/JCSUnity/Scripts/Network/JCS_UDPSocket.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* $File: JCS_UDPGameSocket.cs $
2+
* $File: JCS_UDPSocket.cs $
33
* $Date: 2017-08-30 18:20:10 $
44
* $Revision: $
55
* $Creator: Jen-Chieh Shen $
@@ -16,7 +16,7 @@ namespace JCSUnity
1616
/// <summary>
1717
/// UDP Socket.
1818
/// </summary>
19-
public class JCS_UDPGameSocket : JCS_GameSocket
19+
public class JCS_UDPSocket : JCS_Socket
2020
{
2121
/* Variables */
2222

@@ -43,7 +43,7 @@ public void SetHandler(JCS_ClientHandler handler)
4343

4444
/* Functions */
4545

46-
public JCS_UDPGameSocket(JCS_ClientHandler handler = null)
46+
public JCS_UDPSocket(JCS_ClientHandler handler = null)
4747
{
4848
if (handler != null)
4949
SetHandler(handler);

Assets/JCSUnity/Scripts/Network/JCS_UDPGameSocket.cs.meta renamed to Assets/JCSUnity/Scripts/Network/JCS_UDPSocket.cs.meta

File renamed without changes.

Assets/JCSUnity/Scripts/Settings/JCS_NetworkSettings.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class JCS_NetworkSettings : JCS_Settings<JCS_NetworkSettings>
5151
[Tooltip("Channel count in this game.")]
5252
public int CHANNEL_COUNT = 1;
5353

54-
private static JCS_GameSocket GAME_SOCKET = null;
54+
private static JCS_Socket SOCKET = null;
5555
private static JCS_ClientHandler PRESET_CLIENT_HANDLER = null;
5656

5757
private JCS_ServerRequestProcessor mServerRequestProcessor = null;
@@ -97,8 +97,7 @@ public static bool CreateNetwork(string hostname, int port)
9797
return CreateNetwork(hostname, port, GetPresetClientHandler());
9898
}
9999

100-
/// <returns></returns>
101-
/// /// <summary>
100+
/// <summary>
102101
/// Create the socket and connect to the host and
103102
/// port provided.
104103
/// </summary>
@@ -108,18 +107,18 @@ public static bool CreateNetwork(string hostname, int port)
108107
/// <returns> Sucess or vice versa. </returns>
109108
public static bool CreateNetwork(string hostname, int port, JCS_ClientHandler handler)
110109
{
111-
if (GAME_SOCKET != null)
110+
if (SOCKET != null)
112111
return false;
113112

114113
if (instance.PROTOCAL_TYPE == JCS_ProtocalType.TCP)
115114
{
116-
GAME_SOCKET = new JCS_TCPGameSocket(handler);
117-
GAME_SOCKET.Connect(hostname, port);
115+
SOCKET = new JCS_TCPSocket(handler);
116+
SOCKET.Connect(hostname, port);
118117
}
119118
else if (instance.PROTOCAL_TYPE == JCS_ProtocalType.UDP)
120119
{
121-
GAME_SOCKET = new JCS_UDPGameSocket(handler);
122-
GAME_SOCKET.Connect(hostname, port);
120+
SOCKET = new JCS_UDPSocket(handler);
121+
SOCKET.Connect(hostname, port);
123122
}
124123

125124
return true;
@@ -130,20 +129,20 @@ public static bool CreateNetwork(string hostname, int port, JCS_ClientHandler ha
130129
/// </summary>
131130
public static void CloseSocket()
132131
{
133-
if (GAME_SOCKET == null)
132+
if (SOCKET == null)
134133
return;
135134

136-
GAME_SOCKET.Close();
137-
GAME_SOCKET = null;
135+
SOCKET.Close();
136+
SOCKET = null;
138137
}
139138

140139
/// <summary>
141-
/// Return the Game socket we are using.
140+
/// Return the socket we are using.
142141
/// </summary>
143142
/// <returns> socket. </returns>
144-
public static JCS_GameSocket GetGameSocket()
143+
public static JCS_Socket GetSocket()
145144
{
146-
return GAME_SOCKET;
145+
return SOCKET;
147146
}
148147

149148
/// <summary>

docs/ScriptReference/Network/Interface/JCS_GameSocket.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)