DeserializeVector2
How do I use Deserialize Vector2
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
34 | PhotonPeer.RegisterType(typeof(Vector2), (byte)'W', SerializeVector2, DeserializeVector2); | 1 |
94 | private static object DeserializeVector2(MemoryStream inStream, short length) | 2 |
File name: CustomTypes.cs
Copy
32 internal static void Register()
33 {
34 PhotonPeer.RegisterType(typeof(Vector2), (byte)'W', SerializeVector2, DeserializeVector2);
35 PhotonPeer.RegisterType(typeof(Vector3), (byte)'V', SerializeVector3, DeserializeVector3);
36 PhotonPeer.RegisterType(typeof(Quaternion), (byte)'Q', SerializeQuaternion, DeserializeQuaternion);
37 PhotonPeer.RegisterType(typeof(PhotonPlayer), (byte)'P', SerializePhotonPlayer, DeserializePhotonPlayer);
38 }
File name: CustomTypes.cs
Copy
94 private static object DeserializeVector2(MemoryStream inStream, short length)
95 {
96 Vector2 vo = new Vector2();
97 lock (memVector2)
98 {
99 inStream.Read(memVector2, 0, 2 * 4);
100 int index = 0;
101 Protocol.Deserialize(out vo.x, memVector2, ref index);
102 Protocol.Deserialize(out vo.y, memVector2, ref index);
103 }
104
105 return vo;
106 }
DeserializeVector2 91 lượt xem
Gõ tìm kiếm nhanh...