Exemple #1
0
    private void OnPlayerExtend()
    {
        if (_isShowImgExtend)
        {
            TweenManager.GetInstance().RemoveTweenByGo(_imgExtendGo);
        }
        else
        {
            _isShowImgExtend = true;
            _imgExtendGo.SetActive(true);
            _imgExtend.color = new Color(1, 1, 1, 0);
        }
        // 出现
        TweenAlpha tween = TweenManager.GetInstance().Create <TweenAlpha>();

        tween.SetParas(_imgExtendGo, 0, 10, ePlayMode.Once);
        tween.SetParas(1, InterpolationMode.Linear);
        TweenManager.GetInstance().AddTween(tween);
        // 渐隐
        tween = TweenManager.GetInstance().Create <TweenAlpha>();
        tween.SetParas(_imgExtendGo, 120, 20, ePlayMode.Once);
        tween.SetParas(0, InterpolationMode.Linear);
        tween.SetFinishCallBack(OnExtendFinish);
        TweenManager.GetInstance().AddTween(tween);
        SoundManager.GetInstance().Play("se_extend", Consts.DefaultUISEVolume, false, false);
    }
 public void Execute(int cmd, object data)
 {
     if (cmd == CommandConsts.PreloadComplete)
     {
         TweenAlpha tween = TweenManager.GetInstance().Create <TweenAlpha>();
         tween.SetParas(_bgGo, 0, 20, ePlayMode.Once);
         tween.SetParas(1, 0, InterpolationMode.Linear);
         tween.SetFinishCallBack(TweenCallback);
         TweenManager.GetInstance().AddTween(tween);
     }
 }
 public override void Update()
 {
     if (_curFinishCommandCount >= _totalWaitCommandCount)
     {
         UIManager.GetInstance().UnregisterViewUpdate(this);
         // 缓动
         TweenAlpha tween = TweenManager.GetInstance().Create <TweenAlpha>();
         tween.SetParas(_bgGo, 0, 20, ePlayMode.Once);
         tween.SetParas(1, 0, InterpolationMode.Linear);
         tween.SetFinishCallBack(TweenCallback);
         TweenManager.GetInstance().AddTween(tween);
     }
 }
    protected override void OnShow(object data = null)
    {
        _bgGo.GetComponent <Image>().color = new Color(0, 0, 0, 1);
        _loadingImg.color = new Color(1, 1, 1, 1);

        TweenAlpha tween = TweenManager.GetInstance().Create <TweenAlpha>();

        tween.SetParas(_loadingImg.gameObject, 0, 60, ePlayMode.PingPong);
        tween.SetParas(1, 0, InterpolationMode.Linear);
        TweenManager.GetInstance().AddTween(tween);

        CommandManager.GetInstance().Register(CommandConsts.PreloadComplete, this);
        //UIManager.GetInstance().RegisterViewUpdate(this);
    }
    /// <summary>
    /// 根据栈顶的table创建对应的tween
    /// </summary>
    /// <param name="luaState"></param>
    /// <returns></returns>
    private TweenBase CreateTweenByTable(ILuaState luaState)
    {
        luaState.GetField(-1, "type");
        // 缓动类型
        eTweenType type = (eTweenType)luaState.ToInteger(-1);

        luaState.Pop(1);
        // delay and duration
        int delay, duration;

        luaState.GetField(-1, "delay");
        delay = luaState.ToInteger(-1);
        luaState.GetField(-2, "duration");
        duration = luaState.ToInteger(-1);
        luaState.Pop(2);
        switch (type)
        {
        case eTweenType.Alhpa:
        {
            TweenAlpha        tween = TweenManager.GetInstance().Create <TweenAlpha>();
            float             begin, end;
            InterpolationMode mode;
            luaState.GetField(-1, "beginValue");
            begin = (float)luaState.ToNumber(-1);
            luaState.GetField(-2, "endValue");
            end = (float)luaState.ToNumber(-1);
            luaState.GetField(-3, "mode");
            mode = (InterpolationMode)luaState.ToInteger(-1);
            luaState.Pop(3);
            tween.SetParas(_charCGGo, delay, duration, ePlayMode.Once);
            tween.SetParas(begin, end, mode);
            return(tween);
        }

        case eTweenType.Color:
        {
            TweenColor        tween = TweenManager.GetInstance().Create <TweenColor>();
            Color             begin, end;
            InterpolationMode mode;
            luaState.GetField(-1, "beginValue");
            begin = InterpreterManager.GetInstance().TranslateTableToColor(luaState);
            luaState.GetField(-2, "endValue");
            end = InterpreterManager.GetInstance().TranslateTableToColor(luaState);
            luaState.GetField(-3, "mode");
            mode = (InterpolationMode)luaState.ToInteger(-1);
            luaState.Pop(3);
            tween.SetParas(_charCGGo, delay, duration, ePlayMode.Once);
            tween.SetParas(begin, end, mode);
            return(tween);
        }

        case eTweenType.Pos2D:
        {
            TweenPos2D        tween = TweenManager.GetInstance().Create <TweenPos2D>();
            Vector2           begin, end;
            InterpolationMode mode;
            luaState.GetField(-1, "beginValue");
            begin = InterpreterManager.GetInstance().TranslateTableToVector2(luaState);
            luaState.GetField(-2, "endValue");
            end = InterpreterManager.GetInstance().TranslateTableToVector2(luaState);
            luaState.GetField(-3, "mode");
            mode = (InterpolationMode)luaState.ToInteger(-1);
            luaState.Pop(3);
            tween.SetParas(_charCGGo, delay, duration, ePlayMode.Once);
            tween.SetParas(begin, end, mode);
            return(tween);
        }

        case eTweenType.Pos3D:
        {
            TweenPos3D        tween = TweenManager.GetInstance().Create <TweenPos3D>();
            Vector3           begin, end;
            InterpolationMode mode;
            luaState.GetField(-1, "beginValue");
            begin = InterpreterManager.GetInstance().TranslateTableToVector3(luaState);
            luaState.GetField(-2, "endValue");
            end = InterpreterManager.GetInstance().TranslateTableToVector3(luaState);
            luaState.GetField(-3, "mode");
            mode = (InterpolationMode)luaState.ToInteger(-1);
            luaState.Pop(3);
            tween.SetParas(_charCGGo, delay, duration, ePlayMode.Once);
            tween.SetParas(begin, end, mode);
            return(tween);
        }

        case eTweenType.Rotation:
        {
            TweenRotation     tween = TweenManager.GetInstance().Create <TweenRotation>();
            Vector3           begin, end;
            InterpolationMode mode;
            luaState.GetField(-1, "beginValue");
            begin = InterpreterManager.GetInstance().TranslateTableToVector3(luaState);
            luaState.GetField(-2, "endValue");
            end = InterpreterManager.GetInstance().TranslateTableToVector3(luaState);
            luaState.GetField(-3, "mode");
            mode = (InterpolationMode)luaState.ToInteger(-1);
            luaState.Pop(3);
            tween.SetParas(_charCGGo, delay, duration, ePlayMode.Once);
            tween.SetParas(begin, end, mode);
            return(tween);
        }

        case eTweenType.Scale:
        {
            TweenScale        tween = TweenManager.GetInstance().Create <TweenScale>();
            Vector3           begin, end;
            InterpolationMode mode;
            luaState.GetField(-1, "beginValue");
            begin = InterpreterManager.GetInstance().TranslateTableToVector3(luaState);
            luaState.GetField(-2, "endValue");
            end = InterpreterManager.GetInstance().TranslateTableToVector3(luaState);
            luaState.GetField(-3, "mode");
            mode = (InterpolationMode)luaState.ToInteger(-1);
            luaState.Pop(3);
            tween.SetParas(_charCGGo, delay, duration, ePlayMode.Once);
            tween.SetParas(begin, end, mode);
            return(tween);
        }
        }
        Logger.LogError("Create Tween by table fail! eTweenType not match!");
        return(null);
    }
Exemple #6
0
    /// <summary>
    /// 符卡结束回调
    /// <para>bool isSpellCard 是否为符卡(非符or符卡)</para>
    /// <para>bool isFinishSpellCard 是否成功击破符卡</para>
    /// <para>bool getBonus 是否获得符卡bonus<para>
    /// <para>int timePassed 经过的时间</para>
    /// <para>int realTimePassed 经过的时间</para>
    /// </summary>
    /// <param name="datas"></param>
    private void OnSpellCardFinish(object[] datas)
    {
        // 隐藏符卡时间
        _isShowSpellCardTime = false;
        _scTimeObject.SetActive(false);
        if (_isShowSpellCardInfo)
        {
            // 隐藏符卡名称
            _scNameObject.SetActive(false);
            TweenManager.GetInstance().RemoveTweenByGo(_scNameObject);
        }
        // 如果是符卡,则显示符卡通过信息
        bool isSpellCard = (bool)datas[0];

        if (isSpellCard == true)
        {
            _spellCardResultPanel.SetActive(true);
            _isFinishSC = (bool)datas[1];
            if (_isFinishSC)
            {
                // 显示符卡击破时间
                _finishTimePanel.SetActive(true);
                int timePassed = (int)datas[3];
                UpdateShowTime(timePassed, _finishTimeDatas);
                // 判断是否获得bonus
                bool getBonus = (bool)datas[2];
                if (getBonus)
                {
                    _getBonusGo.SetActive(true);
                    _bonusFailGo.SetActive(false);
                    SoundManager.GetInstance().Play("se_scbonus", Consts.DefaultUISEVolume, false, false);
                }
                else
                {
                    _getBonusGo.SetActive(false);
                    _bonusFailGo.SetActive(true);
                }
            }
            else
            {
                _finishTimePanel.SetActive(false);
                _getBonusGo.SetActive(false);
                _bonusFailGo.SetActive(true);
                SoundManager.GetInstance().Play("se_scfault", Consts.DefaultUISEVolume, false, false);
            }
            // 显示实际时间
            int realTimePassed = (int)datas[4];
            UpdateShowTime(realTimePassed, _realTimeDatas);
            // 设置符卡结果面板动画参数
            _resultState = 0;
            _resultTime  = 0;
            for (int i = 0; i < 10; i++)
            {
                _realTimeDatas[i].sr.color = new Color(1, 1, 1, 0);
            }
            _realTimeText.color = new Color(1, 1, 1, 0);
            if (_isFinishSC)
            {
                for (int i = 0; i < 10; i++)
                {
                    _finishTimeDatas[i].sr.color = new Color(1, 1, 1, 0);
                }
                _finishTimeText.color = new Color(1, 1, 1, 0);
            }
            _getBonusGo.transform.localScale  = new Vector3(100, 100, 1);
            _bonusFailGo.transform.localScale = new Vector3(100, 100, 1);
            _isShowingSCResult = true;
            // 更新BossInfo
            if (_isShowBossInfo)
            {
                if (_bossInfoSCLeft > 0)
                {
                    _bossInfoSCLeft--;
                    GameObject starGo = _bossInfoStarList[_bossInfoSCLeft].gameObject;
                    TweenAlpha tween0 = TweenManager.GetInstance().Create <TweenAlpha>();
                    tween0.SetParas(starGo, 0, 30, ePlayMode.Once);
                    tween0.SetParas(0, InterpolationMode.Linear);
                    TweenManager.GetInstance().AddTween(tween0);
                    TweenScale tween1 = TweenManager.GetInstance().Create <TweenScale>();
                    tween1.SetParas(starGo, 0, 30, ePlayMode.Once);
                    tween1.SetParas(new Vector3(2, 2, 1), InterpolationMode.EaseOutQuad);
                    TweenManager.GetInstance().AddTween(tween1);
                }
                else
                {
                    _isShowBossInfo = false;
                    _bossInfoGo.SetActive(false);
                }
            }
        }
        else
        {
            _spellCardResultPanel.SetActive(false);
        }
    }