EOSp2p
Namespace: SynicSugar.P2P
Description
This is used by ILPostProcesser.
Basically, this is not intended to be used by Library user.
If we add the network attribute to a method and a field, We can also call these directly.
This 1st arg's byte is ConnectHub.CHANNELLIST.METHOD_OR_VARIABLE. 2nd arg's byte[] is serialized by MemoryPack.
Properity
API | description |
---|---|
SendPacketToAll | Send packets to all remote peers |
SendPacket | Send a packet to a specific peer |
using SynicSugar.P2P;
using MemoryPack;
[NetworkPlayer] //For [Rpc]
public class p2pSample {
void HandSend(){
EOSp2p.SendPacketToAll((byte)ConnectHub.CHANNELLIST.RPCFuction, MemoryPack.MemoryPackSerializer.Serialize(3)).Forget();
}
[Rpc] //Then, SourceGenerator add "RPCFuction" to enum ConnectHub.CHANNELLIST.
void RPCFuction(int value){
}
}