Beispiel #1
0
        internal override void ChangeResourceOnDraw(AdvGraphicInfo graphic, float fadeTime)
        {
            patternImage.material = graphic.RenderTextureSetting.GetRenderMaterialIfEnable(patternImage.material);

            // 既に描画されている場合は、クロスフェード用のイメージを作成.
            var crossFade = TryCreateCrossFadeImage(patternImage.PatternName, fadeTime, graphic);

            if (!crossFade)
            {
                ReleaseCrossFadeReference();
            }

            patternImage.CrossFade = crossFade;

            var patternTexture = graphic.File.UnityObject as Modules.PatternTexture.PatternTexture;

            patternImage.PatternTexture = patternTexture;
            patternImage.PatternName    = graphic.SubFileName;
            patternImage.SetNativeSize();

            if (!crossFade)
            {
                ParentObject.FadeIn(fadeTime, () => { });
            }
        }
        protected override void ChangeResourceOnDrawSub(AdvGraphicInfo grapic)
        {
            var settingData = grapic.File.SettingData;

            if (settingData != null)
            {
                if (instance == null)
                {
                    instance = currentObject;

                    animationController = UnityUtility.GetComponent <AnimationPlayer>(currentObject);
                }

                var animationName = settingData.RowData.ParseCellOptional <string>(ANIMATION_ROW_NAME, null);

                var enable = !string.IsNullOrEmpty(animationName);

                UnityUtility.SetActive(gameObject, enable);

                if (enable)
                {
                    animationController.Play(animationName).Subscribe().AddTo(this);
                }
            }
            else
            {
                UnityUtility.SetActive(gameObject, false);
            }
        }
Beispiel #3
0
    void OnLoaded(AdvGraphicInfo graphic)
    {
        switch (graphic.FileType)
        {
        case AdvGraphicInfo.FileTypeDicing:
            dicingImage.DicingData = graphic.File.UnityObject as DicingTextures;
            string pattern = graphic.SubFileName;
            dicingImage.ChangePattern(pattern);
            break;

        default:
            Debug.LogError(graphic.FileType + " is not support ");
            break;
        }
    }
Beispiel #4
0
        // 今の表示状態と比較して、クロスフェード可能か.
        private bool EnableCrossFade(AdvGraphicInfo graphic)
        {
            var patternTexture = graphic.File.UnityObject as PatternTexture.PatternTexture;

            var pattern = graphic.SubFileName;
            var data    = patternImage.GetPatternData(pattern);

            if (data == null)
            {
                return(false);
            }

            return(patternImage.PatternTexture == patternTexture &&
                   patternImage.rectTransform.pivot == graphic.Pivot &&
                   patternImage.Current.width == data.width &&
                   patternImage.Current.height == data.height);
        }
Beispiel #5
0
        protected bool TryCreateCrossFadeImage(string patternName, float time, AdvGraphicInfo graphic)
        {
            if (LastResource == null)
            {
                return(false);
            }

            if (EnableCrossFade(graphic))
            {
                ReleaseCrossFadeReference();

                crossFadeReference = gameObject.AddComponent <AssetFileReference>();
                crossFadeReference.Init(LastResource.File);

                patternImage.CrossFadeTime = time;

                return(true);
            }

            return(false);
        }
Beispiel #6
0
 internal override bool CheckFailedCrossFade(AdvGraphicInfo graphic)
 {
     return(!EnableCrossFade(graphic));
 }
Beispiel #7
0
    public void Load(string name, string pattern)
    {
        AdvGraphicInfo graphicInfo = Engine.DataManager.SettingDataManager.CharacterSetting.KeyToGraphicInfo(AdvCharacterSetting.ToDataKey(name, pattern)).Main;

        Loader.LoadGraphic(graphicInfo, () => OnLoaded(graphicInfo));
    }