Esempio n. 1
0
        void DrawSub(AdvGraphicInfo graphic, float fadeTime)
        {
            TargetObject.name = graphic.File.FileName;

/*			if (LastResource != graphic)
 *                      {
 *                              TargetObject.ChangeResourceOnDraw(graphic, fadeTime);
 *                      }*/
            TargetObject.ChangeResourceOnDraw(graphic, fadeTime);
            if (RenderObject != TargetObject)
            {
                //テクスチャ書き込みをしている
                RenderObject.ChangeResourceOnDraw(graphic, fadeTime);
                if (graphic.IsUguiComponentType)
                {
                    //UGUI系は、描画するImageにスケール値を適用
                    RenderObject.Scale(graphic);
                }
            }
            else
            {
                TargetObject.Scale(graphic);
            }
            RenderObject.Alignment(Layer.SettingData.Alignment, graphic);
            RenderObject.Flip(Layer.SettingData.FlipX, Layer.SettingData.FlipY);
            this.LastResource = graphic;
        }
Esempio n. 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);

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                string         key     = reader.ReadString();
                AdvGraphicInfo graphic = null;
                reader.ReadBuffer(x => graphic = AdvGraphicInfo.ReadGraphicInfo(Engine, x));
                byte[]           buffer = reader.ReadBuffer();
                AdvGraphicObject obj    = CreateObject(key, graphic);
                obj.Read(buffer, graphic);
            }
            string defaulObjectName = reader.ReadString();

            DefaultObject = Find(defaulObjectName);
        }
Esempio n. 3
0
        public AdvCommandParticle(StringGridRow row, AdvSettingDataManager dataManager)
            : base(row)
        {
            this.label = ParseCell <string>(AdvColumnName.Arg1);
            string fileName = ParseCellOptional <string>(AdvColumnName.Arg2, label);

            if (!dataManager.ParticleSetting.Dictionary.ContainsKey(fileName))
            {
                Debug.LogError(ToErrorString(fileName + " is not contained in file setting"));
            }

            this.graphic = dataManager.ParticleSetting.LabelToGraphic(fileName);
            AddLoadGraphic(graphic);

            this.layerName = ParseCellOptional <string>(AdvColumnName.Arg3, "");
            if (!string.IsNullOrEmpty(layerName) && !dataManager.LayerSetting.Contains(layerName))
            {
                Debug.LogError(ToErrorString(layerName + " is not contained in layer setting"));
            }

            //グラフィック表示処理を作成
            this.graphicOperationArg = new AdvGraphicOperationArg(this, graphic, 0);

//			this.sortingOrder = ParseCellOptional<int>(AdvColumnName.Arg4,0);
        }
Esempio n. 4
0
        //クロスフェード用のイメージを作成
        protected bool TryCreateCrossFadeImage(float time, AdvGraphicInfo graphic)
        {
            if (LastResource == null)
            {
                return(false);
            }

            if (EnableCrossFade(graphic))
            {
                ReleaseCrossFadeReference();
                crossFadeReference = this.gameObject.AddComponent <AssetFileReference>();
                crossFadeReference.Init(LastResource.File);
                UguiCrossFadeDicing crossFade = this.gameObject.GetComponentCreateIfMissing <UguiCrossFadeDicing>();
                crossFade.CrossFade(
                    Dicing.PatternData,
                    Dicing.mainTexture,
                    time,
                    () =>
                {
                    Destroy(crossFade);
                }
                    );
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
        //********描画時のリソース変更********//
        internal override void ChangeResourceOnDraw(AdvGraphicInfo graphic, float fadeTime)
        {
            Avatar.Material = graphic.RenderTextureSetting.GetRenderMaterialIfEnable(Avatar.Material);

            //既に描画されている場合は、クロスフェード用のイメージを作成
//			bool crossFade = TryCreateCrossFadeImage(fadeTime);
            //新しくリソースを設定
            AvatarData avatarData = graphic.File.UnityObject as AvatarData;

            Avatar.AvatarData = avatarData;
            Avatar.CachedRectTransform.sizeDelta = avatarData.Size;
            Avatar.AvatarPattern.SetPattern(graphic.RowData);

            //目パチを設定
            SetEyeBlinkSync(graphic.EyeBlinkData);
            //口パクを設定
            SetLipSynch(graphic.LipSynchData);
            //アニメーションを設定
            SetAnimation(graphic.AnimationData);

            if (LastResource == null)
            {
                ParentObject.FadeIn(fadeTime, () => { });
            }
        }
Esempio n. 6
0
        //キャプチャーイメージとして初期化
        internal void InitCaptureImage(AdvGraphicInfo grapic, Camera cachedCamera)
        {
            this.LastResource = grapic;
            AdvGraphicObjectRawImage captueImage = this.gameObject.GetComponentInChildren <AdvGraphicObjectRawImage>();

            captueImage.CaptureCamera(cachedCamera);
        }
Esempio n. 7
0
 internal void Init(AdvGraphicInfo graphic, float pixelsToUnits)
 {
     this.Setting = graphic.RenderTextureSetting;
     this.CreateCamera(pixelsToUnits);
     this.CreateTexture();
     this.CreateRoot(graphic, pixelsToUnits);
 }
Esempio n. 8
0
        //配置
        internal override void Alignment(Utage.Alignment alignment, AdvGraphicInfo graphic)
        {
            RectTransform t = this.transform as RectTransform;

            t.pivot = graphic.Pivot;
            if (alignment == Utage.Alignment.None)
            {
                //アラインメイント指定なし
                t.anchoredPosition = graphic.Position;
                Vector3 local = t.localPosition;
                local.z         = graphic.Position.z;
                t.localPosition = local;
                return;
            }
            //アラインメイントから、アンカーの値を取得
            Vector2 alignmentValue = AlignmentUtil.GetAlignmentValue(alignment);

            t.anchorMin = t.anchorMax = alignmentValue;

            //アラインメントする際の座標値オフセット
            Vector3 offset1 = t.pivot - alignmentValue;

            offset1.Scale(t.GetSizeScaled());
            //アンカーとピボットを考慮したポジション設定
            {
                Vector3 tmp = graphic.Position + offset1;
                t.anchoredPosition = tmp;
                Vector3 local = t.localPosition;
                local.z         = tmp.z;
                t.localPosition = local;
            }
        }
Esempio n. 9
0
        //クロスフェード用のイメージを作成
        protected virtual bool TryCreateCrossFadeImage(float time, AdvGraphicInfo graphic)
        {
            if (LastResource == null)
            {
                return(false);
            }

            if (EnableCrossFade(graphic))
            {
                ReleaseCrossFadeReference();
                crossFadeReference = this.gameObject.AddComponent <AssetFileReference>();
                crossFadeReference.Init(LastResource.File);
                crossFade = this.gameObject.AddComponent <UguiCrossFadeDicing>();
                crossFade.Timer.Unscaled = Engine.Time.Unscaled;
                crossFade.CrossFade(
                    Dicing.PatternData,
                    Dicing.mainTexture,
                    time,
                    () =>
                {
                    ReleaseCrossFadeReference();
                }
                    );
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 10
0
 //********描画時のリソース変更********//
 protected override void ChangeResourceOnDrawSub(AdvGraphicInfo graphic)
 {
     foreach (var item in this.GetComponentsInChildren <IAdvGraphicObjectCustom>())
     {
         item.ChangeResourceOnDrawSub(graphic);
     }
 }
Esempio n. 11
0
        //クロスフェード用のイメージを作成
        protected bool TryCreateCrossFadeImage(float time, AdvGraphicInfo graphic)
        {
            if (LastResource == null)
            {
                return(false);
            }

            if (RawImage.texture == null)
            {
                return(false);
            }

            //前フレームのテクスチャを使ってクロスフェード処理を行う
            ReleaseTemporary();
            Material material = this.Material;

            this.copyTemporary = RenderTextureSpace.RenderTexture.CreateCopyTemporary(0);
            UguiCrossFadeRawImage crossFade = this.gameObject.AddComponent <UguiCrossFadeRawImage>();

            crossFade.Material = material;
            crossFade.CrossFade(
                copyTemporary,
                time,
                () =>
            {
                //テクスチャを破棄
                ReleaseTemporary();
                Destroy(crossFade);
            });
            return(true);
        }
Esempio n. 12
0
        //********描画時のリソース変更********//
        internal override void ChangeResourceOnDraw(AdvGraphicInfo grapic, float fadeTime)
        {
            //新しくリソースを設定
            if (LastResource != grapic)
            {
                currentObject = GameObject.Instantiate(grapic.File.UnityObject) as GameObject;
                Vector3 localPostion     = currentObject.transform.localPosition;
                Vector3 localEulerAngles = currentObject.transform.localEulerAngles;
                Vector3 localScale       = currentObject.transform.localScale;
                currentObject.transform.SetParent(this.transform);
                currentObject.transform.localPosition    = localPostion;
                currentObject.transform.localScale       = localScale;
                currentObject.transform.localEulerAngles = localEulerAngles;
                currentObject.ChangeLayerDeep(this.gameObject.layer);
                currentObject.gameObject.SetActive(true);

                animator = this.GetComponentInChildren <Animator>();
                ChangeResourceOnDrawSub(grapic);
            }

            if (LastResource == null)
            {
                ParentObject.FadeIn(fadeTime, () => { });
            }
        }
Esempio n. 13
0
 protected override void ChangeResourceOnDrawSub(AdvGraphicInfo graphic)
 {
     foreach (IAdvGraphicObjectCustom custom in base.GetComponentsInChildren <IAdvGraphicObjectCustom>())
     {
         custom.ChangeResourceOnDrawSub(graphic);
     }
 }
Esempio n. 14
0
        /// <summary>
        /// テクスチャファイルを設定
        /// </summary>
        /// <param name="graphic">グラフィック情報</param>
        public void LoadFile(AdvGraphicInfo graphic)
        {
            this.GraphicInfo = graphic;
            this.Loader.LoadGraphic(
                graphic, () =>
            {
                switch (graphic.FileType)
                {
                case AdvGraphicInfo.FileType2D:
                case "":
                    RawImage rawImage = ChangeGraphicComponent <RawImage>();
                    rawImage.texture  = graphic.File.Texture;
                    InitSize(new Vector2(rawImage.texture.width, rawImage.texture.height));
                    break;

                case AdvGraphicInfo.FileTypeDicing:
                    DicingImage dicingImage = ChangeGraphicComponent <DicingImage>();
                    dicingImage.DicingData  = graphic.File.UnityObject as DicingTextures;
                    string pattern          = graphic.SubFileName;
                    dicingImage.ChangePattern(pattern);
                    InitSize(new Vector2(dicingImage.PatternData.Width, dicingImage.PatternData.Height));
                    break;

                default:
                    Debug.LogError(graphic.FileType + " is not support ");
                    break;
                }
                OnLoadEnd.Invoke();
            });
        }
Esempio n. 15
0
        //描画オブジェクトを作成
        AdvGraphicObject CreateObject(string name, AdvGraphicInfo grapic)
        {
            AdvGraphicObject obj;
            //IAdvGraphicObjectがAddComponentされたプレハブをリソースに持つかチェック
            GameObject prefab;

            if (grapic.TryGetAdvGraphicObjectPrefab(out prefab))
            {
                //プレハブからリソースオブジェクトを作成して返す
                GameObject go = GameObject.Instantiate(prefab);
                go.name = name;
                obj     = go.GetComponent <AdvGraphicObject>();
                rootObjects.AddChild(obj.gameObject);
            }
            else
            {
                obj = rootObjects.AddChildGameObjectComponent <AdvGraphicObject>(name);
            }
            obj.Init(this, grapic);

            //最初の描画時は位置をリセットする
            if (currentGraphics.Count == 0)
            {
                this.ResetCanvasRectTransform();
            }

            currentGraphics.Add(obj.name, obj);
            return(obj);
        }
Esempio n. 16
0
        //********描画時のリソース変更********//
        internal override void ChangeResourceOnDraw(AdvGraphicInfo graphic, float fadeTime)
        {
            Dicing.material = graphic.RenderTextureSetting.GetRenderMaterialIfEnable(Dicing.material);
            //既に描画されている場合は、クロスフェード用のイメージを作成
            bool crossFade = TryCreateCrossFadeImage(fadeTime, graphic);

            if (!crossFade)
            {
                ReleaseCrossFadeReference();
                this.RemoveComponent <UguiCrossFadeDicing>();
            }
            DicingTextures dicingTexture = graphic.File.UnityObject as DicingTextures;
            string         pattern       = graphic.SubFileName;

            Dicing.DicingData = dicingTexture;
            Dicing.ChangePattern(pattern);
            Dicing.SetNativeSize();

            //目パチを設定
            SetEyeBlinkSync(graphic.EyeBlinkData);
            //口パクを設定
            SetLipSynch(graphic.LipSynchData);
            //アニメーションを設定
            SetAnimation(graphic.AnimationData);
            if (!crossFade)
            {
                ParentObject.FadeIn(fadeTime, () => { });
            }
        }
Esempio n. 17
0
        //********初期化********//
        public virtual void Init(AdvGraphicLayer layer, AdvGraphicInfo graphic)
        {
            this.layer         = layer;
            this.rectTransform = this.transform as RectTransform;
            this.rectTransform.SetStretch();

            if (graphic.RenderTextureSetting.EnableRenderTexture)
            {
                InitRenderTextureImage(graphic);
            }
            else
            {
                GameObject child = this.transform.AddChildGameObject(graphic.Key);
                this.TargetObject = this.RenderObject = child.AddComponent(graphic.GetComponentType()) as AdvGraphicBase;
                this.TargetObject.Init(this);
            }

            //リップシンクのキャラクターラベルを設定
            LipSynchBase lipSync = TargetObject.GetComponentInChildren <LipSynchBase>();

            if (lipSync != null)
            {
                lipSync.CharacterLabel = this.gameObject.name;
                lipSync.OnCheckTextLipSync.AddListener(
                    (x) =>
                {
                    x.EnableTextLipSync = (x.CharacterLabel == Engine.Page.CharacterLabel && Engine.Page.IsSendChar);
                });
            }

            this.FadeTimer   = this.gameObject.AddComponent <Timer>();
            this.effectColor = this.GetComponentCreateIfMissing <AdvEffectColor>();
            this.effectColor.OnValueChanged.AddListener(RenderObject.OnEffectColorsChange);
        }
Esempio n. 18
0
 //新しいグラフィックをロードする(古いのはアンロード)
 public void LoadGraphic(AdvGraphicInfo graphic, Action onComplete)
 {
     Unload();
     this.graphic = graphic;
     //新しいファイルへの参照
     AssetFileManager.Load(graphic.File, this);
     StartCoroutine(CoLoadWait(onComplete));
 }
        /*
         * Live2DLipSynchForCri LipSynchForCri
         * {
         *  get { return this.GetComponentCache<Live2DLipSynchForCri>(ref lipSynchForCri); }
         * }
         * Live2DLipSynchForCri lipSynchForCri;
         *
         * Live2DLipSynch LipSynch
         *      {
         *  get { return this.GetComponentCache<Live2DLipSynch>(ref lipSynch); }
         *      }
         *      Live2DLipSynch lipSynch;
         */
        #endregion

        //描画時のリソース変更
        public void ChangeResourceOnDrawSub(AdvGraphicInfo graphic)
        {
            //描画順の設定
            RenderController.SortingOrder = AdvObj.Layer.SettingData.Order;
            //リップシンクありならそれを設定
            if (UseLipSynch != null)
            {
                UseLipSynch.Play();
            }
        }
Esempio n. 20
0
        //ファイルがあればそれをアンロード(正確にはロードへの参照を切る)
        public void Unload()
        {
            if (this.graphic == null)
            {
                return;
            }

            this.graphic.File.Unuse(this);
            this.graphic = null;
        }
Esempio n. 21
0
        //********描画時にクロスフェードが失敗するであろうかのチェック********//
        internal override bool CheckFailedCrossFade(AdvGraphicInfo grapic)
        {
            //ファイルが同じで、アニメーションステート名が違う場合、アニメーション変更だけのパターン変更とみなす
            if (IsOnlyChangeAnimationState(grapic))
            {
                return(false);
            }

            //それ以外は、クロスフェード失敗で、オブジェクトを作り直す流れに
            return(true);
        }
Esempio n. 22
0
 //クロスフェード可能な素材か比較
 internal bool CheckFailedCrossFade(AdvGraphicInfo target)
 {
     if (target.FileType != this.FileType)
     {
         return(true);
     }
     if (!target.EnablePivot0 && target.Pivot0 != this.Pivot0)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 23
0
 //セーブデータ用のバイナリ読み込み
 public void Read(byte[] buffer, AdvGraphicInfo graphic)
 {
     this.TargetObject.gameObject.SetActive(false);
     Loader.LoadGraphic(
         graphic,
         () =>
     {
         this.TargetObject.gameObject.SetActive(true);
         SetGraphicOnSaveDataRead(graphic);
         BinaryUtil.BinaryRead(buffer, Read);
     }
         );
 }
Esempio n. 24
0
 //ルートオブジェクトの作成
 void CreateRoot(AdvGraphicInfo graphic, float pixelsToUnits)
 {
     if (graphic.IsUguiComponentType)
     {
         CreateCanvas();
     }
     else
     {
         this.RenderRoot = this.RenderCamera.transform.AddChildGameObject("Root");
         this.RenderRoot.transform.localPosition = Setting.RenderTextureOffset / pixelsToUnits;
         this.RenderRoot.transform.localScale    = graphic.Scale;
     }
 }
Esempio n. 25
0
 private void CreateRoot(AdvGraphicInfo graphic, float pixelsToUnits)
 {
     if (graphic.IsUguiComponentType)
     {
         this.CreateCanvas();
     }
     else
     {
         this.RenderRoot = this.RenderCamera.get_transform().AddChildGameObject("Root");
         this.RenderRoot.get_transform().set_localPosition((Vector3)(this.Setting.RenderTextureOffset / pixelsToUnits));
         this.RenderRoot.get_transform().set_localScale(graphic.Scale);
     }
 }
Esempio n. 26
0
        private void SetIconDicing(AdvGraphicInfo graphic, Rect rect)
        {
            DicingImage    image       = this.ChangeIconComponent <DicingImage>();
            DicingTextures unityObject = graphic.File.UnityObject as DicingTextures;
            string         subFileName = graphic.SubFileName;

            image.DicingData = unityObject;
            image.ChangePattern(subFileName);
            float width  = image.PatternData.Width;
            float height = image.PatternData.Height;

            image.UvRect = rect.ToUvRect(width, height);
            this.ChangeReference(graphic.File, image.get_gameObject());
        }
Esempio n. 27
0
        //アイコンのイメージを表示
        protected virtual void SetIconRectImage(AdvGraphicInfo graphic, Rect rect)
        {
            RawImage rawImage = ChangeIconComponent <RawImage>();

            rawImage.material = null;
            Texture2D texture = graphic.File.Texture;

            rawImage.texture = texture;
            float w = texture.width;
            float h = texture.height;

            rawImage.uvRect = rect.ToUvRect(w, h);

            ChangeReference(graphic.File, rawImage.gameObject);
        }
        private bool IsVideoType(AssetFileInfo fileInfo, IAssetFileSettingData settingData)
        {
            if (fileInfo.FileType != AssetFileType.UnityObject)
            {
                return(false);
            }
            if (settingData is AdvCommandSetting)
            {
                AdvCommandSetting setting = settingData as AdvCommandSetting;
                return(setting.Command is AdvCommandVideo);
            }
            AdvGraphicInfo info = settingData as AdvGraphicInfo;

            return((info != null) && (info.FileType == "Video"));
        }
        internal override void ChangeResourceOnDraw(AdvGraphicInfo graphic, float fadeTime)
        {
            bool flag = this.TryCreateCrossFadeImage(fadeTime, graphic);

            if (!flag)
            {
                this.RemoveComponent <UguiCrossFadeRawImage>();
                this.ReleaseTemporary();
            }
            this.RawImage.set_texture(this.RenderTextureSpace.RenderTexture);
            this.RawImage.SetNativeSize();
            if (!flag && (base.LastResource == null))
            {
                if (< > f__am$cache0 == null)
                {
Esempio n. 30
0
        internal override void ChangeResourceOnDraw(AdvGraphicInfo graphic, float fadeTime)
        {
            this.Avatar.Material = graphic.RenderTextureSetting.GetRenderMaterialIfEnable(this.Avatar.Material);
            AvatarData unityObject = graphic.File.UnityObject as AvatarData;

            this.Avatar.AvatarData = unityObject;
            this.Avatar.CachedRectTransform.set_sizeDelta(unityObject.Size);
            this.Avatar.AvatarPattern.SetPattern(graphic.RowData);
            this.SetEyeBlinkSync(graphic.EyeBlinkData);
            this.SetLipSynch(graphic.LipSynchData);
            this.SetAnimation(graphic.AnimationData);
            if (base.LastResource == null)
            {
                if (< > f__am$cache0 == null)
                {