Пример #1
0
        //セーブデータ用のバイナリ読み込み
        public void Read(BinaryReader reader, AdvEngine engine)
        {
            int version = reader.ReadInt32();

            if (version < 0 || version > Version)
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
                return;
            }

            string animationName = reader.ReadString();
            float  speed         = reader.ReadSingle();
            float  time          = reader.ReadSingle();

            AdvAnimationData data = engine.DataManager.SettingDataManager.AnimationSetting.Find(animationName);

            if (data == null)
            {
                Debug.LogError(animationName + " is not found in Animation sheet");
                Destroy(this);
            }
            else
            {
                this.EnableSave  = true;
                this.AutoDestory = true;
                //終了コールバックはロードされないが
                //基本的にはセーブされている場合は、NoWaitなエフェクトで
                //終了コールバックを受けなくて良いものだけのはず
                Play(data.Clip, speed, null);
                SetTime(time);
            }
        }
Пример #2
0
        //********描画時の引数適用********//

        /*		internal virtual void SetArgOnDraw(AdvGraphicOperaitonArg arg, float fadeTime)
         *              {
         *                      base.SetArgOnDraw(arg,fadeTime);
         *              }
         */

        //アニメーションを設定
        protected void SetAnimation(AdvAnimationData data)
        {
            Animation.Cancel();
            if (data != null)
            {
                Animation.Play(data.Clip, Engine.Page.SkippedSpeed);
            }
        }
Пример #3
0
        protected override void OnParseGrid(StringGrid grid)
        {
            int index = 0;

            while (index < grid.Rows.Count)
            {
                if (grid.Rows[index].IsEmpty)
                {
                    index++;
                    continue;
                }

                AdvAnimationData data = new AdvAnimationData(grid, ref index, true);
                DataList.Add(data);
            }
        }
Пример #4
0
        //エフェクト開始時のコールバック
        protected override void OnStartEffect(GameObject target, AdvEngine engine, AdvScenarioThread thread)
        {
            AdvAnimationData animationData = engine.DataManager.SettingDataManager.AnimationSetting.Find(animationName);

            if (animationData == null)
            {
                Debug.LogError(RowData.ToErrorString("Animation " + animationName + " is not found"));
                OnComplete(thread);
                return;
            }

            AnimationPlayer             = target.AddComponent <AdvAnimationPlayer>();
            AnimationPlayer.AutoDestory = true;
            AnimationPlayer.EnableSave  = EnableSave;
            AnimationPlayer.Play(animationData.Clip, engine.Page.SkippedSpeed,
                                 () =>
            {
                OnComplete(thread);
            });
        }
Пример #5
0
        //エフェクト開始時のコールバック
        protected override void OnStartEffect(GameObject target, AdvEngine engine, AdvScenarioThread thread)
        {
            Camera          camera = target.GetComponentInChildren <Camera>(true);
            ImageEffectBase imageEffect;
            bool            alreadyEnabled;

            if (!ImageEffectUtil.TryGetComonentCreateIfMissing(imageEffectType, out imageEffect, out alreadyEnabled, camera.gameObject))
            {
                Complete(imageEffect, thread);
                return;
            }

            if (!inverse)
            {
                imageEffect.enabled = true;
            }

            bool enableAnimation   = !string.IsNullOrEmpty(animationName);
            bool enableFadeStregth = imageEffect is IImageEffectStrength;

            if (!enableFadeStregth && !enableAnimation)
            {
                Complete(imageEffect, thread);
                return;
            }

            if (enableFadeStregth)
            {
                IImageEffectStrength fade = imageEffect as IImageEffectStrength;
                float start = inverse ? fade.Strength : 0;
                float end   = inverse ? 0 : 1;
                Timer timer = camera.gameObject.AddComponent <Timer>();
                timer.AutoDestroy = true;
                timer.StartTimer(
                    engine.Page.ToSkippedTime(this.time),
                    engine.Time.Unscaled,
                    (x) =>
                {
                    fade.Strength = x.GetCurve(start, end);
                },
                    (x) =>
                {
                    if (!enableAnimation)
                    {
                        Complete(imageEffect, thread);
                    }
                });
            }

            if (enableAnimation)
            {
                //アニメーションの適用
                AdvAnimationData animationData = engine.DataManager.SettingDataManager.AnimationSetting.Find(animationName);
                if (animationData == null)
                {
                    Debug.LogError(RowData.ToErrorString("Animation " + animationName + " is not found"));
                    Complete(imageEffect, thread);
                    return;
                }

                AdvAnimationPlayer player = camera.gameObject.AddComponent <AdvAnimationPlayer>();
                player.AutoDestory = true;
                player.EnableSave  = true;
                player.Play(animationData.Clip, engine.Page.SkippedSpeed,
                            () =>
                {
                    Complete(imageEffect, thread);
                });
            }
        }