internal static void SetObjects(Dictionary <string, object> objects) { MBAPI._objects = objects; MBAPI.IMBTestRun = MBAPI.GetObject <IMBTestRun>(); MBAPI.IMBActionSet = MBAPI.GetObject <IMBActionSet>(); MBAPI.IMBAgent = MBAPI.GetObject <IMBAgent>(); MBAPI.IMBAnimation = MBAPI.GetObject <IMBAnimation>(); MBAPI.IMBDelegate = MBAPI.GetObject <IMBDelegate>(); MBAPI.IMBItem = MBAPI.GetObject <IMBItem>(); MBAPI.IMBEditor = MBAPI.GetObject <IMBEditor>(); MBAPI.IMBMission = MBAPI.GetObject <IMBMission>(); MBAPI.IMBMultiplayerData = MBAPI.GetObject <IMBMultiplayerData>(); MBAPI.IMouseManager = MBAPI.GetObject <IMouseManager>(); MBAPI.IMBNetwork = MBAPI.GetObject <IMBNetwork>(); MBAPI.IMBPeer = MBAPI.GetObject <IMBPeer>(); MBAPI.IMBSkeletonExtensions = MBAPI.GetObject <IMBSkeletonExtensions>(); MBAPI.IMBGameEntityExtensions = MBAPI.GetObject <IMBGameEntityExtensions>(); MBAPI.IMBScreen = MBAPI.GetObject <IMBScreen>(); MBAPI.IMBSoundEvent = MBAPI.GetObject <IMBSoundEvent>(); MBAPI.IMBVoiceManager = MBAPI.GetObject <IMBVoiceManager>(); MBAPI.IMBTeam = MBAPI.GetObject <IMBTeam>(); MBAPI.IMBWorld = MBAPI.GetObject <IMBWorld>(); MBAPI.IInput = MBAPI.GetObject <IInput>(); MBAPI.IMBMessageManager = MBAPI.GetObject <IMBMessageManager>(); MBAPI.IMBWindowManager = MBAPI.GetObject <IMBWindowManager>(); MBAPI.IMBDebugExtensions = MBAPI.GetObject <IMBDebugExtensions>(); MBAPI.IMBGame = MBAPI.GetObject <IMBGame>(); MBAPI.IMBFaceGen = MBAPI.GetObject <IMBFaceGen>(); MBAPI.IMBMapScene = MBAPI.GetObject <IMBMapScene>(); MBAPI.IMBBannerlordChecker = MBAPI.GetObject <IMBBannerlordChecker>(); MBAPI.IMBAgentVisuals = MBAPI.GetObject <IMBAgentVisuals>(); MBAPI.IMBBannerlordTableauManager = MBAPI.GetObject <IMBBannerlordTableauManager>(); MBAPI.IMBBannerlordConfig = MBAPI.GetObject <IMBBannerlordConfig>(); }
private void OnInitialize() { Type[] types = AssemblyLoader.LoadFrom(this.ManagedCallbacksDll).GetTypes(); Type type1 = (Type)null; foreach (Type type2 in types) { if (((IEnumerable <Type>)type2.GetInterfaces()).Contains <Type>(typeof(ICallbackManager))) { type1 = type2; break; } } CoreManaged._callbackManager = type1.GetConstructor(new Type[0]).Invoke(new object[0]) as ICallbackManager; CoreManaged._callbackManager.Initialize(); Delegate[] delegates = CoreManaged._callbackManager.GetDelegates(); for (int index = 0; index < delegates.Length; ++index) { try { CoreManaged.PassManagedCoreCallbackMethodPointers(delegates[index]); } catch (Exception ex) { CoreManaged.PassManagedCoreCallbackMethodPointers((Delegate)null); // ISSUE: variable of a boxed type __Boxed <int> local = (ValueType)index; Console.WriteLine(ex.ToString() + " " + (object)local); } } MBAPI.SetObjects(CoreManaged._callbackManager.GetScriptingInterfaceObjects()); Module.CreateModule(); }