private static void onSendResultBuffer(ulong objectId, [MarshalAs(20)] string function, int result, IntPtr buffer, int len) { ApolloObject apolloObject = ApolloObjectManager.Instance.dictObjectCollection[objectId]; if (apolloObject != null && function != null) { Type type = apolloObject.GetType(); MethodInfo method = type.GetMethod(function, 16777276, null, new Type[] { typeof(int), typeof(byte[]) }, null); if (method != null) { byte[] array = new byte[len]; if (buffer != IntPtr.Zero && len > 0) { Marshal.Copy(buffer, array, 0, len); } method.Invoke(apolloObject, new object[] { result, array }); } else { ADebug.LogError("onSendResultBuffer not exist method:" + function + " " + type.get_FullName()); } } else { ADebug.LogError("onSendResultBuffer:" + objectId + " do not exist"); } }
private static void onSendBuffer(ulong objectId, [MarshalAs(UnmanagedType.LPStr)] string function, IntPtr buffer, int len) { ApolloObject obj2 = Instance.dictObjectCollection[objectId]; if ((obj2 != null) && (function != null)) { System.Type type = obj2.GetType(); System.Type[] types = new System.Type[] { typeof(byte[]) }; MethodInfo info = type.GetMethod(function, BindingFlags.IgnoreReturn | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance, null, types, null); if (info != null) { byte[] destination = new byte[len]; Marshal.Copy(buffer, destination, 0, len); object[] parameters = new object[] { destination }; info.Invoke(obj2, parameters); } else { ADebug.LogError("onSendBuffer not exist method:" + function + " " + type.FullName); } } else { ADebug.LogError("onSendBuffer:" + objectId + " do not exist"); } }
public void Update() { this.removedList.Clear(); for (int i = 0; i < this.acceptUpdatedObjectList.Count; i++) { ApolloObject item = this.acceptUpdatedObjectList[i]; if (item.Removable) { this.removedList.Add(item); } else { item.Update(); } } for (int j = 0; j < this.removedList.Count; j++) { ApolloObject obj3 = this.removedList[j]; if (obj3 != null) { this.RemoveObject(obj3); this.RemoveAcceptUpdatedObject(obj3); } } this.removedList.Clear(); }
private static void onSendStruct(ulong objectId, [MarshalAs(20)] string function, IntPtr param) { ApolloObject apolloObject = ApolloObjectManager.Instance.dictObjectCollection[objectId]; if (apolloObject != null && function != null) { Type type = apolloObject.GetType(); MethodInfo method = type.GetMethod(function, 16777276, null, new Type[] { typeof(IntPtr) }, null); if (method != null) { method.Invoke(apolloObject, new object[] { param }); } else { ADebug.LogError("onSendStruct not exist method:" + function + " " + type.get_FullName()); } } else { ADebug.LogError("onSendStruct:" + objectId + " do not exist"); } }
public void AddAcceptUpdatedObject(ApolloObject obj) { if ((obj != null) && !this.acceptUpdatedObjectList.Contains(obj)) { this.acceptUpdatedObjectList.Add(obj); } }
public void RemoveAcceptUpdatedObject(ApolloObject obj) { if ((obj != null) && this.acceptUpdatedObjectList.Contains(obj)) { this.acceptUpdatedObjectList.Remove(obj); } }
private static void onSendMessage(ulong objectId, [MarshalAs(UnmanagedType.LPStr)] string function, [MarshalAs(UnmanagedType.LPStr)] string param) { if (!Instance.dictObjectCollection.ContainsKey(objectId)) { ADebug.LogError(string.Concat(new object[] { "onSendMessage not exist: ", objectId, " function:", function, " param:", param })); } else { ApolloObject obj2 = Instance.dictObjectCollection[objectId]; if ((obj2 != null) && (function != null)) { System.Type[] types = new System.Type[] { typeof(string) }; MethodInfo info = obj2.GetType().GetMethod(function, BindingFlags.IgnoreReturn | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance, null, types, null); if (info != null) { object[] parameters = new object[] { param }; info.Invoke(obj2, parameters); } else { ADebug.LogError("onSendMessage not exist method:" + function); } } else { ADebug.Log("onSendMessage:" + objectId + " do not exist"); } } }
public void RemoveObject(ApolloObject obj) { if ((obj != null) && this.dictObjectCollection.ContainsKey(obj.ObjectId)) { this.dictObjectCollection.Remove(obj.ObjectId); removeApolloObject(obj.ObjectId); } }
public void AddObject(ApolloObject obj) { if ((obj != null) && !this.dictObjectCollection.ContainsKey(obj.ObjectId)) { this.dictObjectCollection.Add(obj.ObjectId, obj); addApolloObject(obj.ObjectId, obj.GetType().FullName); } }
public void ClearObjects() { foreach (ulong num in this.dictObjectCollection.Keys) { ApolloObject obj2 = this.dictObjectCollection[num]; removeApolloObject(obj2.ObjectId); } this.dictObjectCollection.Clear(); }
public void OnApplicationPause(bool pauseStatus) { ADebug.Log("ObjectManager OnApplicationPause:" + pauseStatus); for (int i = 0; i < this.acceptUpdatedObjectList.Count; i++) { ApolloObject apolloObject = this.acceptUpdatedObjectList[i]; apolloObject.OnApplicationPause(pauseStatus); } }
public void OnDisable() { ADebug.Log("ObjectManager OnDisable"); for (int i = 0; i < this.acceptUpdatedObjectList.Count; i++) { ApolloObject apolloObject = this.acceptUpdatedObjectList[i]; apolloObject.OnDisable(); } this.acceptUpdatedObjectList.Clear(); }
public void OnApplicationQuit() { ADebug.Log("ObjectManager OnApplicationQuit"); for (int i = 0; i < this.acceptUpdatedObjectList.Count; i++) { ApolloObject apolloObject = this.acceptUpdatedObjectList[i]; apolloObject.OnApplicationQuit(); } this.acceptUpdatedObjectList.Clear(); this.ClearObjects(); ApolloObjectManager.apollo_quit(); }
public void RemoveObject(ApolloObject obj) { if (obj == null) { return; } if (this.dictObjectCollection.ContainsKey(obj.ObjectId)) { this.dictObjectCollection.Remove(obj.ObjectId); ApolloObjectManager.removeApolloObject(obj.ObjectId); } }
public void AddObject(ApolloObject obj) { if (obj == null) { return; } if (!this.dictObjectCollection.ContainsKey(obj.ObjectId)) { this.dictObjectCollection.Add(obj.ObjectId, obj); ApolloObjectManager.addApolloObject(obj.ObjectId, obj.GetType().get_FullName()); } }
public void ClearObjects() { using (Dictionary <ulong, object> .KeyCollection.Enumerator enumerator = this.dictObjectCollection.Keys.GetEnumerator()) { while (enumerator.MoveNext()) { ulong current = enumerator.get_Current(); ApolloObject apolloObject = this.dictObjectCollection[current]; ApolloObjectManager.removeApolloObject(apolloObject.ObjectId); } } this.dictObjectCollection.Clear(); }
public void Update() { for (int i = 0; i < this.acceptUpdatedObjectList.Count; i++) { ApolloObject item = this.acceptUpdatedObjectList[i]; if (item.Removable) { this.removedUpdatableList.Add(item); } else { item.Update(); } } for (int j = 0; j < this.removedUpdatableList.Count; j++) { ApolloObject obj3 = this.removedUpdatableList[j]; if (obj3 != null) { this.RemoveAcceptUpdatedObject(obj3); } } this.removedUpdatableList.Clear(); DictionaryView <ulong, ApolloObject> .Enumerator enumerator = this.dictObjectCollection.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <ulong, ApolloObject> current = enumerator.Current; ApolloObject obj4 = current.Value; if (obj4.Removable) { this.removedReflectibleList.Add(obj4); } } for (int k = 0; k < this.removedReflectibleList.Count; k++) { ApolloObject obj5 = this.removedReflectibleList[k]; if (obj5 != null) { this.RemoveObject(obj5); } } this.removedReflectibleList.Clear(); }
public void Update() { for (int i = 0; i < this.acceptUpdatedObjectList.Count; i++) { ApolloObject apolloObject = this.acceptUpdatedObjectList[i]; if (apolloObject.Removable) { this.removedUpdatableList.Add(apolloObject); } else { apolloObject.Update(); } } for (int j = 0; j < this.removedUpdatableList.Count; j++) { ApolloObject apolloObject2 = this.removedUpdatableList[j]; if (apolloObject2 != null) { this.RemoveAcceptUpdatedObject(apolloObject2); } } this.removedUpdatableList.Clear(); DictionaryView <ulong, ApolloObject> .Enumerator enumerator = this.dictObjectCollection.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <ulong, ApolloObject> current = enumerator.Current; ApolloObject value = current.get_Value(); if (value.Removable) { this.removedReflectibleList.Add(value); } } for (int k = 0; k < this.removedReflectibleList.Count; k++) { ApolloObject apolloObject3 = this.removedReflectibleList[k]; if (apolloObject3 != null) { this.RemoveObject(apolloObject3); } } this.removedReflectibleList.Clear(); }
private static void onSendMessage(ulong objectId, [MarshalAs(20)] string function, [MarshalAs(20)] string param) { if (!ApolloObjectManager.Instance.dictObjectCollection.ContainsKey(objectId)) { ADebug.LogError(string.Concat(new object[] { "onSendMessage not exist: ", objectId, " function:", function, " param:", param })); return; } ApolloObject apolloObject = ApolloObjectManager.Instance.dictObjectCollection[objectId]; if (apolloObject != null && function != null) { Type type = apolloObject.GetType(); MethodInfo method = type.GetMethod(function, 16777276, null, new Type[] { typeof(string) }, null); if (method != null) { method.Invoke(apolloObject, new object[] { param }); } else { ADebug.LogError("onSendMessage not exist method:" + function); } } else { ADebug.Log("onSendMessage:" + objectId + " do not exist"); } }
private static void onSendStruct(ulong objectId, [MarshalAs(UnmanagedType.LPStr)] string function, IntPtr param) { ApolloObject obj2 = Instance.dictObjectCollection[objectId]; if ((obj2 != null) && (function != null)) { System.Type type = obj2.GetType(); System.Type[] types = new System.Type[] { typeof(IntPtr) }; MethodInfo info = type.GetMethod(function, BindingFlags.IgnoreReturn | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance, null, types, null); if (info != null) { object[] parameters = new object[] { param }; info.Invoke(obj2, parameters); } else { ADebug.LogError("onSendStruct not exist method:" + function + " " + type.FullName); } } else { ADebug.LogError("onSendStruct:" + objectId + " do not exist"); } }