//旧バージョン(LayerManagerだったころ)のレイヤーデータ読み込み internal void ReadOld(BinaryReader reader) { //Transofom,Colorを空読み込み Vector3 pos = new Vector3(); Vector3 euler = new Vector3(); Vector3 scale = new Vector3(); UtageToolKit.ReadLocalTransform(reader, out pos, out euler, out scale); UtageToolKit.ReadColor(reader); //Tween情報を空読み込み int tweenCount = reader.ReadInt32(); for (int i = 0; i < tweenCount; ++i) { AdvTweenPlayer tween = this.gameObject.AddComponent <AdvTweenPlayer>() as AdvTweenPlayer; tween.Read(reader, Manager.PixelsToUnits); Destroy(tween); } //各スプライトの読み込み int count = reader.ReadInt32(); for (int i = 0; i < count; ++i) { string name = reader.ReadString(); GameObject go = UtageToolKit.AddChildGameObject(this.transform, name); AdvGraphicObject2DSprite obj = go.AddComponent <AdvGraphicObject2DSprite>(); obj.Init(this); currentGraphics.Add(name, obj); obj.ReadOld(reader); } //デフォルトオブジェクトを設定 defaultObject = Find(reader.ReadString()); }
/* * /// <summary> * /// セーブデータ用のバイナリ書き込み * /// </summary> * /// <param name="writer">バイナリライター</param> * public void WriteOld(BinaryWriter writer) * { * UtageToolKit.WriteLocalTransform(this.transform, writer); * UtageToolKit.WriteColor(this.LocalColor, writer); * * //無限ループのTweenがある場合は、Tween情報を書き込む * iTweenPlayer[] tweenArray = this.gameObject.GetComponents<iTweenPlayer>() as iTweenPlayer[]; * int tweenCount = 0; * foreach (var tween in tweenArray) * { * if (tween.IsEndlessLoop) ++tweenCount; * } * writer.Write(tweenCount); * foreach (var tween in tweenArray) * { * if (tween.IsEndlessLoop) tween.Write(writer); * } * * writer.Write(CurrentTextureName); * } */ /// <summary> /// 昔のセーブデータ用のバイナリ読みこみ /// </summary> /// <param name="reader">バイナリリーダー</param> public void ReadOld(BinaryReader reader) { UtageToolKit.ReadLocalTransform(this.transform, reader); // EffectColors.SetColor( Utage.EffectColors.Index.TweenColor, UtageToolKit.ReadColor(reader) ); //Tweenがある場合は、Tween情報を読み込む int tweenCount = reader.ReadInt32(); for (int i = 0; i < tweenCount; ++i) { AdvTweenPlayer tween = this.gameObject.AddComponent <AdvTweenPlayer>() as AdvTweenPlayer; tween.Read(reader, pixelsToUnits); } }
internal virtual void Read(GraphicInfoList graphic, BinaryReader reader) { int version = reader.ReadInt32(); if (version == Version) { UtageToolKit.ReadLocalTransform(this.transform, reader); this.EffectColors.Read(reader); //Tweenがある場合は、Tween情報を読み込む int tweenCount = reader.ReadInt32(); for (int i = 0; i < tweenCount; ++i) { AdvTweenPlayer tween = this.gameObject.AddComponent <AdvTweenPlayer>() as AdvTweenPlayer; tween.Read(reader, PixelsToUnits); } OnRead(graphic, reader); } }
//古いセーブデータを読み込み internal void ReadOld(BinaryReader reader) { UtageToolKit.ReadLocalTransform(this.transform, reader); EffectColors.SetColor(Utage.EffectColors.Index.TweenColor, UtageToolKit.ReadColor(reader)); //Tweenがある場合は、Tween情報を読み込む int tweenCount = reader.ReadInt32(); for (int i = 0; i < tweenCount; ++i) { AdvTweenPlayer tween = this.gameObject.AddComponent <AdvTweenPlayer>(); tween.Read(reader, PixelsToUnits); } GraphicInfoList graphic = AdvGraphicInfoParser.FindGraphicInfoFromTexturePath(Engine, reader.ReadString()); OnDraw(graphic, 0); Graphic = graphic; IsLoading = false; }
/// <summary> /// セーブデータ用のバイナリ読みこみ /// </summary> /// <param name="reader">バイナリリーダー</param> public void Read(BinaryReader reader) { int version = reader.ReadInt32(); if (version >= Version) { UtageToolKit.ReadLocalTransform(this.transform, reader); this.LocalColor = UtageToolKit.ReadColor(reader); // this.EffectColors.Read(reader); //Tweenがある場合は、Tween情報を読み込む int tweenCount = reader.ReadInt32(); for (int i = 0; i < tweenCount; ++i) { AdvTweenPlayer tween = this.gameObject.AddComponent <AdvTweenPlayer>(); tween.Read(reader, pixelsToUnits); } } else { Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version)); } }