//C42525D7DE28CE4CFB44651F3D03A50D.5B9DDD8F4DF9A88D297B3B0B3B79FBAA public void ReplaceWorldJoin() { try { var netManager = GetNetworkManager(); var controlHandlerField = BaseObject.GetEntityFieldValue(netManager, NetworkManagerControlHandlerField); Dictionary <int, object> controlHandlers = UtilityFunctions.ConvertDictionary <int>(controlHandlerField); var worldJoinField = controlHandlers[0]; //FAD031AB4FED05B9FE273ACD199496EE FieldInfo worldJoinDelegateField = worldJoinField.GetType().GetField(NetworkingOnWorldRequestField); MulticastDelegate action = (MulticastDelegate)worldJoinDelegateField.GetValue(worldJoinField); m_onWorldRequest = action; m_onWorldRequestType = worldJoinDelegateField.FieldType.GetGenericArguments()[0]; MethodInfo removeMethod = controlHandlerField.GetType().GetMethod("Remove"); removeMethod.Invoke(controlHandlerField, new object[] { 0 }); ThreadPool.QueueUserWorkItem((state) => { OnWorldRequestReplace(state); }); } catch (Exception ex) { } }
//.5B9DDD8F4DF9A88D297B3B0B3B79FBAA public void ReplaceWorldJoin( ) { try { var netManager = GetNetworkManager( ); var controlHandlerField = BaseObject.GetEntityFieldValue(netManager, NetworkManagerControlHandlerField); Dictionary <int, object> controlHandlers = UtilityFunctions.ConvertDictionary <int>(controlHandlerField); MethodInfo removeMethod = controlHandlerField.GetType( ).GetMethod("Remove"); removeMethod.Invoke(controlHandlerField, new object[] { 0 }); ThreadPool.QueueUserWorkItem((state) => { OnWorldRequestReplace(state); }); // Garbage is below as I tried to create a generic delegate and put it into the command handling dictionary. It's not // as straightforward as it seems. I can get the type, object, generic types, but I can't seem to create a delegate // that matches the what they have in game without it throwing an error /* * var worldJoinField = controlHandlers[0]; * //=brsw3F6mys5AacUJHYIS14TVH2= * * FieldInfo worldJoinDelegateField = worldJoinField.GetType().GetField(NetworkingOnWorldRequestField); * MulticastDelegate action = (MulticastDelegate)worldJoinDelegateField.GetValue(worldJoinField); * Type worldJoinDelegateType = worldJoinDelegateField.FieldType; * Type worldJoinDelegateGenericType = worldJoinDelegateType.GetGenericTypeDefinition(); * MethodInfo method = typeof(NetworkManager).GetMethod("WorldTest"); * method = method.MakeGenericMethod(worldJoinDelegateGenericType); * Delegate.CreateDelegate(worldJoinDelegateType, method); */ //worldJoinDelegateField.SetValue(worldJoinField, Delegate.CreateDelegate(worldJoinDelegateType, typeof(NetworkManager).GetMethod("WorldTest"))); //object newWorlDJoinDelegate = Activator.CreateInstance(worldJoinDelegateType, new object[] { //MulticastDelegate action = (MulticastDelegate)worldJoinDelegateField.GetValue(worldJoinField); //action.Method = typeof(NetworkManager).GetMethod("WorldTest", BindingFlags.Public); //m_onWorldRequest = action; //m_onWorldRequestType = worldJoinDelegateField.FieldType.GetGenericArguments()[0]; //action.Method = // this.RegisterControlMessage<MyControlWorldRequestMsg>(MyControlMessageEnum.WorldRequest, new ControlMessageHandler<MyControlWorldRequestMsg>(this.OnWorldRequest)); /* * Type controlMessageHandlerType = SandboxGameAssemblyWrapper.Instance.GetAssemblyType(MultiplayerNamespace, MyControlMessageHandlerClass); * * var worldJoinField = controlHandlers[0]; * FieldInfo worldJoinDelegateField = worldJoinField.GetType().GetField(NetworkingOnWorldRequestField); * Type worldJoinDelegateType = worldJoinDelegateField.FieldType; * Type worldJoinDelegateGenericType = worldJoinDelegateType.GetGenericTypeDefinition(); * * var instance = Activator.CreateInstance(controlMessageHandlerType, new object[] { Delegate.CreateDelegate(typeof(object), typeof(NetworkManager).GetMethod("WorldTest")) as worldJoinDelegateType }); */ //object controlMessageHandler = } catch (Exception ex) { } }
// -- protected Dictionary <long, Object> InternalGetPlayerItemMapping() { try { Object rawPlayerItemMapping = BaseObject.GetEntityFieldValue(BackingObject, PlayerMapGetPlayerItemMappingField); Dictionary <long, Object> allPlayersMapping = UtilityFunctions.ConvertDictionary <long>(rawPlayerItemMapping); return(allPlayersMapping); } catch (Exception ex) { ApplicationLog.BaseLog.Error(ex); return(new Dictionary <long, Object>()); } }
protected Dictionary <long, Object> InternalGetPlayerItemMappping() { try { Object rawPlayerItemMapping = BaseObject.InvokeEntityMethod(BackingObject, PlayerMapGetPlayerItemMappingMethod); Dictionary <long, Object> allPlayersMapping = UtilityFunctions.ConvertDictionary <long>(rawPlayerItemMapping); return(allPlayersMapping); } catch (Exception ex) { LogManager.ErrorLog.WriteLine(ex); return(new Dictionary <long, Object>()); } }