Example #1
0
	protected override void OnStartImmediate()
	{
		if( mTweener == null)
			mTweener = GetComponent<UITweener>();
		mAmountPerDelta = mTweener.amountPerDelta;
		mTweener.amountPerDelta = 0f;
	}
Example #2
0
    // Use this for initialization
    void Start()
    {
        boss = GameObject.FindGameObjectsWithTag(Tags.boss);
        isShowPanel = false;
        bossBloodBarDictionary = new Dictionary<int, UIBossBloodItemEvent>();
        bossControllerDictionary = new Dictionary<int, BossController>();

        UIBossBloodBarContainer = transform.Find("BossBloodContainer").gameObject;
        UIBossBloodBarGrid = UIBossBloodBarContainer.transform.Find("BossBloodBarItems").gameObject;
        tweener = UIBossBloodBarContainer.GetComponent<UITweener>();

        if (boss.Length != 0)
        {
            GameObject prefabItem;
            BossController tempBossController;
            for (int i = 0; i < boss.Length; i++)
            {
                prefabItem = NGUITools.AddChild(UIBossBloodBarGrid, bossBloodBarPrefab);
                tempBossController = boss[i].GetComponent<BossController>();
                tempBossController.onStateChanged += OnBossStateChanged;
                bossControllerDictionary.Add(tempBossController.enemyID, tempBossController);
                bossBloodBarDictionary.Add(tempBossController.enemyID, prefabItem.GetComponent<UIBossBloodItemEvent>());
                bossBloodBarDictionary[tempBossController.enemyID].Init(bossControllerDictionary[tempBossController.enemyID].gameObject.name, bossControllerDictionary[tempBossController.enemyID].GetBossMaxHP());
            }
            UIBossBloodBarGrid.GetComponent<UIGrid>().enabled = true;
        }
    }
Example #3
0
    IEnumerator Play()
    {
        yield return new WaitForSeconds(3.0f);

        for (int i = 0; i < textList.Count; i++)
        {
            switch (textList[i].textType)
            {
                case TextType.text:
                    text.text = textList[i].textInfo;
                    playText = textTweener;
                    break;
                case TextType.textArea:
                    textArea.text = textList[i].textInfo;
                    playText = textAreaTweener;
                    break;
                case TextType.picture:
                    if (!textList[i].textInfo.Equals(""))
                    {
                        picture.spriteName = textList[i].textInfo;
                    }
                    break;
                default:
                    break;
            }
            switch (textList[i].textEffect)
            {
                case TextEffect.foi:
                    playText.PlayForward();
                    yield return new WaitForSeconds(textTweener.duration);

                    if(textTweener.gameObject.name.Equals(text.gameObject.name))
                    {
                        yield return new WaitForSeconds(textTweener.duration * 3);
                    }
                    else
                    {
                        yield return new WaitForSeconds(textTweener.duration * 7);
                    }


                    playText.PlayReverse();
                    yield return new WaitForSeconds(textTweener.duration);

                    break;
                case TextEffect.pictureIn:
                    pictureTweener.PlayForward();
                    yield return new WaitForSeconds(textTweener.duration);
                    break;
                case TextEffect.pictureOut:
                    pictureTweener.PlayReverse();
                    yield return new WaitForSeconds(textTweener.duration);
                    break;
                default:
                    break;
            }
        }
        yield return new WaitForSeconds(3.0f);
        loadingUI.Show( SceneManager.LoadSceneAsync(SceneName.Town));
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        //Give tween a value
        tween = gameObject.GetComponent<UITweener>();

        //Generic popup text for debugging
        PopupText = "Gereric";
    }
 void OnTweenFinished(UITweener tweener)
 {
     ExplorerBusiness eb = GetComponent<ExplorerBusiness>();
     adPanel = GameObject.Find("Main Camera");
     adPanel.SetActive(true);
     adPanel.GetComponent<HTMLExplorer>().SetPosition(eb.Coordinates, gameObject);
     adPanel.GetComponent<HTMLExplorer>().SetReturnPosition();
     gameObject.SetActive(false);
 }
    void OnTweenFinished(UITweener tweener)
    {
		ObjectToTween.rigidbody.isKinematic = false;
        Destroy(oldPos);
        bubble.SetActive(true);
   //     GameObject.FindWithTag("MainCamera").GetComponent<FlyCam>().enabled = true;
        gameObject.SetActive(false);
        FloatingBubble.HasAdUp = false;
        //myTween.Toggle();
    }
    void onButtonAnimFinish(UITweener tweener)
    {
        //Debug.Log("Exit Rumbo");

        tween.from = targetObject.transform.localPosition;
        tween.to = initialPosition;
        tween.Reset();
        tween.enabled = true;

        isClicked = false;
    }
Example #8
0
    private void onFinished(UITweener tween)
    {
        if(DestoryOnFinish)
        {
            Destroy(tween.gameObject);
        }

        if(_callBackFunc != null)
        {
            _callBackFunc();
            _callBackFunc = null;
        }
    }
Example #9
0
    // Use this for initialization
    void Start()
    {
        isShowPanel = false;
        tweener = transform.Find("PortalContainer").GetComponent<UITweener>();
        portalGrid = transform.Find("PortalContainer/Scroll View/Items").gameObject;
        if (PortalManager._instance != null)
        {
            PortalManager._instance.playerStateChange += PlayerPositionChange;
        }

        LoadData();
        tweener.gameObject.SetActive(false);
    }
Example #10
0
    static public TweenPosition Begin(GameObject go, float duration, Vector3 from,Vector3 to, UITweener.Method method)
    {
        TweenPosition comp = UITweener.Begin<TweenPosition>(go, duration);
        comp.from = from;
        comp.to = to;
        comp.method = method;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return comp;
    }
Example #11
0
	// Use this for initialization
	void Start () {
		r_LoadingScreen = gameObject.GetComponent( typeof( UISprite ) ) as UISprite;
		if( r_LoadingScreen == null ){
			Debug.LogError("Unable to find LoadingScreen");
		} else {
			r_LoadingScreenTweener = r_LoadingScreen.GetComponent( typeof( UITweener) ) as UITweener;
			r_LoadingScreen.alpha = 1.0f;
			StartCoroutine("fadeIn");
		}

		r_LoadingMessage = r_LoadingScreen.GetComponentInChildren( typeof (UILabel) ) as UILabel;
		if( r_LoadingMessage == null ){
			Debug.LogError("Unable to find LoadingMessage label");
		} else {
			r_LoadingMessageTweener = r_LoadingMessage.GetComponent( typeof( UITweener ) ) as UITweener;
		}
	}
    void Awake()
    {
        BallCollider = GetComponent<SphereCollider>();

        foreach(Transform t in transform)
        {
            if (t.name == "RainSprite")
            {
                Rainanimation = t.GetComponent<UISpriteAnimation>();
                RainBall = t.gameObject;
            }
            else if (t.name == "ShadowSprite")
            {
                TweenAlphas = t.GetComponent<UITweener>();
                RainShadow = t.gameObject;
            }
        }
    }
Example #13
0
	// Use this for initialization
	void Start () {
        loadingUI = UISceneManager._instance;

        text = transform.Find("Panel/Text").GetComponent<UILabel>();
        textTweener = text.gameObject.GetComponent<UITweener>();

        textArea =transform.Find("Panel/TextArea").GetComponent<UILabel>();
        textAreaTweener = textArea.gameObject.GetComponent<UITweener>();

        picture =transform.Find("Panel/Picture").GetComponent<UISprite>();
        pictureTweener = picture.gameObject.GetComponent<UITweener>();

        textList = GameController._instance.LoadText(0);

        textTweener.PlayReverse();
        textAreaTweener.PlayReverse();
        pictureTweener.PlayReverse();
        //picture.spriteName = "手紙";
        StartCoroutine(Play());
    }
    private void Update()
    {
        bool  flag = false;
        float num  = (!ignoreTimeScale) ? Time.get_deltaTime() : RealTime.deltaTime;
        float num2 = (!ignoreTimeScale) ? Time.get_time() : RealTime.time;

        if (!mStarted)
        {
            flag       = true;
            mStarted   = true;
            mStartTime = num2 + delay;
        }
        if (!(num2 < mStartTime))
        {
            mFactor += amountPerDelta * num;
            if (style == Style.Loop)
            {
                if (mFactor > 1f)
                {
                    mFactor -= Mathf.Floor(mFactor);
                }
            }
            else if (style == Style.PingPong)
            {
                if (mFactor > 1f)
                {
                    mFactor         = 1f - (mFactor - Mathf.Floor(mFactor));
                    mAmountPerDelta = 0f - mAmountPerDelta;
                }
                else if (mFactor < 0f)
                {
                    mFactor         = 0f - mFactor;
                    mFactor        -= Mathf.Floor(mFactor);
                    mAmountPerDelta = 0f - mAmountPerDelta;
                }
            }
            if (style == Style.Once && (duration == 0f || mFactor > 1f || mFactor < 0f))
            {
                mFactor = Mathf.Clamp01(mFactor);
                if (flag)
                {
                    Sample(mFactor, false);
                    if (duration == 0f)
                    {
                        this.set_enabled(false);
                    }
                }
                else
                {
                    Sample(mFactor, true);
                    this.set_enabled(false);
                    if (current == null)
                    {
                        UITweener uITweener = current;
                        current = this;
                        if (onFinished != null)
                        {
                            mTemp      = onFinished;
                            onFinished = new List <EventDelegate>();
                            EventDelegate.Execute(mTemp);
                            for (int i = 0; i < mTemp.Count; i++)
                            {
                                EventDelegate eventDelegate = mTemp[i];
                                if (eventDelegate != null && !eventDelegate.oneShot)
                                {
                                    EventDelegate.Add(onFinished, eventDelegate, eventDelegate.oneShot);
                                }
                            }
                            mTemp = null;
                        }
                        if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished))
                        {
                            eventReceiver.SendMessage(callWhenFinished, (object)this, 1);
                        }
                        current = uITweener;
                    }
                }
            }
            else
            {
                Sample(mFactor, false);
            }
        }
    }
Example #15
0
    public static void TweenPlay(GameObject go, int tweenGroup, Direction playDirection, bool resetOnPlay, EnableCondition ifDisabledOnPlay, DisableCondition disableWhenFinished, bool includeChildren)
    {
        if (!go.activeSelf)
        {
            // If the object is disabled, don't do anything
            if (ifDisabledOnPlay != EnableCondition.EnableThenPlay)
            {
                return;
            }

            // Enable the game object before tweening it
            NGUITools.SetActive(go, true);
        }

        // Gather the tweening components
        UITweener[] mTweens = includeChildren ? go.GetComponentsInChildren <UITweener>() : go.GetComponents <UITweener>();

        if (mTweens.Length == 0)
        {
            // No tweeners found -- should we disable the object?
            if (disableWhenFinished != DisableCondition.DoNotDisable)
            {
                NGUITools.SetActive(go, false);
            }
        }
        else
        {
            bool activated = false;

            // Run through all located tween components
            for (int i = 0, imax = mTweens.Length; i < imax; ++i)
            {
                UITweener tw = mTweens[i];

                // If the tweener's group matches, we can work with it
                if (tw.tweenGroup == tweenGroup)
                {
                    // Ensure that the game objects are enabled
                    if (!activated && !go.activeSelf)
                    {
                        activated = true;
                        NGUITools.SetActive(go, true);
                    }

                    // Toggle or activate the tween component
                    if (playDirection == Direction.Toggle)
                    {
                        tw.Toggle();
                    }
                    else if (playDirection == Direction.Forward)
                    {
                        tw.Play(true);
                    }
                    else
                    {
                        tw.Play(false);
                    }

                    if (resetOnPlay)
                    {
                        tw.Reset();
                    }
                }
            }
        }
    }
Example #16
0
    private void Update()
    {
        float num  = (ignoreTimeScale ? RealTime.deltaTime : Time.deltaTime);
        float num2 = (ignoreTimeScale ? RealTime.time : Time.time);

        if (!mStarted)
        {
            mStarted   = true;
            mStartTime = num2 + delay;
        }
        if (num2 < mStartTime)
        {
            return;
        }
        mFactor += amountPerDelta * num;
        if (style == Style.Loop)
        {
            if (mFactor > 1f)
            {
                mFactor -= Mathf.Floor(mFactor);
            }
        }
        else if (style == Style.PingPong)
        {
            if (mFactor > 1f)
            {
                mFactor         = 1f - (mFactor - Mathf.Floor(mFactor));
                mAmountPerDelta = 0f - mAmountPerDelta;
            }
            else if (mFactor < 0f)
            {
                mFactor         = 0f - mFactor;
                mFactor        -= Mathf.Floor(mFactor);
                mAmountPerDelta = 0f - mAmountPerDelta;
            }
        }
        if (style == Style.Once && (duration == 0f || mFactor > 1f || mFactor < 0f))
        {
            mFactor = Mathf.Clamp01(mFactor);
            Sample(mFactor, isFinished: true);
            if (duration == 0f || (mFactor == 1f && mAmountPerDelta > 0f) || (mFactor == 0f && mAmountPerDelta < 0f))
            {
                base.enabled = false;
            }
            if (!(current == null))
            {
                return;
            }
            current = this;
            if (onFinished != null)
            {
                mTemp      = onFinished;
                onFinished = new List <EventDelegate>();
                EventDelegate.Execute(mTemp);
                for (int i = 0; i < mTemp.Count; i++)
                {
                    EventDelegate eventDelegate = mTemp[i];
                    if (eventDelegate != null)
                    {
                        EventDelegate.Add(onFinished, eventDelegate, eventDelegate.oneShot);
                    }
                }
                mTemp = null;
            }
            if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished))
            {
                eventReceiver.SendMessage(callWhenFinished, this, SendMessageOptions.DontRequireReceiver);
            }
            current = null;
        }
        else
        {
            Sample(mFactor, isFinished: false);
        }
    }
Example #17
0
	void OnTweenerFinishHandle(UITweener tweener)
	{
		if (CallLuaBegin(tweener.gameObject, "onTweenerFinish") == true)
		{
			LuaDLL.lua_pushstring(wLua.L.L, tweener.identity);
			CallLuaEnd(1);
		}
	}
Example #18
0
    public override void Update(uint elapsed)
    {
        if (mModule == null)
        {
            return;
        }

        //float delta = Time.unscaledDeltaTime;
        mTimer += (float)(elapsed * 0.001);        // delta;

        switch (mModule.State)
        {
        case StageEndModule.UIState.STATE_ORIGINAL:
        {
            mTimer = 0.0f;
            mBorderAni.gameObject.SetActive(true);
            mBorderAni.onFinished += OnAniFinished;
            mModule.State          = StageEndModule.UIState.STATE_0;
        }
        break;

        // 界面从上到下大特效
        case StageEndModule.UIState.STATE_0:
        {
            if (mWidget != null)
            {
                if (mTimer > StageEndModule.STATETIME_0)
                {
                    //mUIPanel.alpha = 1.0f;
                    mWidget.topAnchor.relative    = 1.0f;
                    mWidget.bottomAnchor.relative = 0.0f;

                    mTimer       -= StageEndModule.STATETIME_0;
                    mModule.State = StageEndModule.UIState.STATE_1;
                }
                else
                {
                    mWidget.topAnchor.relative    = 2.0f - (mTimer / StageEndModule.STATETIME_0);
                    mWidget.bottomAnchor.relative = 1.0f - (mTimer / StageEndModule.STATETIME_0);

                    //mUIPanel.alpha = mTimer / StageEndModule.STATETIME_0;
                }
            }
        }
        break;

        case StageEndModule.UIState.STATE_1:
        {
            if (mTimer > StageEndModule.STATETIME_1)
            {
                mTitle0.alpha   = 1.0f;
                mTopPanel.alpha = 1.0f;
                mInfoAni0.gameObject.SetActive(true);
                SoundManager.Instance.Play(105);
                mInfoAni0.onFinished += OnAniFinished;
                mTimer       -= StageEndModule.STATETIME_1;
                mModule.State = StageEndModule.UIState.STATE_2;
            }
            else
            {
                float alpha = mTimer / StageEndModule.STATETIME_1;
                mTopPanel.alpha = alpha;
                mTitle0.alpha   = alpha;
            }
        }
        break;

        case StageEndModule.UIState.STATE_2:
        {
            if (mTimer > StageEndModule.STATETIME_2)
            {
                mInfoPanel0.alpha = 1.0f;
                mInfoAni1.gameObject.SetActive(true);
                SoundManager.Instance.Play(105);
                mInfoAni1.onFinished += OnAniFinished;
                mTimer       -= StageEndModule.STATETIME_2;
                mModule.State = StageEndModule.UIState.STATE_3;
            }
            else
            {
                mInfoPanel0.alpha = mTimer / StageEndModule.STATETIME_2;
            }
        }
        break;

        case StageEndModule.UIState.STATE_3:
        {
            if (mTimer > StageEndModule.STATETIME_3)
            {
                mInfoPanel1.alpha = 1.0f;
                mInfoAni2.gameObject.SetActive(true);
                SoundManager.Instance.Play(105);
                mInfoAni2.onFinished += OnAniFinished;
                mTimer       -= StageEndModule.STATETIME_3;
                mModule.State = StageEndModule.UIState.STATE_4;
            }
            else
            {
                mInfoPanel1.alpha = mTimer / StageEndModule.STATETIME_3;
            }
        }
        break;

        case StageEndModule.UIState.STATE_4:
        {
            if (mTimer > StageEndModule.STATETIME_4)
            {
                mInfoPanel2.alpha = 1.0f;
                mTimer           -= StageEndModule.STATETIME_4;
                mModule.State     = StageEndModule.UIState.STATE_5;
            }
            else
            {
                mInfoPanel2.alpha = mTimer / StageEndModule.STATETIME_4;
            }
        }
        break;

        case StageEndModule.UIState.STATE_5:
        {
            if (mTimer > StageEndModule.STATETIME_5)
            {
                mBallBk.alpha = 1.0f;

                UITweener gradeObj = mGradeMap[mModule.GetGrade()];
                gradeObj.gameObject.SetActive(true);
                gradeObj.Play();

                mGradeAni.gameObject.SetActive(true);
                mGradeAni.onFinished += OnAniFinished;

                mTimer        = 0.0f;
                mModule.State = StageEndModule.UIState.STATE_6;
            }
            else
            {
                mBallBk.alpha = mTimer / StageEndModule.STATETIME_5;
            }
        }
        break;

        case StageEndModule.UIState.STATE_6:
        {
            if (mTimer > StageEndModule.STATETIME_6)
            {
                mTimer        = 0.0f;
                mModule.State = StageEndModule.UIState.STATE_7;
            }
        }
        break;

        case StageEndModule.UIState.STATE_7:
        {
            if (mTimer > StageEndModule.STATETIME_7)
            {
                mInfoPanel0.alpha = 0.0f;
                mInfoPanel1.alpha = 0.0f;
                mInfoPanel2.alpha = 0.0f;
                mTitle0.alpha     = 0.0f;

                mTimer       -= StageEndModule.STATETIME_7;
                mModule.State = StageEndModule.UIState.STATE_8;
            }
            else
            {
                float alpha = 1.0f - (mTimer / StageEndModule.STATETIME_7);
                mInfoPanel0.alpha = alpha;
                mInfoPanel1.alpha = alpha;
                mInfoPanel2.alpha = alpha;
                mTitle0.alpha     = alpha;
                mInfoPanel.gameObject.transform.localPosition = new Vector3(mInfoPanel.gameObject.transform.localPosition.x,
                                                                            mInfoPosY + (164.0f * mTimer / StageEndModule.STATETIME_7), mInfoPanel.gameObject.transform.localPosition.z);
                mBallBk.gameObject.transform.localPosition = new Vector3(mBallBk.gameObject.transform.localPosition.x,
                                                                         mBallPosY + (327.0f * mTimer / StageEndModule.STATETIME_7), mBallBk.gameObject.transform.localPosition.z);
                mBallBk.gameObject.transform.localScale = new Vector3(1.0f - 0.2f * (mTimer / StageEndModule.STATETIME_7), 1.0f - 0.2f * (mTimer / StageEndModule.STATETIME_7), 1.0f);
            }
        }
        break;

        case StageEndModule.UIState.STATE_8:
        {
            if (mTimer > StageEndModule.STATETIME_8)
            {
                mTitle1.alpha      = 1.0f;
                mBottomPanel.alpha = 1.0f;
                mTimer            -= StageEndModule.STATETIME_8;
                mModule.State      = StageEndModule.UIState.STATE_9;
            }
            else
            {
                float alpha = mTimer / StageEndModule.STATETIME_8;
                mBottomPanel.alpha = alpha;
                mTitle1.alpha      = alpha;
            }
        }
        break;

        case StageEndModule.UIState.STATE_9:
        {
//                     if(ModuleManager.Instance.FindModule<PlayerDataModule>().IsLevelUp())
//                     {
//                         mLevelUp.SetActive(true);
//                         mLevelUpAnimation.Play(true);
//                     }

            if (mAddExp > 0)
            {
                int addExp = (int)(mTimer * mExpSpeed);

                if (addExp < 1)
                {
                    addExp = 1;
                }

                if (addExp > mAddExp)
                {
                    addExp = mAddExp;
                }

                mAddExp -= addExp;

                if (mCurExp + addExp > mMaxExp)
                {
                    bool playLvUp = false;
                    int  level    = mPlayerModule.GetLevel();
                    do
                    {
                        if (!DataManager.LevelTable.ContainsKey(level + 1))
                        {
                            mCurExp = mMaxExp;
                            UpdateExp();
                            mTimer        = 0.0f;
                            mModule.State = StageEndModule.UIState.STATE_10;
                            break;
                        }

                        playLvUp = true;
                        mCurExp += addExp - mMaxExp;
                        addExp   = mMaxExp - mCurExp;

                        LevelTableItem nextLvRes = DataManager.LevelTable[level + 1] as LevelTableItem;
                        mMaxExp = nextLvRes.exp;
                        level++;
                    }while (mCurExp + addExp > mMaxExp);

                    if (playLvUp)
                    {
                        mLevelUp.SetActive(true);
                        mLevelUpAnimation.Play(true);
                        SoundManager.Instance.Play(7);
                    }
                }
                else
                {
                    mCurExp += addExp;
                }

                UpdateExp();

                if (mAddExp < 1)
                {
                    mTimer        = 0.0f;
                    mModule.State = StageEndModule.UIState.STATE_10;
                }
            }
            else
            {
                mTimer        = 0.0f;
                mModule.State = StageEndModule.UIState.STATE_10;
            }
        }
        break;

        case StageEndModule.UIState.STATE_10:
        {
            if (mTimer > StageEndModule.STATETIME_10)
            {
                mTimer        = 0.0f;
                mModule.State = StageEndModule.UIState.STATE_11;

                EventSystem.Instance.PushEvent(new StageEndUIEvent(StageEndUIEvent.STAGE_END_FINISH));
            }
        }
        break;

        case StageEndModule.UIState.STATE_11:
        {
        }
        break;

        default:
            break;
        }
    }
Example #19
0
    public void Play(bool forward)
    {
        GameObject go = (this.tweenTarget != null) ? this.tweenTarget : base.gameObject;

        if (!NGUITools.GetActive(go))
        {
            if (this.ifDisabledOnPlay != EnableCondition.EnableThenPlay)
            {
                return;
            }
            NGUITools.SetActive(go, true);
        }
        this.mTweens = !this.includeChildren ? go.GetComponents <UITweener>() : go.GetComponentsInChildren <UITweener>();
        if (this.mTweens.Length == 0)
        {
            if (this.disableWhenFinished != DisableCondition.DoNotDisable)
            {
                NGUITools.SetActive(this.tweenTarget, false);
            }
        }
        else
        {
            bool flag = false;
            if (this.playDirection == AnimationOrTween.Direction.Reverse)
            {
                forward = !forward;
            }
            int index  = 0;
            int length = this.mTweens.Length;
            while (index < length)
            {
                UITweener tweener = this.mTweens[index];
                if (tweener.tweenGroup == this.tweenGroup)
                {
                    if (!flag && !NGUITools.GetActive(go))
                    {
                        flag = true;
                        NGUITools.SetActive(go, true);
                    }
                    if (this.playDirection == AnimationOrTween.Direction.Toggle)
                    {
                        tweener.Toggle();
                    }
                    else
                    {
                        tweener.Play(forward);
                    }
                    if (this.resetOnPlay)
                    {
                        tweener.Reset();
                    }
                    tweener.onFinished = this.onFinished;
                    if ((this.eventReceiver != null) && !string.IsNullOrEmpty(this.callWhenFinished))
                    {
                        tweener.eventReceiver    = this.eventReceiver;
                        tweener.callWhenFinished = this.callWhenFinished;
                    }
                }
                index++;
            }
        }
    }
 private void CreateObjects()
 {
     this.fadeBG = base.RegisterClickEvent("FadeBG", new UIEventListener.VoidDelegate(this.OnFadeBGClick), null);
     this.fadeBG.SetActive(false);
     this.btnGroup = base.transform.Find("ButtonGroup").gameObject;
     this.mResurrectBtn = base.RegisterClickEvent("resurrect", new UIEventListener.VoidDelegate(this.OnRechallengeClick), this.btnGroup);
     this.btnLevel = base.RegisterClickEvent("Last", new UIEventListener.VoidDelegate(this.OnBtnLevelClick), this.btnGroup);
     base.RegisterClickEvent("backPveMenu", new UIEventListener.VoidDelegate(this.OnReturnClick), this.btnGroup);
     this.btnGroup.SetActive(false);
     this.victoryPanel = base.transform.Find("VictoryPanel").gameObject;
     this.victoryPanel.SetActive(false);
     this.victoryContent = this.victoryPanel.transform.Find("victory").gameObject;
     this.starGroup = this.victoryContent.transform.Find("StartGroup").gameObject;
     for (int i = 0; i < 3; i++)
     {
         this.starSprite[i] = this.starGroup.transform.Find(string.Format("start{0}", i)).gameObject;
         this.starSprite[i].SetActive(false);
     }
     TweenScale component = this.victoryContent.transform.Find("text").GetComponent<TweenScale>();
     this.content = component.gameObject;
     this.content.SetActive(false);
     this.timeLb = component.transform.Find("Time").GetComponent<UILabel>();
     this.timeLb.gameObject.SetActive(false);
     this.goldLb = component.transform.Find("Gold").GetComponent<UILabel>();
     this.goldLb.gameObject.SetActive(false);
     this.expLb = component.transform.Find("Exp").GetComponent<UILabel>();
     this.expLb.gameObject.SetActive(false);
     this.levelGrp = component.transform.Find("Level").gameObject;
     this.levelGrp.SetActive(false);
     this.levelAnimation = this.levelGrp.AddComponent<GUILevelExpUpAnimation>();
     this.levelAnimation.Init();
     this.goldDouble = this.goldLb.transform.Find("Label").GetComponent<UITweener>();
     this.goldDouble.gameObject.SetActive(false);
     this.expDouble = this.expLb.transform.Find("Label").GetComponent<UITweener>();
     this.expDouble.gameObject.SetActive(false);
     this.victoryFirst = this.victoryContent.transform.Find("victory_first").gameObject;
     this.victoryFirst.SetActive(false);
     this.treasureBox = this.victoryPanel.transform.Find("Treasure-Box").gameObject;
     this.treasureBox.SetActive(false);
     this.cardGroup = this.victoryPanel.transform.Find("CardGroup").gameObject;
     this.cardGroup.SetActive(false);
 }
 public void OnTweenFinished(UITweener tween)
 {
     // Notify the delegate
     if (onFinished != null) onFinished(tween);
 }
Example #22
0
    protected virtual void TransitionEndInternal(UITweener finished)
    {
        if( m_bState == false)
        {
            NGUITools.SetActive(gameObject, m_bState);
        }

        if( m_pTransitionEnd != null)
            m_pTransitionEnd();
        m_pTransitionEnd = null;
    }
 void LastBgmFadeEnd( UITweener uit )
 {
     GameObject.Destroy(uit);
     m_LastActiveBgmTrack.enabled = true;
     m_LastActiveBgmTrack.Stop();
     m_LastActiveBgmTrack.volume = (float)m_CurrentVol/100.0f;
     if ( !m_CrossFade )
     {
         PlayBgmClip(m_CurrentBgmName, m_FadeInTime );
     }
 }
Example #24
0
 public static void ResetAndPlay(this UITweener uitweener)
 {
     uitweener.ResetToBeginning();
     uitweener.PlayForward();
 }
Example #25
0
 private void TweenPositionFinished(UITweener t)
 {
     m_tweenAlpha.Play(true);
 }
    void OnTweenFinished(UITweener tweener)
    {
        Application.LoadLevel(levelIndex);

        Screen.autorotateToPortrait = true;
        Screen.autorotateToPortraitUpsideDown = true;
        Screen.autorotateToLandscapeLeft = true;
        Screen.autorotateToLandscapeRight = true;
		Screen.orientation = ScreenOrientation.AutoRotation;
    }
 void StopBgmFadeEnd(UITweener uit)
 {
     //Debug.Log("Call back is here !! "+m_LastActiveBgmTrack.clip.name);
     //Debug.Log("Active channel is " + m_ActiveBgmTrack );
     m_StoppingFadeFlg = false;
     m_LastActiveBgmTrack.enabled = true;
     m_LastActiveBgmTrack.volume = (float)m_CurrentBgmVol/100.0f;
     m_LastActiveBgmTrack.Stop();
     GameObject.Destroy(uit);
 }
Example #28
0
 void Start()
 {
     SetBestSoreTxt();
     StartCoroutine(UITweener.FadeImage(mainMenuView.BlackScreen, 1, 0, 1f));
 }
Example #29
0
 void OnTweenFinished(UITweener tweener)
 {
     gameObject.rigidbody.isKinematic = false;
     _floatingBubble.SetActive(true);
     rightStick.SetActive(true);
     leftStick.SetActive(true);
     collisions.SetActive(true);
     Destroy(oldPos);
     FloatingBubble.HasAdUp = false;
 }
Example #30
0
 private void OnGameEndedEvent(GameEndedEvent arg)
 {
     mainMenuView.RootCanvas.SetActive(true);
     SetBestSoreTxt();
     StartCoroutine(UITweener.FadeImage(mainMenuView.BlackScreen, 1, 0, 1f));
 }
Example #31
0
 void onFinished(UITweener tween)
 {
     Destroy (tween);
 }
Example #32
0
    public void Play(bool forward)
    {
        GameObject gameObject = (!(this.tweenTarget == null)) ? this.tweenTarget : base.gameObject;

        if (!NGUITools.GetActive(gameObject))
        {
            if (this.ifDisabledOnPlay != EnableCondition.EnableThenPlay)
            {
                return;
            }
            NGUITools.SetActive(gameObject, true);
        }
        this.mTweens = ((!this.includeChildren) ? gameObject.GetComponents <UITweener>() : gameObject.GetComponentsInChildren <UITweener>());
        if (this.mTweens.Length == 0)
        {
            if (this.disableWhenFinished != DisableCondition.DoNotDisable)
            {
                NGUITools.SetActive(this.tweenTarget, false);
            }
        }
        else
        {
            bool flag = false;
            if (this.playDirection == Direction.Reverse)
            {
                forward = !forward;
            }
            int i   = 0;
            int num = this.mTweens.Length;
            while (i < num)
            {
                UITweener uitweener = this.mTweens[i];
                if (uitweener.tweenGroup == this.tweenGroup)
                {
                    if (!flag && !NGUITools.GetActive(gameObject))
                    {
                        flag = true;
                        NGUITools.SetActive(gameObject, true);
                    }
                    if (this.playDirection == Direction.Toggle)
                    {
                        uitweener.Toggle();
                    }
                    else
                    {
                        uitweener.Play(forward);
                    }
                    if (this.resetOnPlay)
                    {
                        uitweener.Reset();
                    }
                    uitweener.onFinished = this.onFinished;
                    if (this.eventReceiver != null && !string.IsNullOrEmpty(this.callWhenFinished))
                    {
                        uitweener.eventReceiver    = this.eventReceiver;
                        uitweener.callWhenFinished = this.callWhenFinished;
                    }
                }
                i++;
            }
        }
    }
    public void CompletePattern()
    {
        GameObject tweenContainer = NGUITools.AddChild(grid.transform.parent.gameObject, flourishPrefab);
        foreach(ShapeColorizer sc in shapes)
        {
            sc.transform.parent = tweenContainer.transform;
            TweenPosition.Begin(sc.gameObject, 0.5f, Vector3.zero);
        }

        flourishTween = TweenPosition.Begin(tweenContainer, 1f, tweenContainer.transform.parent.InverseTransformPoint(ComboLabel.transform.position));
        EventDelegate del = new EventDelegate(FlourishComplete);
        flourishTween.SetOnFinished(del);
        SetPattern(m_patternShapes);
        shapeIndex = 0;
    }
Example #34
0
 private void TweenFinishEvent(UITweener tween)
 {
     m_ToShow = !m_ToShow;
     UpdateHideAndShowBtnDirection();
     m_HideAndShowBtn.isEnabled = true;
 }
    private void startEffect(bool isOpenEffect)
    {
        if (!m_effectStarted)
        {
            m_effectStarted = true;

            if (callWhenEffectStarted != null && eventReceiver != null)
            {
                eventReceiver.SendMessage(callWhenEffectStarted, this, SendMessageOptions.DontRequireReceiver);
            }

            if (!customStartEffect(isOpenEffect))
            {
                if (dialog != null)
                {
                    m_tweenerObjects.Clear();

                    List <Transform> stack = new List <Transform>();
                    stack.Add(dialog.transform);

                    while (stack.Count > 0)
                    {
                        Transform tr = stack[0];
                        stack.RemoveAt(0);
                        UITweener tweener = null;

                        if (tr.gameObject.active)
                        {
                            if (isOpenEffect)
                            {
                                tweener = startOpenEffectInternal(tr.gameObject);
                            }
                            else
                            {
                                tweener = startCloseEffectInternal(tr.gameObject);
                            }

                            if (tweener != null)
                            {
                                tweener.callWhenFinished = "OnTweenDone";
                                tweener.eventReceiver    = gameObject;
                                m_tweenerObjects.Add(tweener);
                            }
                        }

                        for (int ii = 0; ii < tr.childCount; ++ii)
                        {
                            stack.Add(tr.GetChild(ii));
                        }
                    }

                    if (m_tweenerObjects.Count <= 0)
                    {
                        m_effectStarted = false;
                        if (callWhenEffectDone != null && eventReceiver != null)
                        {
                            eventReceiver.SendMessage(callWhenEffectDone, this, SendMessageOptions.DontRequireReceiver);
                        }
                    }
                }
            }
        }
    }
Example #36
0
 ///只给剧情编辑器使用
 public void CustomBegin()
 {
     UGUITweenAlpha comp = UITweener.Begin <UGUITweenAlpha>(this.gameObject, duration);
 }
Example #37
0
    /// <summary>
    /// Fade out or fade in the active sprite and notify the OnChange event listener.
    /// If setting the initial value, call Start() first.
    /// </summary>

    public void Set(bool state, bool notify = true)
    {
        if (validator != null && !validator(state))
        {
            return;
        }

        if (!mStarted)
        {
            mIsActive    = state;
            startsActive = state;
            if (activeSprite != null)
            {
                activeSprite.alpha = invertSpriteState ? (state ? 0f : 1f) : (state ? 1f : 0f);
            }
        }
        else if (mIsActive != state)
        {
            // Uncheck all other toggles
            if (group != 0 && state)
            {
                for (int i = 0, imax = list.size; i < imax;)
                {
                    var cb = list.buffer[i];
                    if (cb != this && cb.group == group)
                    {
                        cb.Set(false);
                    }

                    if (list.size != imax)
                    {
                        imax = list.size;
                        i    = 0;
                    }
                    else
                    {
                        ++i;
                    }
                }
            }

            // Remember the state
            mIsActive = state;

            // Tween the color of the active sprite
            if (activeSprite != null)
            {
                if (instantTween || !NGUITools.GetActive(this))
                {
                    activeSprite.alpha = invertSpriteState ? (mIsActive ? 0f : 1f) : (mIsActive ? 1f : 0f);
                }
                else
                {
                    TweenAlpha.Begin(activeSprite.gameObject, 0.15f, invertSpriteState ? (mIsActive ? 0f : 1f) : (mIsActive ? 1f : 0f));
                }
            }

            if (notify && current == null)
            {
                UIToggle tog = current;
                current = this;

                if (EventDelegate.IsValid(onChange))
                {
                    EventDelegate.Execute(onChange);
                }
                else if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
                {
                    // Legacy functionality support (for backwards compatibility)
                    eventReceiver.SendMessage(functionName, mIsActive, SendMessageOptions.DontRequireReceiver);
                }
                current = tog;
            }

            // Play the checkmark animation
            if (animator != null)
            {
                ActiveAnimation aa = ActiveAnimation.Play(animator, null,
                                                          state ? Direction.Forward : Direction.Reverse,
                                                          EnableCondition.IgnoreDisabledState,
                                                          DisableCondition.DoNotDisable);
                if (aa != null && (instantTween || !NGUITools.GetActive(this)))
                {
                    aa.Finish();
                }
            }
            else if (activeAnimation != null)
            {
                ActiveAnimation aa = ActiveAnimation.Play(activeAnimation, null,
                                                          state ? Direction.Forward : Direction.Reverse,
                                                          EnableCondition.IgnoreDisabledState,
                                                          DisableCondition.DoNotDisable);
                if (aa != null && (instantTween || !NGUITools.GetActive(this)))
                {
                    aa.Finish();
                }
            }
            else if (tween != null)
            {
                bool isActive = NGUITools.GetActive(this);

                if (tween.tweenGroup != 0)
                {
                    UITweener[] tws = tween.GetComponentsInChildren <UITweener>(true);

                    for (int i = 0, imax = tws.Length; i < imax; ++i)
                    {
                        UITweener t = tws[i];

                        if (t.tweenGroup == tween.tweenGroup)
                        {
                            t.Play(state);
                            if (instantTween || !isActive)
                            {
                                t.tweenFactor = state ? 1f : 0f;
                            }
                        }
                    }
                }
                else
                {
                    tween.Play(state);
                    if (instantTween || !isActive)
                    {
                        tween.tweenFactor = state ? 1f : 0f;
                    }
                }
            }
        }
    }
Example #38
0
        protected override void transitContent(bool isIn)
        {
            List <UITweener> twList;

            if (isIn)
            {
                twList = transitInTweener;
            }
            else
            {
                twList = transitOutTweener;
            }

            if (needResetBeforeTransit)
            {
                resetTransit(isIn);
            }

            UITweener longest = null;

            for (int i = 0; i < twList.Count; i++)
            {
                UITweener tw = twList[i];
                if (tw == null)
                {
                    continue;
                }

                if (!isIn && !tw.gameObject.activeInHierarchy)
                {
                    // 如果是出场,但物体已经设置为不可见了,就不再计算它了
                    continue;
                }

                if ((isIn && tw.tweenFactor >= 1) || (!isIn && tw.tweenFactor <= 0))
                {
                    continue;
                }

                if (longest == null)
                {
                    longest = tw;
                }
                else
                {
                    if (longest.duration < tw.duration)
                    {
                        longest = tw;
                    }
                }
            }

            if (longest != null)
            {
                //LogManager.Log("longest=" + longest);
                // 最终转场结束,挂接在最长的转场上
                longest.AddFinishAction(transitOver, true);
            }
            else
            {
                // 这说明没找到任何Tween转场,这时需要立刻结束
                transitOver();
                return;
            }

            for (int i = 0; i < twList.Count; i++)
            {
                UITweener tw = twList[i];
                if (tw == null)
                {
                    continue;
                }

                if (!isIn && !tw.gameObject.activeSelf)
                {
                    // 如果是出场,但物体已经设置为不可见了,就不再计算它了
                    continue;
                }

                tw.ignoreTimeScale = false;

                //LogManager.Log("play tw" + tw);
                // 播放每一个变换
                tw.Play(isIn);
            }
        }
Example #39
0
 void Start()
 {
     uiTweener = this.GetComponent <TweenPosition>();
 }
Example #40
0
 private void OnFadeInFinished(UITweener tweener)
 {
     _time   = 0;
     _status = EnumStatus.lasting;
 }
Example #41
0
    /// <summary>
    /// Update the tweening factor and call the virtual update function.
    /// </summary>

    void Update()
    {
        float delta = ignoreTimeScale ? RealTime.deltaTime : Time.deltaTime;
        float time  = ignoreTimeScale ? RealTime.time : Time.time;

        if (!mStarted)
        {
            delta      = 0;
            mStarted   = true;
            mStartTime = time + delay;
        }

        if (time < mStartTime)
        {
            return;
        }

        // Advance the sampling factor
        mFactor += (duration == 0f) ? 1f : amountPerDelta * delta;

        // Loop style simply resets the play factor after it exceeds 1.
        if (style == Style.Loop)
        {
            if (mFactor > 1f)
            {
                mFactor -= Mathf.Floor(mFactor);
            }
        }
        else if (style == Style.PingPong)
        {
            // Ping-pong style reverses the direction
            if (mFactor > 1f)
            {
                mFactor         = 1f - (mFactor - Mathf.Floor(mFactor));
                mAmountPerDelta = -mAmountPerDelta;
            }
            else if (mFactor < 0f)
            {
                mFactor         = -mFactor;
                mFactor        -= Mathf.Floor(mFactor);
                mAmountPerDelta = -mAmountPerDelta;
            }
        }

        // If the factor goes out of range and this is a one-time tweening operation, disable the script
        if ((style == Style.Once) && (duration == 0f || mFactor > 1f || mFactor < 0f))
        {
            mFactor = Mathf.Clamp01(mFactor);
            Sample(mFactor, true);
            enabled = false;

            if (current != this)
            {
                UITweener before = current;
                current = this;

                if (onFinished != null)
                {
                    mTemp      = onFinished;
                    onFinished = new List <EventDelegate>();

                    // Notify the listener delegates
                    EventDelegate.Execute(mTemp);

                    // Re-add the previous persistent delegates
                    for (int i = 0; i < mTemp.Count; ++i)
                    {
                        EventDelegate ed = mTemp[i];
                        if (ed != null && !ed.oneShot)
                        {
                            EventDelegate.Add(onFinished, ed, ed.oneShot);
                        }
                    }
                    mTemp = null;
                }

                // Deprecated legacy functionality support
                if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished))
                {
                    eventReceiver.SendMessage(callWhenFinished, this, SendMessageOptions.DontRequireReceiver);
                }

                current = before;
            }
        }
        else
        {
            Sample(mFactor, false);
        }
    }
Example #42
0
    protected override void InitEffect()
    {
        UITweener twPos = CreateTweener(mainUiTrans, TweenType.TOP_IN);

        SingletonMB <UITweenManagerController> .GetInstance().AddTweener(twPos);
    }
Example #43
0
 private void TweenAlphaFinished(UITweener t)
 {
     OnFinished.SafeInvoke(this);
 }
Example #44
0
    public void Play(bool forward)
    {
        this.mActive = 0;
        GameObject gameObject = (this.tweenTarget == null) ? base.gameObject : this.tweenTarget;

        if (!NGUITools.GetActive(gameObject))
        {
            if (this.ifDisabledOnPlay != EnableCondition.EnableThenPlay)
            {
                return;
            }
            NGUITools.SetActive(gameObject, true);
        }
        this.mTweens = (this.includeChildren ? gameObject.GetComponentsInChildren <UITweener>() : gameObject.GetComponents <UITweener>());
        if (this.mTweens.Length == 0)
        {
            if (this.disableWhenFinished != DisableCondition.DoNotDisable)
            {
                NGUITools.SetActive(this.tweenTarget, false);
                return;
            }
        }
        else
        {
            bool flag = false;
            if (this.playDirection == Direction.Reverse)
            {
                forward = !forward;
            }
            int i   = 0;
            int num = this.mTweens.Length;
            while (i < num)
            {
                UITweener uITweener = this.mTweens[i];
                if (uITweener.tweenGroup == this.tweenGroup)
                {
                    if (!flag && !NGUITools.GetActive(gameObject))
                    {
                        flag = true;
                        NGUITools.SetActive(gameObject, true);
                    }
                    this.mActive++;
                    if (this.playDirection == Direction.Toggle)
                    {
                        EventDelegate.Add(uITweener.onFinished, new EventDelegate.Callback(this.OnFinished), true);
                        uITweener.Toggle();
                    }
                    else
                    {
                        if (this.resetOnPlay || (this.resetIfDisabled && !uITweener.enabled))
                        {
                            uITweener.Play(forward);
                            uITweener.ResetToBeginning();
                        }
                        EventDelegate.Add(uITweener.onFinished, new EventDelegate.Callback(this.OnFinished), true);
                        uITweener.Play(forward);
                    }
                }
                i++;
            }
        }
    }
Example #45
0
    private void Update()
    {
        float num  = this.ignoreTimeScale ? RealTime.deltaTime : Time.deltaTime;
        float num2 = this.ignoreTimeScale ? RealTime.time : Time.time;

        if (!this.mStarted)
        {
            this.mStarted   = true;
            this.mStartTime = num2 + this.delay;
        }
        if (num2 < this.mStartTime)
        {
            return;
        }
        this.mFactor += this.amountPerDelta * num;
        if (this.style == UITweener.Style.Loop)
        {
            if (this.mFactor > 1f)
            {
                this.mFactor -= Mathf.Floor(this.mFactor);
            }
        }
        else if (this.style == UITweener.Style.PingPong)
        {
            if (this.mFactor > 1f)
            {
                this.mFactor         = 1f - (this.mFactor - Mathf.Floor(this.mFactor));
                this.mAmountPerDelta = -this.mAmountPerDelta;
            }
            else if (this.mFactor < 0f)
            {
                this.mFactor         = -this.mFactor;
                this.mFactor        -= Mathf.Floor(this.mFactor);
                this.mAmountPerDelta = -this.mAmountPerDelta;
            }
        }
        if (this.style == UITweener.Style.Once && (this.duration == 0f || this.mFactor > 1f || this.mFactor < 0f))
        {
            this.mFactor = Mathf.Clamp01(this.mFactor);
            this.Sample(this.mFactor, true);
            base.enabled = false;
            if (UITweener.current == null)
            {
                UITweener uITweener = UITweener.current;
                UITweener.current = this;
                if (this.onFinished != null)
                {
                    this.mTemp      = this.onFinished;
                    this.onFinished = new List <EventDelegate>();
                    EventDelegate.Execute(this.mTemp);
                    for (int i = 0; i < this.mTemp.Count; i++)
                    {
                        EventDelegate eventDelegate = this.mTemp[i];
                        if (eventDelegate != null && !eventDelegate.oneShot)
                        {
                            EventDelegate.Add(this.onFinished, eventDelegate, eventDelegate.oneShot);
                        }
                    }
                    this.mTemp = null;
                }
                if (this.eventReceiver != null && !string.IsNullOrEmpty(this.callWhenFinished))
                {
                    this.eventReceiver.SendMessage(this.callWhenFinished, this, SendMessageOptions.DontRequireReceiver);
                }
                UITweener.current = uITweener;
                return;
            }
        }
        else
        {
            this.Sample(this.mFactor, false);
        }
    }
 void PlayBgmFadeEnd( UITweener uit )
 {
     //		Debug.Log("play bgm fade end");
     GameObject.Destroy(uit);
 }
Example #47
0
    /// <summary>
    /// Update the tweening factor and call the virtual update function.
    /// </summary>

    void Update()
    {
        float delta = !UnscaledTime ? Time.deltaTime : Time.unscaledDeltaTime;
        float time  = Time.time;

        if (!mStarted)
        {
            mStarted   = true;
            mStartTime = time + delay;
        }

        if (time < mStartTime)
        {
            return;
        }

        // Advance the sampling factor
        mFactor += amountPerDelta * delta;

        // Loop style simply resets the play factor after it exceeds 1.
        if (style == Style.Loop)
        {
            if (mFactor > 1f)
            {
                mFactor -= Mathf.Floor(mFactor);
            }
        }
        else if (style == Style.PingPong)
        {
            // Ping-pong style reverses the direction
            if (mFactor > 1f)
            {
                mFactor         = 1f - (mFactor - Mathf.Floor(mFactor));
                mAmountPerDelta = -mAmountPerDelta;
            }
            else if (mFactor < 0f)
            {
                mFactor         = -mFactor;
                mFactor        -= Mathf.Floor(mFactor);
                mAmountPerDelta = -mAmountPerDelta;
            }
        }

        // If the factor goes out of range and this is a one-time tweening operation, disable the script
        if ((style == Style.Once) && (duration == 0f || mFactor > 1f || mFactor < 0f))
        {
            mFactor = Mathf.Clamp01(mFactor);
            Sample(mFactor, true);

            // Disable this script unless the function calls above changed something
            if (duration == 0f || (mFactor == 1f && mAmountPerDelta > 0f || mFactor == 0f && mAmountPerDelta < 0f))
            {
                enabled = false;
            }

            if (current == null)
            {
                current = this;

                OnFinish.Invoke(gameObject);

                // Deprecated legacy functionality support
                if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished))
                {
                    eventReceiver.SendMessage(callWhenFinished, this, SendMessageOptions.DontRequireReceiver);
                }

                current = null;
            }
        }
        else
        {
            Sample(mFactor, false);
        }
    }
Example #48
0
    public unsafe override void Unity_NamedDeserialize(int depth)
    {
        ISerializedNamedStateReader arg_1A_0 = SerializedNamedStateReader.Instance;

        byte[] var_0_cp_0 = $FieldNamesStorage.$RuntimeNames;
        int    var_0_cp_1 = 0;

        this.group = arg_1A_0.ReadInt32(&var_0_cp_0[var_0_cp_1] + 1901);
        if (depth <= 7)
        {
            this.activeSprite = (SerializedNamedStateReader.Instance.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 1907) as UIWidget);
        }
        if (depth <= 7)
        {
            this.activeAnimation = (SerializedNamedStateReader.Instance.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 1920) as Animation);
        }
        if (depth <= 7)
        {
            this.animator = (SerializedNamedStateReader.Instance.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 1069) as Animator);
        }
        if (depth <= 7)
        {
            this.tween = (SerializedNamedStateReader.Instance.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 1936) as UITweener);
        }
        this.startsActive = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 1942);
        SerializedNamedStateReader.Instance.Align();
        this.instantTween = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 1955);
        SerializedNamedStateReader.Instance.Align();
        this.optionCanBeNone = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 1968);
        SerializedNamedStateReader.Instance.Align();
        if (depth <= 7)
        {
            int num = SerializedNamedStateReader.Instance.BeginSequenceGroup(&var_0_cp_0[var_0_cp_1] + 1446);
            this.onChange = new List <EventDelegate>(num);
            for (int i = 0; i < num; i++)
            {
                EventDelegate eventDelegate = new EventDelegate();
                EventDelegate arg_150_0     = eventDelegate;
                SerializedNamedStateReader.Instance.BeginMetaGroup((IntPtr)0);
                arg_150_0.Unity_NamedDeserialize(depth + 1);
                SerializedNamedStateReader.Instance.EndMetaGroup();
                this.onChange.Add(eventDelegate);
            }
            SerializedNamedStateReader.Instance.EndMetaGroup();
        }
        if (depth <= 7)
        {
            this.checkSprite = (SerializedNamedStateReader.Instance.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 1984) as UISprite);
        }
        if (depth <= 7)
        {
            this.checkAnimation = (SerializedNamedStateReader.Instance.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 1996) as Animation);
        }
        if (depth <= 7)
        {
            this.eventReceiver = (SerializedNamedStateReader.Instance.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 1165) as GameObject);
        }
        this.functionName  = (SerializedNamedStateReader.Instance.ReadString(&var_0_cp_0[var_0_cp_1] + 402) as string);
        this.startsChecked = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 2011);
        SerializedNamedStateReader.Instance.Align();
    }
 private void Awake()
 {
     //IL_000c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0011: Expected O, but got Unknown
     //IL_009b: Unknown result type (might be due to invalid IL or missing references)
     //IL_00c2: Unknown result type (might be due to invalid IL or missing references)
     //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
     //IL_0110: Unknown result type (might be due to invalid IL or missing references)
     if (Application.get_isPlaying())
     {
         Transform val       = this.get_transform();
         UIWidget  component = this.GetComponent <UIWidget>();
         if (!(component == null))
         {
             UITweener[] components = this.GetComponents <UITweener>();
             if (components != null && components.Length > 0)
             {
                 int num = components.Length;
                 for (int i = 0; i < num; i++)
                 {
                     UITweener uITweener = components[i];
                     if (uITweener != null)
                     {
                         if (uITweener is TweenAlpha)
                         {
                             TweenAlpha tweenAlpha = uITweener as TweenAlpha;
                             component.alpha = tweenAlpha.from;
                         }
                         else if (uITweener is TweenColor)
                         {
                             TweenColor tweenColor = uITweener as TweenColor;
                             component.color = tweenColor.from;
                         }
                         else if (uITweener is TweenPosition)
                         {
                             TweenPosition tweenPosition = uITweener as TweenPosition;
                             val.set_localPosition(tweenPosition.from);
                         }
                         else if (uITweener is TweenRotation)
                         {
                             TweenRotation tweenRotation = uITweener as TweenRotation;
                             val.set_localEulerAngles(tweenRotation.from);
                         }
                         else if (uITweener is TweenScale)
                         {
                             TweenScale tweenScale = uITweener as TweenScale;
                             val.set_localScale(tweenScale.from);
                         }
                         else if (uITweener is TweenWidth)
                         {
                             TweenWidth tweenWidth = uITweener as TweenWidth;
                             component.width = tweenWidth.from;
                         }
                         else if (uITweener is TweenHeight)
                         {
                             TweenHeight tweenHeight = uITweener as TweenHeight;
                             component.height = tweenHeight.from;
                         }
                     }
                 }
             }
         }
     }
 }
Example #50
0
 // Token: 0x06000327 RID: 807 RVA: 0x0001EF58 File Offset: 0x0001D158
 public void Set(bool state, bool notify = true)
 {
     if (this.validator != null && !this.validator(state))
     {
         return;
     }
     if (!this.mStarted)
     {
         this.mIsActive    = state;
         this.startsActive = state;
         if (this.activeSprite != null)
         {
             this.activeSprite.alpha = (this.invertSpriteState ? (state ? 0f : 1f) : (state ? 1f : 0f));
             return;
         }
     }
     else if (this.mIsActive != state)
     {
         if (this.group != 0 && state)
         {
             int i    = 0;
             int size = UIToggle.list.size;
             while (i < size)
             {
                 UIToggle uitoggle = UIToggle.list.buffer[i];
                 if (uitoggle != this && uitoggle.group == this.group)
                 {
                     uitoggle.Set(false, true);
                 }
                 if (UIToggle.list.size != size)
                 {
                     size = UIToggle.list.size;
                     i    = 0;
                 }
                 else
                 {
                     i++;
                 }
             }
         }
         this.mIsActive = state;
         if (this.activeSprite != null)
         {
             if (this.instantTween || !NGUITools.GetActive(this))
             {
                 this.activeSprite.alpha = (this.invertSpriteState ? (this.mIsActive ? 0f : 1f) : (this.mIsActive ? 1f : 0f));
             }
             else
             {
                 TweenAlpha.Begin(this.activeSprite.gameObject, 0.15f, this.invertSpriteState ? (this.mIsActive ? 0f : 1f) : (this.mIsActive ? 1f : 0f), 0f);
             }
         }
         if (notify && UIToggle.current == null)
         {
             UIToggle uitoggle2 = UIToggle.current;
             UIToggle.current = this;
             if (EventDelegate.IsValid(this.onChange))
             {
                 EventDelegate.Execute(this.onChange);
             }
             else if (this.eventReceiver != null && !string.IsNullOrEmpty(this.functionName))
             {
                 this.eventReceiver.SendMessage(this.functionName, this.mIsActive, SendMessageOptions.DontRequireReceiver);
             }
             UIToggle.current = uitoggle2;
         }
         if (this.animator != null)
         {
             ActiveAnimation activeAnimation = ActiveAnimation.Play(this.animator, null, state ? AnimationOrTween.Direction.Forward : AnimationOrTween.Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable);
             if (activeAnimation != null && (this.instantTween || !NGUITools.GetActive(this)))
             {
                 activeAnimation.Finish();
                 return;
             }
         }
         else if (this.activeAnimation != null)
         {
             ActiveAnimation activeAnimation2 = ActiveAnimation.Play(this.activeAnimation, null, state ? AnimationOrTween.Direction.Forward : AnimationOrTween.Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable);
             if (activeAnimation2 != null && (this.instantTween || !NGUITools.GetActive(this)))
             {
                 activeAnimation2.Finish();
                 return;
             }
         }
         else if (this.tween != null)
         {
             bool active = NGUITools.GetActive(this);
             if (this.tween.tweenGroup != 0)
             {
                 UITweener[] componentsInChildren = this.tween.GetComponentsInChildren <UITweener>(true);
                 int         j   = 0;
                 int         num = componentsInChildren.Length;
                 while (j < num)
                 {
                     UITweener uitweener = componentsInChildren[j];
                     if (uitweener.tweenGroup == this.tween.tweenGroup)
                     {
                         uitweener.Play(state);
                         if (this.instantTween || !active)
                         {
                             uitweener.tweenFactor = (state ? 1f : 0f);
                         }
                     }
                     j++;
                 }
                 return;
             }
             this.tween.Play(state);
             if (this.instantTween || !active)
             {
                 this.tween.tweenFactor = (state ? 1f : 0f);
             }
         }
     }
 }
Example #51
0
    /// <summary>
    /// Activate the tweeners.
    /// </summary>

    public void Play(bool forward)
    {
        mActive = 0;
        GameObject go = (tweenTarget == null) ? gameObject : tweenTarget;

        if (!NGUITools.GetActive(go))
        {
            // If the object is disabled, don't do anything
            if (ifDisabledOnPlay != EnableCondition.EnableThenPlay)
            {
                return;
            }

            // Enable the game object before tweening it
            NGUITools.SetActive(go, true);
        }

        // Gather the tweening components
        mTweens = includeChildren ? go.GetComponentsInChildren <UITweener>() : go.GetComponents <UITweener>();

        if (mTweens.Length == 0)
        {
            // No tweeners found -- should we disable the object?
            if (disableWhenFinished != DisableCondition.DoNotDisable)
            {
                NGUITools.SetActive(tweenTarget, false);
            }
        }
        else
        {
            bool activated = false;
            if (playDirection == Direction.Reverse)
            {
                forward = !forward;
            }

            // Run through all located tween components
            for (int i = 0, imax = mTweens.Length; i < imax; ++i)
            {
                UITweener tw = mTweens[i];

                // If the tweener's group matches, we can work with it
                if (tw.tweenGroup == tweenGroup)
                {
                    // Ensure that the game objects are enabled
                    if (!activated && !NGUITools.GetActive(go))
                    {
                        activated = true;
                        NGUITools.SetActive(go, true);
                    }

                    ++mActive;

                    // Toggle or activate the tween component
                    if (playDirection == Direction.Toggle)
                    {
                        // Listen for tween finished messages
                        EventDelegate.Add(tw.onFinished, OnFinished, true);
                        tw.Toggle();
                    }
                    else
                    {
                        if (resetOnPlay || (resetIfDisabled && !tw.enabled))
                        {
                            tw.ResetToBeginning();
                        }
                        // Listen for tween finished messages
                        EventDelegate.Add(tw.onFinished, OnFinished, true);
                        tw.Play(forward);
                    }
                }
            }
        }
    }
Example #52
0
 private void CameraTweenFinished(UITweener tween)
 {
     ToggleBoundaries(true);
     GameRoot.current.EnteredNewScreen();
 }
 //private void FinishZoomIn()
 private void FinishZoomIn(UITweener tween)
 {
     //npcDetail.transform.position = new Vector3(npcLocation.x,npcLocation.y,npcDetail.transform.localPosition.z);
     //CreateNPCDetails();
     //TweenAlpha.Begin(npcDetail,fadeOutTime,1);
     //togglenArrows();
 }
Example #54
0
    void OnTPEnd(UITweener t)
    {
        LoggerHelper.Debug("Destroy");


        for (int i = 0; i < m_listDragonItem.Count; ++i)
        {
            if (m_listDragonItem[i].name == t.name)
            {
                AssetCacheMgr.ReleaseInstance(m_listDragonItem[i]);
                m_listDragonItem.RemoveAt(i);
            }
        }

    }
Example #55
0
 void OnPositionTweenedOut(UITweener tweener)
 {
     gameObject.transform.position = startPos;
 }
Example #56
0
    /// <summary>
    /// Fade out or fade in the active sprite and notify the OnChange event listener.
    /// </summary>

    public void Set(bool state)
    {
        if (validator != null && !validator(state))
        {
            return;
        }

        if (!mStarted)
        {
            mIsActive    = state;
            startsActive = state;
            if (activeSprite != null)
            {
                activeSprite.alpha = state ? 1f : 0f;
            }
        }
        else if (mIsActive != state)
        {
            // Uncheck all other toggles
            if (group != "" && state)
            {
                for (int i = 0, imax = list.size; i < imax;)
                {
                    UIToggle cb = list[i];
                    if (cb != this && cb.group == group)
                    {
                        cb.Set(false);
                    }

                    if (list.size != imax)
                    {
                        imax = list.size;
                        i    = 0;
                    }
                    else
                    {
                        ++i;
                    }
                }
            }

            // Remember the state
            mIsActive = state;

            // Tween the color of the active sprite
            if (activeSprite != null)
            {
                if (instantTween || !NGUITools.GetActive(this))
                {
                    activeSprite.alpha = mIsActive ? 1f : 0f;
                }
                else
                {
                    TweenAlpha.Begin(activeSprite.gameObject, 0.15f, mIsActive ? 1f : 0f);
                }
            }
            _onChange.Invoke(this, state);

            // Play the checkmark animation
            if (animator != null)
            {
                ActiveAnimation aa = ActiveAnimation.Play(animator, null,
                                                          state ? Direction.Forward : Direction.Reverse,
                                                          EnableCondition.IgnoreDisabledState,
                                                          DisableCondition.DoNotDisable);
                if (aa != null && (instantTween || !NGUITools.GetActive(this)))
                {
                    aa.Finish();
                }
            }
            else if (activeAnimation != null)
            {
                ActiveAnimation aa = ActiveAnimation.Play(activeAnimation, null,
                                                          state ? Direction.Forward : Direction.Reverse,
                                                          EnableCondition.IgnoreDisabledState,
                                                          DisableCondition.DoNotDisable);
                if (aa != null && (instantTween || !NGUITools.GetActive(this)))
                {
                    aa.Finish();
                }
            }
            else if (tween != null)
            {
                bool isActive = NGUITools.GetActive(this);

                if (tween.tweenGroup != 0)
                {
                    UITweener[] tws = tween.GetComponentsInChildren <UITweener>();

                    for (int i = 0, imax = tws.Length; i < imax; ++i)
                    {
                        UITweener t = tws[i];

                        if (t.tweenGroup == tween.tweenGroup)
                        {
                            t.Play(state);
                            if (instantTween || !isActive)
                            {
                                t.tweenFactor = state ? 1f : 0f;
                            }
                        }
                    }
                }
                else
                {
                    tween.Play(state);
                    if (instantTween || !isActive)
                    {
                        tween.tweenFactor = state ? 1f : 0f;
                    }
                }
            }
        }
    }
        /// <summary>
        /// Activate the tweeners.
        /// </summary>
        public void PlayTweeners()
        {
            if (!NGUITools.GetActive(_tweenTarget))
            {
                // If the object is disabled, don't do anything
                if (ifDisabledOnPlay != EnableCondition.EnableThenPlay)
                {
                    return;
                }

                // Enable the game object before tweening it
                NGUITools.SetActive(_tweenTarget, true);
            }

            // Gather the tweening components
            mTweens = includeChildren.Value ? _tweenTarget.GetComponentsInChildren <UITweener>() : _tweenTarget.GetComponents <UITweener>();

            if (mTweens.Length == 0)
            {
                // No tweeners found -- should we disable the object?
                if (disableWhenFinished != DisableCondition.DoNotDisable)
                {
                    NGUITools.SetActive(_tweenTarget, false);
                }
            }
            else
            {
                bool activated = false;
                bool forward   = playDirection == Direction.Forward;

                // Run through all located tween components
                for (int i = 0, imax = mTweens.Length; i < imax; ++i)
                {
                    UITweener tw = mTweens[i];

                    // If the tweener's group matches, we can work with it
                    if (tw.tweenGroup == tweenGroup.Value)
                    {
                        // Ensure that the game objects are enabled
                        if (!activated && !NGUITools.GetActive(_tweenTarget))
                        {
                            activated = true;
                            NGUITools.SetActive(_tweenTarget, true);
                        }



                        // Toggle or activate the tween component
                        if (playDirection == Direction.Toggle)
                        {
                            tw.Toggle();
                        }
                        else
                        {
                            tw.Play(forward);
                        }
                        if (resetOnPlay.Value)
                        {
                            tw.Reset();
                        }


                        // Set the delegate
                        //tw.onFinished = onFinished;

                        /*
                         * // Copy the event receiver
                         * if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished))
                         * {
                         *      tw.eventReceiver = eventReceiver;
                         *      tw.callWhenFinished = callWhenFinished;
                         * }
                         */
                    }
                }
            }
        }
Example #58
0
 private void WaitOnCenter(UITweener tween)
 {
     StartCoroutine(Wait(MoveCenter2End));
 }
Example #59
0
		public void ResetSuccesAnimation ( UITweener p_tween )
		{
			m_successIconTweenAlpha.Play( false );
		}  
Example #60
0
    /// <summary>
    /// Activate the tweeners.
    /// </summary>

    public void Play(bool forward)
    {
                #if UNITY_EDITOR
        if (!Application.isPlaying)
        {
            return;
        }
                #endif

        mActive = 0;
        GameObject go = (tweenTarget == null) ? gameObject : tweenTarget;

        // Gather the tweening components
        mTweens = includeChildren ? go.GetComponentsInChildren <UITweener>() : go.GetComponents <UITweener>();

        if (mTweens.Length == 0)
        {
            // No tweeners found -- should we disable the object?
        }
        else
        {
            bool activated = false;
            if (playDirection == Direction.Reverse)
            {
                forward = !forward;
            }

            // Run through all located tween components
            for (int i = 0, imax = mTweens.Length; i < imax; ++i)
            {
                UITweener tw = mTweens[i];

                // If the tweener's group matches, we can work with it
                if (tw.tweenGroup == tweenGroup)
                {
                    // Ensure that the game objects are enabled
                    if (!activated && !(go && go.activeInHierarchy))
                    {
                        activated = true;
                        go.SetActive(true);
                    }

                    ++mActive;

                    // Toggle or activate the tween component
                    if (playDirection == Direction.Toggle)
                    {
                        // Listen for tween finished messages
                        tw.OnFinished = OnFinished;
                        tw.Toggle();
                    }
                    else
                    {
                        if (resetOnPlay || (resetIfDisabled && !tw.enabled))
                        {
                            tw.ResetToBeginning();
                        }
                        // Listen for tween finished messages
                        tw.OnFinished = OnFinished;
                        tw.Play(forward);
                    }
                }
            }
        }
    }