public bool Deserialize(IRaiseEventRequest req) { if (!(req.Data is object[] data)) { return(false); } var i = 0; if (!data.TryRead(out int time, ref i)) { return(false); } this.ServerTimestamp = time; if (data[i] is null) { i++; this.CurrentLevelPrefix = 0; } else if (data.TryRead(out byte prefix, ref i)) { this.CurrentLevelPrefix = prefix; } else { return(false); } var list = new List <PhotonView>(data.Length); this.PhotonViews = list; while (i < data.Length) { if (!data.TryRead(out object[] pvData, ref i)) { continue; } var j = 0; if (!pvData.TryRead(out int viewId, ref j)) { continue; } if (!this.Holder.TryGetValue(viewId, out var prefab)) { continue; } var view = new PhotonView(prefab.Master, viewId); list.Add(view); if (!view.Deserialize(pvData, ref j)) { continue; } } return(true); }
public static string ToStr(this IRaiseEventRequest info, bool isFromOp = true) { StringBuilder builder = new StringBuilder(); if (info == null) { builder.AppendLine(string.Format("IRaiseEventRequest=null")); } else { if (!isFromOp) { ToStr((IOperationRequest)info, true); } builder.AppendLine(string.Format("IRaiseEventRequest.Cache={0}", info.Cache)); builder.AppendLine(string.Format("IRaiseEventRequest.CacheSliceIndex={0}", info.CacheSliceIndex)); builder.AppendLine(string.Format("IRaiseEventRequest.Data={0}", info.Data)); builder.AppendLine(string.Format("IRaiseEventRequest.EvCode={0}", info.EvCode)); builder.AppendLine(string.Format("IRaiseEventRequest.GameId={0}", info.GameId)); builder.AppendLine(string.Format("IRaiseEventRequest.Group={0}", info.Group)); builder.AppendLine(string.Format("IRaiseEventRequest.HttpForward={0}", info.HttpForward)); builder.AppendLine(string.Format("IRaiseEventRequest.ReceiverGroup={0}", info.ReceiverGroup)); builder.AppendLine(string.Format(info.Actors.ToStr <int>("IRaiseEventRequest.Actors"))); } return(builder.ToString()); }
public bool Deserialize(IRaiseEventRequest req) { if (!(req.Data is Hashtable data)) { return(false); } if (!data.TryGetValue((byte)0, out string prefabName)) { return(false); } this.PrefabName = prefabName; if (!data.TryGetValue((byte)6, out int serverTime)) { return(false); } this.ServerTime = serverTime; if (!data.TryGetValue((byte)7, out int instantiationId)) { return(false); } this.InstantiationID = instantiationId; this.Position = data.TryGetValue <Vector3>((byte)1) ?? Vector3.Zero; this.Rotation = data.TryGetValue <Quaternion>((byte)2) ?? Quaternion.Identity; this.Group = data.TryGetValue <byte>((byte)3) ?? 0; this.ObjLevelPrefix = data.TryGetValue <byte>((byte)8) ?? 0; this.ViewIDs = data.TryGetValue <int[]>((byte)4) ?? new int[] { instantiationId }; this.IncomingInstantiationData = data.TryGetValue <object[]>((byte)5) ?? null; return(true); }
Rpc GetRPC(IRaiseEventRequest request) { IDictionary rpcData = (IDictionary)request.Data; return((Rpc)((byte)rpcData[(byte)5])); }