using Photon.SocketServer;
using Photon.SocketServer.Rpc;
using PhotonHostRuntimeInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChatServer
{
: base(protocol, peer) {
}
{
public ChatPeer( IRpcProtocol protocol, IPhotonPeer peer)
: base(new InitRequest (protocol, peer))
{
}
protected override void OnDisconnect(PhotonHostRuntimeInterfaces.DisconnectReason reasonCode, string reasonDetail)
{
throw new NotImplementedException();
}
//当客户端发起请求的时候调用
protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
{
//这个方法用来给客户端响应
Dictionary<byte, object> dict = new Dictionary<byte, object>();
dict.Add(1, "siki");
OperationResponse response = new OperationResponse(1, dict);
SendOperationResponse(response, sendParameters);
}
}
}
using Photon.SocketServer.Rpc;
using PhotonHostRuntimeInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChatServer
{
//这个用来跟客户端进行通信
//4.0版本此处是继承peer 而3.4是继承peerbase
//3.4版本的
class ChatPeer : PeerBase {
public ChatPeer(IRpcProtocol protocol, IPhotonPeer peer): base(protocol, peer) {
}
//4.0版本的
class ChatPeer : Peer{
public ChatPeer( IRpcProtocol protocol, IPhotonPeer peer)
: base(new InitRequest (protocol, peer))
{
}
protected override void OnDisconnect(PhotonHostRuntimeInterfaces.DisconnectReason reasonCode, string reasonDetail)
{
throw new NotImplementedException();
}
//当客户端发起请求的时候调用
protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
{
//这个方法用来给客户端响应
Dictionary<byte, object> dict = new Dictionary<byte, object>();
dict.Add(1, "siki");
OperationResponse response = new OperationResponse(1, dict);
SendOperationResponse(response, sendParameters);
}
}
}