//セーブデータ用のバイナリ読み込み 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(this.EffectColor.Read); reader.ReadBuffer( (x) => { AdvITweenPlayer.ReadSaveData(x, this.gameObject, true, this.PixelsToUnits); }); reader.ReadBuffer( (x) => { AdvAnimationPlayer.ReadSaveData(x, this.gameObject, Engine); }); if (version <= Version0) { return; } reader.ReadBuffer( (x) => { this.TargetObject.Read(x); }); }
//初期化処理 protected override void AddGraphicComponentOnInit() { Dicing = this.gameObject.AddComponent <DicingImage>(); this.EyeBlink = this.gameObject.AddComponent <EyeBlinkDicing>(); this.LipSynch = this.gameObject.AddComponent <LipSynchDicing>(); this.Animation = this.gameObject.AddComponent <AdvAnimationPlayer>(); }
//セーブデータ用のバイナリ書き込み public void Write(BinaryWriter writer) { writer.Write(Version); writer.WriteLocalTransform(this.transform); writer.WriteBuffer(this.EffectColor.Write); writer.WriteBuffer((x) => AdvITweenPlayer.WriteSaveData(x, this.gameObject)); writer.WriteBuffer((x) => AdvAnimationPlayer.WriteSaveData(x, this.gameObject)); }
//セーブデータ用のバイナリ書き込み public void Write(BinaryWriter writer) { writer.Write(Version); writer.WriteRectTransfom(this.rectTransform); writer.WriteBuffer(this.EffectColor.Write); writer.WriteBuffer((x) => AdvITweenPlayer.WriteSaveData(x, this.gameObject)); writer.WriteBuffer((x) => AdvAnimationPlayer.WriteSaveData(x, this.gameObject)); writer.WriteBuffer((x) => this.TargetObject.Write(x)); }
internal static void ReadSaveData(BinaryReader reader, GameObject go, AdvEngine engine) { //AnimationPlayerの数だけ読みこみ int count = reader.ReadInt32(); for (int i = 0; i < count; ++i) { AdvAnimationPlayer player = go.AddComponent <AdvAnimationPlayer>(); player.Read(reader, engine); } }
//エフェクト開始時のコールバック 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; } AdvAnimationPlayer player = target.AddComponent <AdvAnimationPlayer>(); player.AutoDestory = true; player.EnableSave = true; player.Play(animationData.Clip, engine.Page.SkippedSpeed, () => { OnComplete(thread); }); }
//エフェクト開始時のコールバック 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); }); } }
public void OnEffectFinalize() { Timer = null; AnimationPlayer = null; }