我正在为一个学校项目创建一个基于photon的纸牌游戏,但是idk如何发送struct消息,包括structs卡片和手,有人能解决我的问题吗?有必要使用Photon.RegysterType()吗?我试图找到一些东西,但我没有找到太多,关于使用Photon.RegysterType()序列化自定义类型的光子文档我也不是很了解。
感谢您的回答:)
下面是结构体的列表:
struct card
{
internal string suit;
internal string value;
}
struct Hand
{
internal card[] hand;
internal bool[] FinishedCards;
}
struct Message
{
internal Hand Local, Remote;
internal List Table, Deck;
internal List StackLocal, StackRemote;
}发布于 2019-04-18 18:14:58
Here is one way:
[Serializable]
struct card
{
public string suit;
public string value;
}
[Serializable]
struct Hand
{
public card[] hand;
public bool[] FinishedCards;
}
[Serializable]
struct Message
{
public Hand Local, Remote;
public List<card> Table, Deck;
public List<card> StackLocal, StackRemote;
}
...
view.RPC(nameof(RPCAcceptHand),Photon.Pun.RpcTarget.All,JsonUtility.ToJson(m) );https://stackoverflow.com/questions/49894530
复制相似问题