Exemple #1
0
 public static void SetContainer(object obj)
 {
     if (obj != null)
     {
         var handle = GCHandle.Alloc(obj);
         NativeImported.RegThreadLocalContainer((IntPtr)handle, NativeImported.Func_DisposeObj);
     }
 }
Exemple #2
0
 private static void Init()
 {
     NativeImported.Init_CommonNativeEvents();
     using (AndroidJavaClass jc = new AndroidJavaClass("cn.capstones.anative.android.commonnativeevents.CommonNativeEvents"))
     {
         jc.CallStatic("Init");
     }
 }
Exemple #3
0
        public static Color GetColorAtScreenPos(Vector2 pos)
        {
            IntPtr dc     = NativeImported.GetWindowDC(IntPtr.Zero);
            uint   colorn = NativeImported.GetPixel(dc, (int)pos.x, (int)pos.y);

            byte a = 255; //(byte)((colorn & (0xFF << 24)) >> 24);
            byte b = (byte)((colorn & (0xFF << 16)) >> 16);
            byte g = (byte)((colorn & (0xFF << 8)) >> 8);
            byte r = (byte)(colorn & 0xFF);

            return(new Color32(r, g, b, a));
        }
Exemple #4
0
        public static T GetContainer <T>() where T : class
        {
            var handle = NativeImported.GetThreadLocalContainer();

            if (handle != IntPtr.Zero)
            {
                object obj = null;
                try
                {
                    obj = ((GCHandle)handle).Target;
                }
                catch (Exception e)
                {
                    PlatDependant.LogError(e);
                }
                return(obj as T);
            }
            return(null);
        }
Exemple #5
0
 public static ulong GetThreadID()
 {
     return((ulong)NativeImported.GetThreadID());
 }
Exemple #6
0
 public static void TrigEventInUnityThread()
 {
     NativeImported.TrigDispatcherEvent();
 }
Exemple #7
0
 private static void Init()
 {
     NativeImported.Init_CommonNativeEvents();
 }