Merge branch 'master' of github.com:Saltosion/Cyber

This commit is contained in:
excitedneon 2017-05-11 22:31:13 +03:00
commit 7abde0d4cf
2 changed files with 18 additions and 2 deletions

View File

@ -62,8 +62,8 @@ namespace Cyber.Networking.Clientside {
/// Send messages to the server if the connection is active. /// Send messages to the server if the connection is active.
/// If client is not active, this will return false, otherwise true. /// If client is not active, this will return false, otherwise true.
/// </summary> /// </summary>
/// <param name="msgType"></param> /// <param name="msgType">The message type.</param>
/// <param name="message"></param> /// <param name="message">The message contents.</param>
/// <returns>Weather the send was successful or not.</returns> /// <returns>Weather the send was successful or not.</returns>
public static bool Send(short msgType, MessageBase message) { public static bool Send(short msgType, MessageBase message) {
if (Singleton.Running) { if (Singleton.Running) {
@ -75,6 +75,14 @@ namespace Cyber.Networking.Clientside {
} }
} }
/// <summary>
/// Sends messages to the server by a specified channel.
/// If the client is not active, this will return false, otherwise true.
/// </summary>
/// <param name="msgType">The message type.</param>
/// <param name="message">The message contents.</param>
/// <param name="channelID">The ID of the channel to be used.</param>
/// <returns></returns>
public static bool SendByChannel(short msgType, MessageBase message, byte channelID) { public static bool SendByChannel(short msgType, MessageBase message, byte channelID) {
if (Singleton.Running) { if (Singleton.Running) {
Singleton.NetClient.SendByChannel(msgType, message, channelID); Singleton.NetClient.SendByChannel(msgType, message, channelID);

View File

@ -6,11 +6,19 @@ using UnityEngine;
using UnityEngine.Networking; using UnityEngine.Networking;
namespace Cyber.Networking.Serverside { namespace Cyber.Networking.Serverside {
/// <summary>
/// The Server sync handler handles sync packets coming from the client, see <see cref="PktType.ClientSync"/>.
/// </summary>
public class ServerSyncHandler { public class ServerSyncHandler {
private Dictionary<int, int> LastSyncIDReceived = new Dictionary<int, int>(); private Dictionary<int, int> LastSyncIDReceived = new Dictionary<int, int>();
private Dictionary<int, SConnectedPlayer> Players; private Dictionary<int, SConnectedPlayer> Players;
/// <summary>
/// Creates a nwe Server Sync handler for handling sync packets that are coming from the client.
/// </summary>
/// <param name="players"></param>
public ServerSyncHandler(Dictionary<int, SConnectedPlayer> players) { public ServerSyncHandler(Dictionary<int, SConnectedPlayer> players) {
Players = players; Players = players;
} }