1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using UnityEngine;
- using System;
- using System.Reflection;
- namespace MRStore.Util
- {
-
-
-
- public interface JavaInterface
- {
-
-
-
-
- void Call(string method);
-
-
-
-
-
- void Call(string method, string args);
- }
-
-
-
-
-
-
-
- public abstract class JavaProxy<T> : AndroidJavaProxy, JavaInterface where T : JavaProxy<T>
- {
-
-
-
-
- public JavaProxy(string packName) : base(packName) { }
- public void Call(string method)
- {
- MethodInfo methodInfo = typeof(T).GetMethod(method);
- if (methodInfo == null) throw new Exception(typeof(T) + method + "method is null");
- methodInfo.Invoke(this, null);
- }
- public void Call(string method, string args)
- {
- MethodInfo methodInfo = typeof(T).GetMethod(method);
- if (methodInfo == null) throw new Exception(typeof(T) + method + "method is null");
- methodInfo.Invoke(this, new System.Object[] { args });
- }
- }
- }
|