コード例 #1
0
        public void Read(BinaryReader reader)
        {
            int num = reader.ReadInt32();

            if ((num < 0) || (num > 0))
            {
                object[] args = new object[] { num };
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, args));
            }
            else
            {
                reader.ReadLocalTransform(base.get_transform());
                reader.ReadBuffer(new Action <BinaryReader>(this.LetterBoxCamera.Read));
                int num2 = reader.ReadInt32();
                for (int i = 0; i < num2; i++)
                {
                    ImageEffectBase base2;
                    bool            flag;
                    string          type = reader.ReadString();
                    if (!ImageEffectUtil.TryGetComonentCreateIfMissing(type, out base2, out flag, this.LetterBoxCamera.get_gameObject()))
                    {
                        Debug.LogError("Unkonwo Image Effect Type [ " + type + " ]");
                        reader.SkipBuffer();
                    }
                    else
                    {
                        reader.ReadBuffer(new Action <BinaryReader>(base2.Read));
                    }
                }
            }
        }
コード例 #2
0
        //セーブデータ用のバイナリ読み込み
        public void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

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

            reader.ReadLocalTransform(this.transform);
            reader.ReadBuffer(LetterBoxCamera.Read);

            int count = reader.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                string          imageEffectType = reader.ReadString();
                ImageEffectBase imageEffect;
                bool            alreadyEnabled;
                if (!ImageEffectUtil.TryGetComonentCreateIfMissing(imageEffectType, out imageEffect, out alreadyEnabled, LetterBoxCamera.gameObject))
                {
                    Debug.LogError("Unkonwo Image Effect Type [ " + imageEffectType + " ]");
                    reader.SkipBuffer();
                }
                else
                {
                    reader.ReadBuffer(imageEffect.Read);
                }
            }
        }
コード例 #3
0
        protected override void OnStartEffect(GameObject target, AdvEngine engine, AdvScenarioThread thread)
        {
            Camera camera = target.GetComponentInChildren <Camera>(true);

            ImageEffectBase imageEffect;
            bool            alreadyEnabled;

            ImageEffectUtil.TryGetComonentCreateIfMissing(ImageEffectType.ColorFade.ToString(), out imageEffect, out alreadyEnabled, camera.gameObject);
            ColorFade colorFade = imageEffect as ColorFade;
            float     start, end;

            if (inverse)
            {
                //画面全体のフェードイン(つまりカメラのカラーフェードアウト)
                start = colorFade.color.a;
                end   = 0;
            }
            else
            {
                //画面全体のフェードアウト(つまりカメラのカラーフェードイン)
                //colorFade.Strengthで、すでにフェードされているのでそちらの値をつかう
                start = alreadyEnabled ? colorFade.Strength : 0;
                end   = this.color.a;
            }
            imageEffect.enabled = true;

            colorFade.color = color;

            Timer timer = camera.gameObject.AddComponent <Timer>();

            timer.AutoDestroy = true;
            timer.StartTimer(
                engine.Page.ToSkippedTime(this.time),
                (x) =>
            {
                colorFade.Strength = x.GetCurve(start, end);
            },
                (x) =>
            {
                OnComplete(thread);
                if (inverse)
                {
                    imageEffect.enabled = false;
                    imageEffect.RemoveComponentMySelf();
                }
            });
        }
コード例 #4
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);
                });
            }
        }
コード例 #5
0
        protected override void OnStartEffect(GameObject target, AdvEngine engine, AdvScenarioThread thread)
        {
            Camera camera = target.GetComponentInChildren <Camera>(true);

            float                start, end;
            ImageEffectBase      imageEffect    = null;
            IImageEffectStrength effectStrength = null;

            if (string.IsNullOrEmpty(ruleImage))
            {
                bool alreadyEnabled;
                bool ruleEnabled = camera.gameObject.GetComponent <RuleFade>();
                if (ruleEnabled)
                {
                    camera.gameObject.SafeRemoveComponent <RuleFade>();
                }
                ImageEffectUtil.TryGetComonentCreateIfMissing(ImageEffectType.ColorFade.ToString(), out imageEffect, out alreadyEnabled, camera.gameObject);
                effectStrength = imageEffect as IImageEffectStrength;
                ColorFade colorFade = imageEffect as ColorFade;
                if (inverse)
                {
                    //画面全体のフェードイン(つまりカメラのカラーフェードアウト)
                    //					start = colorFade.color.a;
                    start = (ruleEnabled) ? 1 : colorFade.color.a;
                    end   = 0;
                }
                else
                {
                    //画面全体のフェードアウト(つまりカメラのカラーフェードイン)
                    //colorFade.Strengthで、すでにフェードされているのでそちらの値をつかう
                    start = alreadyEnabled ? colorFade.Strength : 0;
                    end   = this.color.a;
                }
                colorFade.enabled = true;
                colorFade.color   = color;
            }
            else
            {
                bool alreadyEnabled;
                camera.gameObject.SafeRemoveComponent <ColorFade>();
                ImageEffectUtil.TryGetComonentCreateIfMissing(ImageEffectType.RuleFade.ToString(), out imageEffect, out alreadyEnabled, camera.gameObject);
                effectStrength = imageEffect as IImageEffectStrength;
                RuleFade ruleFade = imageEffect as RuleFade;
                ruleFade.ruleTexture = engine.EffectManager.FindRuleTexture(ruleImage);
                ruleFade.vague       = vague;
                if (inverse)
                {
                    start = 1;
                    end   = 0;
                }
                else
                {
                    start = alreadyEnabled ? ruleFade.Strength : 0;
                    end   = 1;
                }
                ruleFade.enabled = true;
                ruleFade.color   = color;
            }

            Timer timer = camera.gameObject.AddComponent <Timer>();

            timer.AutoDestroy = true;
            timer.StartTimer(
                engine.Page.ToSkippedTime(this.time),
                engine.Time.Unscaled,
                (x) =>
            {
                effectStrength.Strength = x.GetCurve(start, end);
            },
                (x) =>
            {
                OnComplete(thread);
                if (inverse)
                {
                    imageEffect.enabled = false;
                    imageEffect.RemoveComponentMySelf();
                }
            });
        }