From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/Export/AndroidJava.txt | 114 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 Runtime/Export/AndroidJava.txt (limited to 'Runtime/Export/AndroidJava.txt') diff --git a/Runtime/Export/AndroidJava.txt b/Runtime/Export/AndroidJava.txt new file mode 100644 index 0000000..ab2c9f5 --- /dev/null +++ b/Runtime/Export/AndroidJava.txt @@ -0,0 +1,114 @@ +C++RAW + + +#include "UnityPrefix.h" +#include "Runtime/Scripting/ScriptingUtility.h" +#include "Runtime/Mono/MonoBehaviour.h" + +CSRAW +#if UNITY_EDITOR || UNITY_ANDROID +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace UnityEngine +{ + +// AndroidJavaObject is the Unity representation of a generic instance of java.lang.Object. +NONSEALED_CLASS AndroidJavaObject : IDisposable + + // Construct an AndroidJavaObject based on the name of the class. + CSRAW public AndroidJavaObject(string className, params object[] args) : this() + { + _AndroidJavaObject(className, args); + } + + // IDisposable callback + CSRAW public void Dispose() + { + _Dispose(); + } + + //=================================================================== + + // Calls a Java method on an object (non-static). + CSRAW public void Call(string methodName, params object[] args) + { + _Call(methodName, args); + } + + //=================================================================== + + // Call a static Java method on a class. + CSRAW public void CallStatic(string methodName, params object[] args) + { + _CallStatic(methodName, args); + } + + //=================================================================== + + // Get the value of a field in an object (non-static). + CSRAW public FieldType Get(string fieldName) + { + return _Get(fieldName); + } + + + // Set the value of a field in an object (non-static). + CSRAW public void Set(string fieldName, FieldType val) + { + _Set(fieldName, val); + } + + + //=================================================================== + + // Get the value of a static field in an object type. + CSRAW public FieldType GetStatic(string fieldName) + { + return _GetStatic(fieldName); + } + + + // Set the value of a static field in an object type. + CSRAW public void SetStatic(string fieldName, FieldType val) + { + _SetStatic(fieldName, val); + } + + + //=================================================================== + + // Retrieve the raw jobject pointer to the Java object. + CSRAW public IntPtr GetRawObject() { return _GetRawObject(); } + // Retrieve the raw jclass pointer to the Java class; + CSRAW public IntPtr GetRawClass() { return _GetRawClass(); } + + //=================================================================== + + // Call a Java method on an object. + CSRAW public ReturnType Call(string methodName, params object[] args) + { + return _Call(methodName, args); + } + + // Call a static Java method on a class. + CSRAW public ReturnType CallStatic(string methodName, params object[] args) + { + return _CallStatic(methodName, args); + } +END + +// AndroidJavaClass is the Unity representation of a generic instance of java.lang.Class +NONSEALED_CLASS AndroidJavaClass : AndroidJavaObject + + // Construct an AndroidJavaClass from the class name + CSRAW public AndroidJavaClass(string className) : base() + { + _AndroidJavaClass(className); + } +END + +CSRAW +} +#endif -- cgit v1.1-26-g67d0