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); }
/// <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); } }
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 }
public REPeer(IRpcProtocol rpcprotocol, IPhotonPeer nativePeer, REServer serverApplication) : base(rpcprotocol,nativePeer) { guid = Guid.NewGuid(); server = serverApplication; server.wandererDictionary.Add(guid, this); }
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); }
public ChatPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer) : base(protocol, unmanagedPeer) { lock (syncRoot) { BroadcastMessage += this.OnBroadcastMessage; } }
public LatencyPeer(IRpcProtocol protocol, IPhotonPeer nativePeer) : base(protocol, nativePeer) { if (log.IsDebugEnabled) { log.DebugFormat("Latency monitoring client connected, serverId={0}", GameApplication.ServerId); } }
/// <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); } }
/// <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); }
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: "******", DBPassword: "******"No credentials found on PopBloopServer.config"); } } else { log.Info("Credentials Invalid: '" + username +"'"); } } } } #endregion }
/// <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(); }
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 }
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); }
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"); }
/// <summary> /// Initializes a new instance of the <see cref="SetViewDistance"/> class. /// </summary> /// <param name="protocol"> /// The protocol. /// </param> /// <param name="request"> /// The request. /// </param> public SetViewDistance(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
public DeleteCharacter(IRpcProtocol protocol, GameOperationRequest request) : base(protocol, request) { }
public EnterServer(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
public DummyPeer(IRpcProtocol protocol, string username) { this.protocol = protocol; this.username = username; this.connectionId = Interlocked.Increment(ref connectionIds); }
public TestHivePeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer, string userId) : this(rpcProtocol, nativePeer) { this.UserId = userId; }
public AuthenticateUpdateEvent(IRpcProtocol protocol, IEventData eventData) : base(protocol, eventData.Parameters) { }
public AuthenticateRequest(IRpcProtocol protocol, OperationRequest operationRequest) : base(protocol, operationRequest) { }
public EnterWorkshop(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
public UseInventorySlot(IRpcProtocol protocol, GameOperationRequest request) : base(protocol, request) { }
public LeaveRequest(IRpcProtocol protocol, OperationRequest operationRequest) : base(protocol, operationRequest) { }
public RequestServerID(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
public FireBullet(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
public JoinLobbyRequest(IRpcProtocol protocol, OperationRequest operationRequest) : base(protocol, operationRequest) { }
public MmoPeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer) : base(rpcProtocol, nativePeer) { // this is the operation handler before entering a world this.SetCurrentOperationHandler(this); }
/// <summary> /// Initializes a new instance of the <see cref="CreateWorld"/> class. /// </summary> /// <param name="protocol"> /// The protocol. /// </param> /// <param name="request"> /// The request. /// </param> public CreateWorld(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
public RegisterSubServer(IRpcProtocol rpcProtocol, OperationRequest operationRequest) : base(rpcProtocol, operationRequest) { }
public AddActionbarSpell(IRpcProtocol protocol, GameOperationRequest request) : base(protocol, request) { }
/// <summary> /// Initializes a new instance of the <see cref="T:Photon.SocketServer.InitResponse"/> class. /// </summary> /// <param name="applicationId">The application id.</param> /// <param name="protocol">The rpc Protocol.</param> internal InitResponse(string applicationId, IRpcProtocol protocol) { this.applicationId = applicationId; this.protocol = protocol; }
public ChangeGroups(IRpcProtocol protocol, OperationRequest operationRequest) : base(protocol, operationRequest) { }
public SubscribeItem(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
public GetMailBoxOperationRequest(IRpcProtocol protocol, OperationRequest operationRequest) : base(protocol, operationRequest) { }
public AddSession(IRpcProtocol protocol, IEventData eventData) : base(protocol, eventData.Parameters) { }
public UpdateGameEvent(IRpcProtocol protocol, IEventData eventData) : base(protocol, eventData.Parameters) { }
public TestHivePeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer, string userId) : this(rpcProtocol, nativePeer) { this.UserId = userId; }
public MyEchoRequest(IRpcProtocol protocol, OperationRequest operationRequest) : base(protocol, operationRequest) { }
public SetPropertiesRequest(IRpcProtocol protocol, OperationRequest operationRequest) : base(protocol, operationRequest) { }
public SendChat(IRpcProtocol protocol, GameOperationRequest request) : base(protocol, request) { }
public CreateGameRequest(IRpcProtocol protocol, OperationRequest operationRequest) : base(protocol, operationRequest) { }
public RegisterSubServer(IRpcProtocol rpcProtocol, OperationRequest operationRequest) : base(rpcProtocol, operationRequest) { }
public SubscribeCounter(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
public PokerPeer(PokerApplication pokerApplication,IRpcProtocol protocol, IPhotonPeer unmanagedPeer) : base(pokerApplication,protocol, unmanagedPeer) { RegisterHandler<VoiceDataMessage>(ReceiveVoiceData); }
public GetLobbyStatsRequest(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
public MyPeer(IRpcProtocol rpcProtocol, IPhotonPeer peer) : base(rpcProtocol, peer) { }
public TestHivePeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer) : this(new InitRequest(rpcProtocol, nativePeer)) { }
public TestHivePeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer) : this(new InitRequest(rpcProtocol, nativePeer)) { }
public BowAutoAttackRequest(string actionSource, IRpcProtocol protocol, OperationRequest request) : base(actionSource, protocol, request) { }
/// <summary> /// Initializes a new instance of the <see cref = "LitePeer" /> class. /// </summary> /// <param name = "rpcProtocol"> /// The rpc protocol. /// </param> /// <param name = "nativePeer"> /// The native peer. /// </param> public LitePeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer) : base(rpcProtocol, nativePeer) { }
public ItemDequipOperation(IRpcProtocol protocol, IMessage message) : base(protocol, new OperationRequest(message.Code, message.Parameters)) { }
public RemoveGameEvent(IRpcProtocol protocol, IEventData eventData) : base(protocol, eventData.Parameters) { }
public RegisterGameServerResponse(IRpcProtocol protocol, OperationResponse response) : base(protocol, response.Parameters) { }
public ExitRequest(IRpcProtocol protocol, OperationRequest operationRequest) : base(protocol, operationRequest) { }
public CreateGhost(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
/// <summary> /// Initializes a new instance of the <see cref="DestroyItem"/> class. /// </summary> /// <param name="protocol"> /// The protocol. /// </param> /// <param name="request"> /// The request. /// </param> public DestroyItem(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
/// <summary> /// Initializes a new instance of the <see cref="Move"/> class. /// </summary> /// <param name="protocol"> /// The protocol. /// </param> /// <param name="request"> /// The request. /// </param> public Move(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
public Login(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }
/// <summary> /// Initializes a new instance of the <see cref="DetachInterestArea"/> class. /// </summary> /// <param name="protocol"> /// The protocol. /// </param> /// <param name="request"> /// The request. /// </param> public DetachInterestArea(IRpcProtocol protocol, OperationRequest request) : base(protocol, request) { }