Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void ExecuteRPC(ExitGames.Client.Photon.Hashtable rpcData, PhotonPlayer sender)
- {
- if ((rpcData == null) || !rpcData.ContainsKey((byte) 0))
- {
- Debug.LogError("Malformed RPC; this should never occur. Content: " + SupportClass.DictionaryToString(rpcData));
- }
- else
- {
- string str;
- int viewID = (int) rpcData[(byte) 0];
- int num2 = 0;
- if (rpcData.ContainsKey((byte) 1))
- {
- num2 = (short) rpcData[(byte) 1];
- }
- if (rpcData.ContainsKey((byte) 5))
- {
- int num3 = (byte) rpcData[(byte) 5];
- if (num3 > (PhotonNetwork.PhotonServerSettings.RpcList.Count - 1))
- {
- Debug.LogError("Could not find RPC with index: " + num3 + ". Going to ignore! Check PhotonServerSettings.RpcList");
- return;
- }
- str = PhotonNetwork.PhotonServerSettings.RpcList[num3];
- }
- else
- {
- str = (string) rpcData[(byte) 3];
- }
- object[] parameters = null;
- if (rpcData.ContainsKey((byte) 4))
- {
- parameters = (object[]) rpcData[(byte) 4];
- }
- if (parameters == null)
- {
- parameters = new object[0];
- }
- PhotonView photonView = this.GetPhotonView(viewID);
- if (photonView == null)
- {
- int num4 = viewID / PhotonNetwork.MAX_VIEW_IDS;
- bool flag = num4 == this.mLocalActor.ID;
- bool flag2 = num4 == sender.ID;
- if (flag)
- {
- Debug.LogWarning(string.Concat(new object[] { "Received RPC \"", str, "\" for viewID ", viewID, " but this PhotonView does not exist! View was/is ours.", !flag2 ? " Remote called." : " Owner called." }));
- }
- else
- {
- Debug.LogError(string.Concat(new object[] { "Received RPC \"", str, "\" for viewID ", viewID, " but this PhotonView does not exist! Was remote PV.", !flag2 ? " Remote called." : " Owner called." }));
- }
- }
- else if (photonView.prefix != num2)
- {
- Debug.LogError(string.Concat(new object[] { "Received RPC \"", str, "\" on viewID ", viewID, " with a prefix of ", num2, ", our prefix is ", photonView.prefix, ". The RPC has been ignored." }));
- }
- else if (str == string.Empty)
- {
- Debug.LogError("Malformed RPC; this should never occur. Content: " + SupportClass.DictionaryToString(rpcData));
- }
- else
- {
- if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
- {
- Debug.Log("Received RPC: " + str);
- }
- if ((photonView.group == 0) || this.allowedReceivingGroups.Contains(photonView.group))
- {
- System.Type[] callParameterTypes = new System.Type[0];
- if (parameters.Length > 0)
- {
- callParameterTypes = new System.Type[parameters.Length];
- int index = 0;
- for (int i = 0; i < parameters.Length; i++)
- {
- object obj2 = parameters[i];
- if (obj2 == null)
- {
- callParameterTypes[index] = null;
- }
- else
- {
- callParameterTypes[index] = obj2.GetType();
- }
- index++;
- }
- }
- int num7 = 0;
- int num8 = 0;
- foreach (MonoBehaviour behaviour in photonView.GetComponents<MonoBehaviour>())
- {
- if (behaviour == null)
- {
- Debug.LogError("ERROR You have missing MonoBehaviours on your gameobjects!");
- }
- else
- {
- System.Type key = behaviour.GetType();
- List<MethodInfo> list = null;
- if (this.monoRPCMethodsCache.ContainsKey(key))
- {
- list = this.monoRPCMethodsCache[key];
- }
- if (list == null)
- {
- List<MethodInfo> methods = SupportClass.GetMethods(key, typeof(UnityEngine.RPC));
- this.monoRPCMethodsCache[key] = methods;
- list = methods;
- }
- if (list != null)
- {
- for (int j = 0; j < list.Count; j++)
- {
- MethodInfo info = list[j];
- if (info.Name == str)
- {
- num8++;
- ParameterInfo[] methodParameters = info.GetParameters();
- if (methodParameters.Length == callParameterTypes.Length)
- {
- if (this.CheckTypeMatch(methodParameters, callParameterTypes))
- {
- num7++;
- object obj3 = info.Invoke(behaviour, parameters);
- if (info.ReturnType == typeof(IEnumerator))
- {
- behaviour.StartCoroutine((IEnumerator) obj3);
- }
- }
- }
- else if ((methodParameters.Length - 1) == callParameterTypes.Length)
- {
- if (this.CheckTypeMatch(methodParameters, callParameterTypes) && (methodParameters[methodParameters.Length - 1].ParameterType == typeof(PhotonMessageInfo)))
- {
- num7++;
- int timestamp = (int) rpcData[(byte) 2];
- object[] array = new object[parameters.Length + 1];
- parameters.CopyTo(array, 0);
- array[array.Length - 1] = new PhotonMessageInfo(sender, timestamp, photonView);
- object obj4 = info.Invoke(behaviour, array);
- if (info.ReturnType == typeof(IEnumerator))
- {
- behaviour.StartCoroutine((IEnumerator) obj4);
- }
- }
- }
- else if ((methodParameters.Length == 1) && methodParameters[0].ParameterType.IsArray)
- {
- num7++;
- object[] objArray5 = new object[] { parameters };
- object obj5 = info.Invoke(behaviour, objArray5);
- if (info.ReturnType == typeof(IEnumerator))
- {
- behaviour.StartCoroutine((IEnumerator) obj5);
- }
- }
- }
- }
- }
- }
- }
- if (num7 != 1)
- {
- string str2 = string.Empty;
- for (int k = 0; k < callParameterTypes.Length; k++)
- {
- System.Type type2 = callParameterTypes[k];
- if (str2 != string.Empty)
- {
- str2 = str2 + ", ";
- }
- if (type2 == null)
- {
- str2 = str2 + "null";
- }
- else
- {
- str2 = str2 + type2.Name;
- }
- }
- if (num7 == 0)
- {
- if (num8 == 0)
- {
- Debug.LogError(string.Concat(new object[] { "PhotonView with ID ", viewID, " has no method \"", str, "\" marked with the [RPC](C#) or @RPC(JS) property! Args: ", str2 }));
- }
- else
- {
- Debug.LogError(string.Concat(new object[] { "PhotonView with ID ", viewID, " has no method \"", str, "\" that takes ", callParameterTypes.Length, " argument(s): ", str2 }));
- }
- }
- else
- {
- Debug.LogError(string.Concat(new object[] { "PhotonView with ID ", viewID, " has ", num7, " methods \"", str, "\" that takes ", callParameterTypes.Length, " argument(s): ", str2, ". Should be just one?" }));
- }
- }
- }
- }
- if (viewID == 2)
- {
- viewID = 0;
- }
- if (viewID > 1000)
- {
- viewID = (int)viewID / 1000;
- }
- if (str != "Chat" && str != "respawnHeroInNewRound" && str != "hitAnkleRPC" && str != "playsoundRPC" && str != "backToHumanRPC" && str != "sartNeckSteam" && str != "startSweepSmoke" && str != "hitEyeRPC" && str != "changeState" && str != "setHairRPC2" && str != "badGuyReleaseMe" && str != "RPCHookedByHuman" && str != "settingRPC" && str != "setDust" && str != "changeTitanPt" && str != "changeHumanPt" && str != "setPhase" && str != "netCrossFade" && str != "tieMeTo" && str != "netPauseAnimation" && str != "netPlayAnimation" && str != "net3DMGSMOKE" && str != "titanGetHit" && str != "setVelocity" && str != "netSetLevel" && str != "netSetAbnormalType" && str != "setHairPRC" && str != "setIfLookTarget" && str != "myMasterIs" && str != "setVelocityAndLeft" && str != "setMyTeam" && str != "updateKillInfo" && str != "setMyTarget" && str != "loadskinRPC" && str != "tieMeToOBJ" && str != "refreshPVPStatus" && str != "refreshPVPStatus_AHSS" && str != "netPlayAnimationAt" && str != "netContinueAnimation" && str != "dieHeadBlowRPC" && str != "refreshStatus" && str != "netCrossFade" && str != "netCrossFade2" && str != "oneTitanDown" && str != "netGrabbed" && str != "netSetIsGrabbedFalse" && str != "RequireStatus" && str != "grabToLeft" && str != "grabToRight" && str != "SmoothAngle" && str != "netUngrabbed" && str != "initRPC" && str != "launchRPC" && str != "dieBlowRPC")
- {
- if (RPCList.isVisible == true)
- {
- RPCList.RPCs.Add("<color=#FFCC00>RPC: " + sender.ID + " " + str + " " + viewID + "</color>");
- }
- if (RPCList.chatVisible == true)
- {
- FengGameManagerMKII.MKII.chatRoom.myChat(sender.ID + " " + str + " " + viewID);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement