internal static void Init() { lock (InitLock) { if (ReferenceEquals(_instance, null)) { var instances = FindObjectsOfType <GoodiesSceneHelper>(); if (instances.Length > 1) { Debug.LogError(typeof(GoodiesSceneHelper) + " Something went really wrong " + " - there should never be more than 1 " + typeof(GoodiesSceneHelper) + " Reopening the scene might fix it."); } else if (instances.Length == 0) { GameObject singleton = new GameObject(); _instance = singleton.AddComponent <GoodiesSceneHelper>(); singleton.name = "GoodiesSceneHelper"; DontDestroyOnLoad(singleton); Debug.Log("[Singleton] An _instance of " + typeof(GoodiesSceneHelper) + " is needed in the scene, so '" + singleton.name + "' was created with DontDestroyOnLoad."); } else { Debug.Log("[Singleton] Using _instance already created: " + _instance.gameObject.name); } } } }
public static bool IsNotAndroidCheck() { bool isAndroid = Application.platform == RuntimePlatform.Android; if (isAndroid) { GoodiesSceneHelper.Init(); } return(!isAndroid); }
public void onScanCompleted(String path, AndroidJavaObject uri) { if (uri.IsJavaNull()) { Debug.LogWarning("Scannning file " + path + " failed"); } if (_onScanCompleted != null) { GoodiesSceneHelper.Queue(() => _onScanCompleted(path, uri)); } }
// ReSharper disable once InconsistentNaming // ReSharper disable once UnusedMember.Local void onTextureDataReceived(AndroidJavaObject jo, string fileName) { AndroidJavaObject bufferObject = jo.Get <AndroidJavaObject>("Buffer"); byte[] buffer = AndroidJNIHelper.ConvertFromJNIArray <byte[]>(bufferObject.GetRawObject()); GoodiesSceneHelper.Queue(() => { var tex = new Texture2D(2, 2); tex.LoadImage(buffer); var result = new ImagePickResult(fileName, tex); _onPhotoReceivedAction(result); }); }
public void onClick(AndroidJavaObject dialog, int which) { if (_onClickVoid != null) { GoodiesSceneHelper.Queue(_onClickVoid); } if (_onClickInt != null) { GoodiesSceneHelper.Queue(() => _onClickInt(which)); } if (_dismissOnClick) { GoodiesSceneHelper.Queue(() => dialog.Call("dismiss")); } }
void onClick(AndroidJavaObject dialog, int which, bool isChecked) { GoodiesSceneHelper.Queue(() => _onClick(which, isChecked)); }
void onDismiss(AndroidJavaObject dialog) { GoodiesSceneHelper.Queue(_onDismiss); }
void onCancel(AndroidJavaObject dialog) { GoodiesSceneHelper.Queue(_onCancel); }
void onError(AndroidJavaObject error) { GoodiesSceneHelper.Queue(() => _errorCallback((AGFingerprintScanner.Error)error.CallInt("getValue"))); }
void onWarning(AndroidJavaObject warning) { GoodiesSceneHelper.Queue(() => _warningCallback((AGFingerprintScanner.Warning)warning.CallInt("getValue"))); }
void onSuccess(string value) { GoodiesSceneHelper.Queue(() => _successCallback(value)); }