Inheritance: UITweener
Example #1
0
 // Use this for initialization
 void Start()
 {
     timeLabel = gameObject.GetComponentInChildren<UILabel>();
     god = transform.parent.gameObject.GetComponent<God>();
     colorTween = gameObject.GetComponentInChildren<TweenColor>();
     scaleTween = gameObject.GetComponentInChildren<TweenScale>();
 }
 IEnumerator delayFight(TweenColor tc)
 {
     yield return new WaitForSeconds(2f);
     Destroy(tc);
     boss.color = Color.white;
     allTime = 0;
     tmpLst.AddRange(lstLbi);
     runBegin = true;
 }
Example #3
0
	void Start ()
	{
		field_textTweenColor = Text.GetComponent<TweenColor>();
		field_backgroundTweenColor = Background.GetComponent<TweenColor>();

		field_textTweenColor.enabled = true;
		field_backgroundTweenColor.enabled = true;

		field_textTweenColor.PlayReverse();
		field_backgroundTweenColor.PlayReverse();
	}
	void Init (RoomData roomData) {
		Debug.Log ("roomId = " + roomData.Id);
		mRoomData = roomData;
		mShortMoneyTweenColor = priceLabelObject.GetComponent<TweenColor>();
		string spriteName = "room_item_" + roomData.Id;
		UISpriteData spriteData = roomItemAtlas.GetSprite (spriteName);
		itemSprite.spriteName = "room_item_" + roomData.Id;
		itemSprite.width = spriteData.width;
		itemSprite.height = spriteData.height;
		nameLabel.text = roomData.ItemName;
		priceLabelObject.GetComponent<UILabel>().text  = "price : " + roomData.ItemPrice;
		countLabel.text = "所持数 : " + roomData.ItemCount;
		descriptionLabel.text = roomData.ItemDescription;
	}
Example #5
0
	void Start ()
	{
		field_playerOneScoreText = PlayerOneScore.GetComponent<UILabel>();
		field_playerTwoScoreText = PlayerTwoScore.GetComponent<UILabel>();

		field_playerOneScoreTextTweenColor = PlayerOneScore.GetComponent<TweenColor>();
		field_playerTwoScoreTextTweenColor = PlayerTwoScore.GetComponent<TweenColor>();

		//field_playerOneScoreTextTweenColor.enabled = true;
		//field_playerTwoScoreTextTweenColor.enabled = true;

		//field_playerOneScoreTextTweenColor.PlayReverse();
		//field_playerTwoScoreTextTweenColor.PlayReverse();

		Global.ScoreManager.OnScoreChange += SetScore;
	}
Example #6
0
 protected override void OnFadeOut()
 {
     if (this.mTweenColor == null)
     {
         this.mColor.a = 0f;
         this.mTweenColor = TweenColor.Begin(this.sprite.cachedGameObject, 1f, this.mColor);
         this.mColor.a = 1f;
         this.mTweenColor.from = this.mColor;
         this.mTweenColor.method = UITweener.Method.Linear;
     }
     else
     {
         this.mTweenColor.Play(true);
     }
     this.mFadingOut = false;
 }
Example #7
0
    public static void PlaySpriteToFaceAnimation(tk2dSprite sprite, Color c)
    {
        tk2dSprite spriteCopy = GameObject.Instantiate(sprite) as tk2dSprite;

        spriteCopy.transform.parent        = sprite.transform.parent;
        spriteCopy.transform.localPosition = new Vector3(0, 0, -5);

        spriteCopy.transform.localScale = Vector3.one;
        spriteCopy.color = c;

        TweenScale iconTweenScale = TweenScale.SetScale(spriteCopy.gameObject, Vector3.one * 5f, 0.3f);

        iconTweenScale.BeginScale = Vector3.one;

        TweenColor iconTweenColor = TweenColor.SetColor(spriteCopy.gameObject, Color.clear, 0.3f);

        iconTweenColor.beginColor       = Color.white;
        iconTweenColor.useChanelMask[0] = iconTweenColor.useChanelMask[1] = iconTweenColor.useChanelMask[2] = false;
        iconTweenColor.SetOnFinishedDelegate(delegate
        {
            Destroy(spriteCopy.gameObject);
        });
    }
 public static void SelectedObjectBlink(UIButton[] Buttons, int Index)
 {
     for (int i = 0; i < Buttons.Length; i++)
     {
         if (Index == i)
         {
             TweenColor tweenColor = TweenColor.Begin(Buttons[i].get_gameObject(), 0.2f, Util.CursolColor);
             tweenColor.from.r   = Util.CursolColor.r;
             tweenColor.from.g   = Util.CursolColor.g;
             tweenColor.from.b   = Util.CursolColor.b;
             tweenColor.to.r     = Color.get_white().r * 0.8f + Util.CursolColor.r * 0.2f;
             tweenColor.to.g     = Color.get_white().g * 0.8f + Util.CursolColor.g * 0.2f;
             tweenColor.to.b     = Color.get_white().b * 0.8f + Util.CursolColor.b * 0.2f;
             tweenColor.duration = Util.CursolBarDurationTime;
             tweenColor.method   = UITweener.Method.EaseInOut;
             tweenColor.style    = UITweener.Style.PingPong;
         }
         else
         {
             TweenColor.Begin(Buttons[i].get_gameObject(), 0.2f, Color.get_white());
         }
     }
 }
Example #9
0
    void OnDisable()
    {
        if (!mInitDone)
        {
            return;
        }
        if (targets.Length > 0)
        {
            for (int i = 0; i < targets.Length; i++)
            {
                if (targets[i] != null)
                {
                    TweenColor tc = targets[i].GetComponent <TweenColor>();

                    if (tc != null)
                    {
                        tc.value   = mColors[i];
                        tc.enabled = false;
                    }
                }
            }
        }
    }
Example #10
0
    /// <summary>
    /// 侠客死亡
    /// </summary>
    public void OnPlayDie()
    {
        _isControlPause = true;
        mBatManage.RemoveDieHero(this);
        PlayAnimation("death");
        mHeroBlood.ShowBlood();
        SkinnedMeshRenderer render = transform.GetComponentInChildren <SkinnedMeshRenderer>();

        if (render == null)
        {
            return;
        }
        AnimationState state = mAnima["death"];
        TweenColor     tcol  = TweenColor.Begin(render.gameObject, state.clip.length + 0.1f, new Color(120 / 255f, 120 / 255f, 120 / 255f, 0));

        tcol.method = UITweener.Method.EaseIn;
        tcol.style  = UITweener.Style.Once;
        tcol.AddOnFinished(delegate()
        {
            GameObject.DestroyObject(gameObject);
        });
        tcol.Play();
    }
    public static int Begin_s(IntPtr l)
    {
        int result;

        try
        {
            GameObject go;
            LuaObject.checkType <GameObject>(l, 1, out go);
            float duration;
            LuaObject.checkType(l, 2, out duration);
            Color color;
            LuaObject.checkType(l, 3, out color);
            TweenColor o = TweenColor.Begin(go, duration, color);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Example #12
0
    protected virtual void OnPress(bool isPressed)
    {
        if (enabled)
        {
            if (!mStarted)
            {
                Start();
            }

            if (isPressed)
            {
                TweenColor.Begin(tweenTarget, duration, pressed);
            }
            else if (UICamera.currentTouch.current == gameObject && UICamera.currentScheme == UICamera.ControlScheme.Controller)
            {
                TweenColor.Begin(tweenTarget, duration, hover);
            }
            else
            {
                TweenColor.Begin(tweenTarget, duration, mColor);
            }
        }
    }
Example #13
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        UIEditorTools.SetLabelWidth(120f);

        TweenColor tw = target as TweenColor;

        GUI.changed = false;

        Color from = EditorGUILayout.ColorField("From", tw.From);
        Color to   = EditorGUILayout.ColorField("To", tw.To);

        if (GUI.changed)
        {
            UIEditorTools.RegisterUndo("Tween Change", tw);
            tw.From = from;
            tw.To   = to;

            UnityEditor.EditorUtility.SetDirty(tw);
        }

        DrawCommonProperties();
    }
Example #14
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.transform.tag == "tile" && isIMmortal == false)
        {
            collision.gameObject.GetComponent <TweenColor>().style = Style.PingPong;
            TweenColor.SetColor(collision.gameObject, tileFlickerColor, FLICKER_RATE);
            ScoreController.instance.StopAllCoroutines();
            TileSpawner.instance.StopAllCoroutines();
            StopAllCoroutines();
            GameConditionsController.instance.IsAlive = false;
            Scheduler.Instance.CallMethodWithDelay(this.gameObject, ShowDeathMenu, 2f);
        }

        if (collision.transform.tag == "tile" && isIMmortal == true && isInJump == false)
        {
            collision.gameObject.SetActive(false);
        }

        if (collision.transform.tag == "Booster")
        {
            ScoreController.instance.SetTimerStarted();
            Scheduler.Instance.CallMethodWithDelay(this.gameObject, ScoreController.instance.DiactivateTimer, 5f);
            if (collision.gameObject.GetComponent <Booster>().isImmortableBoosterProperty)
            {
                collision.gameObject.SetActive(false);
                isIMmortal = true;
                Scheduler.Instance.CallMethodWithDelay(this, SetMortalable, 5);
                flicker();
            }
            else
            {
                collision.gameObject.SetActive(false);
                ReduceSize();
                Scheduler.Instance.CallMethodWithDelay(this.gameObject, WaitForSetNormalScale, 5f);
            }
        }
    }
Example #15
0
 public void Close()
 {
     base.StopCoroutine("CloseIfUnselected");
     mSelection = null;
     if (!(mChild != null))
     {
         return;
     }
     mLabelList.Clear();
     handleEvents = false;
     if (isAnimated)
     {
         UIWidget[] componentsInChildren = mChild.GetComponentsInChildren <UIWidget>();
         int        i = 0;
         for (int num = componentsInChildren.Length; i < num; i++)
         {
             UIWidget uIWidget = componentsInChildren[i];
             Color    color    = uIWidget.color;
             color.a = 0f;
             TweenColor.Begin(uIWidget.gameObject, 0.15f, color).method = UITweener.Method.EaseOut;
         }
         Collider[] componentsInChildren2 = mChild.GetComponentsInChildren <Collider>();
         int        j = 0;
         for (int num2 = componentsInChildren2.Length; j < num2; j++)
         {
             componentsInChildren2[j].enabled = false;
         }
         UnityEngine.Object.Destroy(mChild, 0.15f);
     }
     else
     {
         UnityEngine.Object.Destroy(mChild);
     }
     mBackground = null;
     mHighlight  = null;
     mChild      = null;
 }
Example #16
0
    public static TweenColor ColorTo(bool reset, GameObject go, UITweener.Method method, UITweener.Style style,
                                     float duration, float delay, Color colorTo)
    {
        if (go == null)
        {
            return(null);
        }

        if (reset)
        {
            //go.RemoveComponent<TweenColor>();
        }

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

        if (reset)
        {
            comp = ResetTween(comp);
        }
        comp.from     = comp.color;
        comp.to       = colorTo;
        comp.duration = duration;
        comp.delay    = delay;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        if (!reset)
        {
            comp = ResetTween(comp);
        }
        comp.Play(true);
        return(comp);
    }
Example #17
0
    // 更新当前页面Logo
    public void UpdatePageLogo(int lastPageNum, int curPageNum)
    {
        if (curPageNum > m_lstPageLogos.Count)
        {
            Debug.LogError("CurPageNum exceed the maximum limit!!");
            return;
        }
        // 关闭上一个Logo
        TweenScale temp_scale0 = m_lstPageLogos[lastPageNum].GetComponent <TweenScale>();

        temp_scale0.PlayForward();
        TweenColor temp_color0 = m_lstPageLogos[lastPageNum].GetComponent <TweenColor>();

        temp_color0.enabled = true;
        temp_color0.PlayForward();
        // 开启当前Logo
        TweenScale temp_scale1 = m_lstPageLogos[curPageNum].GetComponent <TweenScale>();

        temp_scale1.PlayReverse();
        TweenColor temp_color1 = m_lstPageLogos[curPageNum].GetComponent <TweenColor>();

        temp_color1.enabled = true;
        temp_scale1.PlayReverse();
    }
Example #18
0
    public static void UpdateColor(UIWidget widget)
    {
        TweenColor tweenColor = widget.gameObject.AddComponent <TweenColor>();

        if (null == tweenColor)
        {
            throw new MissingComponentException();
        }

        tweenColor.from = widget.color;        //GetHighlightColorByTimeState(Instance.PreviousTimeState);
        tweenColor.to   = GetCurrentTextColor();

        tweenColor.delay    = 1f;
        tweenColor.duration = AnimationDuration;

        if (null == EasyInOutAnimCurve)
        {
            Instance.InitAnimationCurve();
        }

        tweenColor.animationCurve = EasyInOutAnimCurve;

        tweenColor.SetOnFinished(() => Destroy(tweenColor));
    }
    protected override void OnDisable()
    {
        base.OnDisable();
        if (Started && tweenTarget != null)
        {
                        #if NGUI_DLL
            TweenColor tc = tweenTarget.GetComponent <TweenColor>();

            if (tc != null)
            {
                tc.color   = mColor;
                tc.enabled = false;
            }
                        #else
            ColorScheduler tc = tweenTarget.GetComponent <ColorScheduler>();

            if (tc != null)
            {
                tc.From    = mColor;
                tc.enabled = false;
            }
                        #endif
        }
    }
Example #20
0
    protected void FadeOut_()
    {
        if (avController != null)
        {
            Destroy(avController.gameObject);
            avController = null;
            Resources.UnloadUnusedAssets();
        }

        TweenColor colorTweener = fadeTexture.GetComponentInChildren <TweenColor>();

        if (colorTweener == null)
        {
            colorTweener = fadeTexture.gameObject.AddComponent <TweenColor>();
        }

        colorTweener.from = new Color(0f, 0f, 0f, 0f);
        colorTweener.to   = fadeColor;

        colorTweener.duration = appearFadeDuration;
        colorTweener.Play(false);

        currentShowAlertParams = null;
    }
Example #21
0
    public void StartAnimation()
    {
        // animate crosshait
        if (animation.isPlaying)
        {
            animation.Stop();
            topArrow.color   = Color.white;
            rightArrow.color = Color.white;
            botArrow.color   = Color.white;
            leftArrow.color  = Color.white;
        }

        Color startCol = new Color(1, 1, 1, 0);

        topArrow.color   = startCol;
        rightArrow.color = startCol;
        botArrow.color   = startCol;
        leftArrow.color  = startCol;
        animation.Play();
        TweenColor.Begin(topArrow.gameObject, animationTime, Color.white);
        TweenColor.Begin(rightArrow.gameObject, animationTime, Color.white);
        TweenColor.Begin(botArrow.gameObject, animationTime, Color.white);
        TweenColor.Begin(leftArrow.gameObject, animationTime, Color.white);
    }
Example #22
0
 private void EnableFX(GameObject p_FXRoot, Boolean p_wasClosed)
 {
     if (m_enabledGO != p_FXRoot)
     {
         p_FXRoot.SetActive(true);
         ParticleSystem[] componentsInChildren = p_FXRoot.GetComponentsInChildren <ParticleSystem>();
         foreach (ParticleSystem particleSystem in componentsInChildren)
         {
             particleSystem.Play();
         }
         UISprite[] componentsInChildren2 = p_FXRoot.GetComponentsInChildren <UISprite>();
         foreach (UISprite uisprite in componentsInChildren2)
         {
             TweenColor.Begin(uisprite.gameObject, 0.4f, Color.white);
         }
         Collider[] componentsInChildren3 = p_FXRoot.GetComponentsInChildren <Collider>();
         foreach (Collider collider in componentsInChildren3)
         {
             collider.enabled = true;
         }
         p_FXRoot.SendMessage("OnEnableFXFrom" + ((!p_wasClosed) ? "Opened" : "Closed"));
         m_enabledGO = p_FXRoot;
     }
 }
Example #23
0
	// Use this for initialization
	void Start ()
	{
	    _tweenColor = GetComponent<TweenColor>();
	    _sprite = GetComponent<UISprite>();
	    _originalColor = _sprite.color;

	    if (IsFixed)
	    {
	        _sprite.height = 60;
	        _sprite.width = fixedLength;

            // get a random action
	        fixedAction = Random.Range(0, 3);

	        switch (fixedAction)
	        {
	            case 0:
                    _sprite.color = new Color(92f / 255, 176f / 255, 72f / 255);
	                mashLabels.text = "MASH (A)";
	                break;
	            case 1:
                    _sprite.color = new Color(192f / 255, 74f / 255, 55f / 255);
                    mashLabels.text = "MASH (B)";

	                break;
	            case 2:
	                _sprite.color = new Color(58f/255, 152f/255, 196f/255);
                    mashLabels.text = "MASH (X)";
	                break;
	            case 3:
                    _sprite.color = new Color(204f / 255, 169f / 255, 51f / 255);
                    mashLabels.text = "MASH (Y)";
	                break;
	        }
	    }
	}
Example #24
0
    /// <summary>
    /// Manually close the popup list.
    /// </summary>

    public void Close()
    {
        if (mChild != null)
        {
            mLabelList.Clear();
            handleEvents = false;

            if (isAnimated)
            {
                UIWidget[] widgets = mChild.GetComponentsInChildren <UIWidget>();

                for (int i = 0, imax = widgets.Length; i < imax; ++i)
                {
                    UIWidget w = widgets[i];
                    Color    c = w.color;
                    c.a = 0f;
                    TweenColor.Begin(w.gameObject, animSpeed, c).method = UITweener.Method.EaseOut;
                }

                Collider[] cols = mChild.GetComponentsInChildren <Collider>();
                for (int i = 0, imax = cols.Length; i < imax; ++i)
                {
                    cols[i].enabled = false;
                }
                Destroy(mChild, animSpeed);
            }
            else
            {
                Destroy(mChild);
            }

            mBackground = null;
            mHighlight  = null;
            mChild      = null;
        }
    }
Example #25
0
 void OnPress(bool isPressed)
 {
     if (!mInitDone)
     {
         Init();
     }
     if (duration > 0)
     {
         if (enabled)
         {
             for (int i = 0; i < targets.Length; i++)
             {
                 TweenColor.Begin(targets[i], duration, isPressed ? pressed : mColors[i]);
             }
         }
     }
     else
     {
         for (int i = 0; i < targets.Length; i++)
         {
             ChangeColor(targets[i], isPressed ? pressed : mColors[i]);
         }
     }
 }
Example #26
0
    //Copy UpdateColor
    void UpdateTitleColor(bool instant)
    {
        if (title == null)
        {
            return;
        }

        TweenColor tc;

        switch (mState)
        {
        // case State.Hover: tc = TweenColor.Begin(title.gameObject, duration, hover); break;
        // case State.Pressed: tc = TweenColor.Begin(title.gameObject, duration, pressed); break;
        case State.Disabled: tc = TweenColor.Begin(title.gameObject, duration, mDisableTitleColor); break;

        default: tc = TweenColor.Begin(title.gameObject, duration, mDefaultTitleColor); break;
        }

        if (instant && tc != null)
        {
            tc.value   = tc.to;
            tc.enabled = false;
        }
    }
Example #27
0
    /// <summary>
    /// Change the visual state.
    /// </summary>

    public virtual void SetState(State state, bool instant)
    {
        if (!mInitDone)
        {
            mInitDone = true;
            OnInit();
        }

        if (mState != state)
        {
            mState = state;

            TweenColor tc = null;

            switch (mState)
            {
            case State.Hover:                     //tc = TweenColor.Begin(tweenTarget, duration, hover);
                break;

            case State.Pressed:                     //tc = TweenColor.Begin(tweenTarget, duration, pressed);
                break;

            case State.Disabled:                     //tc = TweenColor.Begin(tweenTarget, duration, disabledColor);
                break;

            default:                    // tc = TweenColor.Begin(tweenTarget, duration, mDefaultColor);
                break;
            }

            if (instant && tc != null)
            {
                tc.value   = tc.to;
                tc.enabled = false;
            }
        }
    }
Example #28
0
    /// <summary>
    /// Update the button's color. Call this method after changing the colors of the button at run-time.
    /// </summary>

    public void UpdateColor(bool instant)
    {
        TweenColor tc;

        if (tweenTarget != null)
        {
            switch (mState)
            {
            case State.Hover: tc = TweenColor.Begin(tweenTarget, duration, hover); break;

            case State.Pressed: tc = TweenColor.Begin(tweenTarget, duration, pressed); break;

            case State.Disabled: tc = TweenColor.Begin(tweenTarget, duration, disabledColor); break;

            default: tc = TweenColor.Begin(tweenTarget, duration, mDefaultColor); break;
            }

            if (instant && tc != null)
            {
                tc.value   = tc.to;
                tc.enabled = false;
            }
        }
    }
    /// <summary>
    /// Reset the initial state.
    /// </summary>

    protected virtual void OnDisable()
    {
#if UNITY_EDITOR
        if (!Application.isPlaying)
        {
            return;
        }
#endif
        if (mInitDone && mState != State.Normal)
        {
            SetState(State.Normal, true);

            if (tweenTarget != null)
            {
                TweenColor tc = tweenTarget.GetComponent <TweenColor>();

                if (tc != null)
                {
                    tc.value   = mDefaultColor;
                    tc.enabled = false;
                }
            }
        }
    }
Example #30
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public TweenColor Begin(GameObject go, float duration, Color color)
    {
#if UNITY_EDITOR
        if (!Application.isPlaying)
        {
            return(null);
        }
#endif
        TweenColor comp = UITweener.Begin <TweenColor>(go, duration);
        if (comp == null)
        {
            return(null);
        }

        comp.from = comp.value;
        comp.to   = color;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
Example #31
0
    public override void UpdateColor(bool shouldBeEnabled, bool immediate)
    {
        if (!mStarted)
        {
            mStarted = true;
            Init();
        }

        float duration = 0.2f;

        foreach (UIWidget tweenTarget_ in _widgetColors.Keys)
        {
            if (tweenTarget_ != null && NGUITools.GetActive(tweenTarget_.gameObject))
            {
                Color      c  = shouldBeEnabled ? _widgetColors[tweenTarget_]: _widgetColors[tweenTarget_] * disabledColor;
                TweenColor tc = TweenColor.Begin(tweenTarget_.gameObject, duration, c);
                if (immediate)
                {
                    tc.Sample(1.0f, true);
                    tc.enabled = false;
                }
            }
        }
    }
    protected virtual void SetState(UIButtonColor.State state, bool instant)
    {
        if (!this.mInitDone)
        {
            this.mInitDone = true;
            this.OnInit();
        }
        if (this.mState != state)
        {
            this.mState = state;
            TweenColor tweenColor;
            switch (this.mState)
            {
            case UIButtonColor.State.Hover:
                tweenColor = TweenColor.Begin(this.tweenTarget, this.duration, this.hover);
                break;

            case UIButtonColor.State.Pressed:
                tweenColor = TweenColor.Begin(this.tweenTarget, this.duration, this.pressed);
                break;

            case UIButtonColor.State.Disabled:
                tweenColor = TweenColor.Begin(this.tweenTarget, this.duration, this.disabledColor);
                break;

            default:
                tweenColor = TweenColor.Begin(this.tweenTarget, this.duration, this.mColor);
                break;
            }
            if (instant && tweenColor != null)
            {
                tweenColor.value   = tweenColor.to;
                tweenColor.enabled = false;
            }
        }
    }
Example #33
0
	// Update is called once per frame
	void Update () {
		if (colaps != oldColaps) {
			NeedSizeRecalced = true;
			for(NodeVis p = parent; p != null; p = p.parent){
				p.NeedSizeRecalced = true;
			}
			foreach(NodeVis nVis in childs){
				nVis.gameObject.SetActive(!colaps);
			}
			treeVis.TreeVisRoot.calculatePosition(0);
			oldColaps = colaps;	
		}
		if(tc == null)
			tc = GetComponentInChildren<TweenColor>();

		if (node.IsActive) {
			if (linkToParent != null)
				linkToParent.lr.SetColors (Color.green, Color.green);


			if(tc != null){
				tc.PlayForward();
			}
		} else {
			if (linkToParent != null)
				linkToParent.lr.SetColors (Color.white, Color.white);
			
			if(tc != null){
				tc.PlayReverse();
			}
		}
				
	}
Example #34
0
 protected void OnPointerUp(UnityEngine.EventSystems.BaseEventData eventData)
 {
     TweenColor.Begin(tweenTarget, duration, mColor);
 }
Example #35
0
 protected void OnPointerDown(UnityEngine.EventSystems.BaseEventData eventData)
 {
     TweenColor.Begin(tweenTarget, duration, pressed);
 }
Example #36
0
    void CreatePieces()
    {
        int h = -1;

        for (int i = 0; i < cantPieces; i++)
        {
            UISprite sprite = NGUITools.AddSprite(panelPivot.gameObject, puzzleAtlas, "Part" + (i + 1));
            sprite.name = "Part" + (i + 1);
            sprite.MakePixelPerfect();
            if (i % width == 0)
            {
                h++;
            }
            pieceDifference = (pieceSizeDefault - pieceSize) / 2;
            sprite.depth    = (i + 1);
            sprite.pivot    = UIWidget.Pivot.Center;
            sprite.transform.localPosition = new Vector3((pieceSize * (i % width)) - (pieceSizeDefault + pieceDifference), (pieceSize * -h) + (pieceSizeDefault + pieceDifference), 0);
            sprite.gameObject.AddComponent(typeof(BoxCollider));
            sprite.GetComponent <BoxCollider>().center = new Vector3(0, 0, 0);
            PuzzlePiece tempPiece = sprite.gameObject.AddComponent(typeof(PuzzlePiece)) as PuzzlePiece;
            tempPiece.id  = new Vector2((i % width), h);
            tempPiece.pos = new Vector2((i % width), h);
            piecesMatrix[(i % width), h] = tempPiece;
            piecesList.Add(tempPiece);
            if (i == cantPieces - 1)
            {
                freeSpace        = new Vector2(i % width, h);
                freeSprite       = sprite;
                freeSprite.depth = 0;
                freeId           = new Vector2(i % width, h);
                freePiece        = tempPiece;
            }
            //"oncomplete", "PieceArrived", "oncompletetarget", this.gameObject,
            iTween.ScaleFrom(tempPiece.gameObject, iTween.Hash("scale", Vector3.zero, "time", 2.5f, "isLocal", true, "delay", i * .2f, "easetype", iTween.EaseType.easeOutElastic));
        }

        piecesList[piecesList.Count - 1].GetComponent <UISprite>().alpha = 0;

        spritePreviewStatic = NGUITools.AddSprite(previewPivotStatic.gameObject, puzzleAtlas, "Source");
        spritePreviewStatic.MakePixelPerfect();
        spritePreviewStatic.depth = cantPieces;
        spritePreviewStatic.pivot = UIWidget.Pivot.Center;
        spritePreviewStatic.alpha = .75f;
        spritePreviewStatic.transform.localPosition = new Vector3(0, 0, 0);
        previewPivotStatic.transform.localScale     = new Vector3(0.4f, 0.4f, 1);
        iTween.ScaleFrom(previewPivotStatic.gameObject, iTween.Hash("scale", Vector3.zero, "time", 1f, "isLocal", true, "easetype", iTween.EaseType.easeOutExpo));
        UISprite spritePreview = NGUITools.AddSprite(previewPivot.gameObject, puzzleAtlas, "Source");

        spritePreview.MakePixelPerfect();
        spritePreview.depth = cantPieces + 1;
        spritePreview.pivot = UIWidget.Pivot.Center;
        spritePreview.cachedTransform.localPosition = new Vector3(0, 0, 0);
        iTween.ScaleFrom(spritePreview.gameObject, iTween.Hash("scale", Vector3.zero, "time", 1f, "isLocal", true, "easetype", iTween.EaseType.easeOutExpo));
        BoxCollider boxC = spritePreview.gameObject.AddComponent(typeof(BoxCollider)) as BoxCollider;

        boxC.center = new Vector3(0, 0, 0);
        UIButtonMessage buttonM = spritePreview.gameObject.AddComponent(typeof(UIButtonMessage)) as UIButtonMessage;

        buttonM.functionName = "OnPreviewClicked";
        buttonM.target       = this.gameObject;
        buttonT          = spritePreview.gameObject.AddComponent(typeof(TweenColor)) as TweenColor;
        buttonT.from     = new Color(255, 255, 255, 1);
        buttonT.to       = new Color(255, 255, 255, .5f);
        buttonT.duration = 0.5f;
        buttonT.enabled  = false;
        previewPivot.transform.localScale = new Vector3(0.4f, 0.4f, 1);
    }
Example #37
0
 void Awake()
 {
     tweenColor = GetComponent <TweenColor>();
     sprite     = GetComponent <UI2DSprite>();
     btn        = GetComponent <UIButton>();
 }
    /// <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);
    }
Example #39
0
	void OnEnable () {
		tweenColor = GetComponent <TweenColor>();
		tweenColor.enabled = false;
		slotButtons.Add (this);
	}
Example #40
0
	// Use this for initialization
	void Start () {
		tweenColor = GetComponent<TweenColor> ();
		tweenScale = GetComponent<TweenScale> ();
	}