Exemplo n.º 1
0
        private IEnumerator ExitSubtitle(float _duration, int _mode)
        {
            float speed = 3000f;
            float left_ = canvas_.sizeDelta.x;
            //float top_ = subtitle_.rectTransform.sizeDelta.y;
            Text t = text_.GetComponent <Text>();

            yield return(new WaitForEndOfFrame());

            while (!t.text.Equals(""))
            {
                yield return(new WaitForEndOfFrame());

                if (t.rectTransform.anchoredPosition.x < left_ && _mode.Equals(0))
                {
                    t.rectTransform.Translate(new Vector3(speed * Time.deltaTime, 0, 0));
                }

                else if (_mode.Equals(1))
                {
                    CoroutineMgr.Start(Fade_Subtitle(_duration, 1));
                    break;
                }
                else
                {
                    t.rectTransform.anchoredPosition = new Vector2(0, 0);
                    text_.text = "";
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public static void LoadSkybox(string _package, string _file
                                      , OnLoadReadyDelegate _onReady
                                      , OnLoadObjectSuccessDelegate _onSuccess
                                      , OnErrorDelegate _onError)
        {
            if (string.IsNullOrEmpty(_package))
            {
                _onError("package is null");
                return;
            }

            if (string.IsNullOrEmpty(_file))
            {
                _onError("file is null");
                return;
            }

            _onReady();

            CoroutineMgr.Start(asyncLoadBundle(_package, _file, (_res) =>
            {
                Log.Debug("ResourceMgr", "load skybox [{0}] finish...", _file);
                CameraMgr.ApplySkybox(_res as Material);
                _onSuccess(_res);
            },
                                               _onError));
        }
Exemplo n.º 3
0
        public static void LoadAudioClip(string _package, string _file, int _track
                                         , OnLoadReadyDelegate _onReady
                                         , OnLoadObjectSuccessDelegate _onSuccess
                                         , OnErrorDelegate _onError)
        {
            if (string.IsNullOrEmpty(_package))
            {
                _onError("package is null");
                return;
            }
            if (string.IsNullOrEmpty(_file))
            {
                _onError("file is null");
                return;
            }

            _onReady();

            CoroutineMgr.Start(asyncLoadBundle(_package, _file, (_res) =>
            {
                Log.Debug("ResourceMgr", "load audioclip [{0}] finish...", _file);
                _onSuccess(_res);
            },
                                               _onError));
        }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="_duration"></param>
 /// <param name="_mode">
 /// 0 : FadeIn
 /// 1 : FadeOut
 /// </param>
 public static void FadeMask(float _duration, int _mode, OnFinishDelegate _onFinish)
 {
     CoroutineMgr.Start(Fade_Mask(_duration, _mode, () =>
     {
         _onFinish();
     }));
 }
Exemplo n.º 5
0
        private IEnumerator InsertSubtitle(float _duration, int _mode, string _text)
        {
            float speed = 3000f;
            float left_ = canvas_.sizeDelta.x;
            float top_  = subtitle_.rectTransform.sizeDelta.y;
            Text  t     = text_.GetComponent <Text>();

            yield return(new WaitForEndOfFrame());

            if (_mode.Equals(0))
            {
                t.rectTransform.Translate(new Vector3(-left_, 0, 0));
                t.rectTransform.anchoredPosition = new Vector2(-left_, 0);
                t.text = _text;
            }
            else if (_mode.Equals(1))
            {
                t.rectTransform.Translate(new Vector3(0, -top_, 0));
                t.rectTransform.anchoredPosition = new Vector2(0, -top_);
                t.text = _text;
            }
            else if (_mode.Equals(2) && t.text.Equals(""))
            {
                Color color = t.color;
                color.a = 0;
                t.color = color;
                t.text  = _text;
                Debug.Log("2...");
                CoroutineMgr.Start(Fade_Subtitle(2));
            }
            float time = 0;

            while (true)
            {
                yield return(new WaitForEndOfFrame());

                time += Time.deltaTime;

                if (t.rectTransform.anchoredPosition.x < 0 && _mode.Equals(0))
                {
                    t.rectTransform.Translate(new Vector3(speed * Time.deltaTime, 0, 0));
                }
                else if (t.rectTransform.anchoredPosition.y < 0 && _mode.Equals(1))
                {
                    t.rectTransform.Translate(new Vector3(0, (speed / 3f) * Time.deltaTime, 0));
                }
                else
                {
                    t.rectTransform.anchoredPosition = new Vector2(0, 0);
                }

                if (time > _duration)
                {
                    t.text = "";
                    break;
                }
            }
        }
Exemplo n.º 6
0
 public static void ReadPersistentData(string _file
                                       , OnReadDataSuccessDelegate _onSuccess
                                       , OnErrorDelegate _onError)
 {
     if (string.IsNullOrEmpty(_file))
     {
         _onError("file is null");
         return;
     }
     CoroutineMgr.Start(readPersistentData(_file, _onSuccess, _onError));
 }
Exemplo n.º 7
0
 public static void ReadPersistentImage(string _uuid
                                        , OnLoadImageSuccessDelegate _onSuccess
                                        , OnErrorDelegate _onError)
 {
     if (string.IsNullOrEmpty(_uuid))
     {
         _onError("file is null");
         return;
     }
     CoroutineMgr.Start(readPersistentImage(_uuid, _onSuccess, _onError));
 }
Exemplo n.º 8
0
 public static void ReadStreamText(string _file
                                   , OnReadTextSuccessDelegate _onSuccess
                                   , OnErrorDelegate _onError)
 {
     if (string.IsNullOrEmpty(_file))
     {
         _onError("file is null");
         return;
     }
     CoroutineMgr.Start(readStreamText(_file, _onSuccess, _onError));
 }
Exemplo n.º 9
0
 public void UpdateAnimationSubtitle(Animation _anim = null)
 {
     if (_anim is InsertAnim)
     {
         InsertAnim anim = _anim as InsertAnim;
         CoroutineMgr.Start(InsertSubtitle(anim.duration, anim.mode, anim.text));
     }
     else if (_anim is ExitAnim)
     {
         ExitAnim anim = _anim as ExitAnim;
         CoroutineMgr.Start(ExitSubtitle(anim.duration, anim.mode));
     }
 }
Exemplo n.º 10
0
        public static void PreloadAsset(string _package, string _file
                                        , OnLoadReadyDelegate _onReady
                                        , OnLoadObjectSuccessDelegate _onSuccess
                                        , OnErrorDelegate _onError)
        {
            if (string.IsNullOrEmpty(_package))
            {
                _onError("package is null");
                return;
            }

            if (string.IsNullOrEmpty(_file))
            {
                _onError("file is null");
                return;
            }

            _onReady();
            string assetID = _package + "@" + _file;

            if (!preloadAssets.ContainsKey(assetID))
            {
                preloadAssets.Add(assetID, null);
                CoroutineMgr.Start(asyncLoadBundle(_package, _file, (_res) =>
                {
                    Log.Debug("ResourceMgr", "load res [{0}] finish...", assetID);
                    preloadAssets[assetID] = _res;
                    _onSuccess(_res);
                },
                                                   _onError));
            }
            else
            {
                Log.Debug("ResourceMgr", "res [{0}] is exists...", assetID);
                _onSuccess(preloadAssets[assetID]);
            }
        }
Exemplo n.º 11
0
        private static void addXRectiel(Transform _parent)
        {
            GameObject centerEye = new GameObject("CenterEye");

            centerEye.tag = "MainCamera";
            centerEye.transform.SetParent(_parent);

            centerEyeCamera_            = centerEye.AddComponent <Camera>();
            centerEyeCamera_.clearFlags = CameraClearFlags.Nothing;

            centerEye.AddComponent <XCenterCamera>();
            centerEye.AddComponent <PhysicsRaycaster>();

            reticle_      = Object.Instantiate <GameObject>(Resources.Load <GameObject>("VR/XReticle"));
            reticle_.name = "Reticle";
            reticle_.transform.SetParent(_parent);
            XReticle cpt = reticle_.AddComponent <XReticle>();

            event_ = new GameObject("EventSystem");
            event_.transform.SetParent(device_);
            event_.AddComponent <XGazeInputModule>();

            CoroutineMgr.Start(EndOfFrame());
        }
Exemplo n.º 12
0
 public static void Shake(float _duration, OnFinishDelegate _onFinish)
 {
     CoroutineMgr.Start(ShakeCamera(_duration, _onFinish));
 }
Exemplo n.º 13
0
 public static void ReadWebFile(string _file, System.Action _onReady, System.Action <byte[]> _onSuccess, System.Action <string> _onError)
 {
     CoroutineMgr.Start(readWebFile(_file, _onReady, _onSuccess, _onError));
 }
Exemplo n.º 14
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="_duration"></param>
 /// <param name="_mode">
 /// 0 : fadein
 /// 1 : fadeout
 /// </param>
 /// <param name="_reverse">
 /// true : from bottom to top
 /// false : from top to bottom
 /// </param>
 public static void VerticalFadeMask(float _duration, int _mode, bool _inversion)
 {
     CoroutineMgr.Start(VerticalMask(_duration, _mode, _inversion));
 }
Exemplo n.º 15
0
 public void UpdateSubtitle(string _text, float _duration)
 {
     Debug.Log(string.Format("[TEST: ] {0}_{1}_{2}", "UpdateSubtitle", _text, _duration));
     CoroutineMgr.Start(Update_Subtitle(_duration, _text));
 }
Exemplo n.º 16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="_duration"></param>
 /// <param name="_mode">
 /// 0 : FadeIn
 /// 1 : FadeOut
 /// </param>
 public static void FadeMask(float _duration, int _mode)
 {
     CoroutineMgr.Start(Fade_Mask(_duration, _mode,
                                  () => { }));
 }
Exemplo n.º 17
0
 public static void Move(Vector3 _position, Vector3 _rotation, float _duration, OnFinishDelegate _onFinis)
 {
     CoroutineMgr.Start(move(_position, _rotation, _duration, _onFinis));
 }
Exemplo n.º 18
0
 public static void ZoomPull(float _duration, float _distance)
 {
     CoroutineMgr.Start(ZoomCamera(_duration, _distance, false));
 }
Exemplo n.º 19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="_duration"></param>
 /// <param name="_mode">
 /// 0 : fadein
 /// 1 : fadeout
 /// </param>
 /// <param name="_reverse">
 /// true : clockwise rotate
 /// false : anticlockwise rotate
 /// </param>
 public static void RotateFadeMask(float _duration, int _mode, bool _inversion)
 {
     CoroutineMgr.Start(RotateMask(_duration, _mode, _inversion));
 }
Exemplo n.º 20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="_duration"></param>
 /// <param name="_mode">
 /// 0 :  fadein
 /// 1 :  fadeout
 /// </param>
 public void FadeBackGroundSubtitle(float _duration, int _mode)
 {
     CoroutineMgr.Start(FadeBGSubtitle(_duration, _mode));
 }