本文整理汇总了C#中IRpcProtocol类的典型用法代码示例。如果您正苦于以下问题:C# IRpcProtocol类的具体用法?C# IRpcProtocol怎么用?C# IRpcProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRpcProtocol类属于命名空间,在下文中一共展示了IRpcProtocol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetPropertiesRequest
/// <summary>
/// Initializes a new instance of the <see cref="SetPropertiesRequest"/> class.
/// </summary>
/// <param name="protocol">
/// The protocol.
/// </param>
/// <param name="operationRequest">
/// Operation request containing the operation parameters.
/// </param>
public SetPropertiesRequest(IRpcProtocol protocol, OperationRequest operationRequest)
: base(protocol, operationRequest)
{
if (!this.IsValid)
{
return;
}
// special handling for game and actor properties send by AS3/Flash (Amf3 protocol) or JSON clients
if (protocol.ProtocolType == ProtocolType.Amf3V16 || protocol.ProtocolType == ProtocolType.Json)
{
if (this.UpdatingGameProperties)
{
Utilities.ConvertAs3WellKnownPropertyKeys(this.Properties, null);
Utilities.ConvertAs3WellKnownPropertyKeys(this.ExpectedValues, null);
}
else
{
Utilities.ConvertAs3WellKnownPropertyKeys(null, this.Properties);
Utilities.ConvertAs3WellKnownPropertyKeys(null, this.ExpectedValues);
}
}
if (this.UpdatingGameProperties)
{
this.isValid = GameParameterReader.TryGetProperties(this.Properties, out this.newMaxPlayer,
out this.newIsOpen, out this.newIsVisible,
out this.newLobbyProperties, out this.MasterClientId,
out this.ExpectedUsers, out this.errorMessage);
}
}
示例2: OutgoingMasterServerPeer
public OutgoingMasterServerPeer(IRpcProtocol protocol, IPhotonPeer nativePeer, GameApplication application)
: base(protocol, nativePeer)
{
this.application = application;
log.InfoFormat("connection to master at {0}:{1} established (id={2}), serverId={3}", this.RemoteIP, this.RemotePort, this.ConnectionId, GameApplication.ServerId);
this.RequestFiber.Enqueue(this.Register);
}
示例3: StarCollectorPeer
public StarCollectorPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
: base(protocol, unmanagedPeer)
{
#region Assigned ID
lock (allocateIDLock)
{
playerID = lastAssignedID;
lastAssignedID++;
}
//notify player of their ID
EventData evt = new EventData()
{
Code = (byte)AckEventType.AssignPlayerID,
Parameters = new Dictionary<byte, object>()
{
{ (byte)Parameter.PlayerID, this.playerID }
}
};
evt.Parameters[(byte)Parameter.PlayerID] = playerID;
this.SendEvent(evt, new SendParameters());
#endregion
#region Join to world
lock (StarCollectorGame.Instance)
{
StarCollectorGame.Instance.PeerJoined(this);
}
#endregion
}
示例4: OutgoingMasterServerPeer
public OutgoingMasterServerPeer(IRpcProtocol protocol, IPhotonPeer nativePeer, SubServer subServer)
: base(protocol, nativePeer)
{
_application = subServer;
Log.InfoFormat("connection to master at {0}:{1} established (id={2})", RemoteIP, RemotePort, ConnectionId);
RequestFiber.Enqueue(Register);
}
示例5: REPeer
public REPeer(IRpcProtocol rpcprotocol, IPhotonPeer nativePeer, REServer serverApplication)
: base(rpcprotocol,nativePeer)
{
guid = Guid.NewGuid();
server = serverApplication;
server.wandererDictionary.Add(guid, this);
}
示例6: ChatPeer
public ChatPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
: base(protocol, unmanagedPeer)
{
lock (syncRoot)
{
BroadcastMessage += this.OnBroadcastMessage;
}
}
示例7: LatencyPeer
public LatencyPeer(IRpcProtocol protocol, IPhotonPeer nativePeer)
: base(protocol, nativePeer)
{
if (log.IsDebugEnabled)
{
log.DebugFormat("Latency monitoring client connected, serverId={0}", GameApplication.ServerId);
}
}
示例8: GetPropertiesRequest
/// <summary>
/// Initializes a new instance of the <see cref = "GetPropertiesRequest" /> class.
/// </summary>
/// <param name = "protocol">
/// The protocol.
/// </param>
/// <param name = "operationRequest">
/// Operation request containing the operation parameters.
/// </param>
public GetPropertiesRequest(IRpcProtocol protocol, OperationRequest operationRequest)
: base(protocol, operationRequest)
{
// special treatment for game and actor properties sent by AS3/Flash or JSON clients
if (protocol.ProtocolType == ProtocolType.Amf3V16 || protocol.ProtocolType == ProtocolType.Json)
{
Utilities.ConvertAs3WellKnownPropertyKeys(this.GamePropertyKeys, this.ActorPropertyKeys);
}
}
示例9: ServerPeer
/// <summary>
/// 类型:方法
/// 名称:ServerPeer
/// 作者:taixihuase
/// 作用:构造 ServerPeer 对象
/// 编写日期:2015/7/12
/// </summary>
/// <param name="protocol"></param>
/// <param name="unmanagedPeer"></param>
/// <param name="server"></param>
public ServerPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer, ServerApplication server)
: base(protocol, unmanagedPeer)
{
PeerGuid = Guid.NewGuid();
Server = server;
// 将当前 peer 加入连线列表
Server.Users.AddConnectedPeer(PeerGuid, this);
}
示例10: MmoPeer
public MmoPeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer)
: base(rpcProtocol, nativePeer)
{
// this is the operation handler before entering a world
this.SetCurrentOperationHandler(this);
#region PopBloop
string configFile = Path.Combine(DbSettings.BinaryPath, "PopBloopServer.config");
if (File.Exists(configFile))
{
using (StreamReader reader = new StreamReader(configFile))
{
string line = reader.ReadLine();
if (line.Length > 1)
{
string[] config = line.Split('@');
string address = config[1];
string username = config[0];
if (address.Trim().Length > 1 && address.Contains(":"))
{
DbSettings.DBServerAddress = address;
log.Info("DBServerAddress: " + address);
}
if (username.Trim().Length > 1 && username.Contains(":"))
{
string[] credentials = username.Split(':');
if (credentials.Length == 2)
{
DbSettings.DBServerUsername = credentials[0];
DbSettings.DBServerPassword = credentials[1];
log.Info("DBUserName: " + credentials[0] + ", DBPassword: " + credentials[1]);
}
else
{
log.Error("No credentials found on PopBloopServer.config");
}
}
else
{
log.Info("Credentials Invalid: '" + username +"'");
}
}
}
}
#endregion
}
示例11: JoinGameRequest
/// <summary>
/// Initializes a new instance of the <see cref="JoinGameRequest"/> class.
/// </summary>
/// <param name="protocol">
/// The protocol.
/// </param>
/// <param name="operationRequest">
/// Operation request containing the operation parameters.
/// </param>
public JoinGameRequest(IRpcProtocol protocol, OperationRequest operationRequest)
: base(protocol, operationRequest)
{
if (!this.IsValid)
{
return;
}
// special treatment for game and actor properties sent by AS3/Flash or JSON clients
var protocolId = protocol.ProtocolType;
if (protocolId == ProtocolType.Amf3V16 || protocolId == ProtocolType.Json)
{
Utilities.ConvertAs3WellKnownPropertyKeys(this.GameProperties, this.ActorProperties);
}
this.SetupRequest();
}
示例12: ActorPeer
public ActorPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
: base(protocol, unmanagedPeer)
{
#region Assigned ID
lock (allocateIDLock)
{
playerID = lastAssignedID;
lastAssignedID++;
}
#endregion
#region Join to Arena
lock (ServerArena.Instance)
{
ServerArena.Instance.Enter(this);
}
#endregion
}
示例13: LatencyMonitor
public LatencyMonitor(
IRpcProtocol protocol, IPhotonPeer nativePeer, byte operationCode, int maxHistoryLength, int intervalMs, WorkloadController workloadController)
: base(protocol, nativePeer)
{
this.operationCode = operationCode;
this.intervalMs = intervalMs;
this.workloadController = workloadController;
this.latencyHistory = new ValueHistory(maxHistoryLength);
this.averageLatencyMs = 0;
this.lastLatencyMs = 0;
log.InfoFormat("{1} connection for latency monitoring established (id={0}), serverId={2}", this.ConnectionId, this.NetworkProtocol, GameApplication.ServerId);
if (!Stopwatch.IsHighResolution)
{
log.InfoFormat("No hires stopwatch!");
}
this.pingTimer = this.RequestFiber.ScheduleOnInterval(this.Ping, 0, this.intervalMs);
}
示例14: PhotonAckPeer
public PhotonAckPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
: base(protocol, unmanagedPeer)
{
lock (lockPlayerID)
{
this.playerID = lastAssignedPlayerID;
lastAssignedPlayerID++;
}
PhotonAckGame.Instance.PeerConnected(this);
EventData evn = new EventData((byte)AckEventType.AssignPlayerID)
{
Parameters = new Dictionary<byte, object>()
{
{ (byte)Parameter.PlayerID, this.playerID }
}
};
Console.WriteLine("PhotonAckPeer PlayerID: " + this.playerID);
this.SendEvent(evn,new SendParameters());
Console.WriteLine("PhotonAckPeer SendEvent");
}
示例15: RemoveGameEvent
public RemoveGameEvent(IRpcProtocol protocol, IEventData eventData)
: base(protocol, eventData.Parameters)
{
}