Example #1
0
    public void OnCameraUpdatePosition()
    {
        Vector3 above = playerTransform.position + (Vector3.up * 2f);

        myTransform.localPosition = Camera.main.WorldToScreenPoint(above) -
                                    new Vector3(Screen.width / 2f, Screen.height / 2f, 0);

        if ((isFadedOut && myTransform.localPosition.z > MIN_FADE_OUT_DISTANCE &&
             myTransform.localPosition.z < MAX_FADE_OUT_DISTANCE)
            ||
            (!isFadedOut && myTransform.localPosition.z > MIN_FADE_IN_DISTANCE &&
             myTransform.localPosition.z < MAX_FADE_IN_DISTANCE))
        {
            backTransform.localScale = new Vector3(3000 / myTransform.localPosition.z,
                                                   backTransform.localScale.y, backTransform.localScale.z);

            hpTransform.localPosition = new Vector3(-((backTransform.localScale.x / 2f) - (BASE_PADDING_WIDTH / 2f)), 0, 0);
            hpTransform.localScale    = new Vector3(
                Mathf.Clamp(((3000 / myTransform.localPosition.z) - BASE_PADDING_WIDTH) * lastHpChangePercent, 0.01f, 2000f),
                hpTransform.localScale.y, hpTransform.localScale.z);

            hpAlphaTween.Play(true);
            backAlphaTween.Play(true);
            isFadedOut = false;
        }
        else
        {
            hpAlphaTween.Play(false);
            backAlphaTween.Play(false);
            isFadedOut = true;
        }
    }
    public void changeTrackMap(Track track)
    {
        switch (track)
        {
        case Track.Track1:
            track1.Play(true);
            track2.Play(false);
            track3.Play(false);
            selectedTrack = Track.Track1;
            break;

        case Track.Track2:
            track1.Play(false);
            track2.Play(true);
            track3.Play(false);
            selectedTrack = Track.Track2;
            break;

        case Track.Track3:
            track1.Play(false);
            track2.Play(false);
            track3.Play(true);
            selectedTrack = Track.Track3;
            break;

        case Track.None:
            track1.Play(false);
            track2.Play(false);
            track3.Play(false);
            selectedTrack = 0;
            break;
        }
    }
Example #3
0
        public void _show(object callback, List <string> list)
        {
            NGUITools.SetActive(gameObject, true);
            List <string> tmplist = defautSpriteNameList;

            if (list != null && list.Count > 0)
            {
                tmplist = list;
            }
            if (tmplist != null && tmplist.Count > 0)
            {
                int index = NumEx.NextInt(0, tmplist.Count);
                CLUIUtl.setSpriteFit(sprite, tmplist [index]);
            }

            finishCallback = callback;
//		NGUITools.SetActive (label.gameObject, false);
            tweenAlpha.Play(true);

            CLPanelBase p = CLPanelManager.topPanel;

            panel.depth       = p == null ? 3000 : p.panel.depth + CLPanelManager.depthOffset + 100;
            panel.renderQueue = UIPanel.RenderQueue.StartAt;
            // 设置startingRenderQueue是为了可以在ui中使用粒子效果,注意在粒子中要绑定CLUIParticle角本
            panel.startingRenderQueue = CLPanelManager.Const_RenderQueue + this.panel.depth;
        }
Example #4
0
    private void OnSysTemClick()
    {
        isShrinkSystemBtn = !isShrinkSystemBtn;
        sysTemTweenP.Play(isShrinkSystemBtn);
        sysTemTweenA.Play(isShrinkSystemBtn);
        sysTemTweenP.gameObject.SetActive(true);
        bool p = serverMgr.GetInstance().GetGameMusic();

        if (p)
        {
            yinyueSwitch.spriteName = "yinyueguan";
        }
        else
        {
            yinyueSwitch.spriteName = "yinyue";
        }
        bool s = serverMgr.GetInstance().GetGameSoundEffect();

        if (s)
        {
            yinxiaoSwitch.spriteName = "yingxiaoguan";
        }
        else
        {
            yinxiaoSwitch.spriteName = "yingxiao";
        }
        //mark.gameObject.SetActive(true);
    }
Example #5
0
 public void AddColorFadeIn()
 {
     if (Application.platform == RuntimePlatform.WP8Player)
     {
         m_addColorTweenAlpha.enabled = true;
         m_addColorTweenAlpha.Play(true);
     }
 }
Example #6
0
 public void DoFadeout(float time)
 {
     Fadeout.gameObject.SetActive(true);
     Fadein.gameObject.SetActive(false);
     Fadeout.ResetToBeginning();
     Fadeout.duration = time;
     Fadeout.Play();
 }
Example #7
0
 void ResultOn()
 {
     _resultAlpha.callWhenFinished = "";
     _resultAlpha.from             = 0;
     _resultAlpha.to = 1;
     _resultAlpha.Reset();
     _resultAlpha.Play(true);
 }
Example #8
0
 public void OnObject()
 {
     _tweenAlpha.from     = 0;
     _tweenAlpha.to       = 1;
     _tweenAlpha.duration = 1;
     //<<sprite 교체코드 삽입 필요, 스프라이트를 인자로 받던가..
     _tweenAlpha.Reset();
     _tweenAlpha.Play(true);
 }
    void applyTweenEvents(UILabel label, int difference, TweenPosition positionTween, TweenAlpha alphaTween, UILabel destinationLabel, Color positveColor, Color negativeColor, float duration = 2.5f)
    {
        if (difference > 0)
        {
            label.text = "+ " + difference.ToString();
        }
        else
        {
            label.text = difference.ToString();
        }

        positionTween = label.GetComponent <TweenPosition>();
        alphaTween    = label.GetComponent <TweenAlpha>();

        if (positionTween == null)
        {
            positionTween          = label.gameObject.AddMissingComponent <TweenPosition>();
            positionTween.from     = new Vector3(label.transform.localPosition.x, label.transform.localPosition.y, 0);
            positionTween.to       = new Vector3(label.transform.localPosition.x, (root.activeHeight / 2) - (destinationLabel.height / 2), 0);
            positionTween.duration = duration;
            positionTween.style    = UITweener.Style.Once;
            positionTween.Play();
        }
        else
        {
            positionTween.ResetToBeginning();
            positionTween.Play();
        }

        //tweenPosition.onFinished.Add(EventDelegate(this.OnTweenFinished));

        if (difference > 0)
        {
            label.color = positveColor;
        }
        else
        {
            label.color = negativeColor;
        }


        if (alphaTween == null)
        {
            alphaTween          = label.gameObject.AddMissingComponent <TweenAlpha>();
            alphaTween.from     = 1f;
            alphaTween.to       = 0f;
            alphaTween.duration = duration;
            alphaTween.style    = UITweener.Style.Once;
            alphaTween.Play();
        }
        else
        {
            alphaTween.ResetToBeginning();
            alphaTween.Play();
        }
    }
    IEnumerator DelayedSpriteAppearance(float delay)
    {
        yield return(new WaitForSeconds(delay));

        draggedSprite.spriteName = picker.CurrentSpriteName;
        draggedSprite.cachedTransform.localScale = picker.GetCenterWidget().cachedTransform.localScale;
        draggedSprite.enabled = true;
        tweenAlpha.ResetToBeginning();
        tweenAlpha.Play(true);
    }
Example #11
0
 void CardOn()
 {
     _cardTween.callWhenFinished = "";
     _cardTween.from.y           = 175;
     _cardTween.to.y             = 314;
     _cardTweenAlpha.from        = 0;
     _cardTweenAlpha.to          = 1;
     _cardTween.Reset();
     _cardTween.Play(true);
     _cardTweenAlpha.Reset();
     _cardTweenAlpha.Play(true);
 }
Example #12
0
    void OnEnable()
    {
        if (bgTween != null)
        {
//			bgTween.enabled = true;
//			bgTween.from = 0f;
//			bgTween.to = 1f;
            bgTween.Play();
        }
        RestaurantData.StatisticsRestaurantWaitBilling();
        UpdateBelleTip();
        UpdateRestaurantTips();
        UpdateFellowRedTip();
    }
 public void changeGameState(GameState change)
 {
     if (change == activeGameState)
     {
         if (applyToTweenAlpha && alpha != null)
         {
             alpha.Play(true);
         }
         if (applyToTweenColor && color != null)
         {
             color.Play(true);
         }
         if (applyToTweenPosition && position != null)
         {
             position.Play(true);
         }
         if (applyToTweenRotate && rotate != null)
         {
             rotate.Play(true);
         }
         if (applyToTweenScale && scale != null)
         {
             scale.Play(true);
         }
     }
     else
     {
         if (applyToTweenAlpha && alpha != null)
         {
             alpha.Play(false);
         }
         if (applyToTweenColor && color != null)
         {
             color.Play(false);
         }
         if (applyToTweenPosition && position != null)
         {
             position.Play(false);
         }
         if (applyToTweenRotate && rotate != null)
         {
             rotate.Play(false);
         }
         if (applyToTweenScale && scale != null)
         {
             scale.Play(false);
         }
     }
 }
 /// <summary>
 /// 参加人数の確認とラベルエフェクトの再生を行う
 /// </summary>
 public void CheckEntryAndPlayEffect()
 {
     if (CheckEntry())
     {
         goLabelEffect_Entry.Play(true);
         goLabelEffect_Stay.enabled = true;
         flagStartAndGo             = true;
     }
     else
     {
         goLabelEffect_Entry.Play(false);
         goLabelEffect_Stay.enabled = false;
         flagStartAndGo             = false;
     }
 }
Example #15
0
    public void PlayAnim()
    {
        if (m_spSign != null)
        {
            TweenAlpha ta = m_spSign.GetComponentsInChildren <TweenAlpha>(true)[0];
            //TweenScale ts = m_spSign.GetComponentsInChildren<TweenScale>(true)[0];

            ta.Reset();
            //ts.Reset();

            ta.enabled = true;
            //ts.enabled = true;

            ta.Play(true);
            //ts.Play(true);
        }

        for (int i = 0; i < m_listSprite.Count; ++i)
        {
            TweenAlpha ta = m_listSprite[i].GetComponentsInChildren <TweenAlpha>(true)[0];
            //TweenScale ts = m_listSprite[i].GetComponentsInChildren<TweenScale>(true)[0];

            ta.Reset();
            //ts.Reset();

            ta.enabled = true;
            //ts.enabled = true;

            ta.Play(true);
            //ts.Play(true);
        }
    }
 void ColorFade(TweenAlpha objectAlpha)
 {
     objectAlpha.enabled = false;
     objectAlpha.ResetToBeginning();
     objectAlpha.enabled = true;
     objectAlpha.Play();
 }
Example #17
0
    public void Init(Color color, string text)
    {
        label.color       = color;
        label.effectColor = Color.black;
        label.text        = text;

        tweenAlpha.duration = 1;
        tweenScale.duration = 1;

        tweenScale.ResetToBeginning();
        tweenAlpha.ResetToBeginning();
        tweenScale.Play();
        tweenAlpha.Play();

        cooldown = CooldownManager.AddCooldown(tweenAlpha.duration, null, UnSpawn, 0, Time.fixedDeltaTime);
    }
    // Update is called once per frame
    void Update()
    {
        if (m_tweenPosition.enabled == false)
        {
            // フレームをデルタタイムで取得
            m_frame += Time.deltaTime;

            if (m_frame >= 0.75f && m_isTween == true)
            {
                GameObject.Destroy(this.gameObject);
            }
            // 0.25秒経ったら
            if (m_frame >= 0.25f && m_isTween == false)
            {
                m_tweenAlpha.delay = 0.0f;
                m_tweenAlpha.Play(false);
                m_isTween = true;

                CGameManager.m_soundPlayer.ChangeSEVolume(0.1f);
                CGameManager.m_soundPlayer.PlaySE("game/time_count");

//this.transform.Find("Player1").transform.GetChild("player").transform.GetComponent<CPlayer1>().m_playerSE.PlaySE("game/time_count");
                m_tweenPosition.from  = new Vector3(this.transform.localPosition.x, -30.0f, 0.0f);
                m_tweenPosition.to    = new Vector3(this.transform.localPosition.x, 30.0f, 0.0f);
                m_tweenPosition.delay = 0.0f;
                m_tweenPosition.Play(false);
            }
        }
    }
Example #19
0
    /// <summary>
    /// ���Ż���ǿ������3����
    /// </summary>
    private void PlayBaseReward2TextAnimation()
    {
        if (!IsPlayingSuccessAnimation)
        {
            return;
        }

        m_lblBaseReward2Num.gameObject.SetActive(true);
        m_lblBaseReward2TextAnimation.gameObject.SetActive(true);

        TweenScale ts = m_lblBaseReward2TextAnimation.GetComponentsInChildren <TweenScale>(true)[0];

        ts.Reset();
        ts.duration         = TEXT_ANIMATION_DURATION;
        ts.to               = TEXT_ANIMATION_TO;
        ts.callWhenFinished = "OnBaseReward2TextAnimationEnd";
        ts.eventReceiver    = this.gameObject;
        ts.enabled          = true;
        ts.Play(true);

        TweenAlpha ta = m_lblBaseReward2TextAnimation.GetComponentsInChildren <TweenAlpha>(true)[0];

        ta.Reset();
        ta.duration = TEXT_ANIMATION_DURATION;
        ta.enabled  = true;
        ta.Play(true);
    }
Example #20
0
    public void StartFade(bool forward)
    {
        m_ta.Reset();

        m_ta.gameObject.SetActive(true);

        if (forward)
        {
            m_spLighting.color = new Color(1, 1, 1, 0);
            m_ta.from          = 0;
            m_ta.to            = 1;

            m_ta.eventReceiver = null;
        }
        else
        {
            m_spLighting.color = new Color(1, 1, 1, 1);
            m_ta.from          = 1;
            m_ta.to            = 0;

            m_ta.eventReceiver    = gameObject;
            m_ta.callWhenFinished = "OnTAEnd";
        }

        m_ta.Play(true);
    }
Example #21
0
    // Use this for initialization
    void Start()
    {
        MySprite  = GameObject.Find("MySprite");
        spriteAni = MySprite.GetComponent <UISpriteAnimation> ();
        spriteAni.Pause();

        //获取images中的子物体
        GameObject images = GameObject.Find("images");

        for (int i = 0; i < images.transform.childCount; i++)
        {
            GameObject _text  = images.transform.GetChild(i).gameObject;
            TweenAlpha _tween = _text.GetComponent <TweenAlpha> ();
            //将每个text都隐藏起来
            _tween.Play(false);
            tweens.Add(_tween);
        }
        //获取按钮和其透明度
        GameObject btn = GameObject.Find("buttons");

        for (int i = 0; i < btn.transform.childCount; i++)
        {
            GameObject gameobject = btn.transform.GetChild(i).gameObject;
            TweenAlpha _tween     = gameobject.GetComponent <TweenAlpha> ();
            UIButton   _btn       = gameobject.GetComponent <UIButton> ();
            _tween.Play(false);
            buttons.Add(_btn);
            tweenBtn.Add(_tween);
        }

        StaticGlobal.Spin = false;
    }
Example #22
0
    // 倒计时结束的关闭
    public void OnCloseClick()
    {
        // 进入战斗
        //UISystem.Get ().FadeBattle(true);

        // 当前页面的渐出,透明度
        TweenAlpha ta = gameObject.GetComponent <TweenAlpha> ();

        if (ta == null)
        {
            ta = gameObject.AddComponent <TweenAlpha> ();
        }
        ta.ResetToBeginning();
        ta.from     = 1;
        ta.to       = 0;
        ta.duration = 0.25f;
        ta.SetOnFinished(() => {
            StartGame();
        });
        ta.Play(true);

        // 当前页面的渐出,放大

        /*
         * TweenScale ts = gameObject.GetComponent<TweenScale> ();
         * if (ts == null) {
         *      ts = gameObject.AddComponent<TweenScale> ();
         * }
         * ts.ResetToBeginning ();
         * ts.from = Vector3.one;
         * ts.to = Vector3.one * 1.25f;
         * ts.duration = 0.3f;
         * ts.Play (true);
         */
    }
Example #23
0
    public override void OnShow()
    {
        base.OnShow();
        gameType = BattleSystem.Instance.battleData.gameType;
        if (gameType == GameType.Single || gameType == GameType.PayLevel || gameType == GameType.TestLevel || gameType == GameType.SingleLevel)
        {
            // 单机
            BattleSystem.Instance.lockStep.Reset();
            Invoke("FinishSingle", 3f);
            lineSingle.gameObject.SetActive(true);

            TweenAlpha ta = gameObject.GetComponent <TweenAlpha>();
            if (ta == null)
            {
                ta = gameObject.AddComponent <TweenAlpha>();
            }

            ta.ResetToBeginning();
            ta.from     = 1f;
            ta.to       = 0;
            ta.duration = 2.0f;
            ta.Play(true);
        }
        else
        {
            // 非单机
            haveResult = false;
            Invoke("FinishPvp", 3f);
            linePvp.gameObject.SetActive(true);
        }
    }
Example #24
0
    public void Show(TransitionMode mode)
    {
        Setup();
        if (panel == null)
        {
            Debug.LogError("[Transition] UIPanel not found");
            return;
        }

        this.gameObject.SetActive(true);
        if (mode == TransitionMode.EaseIn)
        {
            bShowing = true;
            bDone    = false;
            if (bFirstTime)
            {
                bFirstTime = false;
                tween.ResetToBeginning();
            }
            tween.Play(false);
        }
        else if (mode == TransitionMode.EaseOut)
        {
            panel.alpha = 1;
            bShowing    = false;
            bDone       = false;
            if (bFirstTime)
            {
                bFirstTime = false;
                tween.ResetToBeginning();
            }
            tween.PlayForward();
        }
        tween.enabled = true;
    }
Example #25
0
    void DecreaseHp(float newHP)
    {
        hpIndicatorAnim.Reset();
        Vector3 scale = hpIndicator.localScale;

        scale.x = _hpPercent;
        hpIndicatorAnim.from = scale;
        scale.x                  = newHP;
        hpIndicatorAnim.to       = scale;
        hpIndicatorAnim.duration = decreaseTime;
        hpIndicatorAnim.Play(true);

        hpIndicatorEffectAnim2.Reset();
        scale   = hpIndicatorEffect.localScale;
        scale.x = _hpPercent;
        hpIndicatorEffectAnim2.from = scale;
        scale.x = newHP;
        hpIndicatorEffectAnim2.to = scale;
        hpIndicatorEffectAnim2.Play(true);

        hpIndicatorEffectAnim.Reset();
        hpIndicatorEffectAnim.Play(true);

        _hpPercent = newHP;
    }
Example #26
0
    private void SetSignInfo()
    {
        m_tChick.Clear();
        if (moduleUnion.CardSignInfo == null)
        {
            return;
        }
        string signKey = "unionSign" + modulePlayer.id_.ToString() + modulePlayer.roleInfo?.leagueID.ToString();

        m_cardBgGroup.SafeSetActive(false);
        var first = moduleWelfare.FrirstOpen(signKey);

        if (first)
        {
            m_cardBgGroup.SafeSetActive(true);
            for (int i = 0; i < m_itemBg.Count; i++)
            {
                if (m_itemBg[i] == null)
                {
                    continue;
                }
                TweenRotation rotation = m_itemBg[i].GetComponent <TweenRotation>();
                TweenAlpha    alpha    = m_itemBg[i].GetComponent <TweenAlpha>();
                TweenPosition position = m_itemBg[i].GetComponent <TweenPosition>();
                rotation?.Play();
                alpha?.Play();
                position?.Play();
            }
        }

        SetTimesTxt();
    }
Example #27
0
    public static TweenAlpha FadeTo(GameObject go, UITweener.Method method, UITweener.Style style,
                                    float duration, float delay, float alphaFrom, float alphaTo)
    {
        if (go == null)
        {
            return(null);
        }

        //go.RemoveComponent<TweenAlpha>();

        TweenAlpha comp = UITweenerUtil.Begin <TweenAlpha>(go, method, style, duration, delay);

        //comp.ResetToBeginning();
        comp.from     = alphaFrom;
        comp.to       = alphaTo;
        comp.duration = duration;
        comp.delay    = delay;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        comp = ResetTween(comp);
        comp.Play(true);
        return(comp);
    }
Example #28
0
    public void FadeToBlack()
    {
        BlackBG.gameObject.SetActive(true);

        BlackBGAlpha.Reset();
        BlackBGAlpha.Play(true);
    }
Example #29
0
    public void PlayAnim()
    {
        for (int i = 0; i < m_listSprite.Count; ++i)
        {
            TweenAlpha ta = m_listSprite[i].GetComponentsInChildren <TweenAlpha>(true)[0];
            TweenScale ts = m_listSprite[i].GetComponentsInChildren <TweenScale>(true)[0];

            ta.Reset();
            ts.Reset();

            ta.enabled = true;
            ts.enabled = true;

            ta.Play(true);
            ts.Play(true);
        }

        if (m_bIsNeedSign)
        {
            TweenAlpha ta = m_goBillboard.GetComponentsInChildren <UISprite>(true)[m_iSignID].GetComponentsInChildren <TweenAlpha>(true)[0];
            TweenScale ts = m_goBillboard.GetComponentsInChildren <UISprite>(true)[m_iSignID].GetComponentsInChildren <TweenScale>(true)[0];
            ta.Reset();
            ts.Reset();

            ta.enabled = true;
            ts.enabled = true;

            ta.Play(true);
            ts.Play(true);
        }
    }
    // Update is called once per frame
    void Update()
    {
        label.text = "" + Time.timeSinceLevelLoad;

        countdown = maxCountdown - Mathf.FloorToInt(Time.timeSinceLevelLoad);
        if (countdown == 0)
        {
            label.text = "GO";

            // enable all players
            PlayerScript.EnableAllPlayers(true);

            // enable UI time
            UITimeScript.Enabled = true;
        }
        else if (countdown <= 0)
        {
            this.gameObject.SetActive(false);
            sprite.SetActive(false);
            playerCamera.GetComponent <musicPlaylist>().enabled = true;
        }
        else
        {
            label.text = (countdown).ToString();
        }

        if (lastTextChange != label.text)
        {
            lastTextChange = label.text;
            alpha.Reset();
            alpha.Play(true);
            scale.Reset();
            scale.Play(true);
        }
    }
Example #31
0
    public void FadeOut()
    {
        Camera mainCamera = Camera.main;
        AudioSource musicPlayer = mainCamera.GetComponent(typeof(AudioSource)) as AudioSource;
        TweenVolume volTween = mainCamera.gameObject.AddComponent<TweenVolume>() as TweenVolume;
        volTween.from = musicPlayer.volume;
        volTween.to = 0f;
        volTween.delay = 2.0f;
        volTween.duration = 2.5f;

        panel.gameObject.SetActive(true);

        tween = panel.GetComponent<TweenAlpha>() as TweenAlpha;
        tween.from = 0f;
        tween.to = 1f;
        tween.duration = 3.0f;
        tween.delay = 2.0f;

        tween.ResetToBeginning();
        tween.Play(true);
        volTween.Play(true);
    }
Example #32
0
 public override void OnUpdate(float deltaTime)
 {
     if (!mIsRefresh) return;
     if (mBloodTime <= 0)
     {
         mIsRefresh = false;
         mTweenAlpha = TweenAlpha.Begin(gameObject, 1f, 0);
         mTweenAlpha.from = 1;
         mTweenAlpha.to = 0;
         mTweenAlpha.Play();
         return;
     }
     mBloodTime -= deltaTime;
     OnRefreshBlood();
 }