Ejemplo n.º 1
0
        //ロード
        protected IEnumerator AsyncSceneLoadStart(string scene, float wait = 0.5f)
        {
            //読み込みチェック
            if (UnityEngine.SceneManagement.SceneManager.GetSceneByName(scene) == null)
            {
                InstantLog.StringLogError("Scene Missing");
                yield break;
            }

            //読み込み開始
            _async = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(scene);
            _async.allowSceneActivation = false;

            InstantLog.StringLog("Load Start", StringExtensions.TextColor.darkblue);

            //読み込み中
            while (_async.progress < 0.9f)
            {
                yield return(new WaitForEndOfFrame());
            }

            //読み込み終了
            InstantLog.StringLog("Scene Loaded", StringExtensions.TextColor.blue);
            if (_callbacks != null)
            {
                _callbacks();
            }
            yield return(new WaitForSeconds(wait));

            _async.allowSceneActivation = true;
        }
Ejemplo n.º 2
0
        //Component単位のactive
        public virtual void SetEnable <T>(bool able) where T : Component
        {
            T component = GetComponent <T>();

            if (component == null)
            {
                InstantLog.StringLogError("This object doesn't have any designed components.");
                return;
            }

            (GetComponent <T>() as MonoBehaviour).enabled = able;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// ファイルのバイナリ読み出し
        /// </summary>
        /// <param name="path">バイナリのパス</param>
        /// <returns>バイト配列</returns>
        public static byte[] ReadBinary(string path, bool deleteFlg = false)
        {
            if (!File.Exists(path))
            {
                InstantLog.StringLogError("ReadBinary : file does not exist");
                return(null);
            }

            var fs = new FileStream(path, FileMode.Open, FileAccess.Read);

            byte[] bs = new byte[fs.Length];
            fs.Read(bs, 0, bs.Length);
            if (deleteFlg)
            {
                File.Delete(path);
            }
            fs.Close();

            return(bs);
        }
Ejemplo n.º 4
0
        public void Play()
        {
            if (TextAnimation == null)
            {
                InstantLog.StringLogError("Animation isn't set");
                return;
            }

            TextAnimation
            .OnStart(() =>
            {
                OnAnimationStarted?.Invoke();
            })
            .OnComplete(() =>
            {
                OnAnimationEnded?.Invoke();
            });

            TextAnimation.Play();
        }
Ejemplo n.º 5
0
        private void LoadLocalizationFile()
        {
            string filePath = Path.Combine(Application.streamingAssetsPath, LOCALIZATION_FILE_PATH);

            if (File.Exists(filePath))
            {
                string[] lines = File.ReadAllLines(filePath);
                for (int i = 0; i < lines.Length; ++i)
                {
                    var split = lines[i].Split(KEY_VALUE_SPLIT);
                    if (split == null || split.Length != 2)
                    {
                        continue;
                    }
                    _localizedTextMap.Add(split[0], split[1]);
                }
            }
            else
            {
                InstantLog.StringLogError("Missing Localization File");
            }
        }