Exemple #1
0
        public void InitializeByParams(object[] param)
        {
            CommandParam data = param[0] as CommandParam;

            AdvKeyContent bgKeys = AdvKeyContent.GetCurrentInstance();

            if (string.Equals(data.command, "CgOff", System.StringComparison.OrdinalIgnoreCase))
            {
                display = BackgroundDisplayType.HideAll;
                return;
            }
            if (bgKeys != null)
            {
                spriteCG = bgKeys.GetDiceCGByKey(data.image);
                if (spriteCG == null)
                {
                    if (!string.IsNullOrEmpty(data.image))
                    {
                        AdvUtility.LogWarning("找不到CG檔:" + data.image + " , 於 行數 " + (this.itemId - 3));
                    }
                }
                else
                {
                    atlasCG = spriteCG.AtlasAsset;
                }
            }
        }
Exemple #2
0
        public override void OnEnter()
        {
            BillboardOptions options = new BillboardOptions();

            options.billboardSprite    = spriteBillboard;
            options.billboardDiceAtlas = spriteAtlas;
            if (spriteDynamicBillboard == null && spriteAtlas != null)
            {
                spriteDynamicBillboard = spriteAtlas.GetSpriteContainName("Normal");
            }
            options.billboardDiceSprite = spriteDynamicBillboard;
            options.display             = display;
            options.fromPosition        = fromPosition;
            options.toPosition          = toPosition;
            options.toPositionShift     = positionShift;
            options.shiftAmount         = positionShiftAmount;
            options.toDistance          = spriteDistance;
            options.hideWhich           = hideWhich;
            options.flipFace            = flipFace;
            options.useDefaultSettings  = useDefaultSettings;
            options.fadeDuration        = fadeDuration;
            options.moveDuration        = moveDuration;
            options.shiftOffset         = shiftOffset;
            options.move              = move;
            options.shiftIntoPlace    = shiftIntoPlace;
            options.waitUntilFinished = waitUntilFinished;

            targetStage = AdvManager.Instance.advStage;
            targetStage.BillboardLayout.RunBillboardCommand(options, Continue); // 已在 callback 加上 Continue, 因此此指令執行完時直接 Continue
            //targetStage.RunBillboardCommand(options, Continue);
        }
Exemple #3
0
    public void SetRendererSprite(string _sprite)
    {
        DicedSprite _target = GetSprite(_sprite);

        if (_target == null)
        {
            return;
        }

        SetRendererSprite(_target);
    }
Exemple #4
0
        public override void OnEnter()
        {
            var cgFront  = AdvManager.Instance.advStage.BackgoundLayout.DS_CG_Front;
            var cgBehide = AdvManager.Instance.advStage.BackgoundLayout.DS_CG_Behide;


            if (display == BackgroundDisplayType.Show)
            {
                // Fade in the new sprite image
                if (cgFront.DicedSprite != null)
                {
                    cgBehide.SetDicedSprite(cgFront.DicedSprite);
                }
                cgBehide.Color = cgFront.Color;

                cgFront.Color = new Color(sprtieColor.r, sprtieColor.g, sprtieColor.b, 0f);
                DicedSprite targetDS = AdvVariantManager.Instance.GetDiceSprite($"{spriteCG.AtlasAsset.name}.{spriteCG.name}");
                if (targetDS != null)
                {
                    cgFront.SetDicedSprite(targetDS);
                    AdvManager.Instance.advStage.BackgoundLayout.OnReadCG?.Invoke(targetDS);
                }
                else
                {
                    Debug.LogError($">> Can't load CG key: {spriteCG.AtlasAsset.name}.{spriteCG.name}");
                }

                DOTween.To(() => cgFront.Color, x => cgFront.Color = x, sprtieColor, duration).SetEase(FadeEaseType).OnComplete(() => {
                    if (waitUntilFinished)
                    {
                        Continue();
                    }
                });

                //如果要蓋上去的背景具有半透明,則淡出上一張背景
                if (sprtieColor.a < 0.99f)
                {
                    DOTween.To(() => cgBehide.Color, x => cgBehide.Color = x, new Color(0, 0, 0, 0), duration).SetEase(FadeEaseType);
                }

                if (!waitUntilFinished)
                {
                    Continue();
                }
            }
            else if (display == BackgroundDisplayType.HideAll)
            {
                cgBehide.Color = new Color(sprtieColor.r, sprtieColor.g, sprtieColor.b, 0f);
                DOTween.To(() => cgFront.Color, x => cgFront.Color = x, new Color(0, 0, 0, 0), duration).SetEase(FadeEaseType).OnComplete(() => {
                    if (waitUntilFinished)
                    {
                        Continue();
                    }
                });

                if (!waitUntilFinished)
                {
                    Continue();
                }
            }
            else
            {
                Continue();
            }
        }
Exemple #5
0
        public void InitializeByParams(object[] param)
        {
            CommandParam data = param[0] as CommandParam;

            Sprite           _sprite = null;
            DicedSpriteAtlas _atlas;
            DicedSprite      _diceSprite = null;

            AdvKeyContent ADVKeys = AdvKeyContent.GetCurrentInstance();

            if (ADVKeys != null)
            {
                //尋找立繪圖區(DiceAtlas)
                _atlas = ADVKeys.GetDiceAtlasByKey(data.image);
                if (_atlas != null)
                {
                    spriteAtlas = _atlas;
                    _diceSprite = ADVKeys.GetDiceBillboardByKeyContain("Normal", _atlas);

                    if (_diceSprite == null)
                    {
                        AdvUtility.LogWarning("找不到Billboard檔:" + data.image + " , 於 行數 " + (this.itemId - 3));
                        if (Application.isPlaying)
                        {
                            //_diceSprite = FungusExtendEditorConfig.Instance.DefaultDiceSprite;
                        }
                    }
                }
                else if (!string.IsNullOrEmpty(data.image))
                {
                    //可能是使用怪物圖
                    _sprite = ADVKeys.GetEnemyByKey(data.image);

                    if (_sprite == null)
                    {
                        AdvUtility.LogWarning("找不到Billboard檔:" + data.image + " , 於 行數 " + (this.itemId - 3));
                        if (Application.isPlaying)
                        {
                            //_diceSprite = AdvManager.Instance.DefaultDiceSprite;
                        }
                    }
                }

                /*
                 * _diceSprite = ADVKeys.GetDiceBillboardByKey(data.billboardKey);  // ex: Lica_Normal
                 * if(_diceSprite == null && !string.IsNullOrEmpty(data.billboardKey)) {
                 *  AdvUtility.LogWarning("找不到Billboard檔:" + data.billboardKey + " , 於 行數 " + (this.itemId - 3));
                 *  _diceSprite = AdvManager.Instance.DefaultDiceSprite;
                 * }
                 */

                /* // 舊版 UI 型 立繪
                 * //尋找立繪圖區
                 * _sprite = ADVKeys.GetBillboardByKey(data.billboardKey);
                 * if(_sprite == null){
                 * //可能使用怪物圖區,尋找怪物圖區
                 *  _sprite = ADVKeys.GetEnemyByKey(data.billboardKey);
                 * }
                 * //兩者皆沒有,替換為香菇
                 * if(_sprite == null && !string.IsNullOrEmpty(data.billboardKey)){
                 *
                 *  AdvUtility.LogWarning("找不到Billboard檔:" + data.billboardKey + " , 於 行數 " + (this.itemId - 3));
                 *  _sprite = AdvManager.Instance.DefaultSprite;
                 * }
                 */
            }

            spriteBillboard        = _sprite;
            spriteDynamicBillboard = _diceSprite;
            display        = StageExtend.GetDisplayTypeByCommand(data.command);
            spriteDistance = StageExtend.GetBbDistanceByString(data.arg1);
            toPosition     = StageExtend.GetBbPositionByString(data.target);
            hideWhich      = StageExtend.GetBbHideByString(data.target);
            //flipFace = flipFace;
            useDefaultSettings = true;
            //fadeDuration = fadeDuration;
            //moveDuration = moveDuration;
            //shiftOffset = shiftOffset;
            //move = move;
            //shiftIntoPlace = shiftIntoPlace;
            //waitUntilFinished = waitUntilFinished;
        }
Exemple #6
0
 public void SetRendererSprite(DicedSprite _sprite)
 {
     GetRenderer().SetDicedSprite(_sprite);
 }