예제 #1
0
        public void TestInstantiationDataSerialzation()
        {
            var data = new InstantiationData(
                new object[2] {
                SyncTokenType.Player,
                new List <string> {
                    "syncPos", "True", "syncRot", "False"
                }
            });

            Debug.Log($"data:{data.ToString()} {data.Count} {data.ToData().Length}");

            var ty = (SyncTokenType)data.ToData()[0];

            Debug.Log($"data SyncTokenType:{ty}");
            var li = (List <string>)data.ToData()[1];

            Debug.Log($"data List<string>:{li}");
            foreach (var ll in li)
            {
                Debug.Log($"<string>:{ll}");
            }

            var data2 = new InstantiationData(data.ToData());

            Debug.Log($"data2 Objectify:{data2.ToString()} {data2.Count} {data2.ToData().Length}");

            var data3 = InstantiationData.Build(data.ToString());

            data3.Add("k3", "v3");
            Debug.Log($"data3 Stringify:{data3.ToString()} {data3.Count} {data3.ToData().Length}");

            var data4 = InstantiationData.Build(SyncTokenType.Player);

            data4.Add("k1", "v1");
            data4.Add("k2", "v2");
            data4.Add("k3", "v3");
            data4.Add("k4", "v4");
            Debug.Log($"data4 Stringify:{data4.ToString()} {data4.Count} {data4.ToData().Length}");
        }
예제 #2
0
 public void Init(InstantiationData data)
 {
     if (photonView.Owner == null)
     {
         Debug.Log($"InRoomObject:{photonView.ViewID} OwnedByRoom");
     }
     else if (photonView.IsMine)
     {
         Debug.Log($"I({PhotonNetwork.LocalPlayer.UserId}) Own {photonView.ViewID}" + photonView.Owner.ToStringFull());
     }
     else
     {
         // deal with photonView.InstantiationData
         Debug.Log($"{photonView.ViewID} TryLoadData with data {data.ToString()}");
     }
 }