public static void Show(
        Color color,
        OnColorSelectedCallback onColorSelectedCallback,
        OnFinishCallback onFinishCallback,
        OnEarlierIOSVersionsCallback onEarlierIOSVersionsCallback)
    {
        if (gcHandleForRGBColorSelectedCallback != IntPtr.Zero ||
            gcHandleForColorSelectedCallback != IntPtr.Zero ||
            gcHandleForOnFinishCallback != IntPtr.Zero)
        {
            return;
        }

        // コールバック関数をGCされないようにAllocしてハンドルを取得する。
        gcHandleForColorSelectedCallback        = (IntPtr)GCHandle.Alloc(onColorSelectedCallback, GCHandleType.Normal);
        gcHandleForOnFinishCallback             = (IntPtr)GCHandle.Alloc(onFinishCallback, GCHandleType.Normal);
        gcHandleForOnEarlierIOSVersionsCallback = (IntPtr)GCHandle.Alloc(onEarlierIOSVersionsCallback, GCHandleType.Normal);

        // 普通の引数 + コールバック関数のハンドル + コールバック関数を呼び出すためのstaticなメソッド
        _CallColorPickerPlugin(
            color.r,
            color.g,
            color.b,
            color.a,
            CallColorSelectedCallback,
            CallOnFinishCallback,
            CallOnEarlierIOSVersionsCallback);
    }
Exemplo n.º 2
0
    public void CreateElementsPrize(OnFinishCallback onFinish = null)
    {
        prizeType = GameManager.Instance.currPrize;

        // Obtener nombre de los modelos a cargar
        DataPrize data = GameManager.Instance.GetDataPrize(prizeType);

        matCoin.SetFloat("_Transparency", 1f);

        foreach (string fileName in data.nameFile)
        {
            // Cargar modelos desde resources
            GameObject p = Instantiate(Resources.Load <GameObject>(pathResources + fileName));
            p.name = data.namePrize;

            if (fileName != "Coin")
            {
                currPrizeRotate = p;
                p.transform.SetParent(this.transform);
            }
            else
            {
                p.transform.SetParent(posCoin);
                _coin = p;
            }

            p.transform.localPosition = Vector3.zero;
            p.transform.localScale    = new Vector3(scale, scale, scale);
        }

        if (onFinish != null)
        {
            onFinish();
        }
    }
    static void CallOnFinishCallback()
    {
        GCHandle         handle   = (GCHandle)gcHandleForOnFinishCallback;
        OnFinishCallback callback = handle.Target as OnFinishCallback;

        // 不要になったハンドルを解放する。
        CleanUpHandles();

        callback();
    }
Exemplo n.º 4
0
        public virtual void Reverse(OnFinishCallback onFinish = null)
        {
            var temp = ValueOriginal;

            ValueOriginal = ValueTarget;
            ValueTarget   = temp;

            DurationCurrent = (Duration - DurationCurrent);

            //Debug.LogFormat("Reversing - Begin:{0} End:{1}", ValueBegin, ValueEnd);

            OnFinish = onFinish;
        }
Exemplo n.º 5
0
        public void Upgrade(List <Task> _tasks, OnFinishCallback _onFinish, OnErrorCallback _onError)
        {
            Downloader downloader = new Downloader();

            downloader.onStatusUpdate = (_status) => {
                if (null != onStatusUpdate)
                {
                    onStatusUpdate(_status);
                }
            };
            downloader.Setup(config);
            downloader.InstallProcessor(processor);
            downloader.Download(_tasks, () => { _onFinish(); }, (_err) => { _onError(_err); });
        }
Exemplo n.º 6
0
        public void Download(List <Task> _tasks, OnFinishCallback _onFinish, OnErrorCallback _onError)
        {
            run             = true;
            status.total    = _tasks.Count;
            status.finish   = 0;
            status.progress = 0f;
            config.mono.StartCoroutine(updateStatus());

            Queue <Task> tasks = new Queue <Task>(_tasks.Count);

            foreach (Task task in _tasks)
            {
                tasks.Enqueue(task);
            }
            config.mono.StartCoroutine(downloadQueue(tasks, _onFinish, _onError));
        }
Exemplo n.º 7
0
        private IEnumerator downloadQueue(Queue <Task> _task, OnFinishCallback _onFinish, OnErrorCallback _onError)
        {
            while (_task.Count > 0)
            {
                yield return(new WaitForEndOfFrame());

                Task   task = _task.Dequeue();
                string uri  = config.domain + "/upgrade" + task.path + task.file;

                string filename = task.file;
                if (null != processor)
                {
                    if (null != processor.Rename)
                    {
                        filename = processor.Rename(task.file);
                    }
                }

                string outpath = Path.Combine(config.dir, task.path.Remove(0, 1));
                Directory.CreateDirectory(outpath);
                string outfile = Path.Combine(outpath, filename);
                using (webRequest = new UnityWebRequest(uri))
                {
                    byte[] buffer = new byte[64 * 1024];
                    webRequest.downloadHandler = new FileDownloadHandler(buffer, outfile);
                    webRequest.SendWebRequest();
                    while (!webRequest.isDone)
                    {
                        yield return(new WaitForEndOfFrame());
                    }

                    if (!string.IsNullOrEmpty(webRequest.error))
                    {
                        //retry
                        _task.Enqueue(task);
                        _onError(webRequest.error);
                        continue;
                    }
                    File.WriteAllText(Path.Combine(outpath, filename) + ".md5", task.md5);
                }
                webRequest = null;

                status.finish += 1;
            }
            run = false;
            _onFinish();
        }
Exemplo n.º 8
0
        IEnumerator LoadAsyncScene(int index, OnFinishCallback onFinish = null)
        {
            AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(index);

            // Wait until the asynchronous scene fully loads
            while (!asyncLoad.isDone)
            {
                yield return(null);
            }

            //loadingScreen.SetActive(false);

            if (onFinish != null)
            {
                onFinish();
            }
        }
Exemplo n.º 9
0
        // Try to add a job to current queue. If the job is already presented, the existing job will be returned; If the job is already finished, null will be returned; otherwise the job itself will be returned.
        public static CustomJob TryAddJob(CustomJob job, OnFinishCallback finishCallback = null)
        {
#if PROFILE
            UnityEngine.Profiling.Profiler.BeginSample("CustomJob.TryAddJob");
#endif
            if (job.isUnique)
            {
                if (queuedUniqueJobs.ContainsKey(job))
                {
                    //Debug.Log($"{job.ToString()} has already been queued.");
                    queuedUniqueJobs[job].finishCallback += finishCallback;
#if PROFILE
                    Profiler.EndSample();
#endif
                    return(queuedUniqueJobs[job]);
                }

                // Check if job is already finished
                job.finishCallback = finishCallback;
                if (job.AlreadyFinished())
                {
                    job.OnFinish();
#if PROFILE
                    Profiler.EndSample();
#endif
                    return(null);
                }

                job.InitJob();
                queuedUniqueJobs.Add(job, job);
                Count += 1;
                job.Schedule();
            }
            else
            {
                job.InitJob();
                Count += 1;
                job.Schedule();
            }

#if PROFILE
            Profiler.EndSample();
#endif

            return(job);
        }
Exemplo n.º 10
0
 public void UploadFinished(object o, EventArgs ea)
 {
     OnFinishCallback d = new OnFinishCallback(UploadFinished);
     listViewFlights.Invoke(d, new object[] { null });
 }
 /// <summary>
 /// 设置完成时的回调
 /// </summary>
 /// <param name="onFinish"></param>
 public void SetOnFinishCallback(OnFinishCallback onFinish)
 {
     OnFinish += onFinish;
 }
Exemplo n.º 12
0
        public void LoadScene(int index, OnFinishCallback onFinish = null)
        {
            //loadingScreen.SetActive(true);

            StartCoroutine(LoadAsyncScene(index, onFinish));
        }
Exemplo n.º 13
0
        public void UploadFinished(object o, EventArgs ea)
        {
            OnFinishCallback d = new OnFinishCallback(UploadFinished);

            dataGridView2.Invoke(d, new object[] { null });
        }