internal override void OnDraw(GraphicInfoList graphic, float fadeTime)
		{
			//テクスチャが同じなら、変化なし
			if (this.CurrentSprite != null && this.CurrentSprite.GraphicInfo == graphic.Main) return;

			//フェードアウト中のスプライトは消す
			if (FadeOutSprite != null)
			{
				FadeOutSprite.FadeOut(0, true);
				FadeOutSprite = null;
			}

			if (CurrentSprite != null)
			{
				//既にスプライトがあるならフェードアウトさせる
				FadeOutSprite = CurrentSprite;
				///表示順は手前にする
				FadeOutSprite.LocalOrderInLayer = FadeOutSprite.LocalOrderInLayer + 1;
				FadeOutSprite.FadeOut(fadeTime, true);

				//テクスチャからスプライト作成
				CurrentSprite = CreateSprite(graphic);
			}
			else
			{
				//新規スプライトがあるならフェードインさせる
				//テクスチャからスプライト作成
				CurrentSprite = CreateSprite(graphic);
				CurrentSprite.FadeIn(fadeTime);
			}
		}
Esempio n. 2
0
        //セーブデータ用のバイナリ読み込み
        void ReadSaveData(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version <= VERSION_1)
            {
                ReadOldVersion(reader, version);
            }
            else if (version == VERSION)
            {
                this.isEventMode = reader.ReadBoolean();
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    string           name            = reader.ReadString();
                    string           layerName       = reader.ReadString();
                    string           graphicDataType = reader.ReadString();
                    string           graphicKey      = reader.ReadString();
                    bool             isDefault       = reader.ReadBoolean();
                    GraphicInfoList  graphicInfo     = AdvGraphicInfoParser.FindGraphicInfo(engine, graphicDataType, graphicKey);
                    AdvGraphicLayer  layer           = FindLayer(layerName);
                    AdvGraphicObject graphic         = layer.AddObject(name, graphicInfo, isDefault);
                    graphic.Read(graphicInfo, reader);
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Esempio n. 3
0
        internal AdvGraphicOperaitonArg(AdvCommand command, GraphicInfoList graphic, float fadeTime, bool isNoPtattern = false)
        {
            this.RowData      = command.RowData;
            this.Graphic      = graphic;
            this.FadeTime     = fadeTime;
            this.IsNoPtattern = isNoPtattern;

            this.Arg2 = command.ParseCellOptional <string>(AdvColumnName.Arg2, "");
            this.Arg3 = command.ParseCellOptional <string>(AdvColumnName.Arg3, "");
            this.Arg4 = command.ParseCellOptional <string>(AdvColumnName.Arg4, "");
            this.Arg5 = command.ParseCellOptional <string>(AdvColumnName.Arg5, "");
            float x;

            if (float.TryParse(Arg4, out x))
            {
                this.X = x;
            }
            float y;

            if (float.TryParse(Arg5, out y))
            {
                this.Y = y;
            }
            else
            {
                MotionPlayType type;
                if (UtageToolKit.TryParaseEnum <MotionPlayType>(Arg5, out type))
                {
                    PlayType = type;
                }
            }
        }
Esempio n. 4
0
        internal override void OnDraw(GraphicInfoList graphic, float fadeTime)
        {
            //テクスチャが同じなら、変化なし
            if (this.CurrentSprite != null && this.CurrentSprite.GraphicInfo == graphic.Main)
            {
                return;
            }

            //フェードアウト中のスプライトは消す
            if (FadeOutSprite != null)
            {
                FadeOutSprite.FadeOut(0, true);
                FadeOutSprite = null;
            }

            if (CurrentSprite != null)
            {
                //既にスプライトがあるならフェードアウトさせる
                FadeOutSprite = CurrentSprite;
                ///表示順は手前にする
                FadeOutSprite.LocalOrderInLayer = FadeOutSprite.LocalOrderInLayer + 1;
                FadeOutSprite.FadeOut(fadeTime, true);

                //テクスチャからスプライト作成
                CurrentSprite = CreateSprite(graphic);
            }
            else
            {
                //新規スプライトがあるならフェードインさせる
                //テクスチャからスプライト作成
                CurrentSprite = CreateSprite(graphic);
                CurrentSprite.FadeIn(fadeTime);
            }
        }
		internal AdvGraphicOperaitonArg(StringGridRow row, GraphicInfoList graphic, float fadeTime, bool isNoPtattern = false)
		{
			this.RowData = row;
			this.Graphic = graphic;
			this.FadeTime = fadeTime;
			this.IsNoPtattern = isNoPtattern;

			this.Arg2 = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg2, "");
			this.Arg3 = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg3, "");
			this.Arg4 = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg4, "");
			this.Arg5 = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg5, "");
			float x;
			if (float.TryParse(Arg4, out x))
			{
				this.X = x;
			}
			float y;
			if (float.TryParse(Arg5, out y))
			{
				this.Y = y;
			}
			else
			{
				MotionPlayType type;
				if (UtageToolKit.TryParaseEnum<MotionPlayType>(Arg5, out type))
				{
					PlayType = type;
				}
			}
		}
Esempio n. 6
0
        Sprite2D CreateSprite(GraphicInfoList graphic)
        {
            GraphicInfo texture = graphic.Main;
            Sprite2D    sprite  = UtageToolKit.AddChildGameObjectComponent <Sprite2D>(this.transform, FilePathUtil.GetFileNameWithoutExtension(texture.File.FileName));

            sprite.SetTextureFile(texture, PixelsToUnits);
            sprite.LocalOrderInLayer = Layer.SettingData.Order;
            return(sprite);
        }
		//ロードの必要があるファイルを追加
		public void AddLoadGraphic(GraphicInfoList graphic )
		{
			if(graphic==null) return;

			foreach( var item in graphic.InfoList )
			{
				AddLoadFile(item.File);
			}
		}
        //ロードの必要があるファイルを追加
        public void AddLoadGraphic(GraphicInfoList graphic)
        {
            if (graphic == null)
            {
                return;
            }

            foreach (var item in graphic.InfoList)
            {
                AddLoadFile(item.File);
            }
        }
Esempio n. 9
0
 /// <summary>
 /// 初期化
 /// </summary>
 /// <param name="key">キー(キャラ名を)</param>
 /// <param name="fileName">ファイルネーム</param>
 internal void Init(string name, string pattern, string nameText, StringGridRow row)
 {
     this.name    = name;
     this.pattern = pattern;
     this.InitKey(AdvCharacterSetting.ToDataKey(name, pattern));
     this.nameText = nameText;
     this.graphic  = new GraphicInfoList(AdvGraphicInfoParser.TypeCharacter, Key, AdvParser.ParseCellOptional <string>(row, AdvColumnName.FileType, ""));
     if (!AdvParser.IsEmptyCell(row, AdvColumnName.FileName))
     {
         AddGraphicInfo(row);
     }
 }
		//描画
		internal override void OnDraw(GraphicInfoList graphic, float fadeTime)
		{
			if (Graphic == graphic)
			{
			}
			else
			{
				GraphicInfo main = graphic.Main;
				currentObject = UtageToolKit.AddChildUnityObject(childRoot.transform, main.File.UnityObject);
				childRoot.transform.localScale = new Vector3(main.Scale.x, main.Scale.y, 1.0f);
//				childRoot.transform.localPosition = PivotUtil.GetPivotOffset(currentObject, graphic.Pivot);
			}
		}
Esempio n. 11
0
        //描画
        internal override void OnDraw(GraphicInfoList graphic, float fadeTime)
        {
            if (Graphic == graphic)
            {
            }
            else
            {
                GraphicInfo main = graphic.Main;
                currentObject = UtageToolKit.AddChildUnityObject(childRoot.transform, main.File.UnityObject);
                childRoot.transform.localScale = new Vector3(main.Scale.x, main.Scale.y, 1.0f);
//				childRoot.transform.localPosition = PivotUtil.GetPivotOffset(currentObject, graphic.Pivot);
            }
        }
        /// <summary>
        /// StringGridの一行からデータ初期化
        /// </summary>
        /// <param name="row">初期化するためのデータ</param>
        /// <returns>成否</returns>
        public override bool InitFromStringGridRow(StringGridRow row)
        {
            string key = AdvParser.ParseCell <string>(row, AdvColumnName.Label);

            InitKey(key);
            this.type             = AdvParser.ParseCell <Type>(row, AdvColumnName.Type);
            this.graphic          = new GraphicInfoList(AdvGraphicInfoParser.TypeTexture, key, AdvParser.ParseCellOptional <string>(row, AdvColumnName.FileType, ""));
            this.thumbnailName    = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Thumbnail, "");
            this.thumbnailVersion = AdvParser.ParseCellOptional <int>(row, AdvColumnName.ThumbnailVersion, 0);
            this.cgCategolly      = AdvParser.ParseCellOptional <string>(row, AdvColumnName.CgCategolly, "");
            this.AddGraphicInfo(row);
            return(true);
        }
        /// セーブデータの読みこみ
        internal virtual void OnRead(GraphicInfoList graphic, BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version >= BaseVersion)
            {
                StartCoroutine(CoLoadGraphic(graphic, () => OnReadComplete(graphic)));
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Esempio n. 14
0
        //指定の名前のオブジェクトを取得、なければ作成
        internal AdvGraphicObject AddObject(string name, GraphicInfoList grapic, bool isDefault)
        {
            Type             type = AdvGraphicObjectFactory.Create(grapic.FileType);
            GameObject       go   = UtageToolKit.AddChildGameObject(this.transform, name);
            AdvGraphicObject obj  = go.AddComponent(type) as AdvGraphicObject;

            obj.Init(this);
            currentGraphics.Add(name, obj);
            if (isDefault)
            {
                defaultObject = obj;
            }
            return(obj);
        }
Esempio n. 15
0
        //テクスチャパスからグラフィック情報を取得(古いバージョンのセーブデータを読むのに使う)
        internal static GraphicInfoList FindGraphicInfoFromTexturePath(AdvEngine engine, string texturePath)
        {
            GraphicInfoList graphic = engine.DataManager.SettingDataManager.CharacterSetting.FindFromPath(texturePath);

            if (graphic != null)
            {
                return(graphic);
            }

            graphic = engine.DataManager.SettingDataManager.TextureSetting.FindFromPath(texturePath);
            if (graphic != null)
            {
                return(graphic);
            }

            return(new GraphicInfoList(texturePath));
        }
        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);
            }
        }
Esempio n. 17
0
        //古いセーブデータを読み込み
        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;
        }
        protected IEnumerator CoLoadGraphic(GraphicInfoList graphic, Action OnComplete)
        {
            IsLoading = true;
            //直前のファイルがあればそれを削除
            foreach (var item in this.GetComponents <AssetFileReference>())
            {
                Destroy(item);
            }

            foreach (var item in graphic.InfoList)
            {
                AssetFile file = AssetFileManager.Load(item.File, this);
                file.AddReferenceComponet(this.gameObject);
                file.Unuse(this);
            }

            while (!graphic.IsLoadEnd)
            {
                yield return(0);
            }

            OnComplete();
            IsLoading = false;
        }
		//指定の名前のオブジェクトを取得、なければ作成
		internal AdvGraphicObject AddObject(string name, GraphicInfoList grapic, bool isDefault )
		{
			Type type = AdvGraphicObjectFactory.Create(grapic.FileType);
			GameObject go = UtageToolKit.AddChildGameObject(this.transform, name);
			AdvGraphicObject obj = go.AddComponent(type) as AdvGraphicObject;
			obj.Init(this);
			currentGraphics.Add(name, obj);
			if(isDefault) defaultObject = obj;
			return obj;
		}
		Sprite2D CreateSprite(GraphicInfoList graphic)
		{
			GraphicInfo texture = graphic.Main;
			Sprite2D sprite = UtageToolKit.AddChildGameObjectComponent<Sprite2D>(this.transform, System.IO.Path.GetFileNameWithoutExtension(texture.File.FileName));
			sprite.SetTextureFile(texture, PixelsToUnits);
			sprite.LocalOrderInLayer = Layer.SettingData.Order;
			return sprite;
		}
 //グラフィック情報の設定
 internal abstract void OnDraw(GraphicInfoList graphic, float fadeTime);
 internal virtual void OnReadComplete(GraphicInfoList graphic)
 {
     OnDraw(graphic, 0);
     Graphic = graphic;
     EffectColors.OnValueChanged.Invoke(EffectColors);
 }