Execute() public method

Execute the delegate, if possible. This will only be used when the application is playing in order to prevent unintentional state changes.
public Execute ( ) : bool
return bool
Beispiel #1
0
    private void Update()
    {
        float num  = (!this.ignoreTimeScale) ? Time.deltaTime : RealTime.deltaTime;
        float num2 = (!this.ignoreTimeScale) ? Time.time : RealTime.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);
            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;
            }
            if (this.duration == 0f || (this.mFactor == 1f && this.mAmountPerDelta > 0f) || (this.mFactor == 0f && this.mAmountPerDelta < 0f))
            {
                base.enabled = false;
            }
        }
        else
        {
            this.Sample(this.mFactor, false);
        }
    }
Beispiel #2
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 != 0 && 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);
                }
            }

            if (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();
                }
            }
        }
    }
Beispiel #3
0
 private void Set(bool state)
 {
     if (!mStarted)
     {
         mIsActive    = state;
         startsActive = state;
         if (activeSprite != null)
         {
             activeSprite.alpha = ((!state) ? 0f : 1f);
         }
     }
     else if (mIsActive != state)
     {
         if (group != 0 && state)
         {
             int num  = 0;
             int size = list.size;
             while (num < size)
             {
                 UIToggle uIToggle = list[num];
                 if (uIToggle != this && uIToggle.group == group)
                 {
                     uIToggle.Set(state: false);
                 }
                 if (list.size != size)
                 {
                     size = list.size;
                     num  = 0;
                 }
                 else
                 {
                     num++;
                 }
             }
         }
         mIsActive = state;
         if (activeSprite != null)
         {
             if (instantTween || !NGUITools.GetActive(this))
             {
                 activeSprite.alpha = ((!mIsActive) ? 0f : 1f);
             }
             else
             {
                 TweenAlpha.Begin(activeSprite.gameObject, 0.15f, (!mIsActive) ? 0f : 1f);
             }
         }
         if (current == null)
         {
             UIToggle uIToggle2 = current;
             current = this;
             if (EventDelegate.IsValid(onChange))
             {
                 EventDelegate.Execute(onChange);
             }
             else if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
             {
                 eventReceiver.SendMessage(functionName, mIsActive, SendMessageOptions.DontRequireReceiver);
             }
             current = uIToggle2;
         }
         if (this.activeAnimation != null)
         {
             ActiveAnimation activeAnimation = ActiveAnimation.Play(this.activeAnimation, null, state ? Direction.Forward : Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable);
             if (activeAnimation != null && (instantTween || !NGUITools.GetActive(this)))
             {
                 activeAnimation.Finish();
             }
         }
     }
 }
Beispiel #4
0
    IEnumerator runfadeOutWithEvent(GameObject target, ESpriteType type, float time, EventDelegate callback)
    {
        if (type == ESpriteType.SPRITE_RENDERER)
        {
            SpriteRenderer render         = target.GetComponent <SpriteRenderer>();
            float          ValueEachFrame = (float)Time.deltaTime / time;

            while (true)
            {
                if (render == null)
                {
                    yield break;
                }

                Color color = render.color;

                if (color.a <= 0)
                {
                    callback.Execute();
                    yield break;
                }
                else
                {
                    render.color = new Color(color.r, color.g, color.b, color.a - ValueEachFrame);
                }

                yield return(0);
            }
        }
        else if (type == ESpriteType.UI_SPRITE)
        {
            UISprite render         = target.GetComponent <UISprite>();
            float    ValueEachFrame = (float)Time.deltaTime / time;

            while (true)
            {
                if (render == null)
                {
                    yield break;
                }

                Color color = render.color;

                if (color.a <= 0)
                {
                    callback.Execute();
                    yield break;
                }
                else
                {
                    render.color = new Color(color.r, color.g, color.b, color.a - ValueEachFrame);
                }

                yield return(0);
            }
        }
        else if (type == ESpriteType.UI_TEXTURE)
        {
            UITexture render         = target.GetComponent <UITexture>();
            float     ValueEachFrame = (float)Time.deltaTime / time;

            while (true)
            {
                if (render == null)
                {
                    yield break;
                }

                Color color = render.color;

                if (color.a <= 0)
                {
                    callback.Execute();
                    yield break;
                }
                else
                {
                    render.color = new Color(color.r, color.g, color.b, color.a - ValueEachFrame);
                }

                yield return(0);
            }
        }
    }
Beispiel #5
0
    void Update()
    {
        if (!_start)
        {
            return;
        }
        _passTime += Time.deltaTime;
        if (_flashCount > 0)
        {
            if (isPlaySound)
            {
                isPlaySound = false;
                UtilTools.PlaySoundEffect("Sounds/RichCar/roulette20f", 0.3f * _flashCount);
            }
            if (_passTime >= 0.3f)
            {
                if (_flashCount % 2 == 0)
                {
                    for (int i = 0; i < _spList.Count; i++)
                    {
                        _spList[i].alpha = 1f;
                    }
                }
                else
                {
                    for (int i = 0; i < _spList.Count; i++)
                    {
                        _spList[i].alpha = 0f;
                    }
                }
                _passTime = 0f;
                _flashCount--;
                //if (_flashCount == 3)
                //{
                //    UtilTools.SetBgm("Sounds/RichCar/roulette20");
                //}
            }
            return;
        }
        if (_passTime >= _dur)
        {
            if (_moveCount == 0)
            {
                _start = false;
                _spList[_toIndex].alpha = 1f;
                if (_lastIndex < _trList.Count && _lastIndex >= 0)
                {
                    _trList[_lastIndex].localScale = new Vector3(1f, 1f, 1f);
                    _lastIndex = _toIndex;
                    _trList[_toIndex].localScale = new Vector3(1.05f, 1.05f, 1.05f);
                }
                _passTime = 0f;

                if (onComplete.Count > 0)
                {
                    EventDelegate.Execute(onComplete);
                }

                return;
            }
            _passTime = _passTime - _dur;
            StartTweenAlpha(_nowSelect);
            _nowSelect += 1;
            _moveCount--;
            _count++;
            if (_count <= 2)
            {
            }
            else
            {
                if (_count == 16)
                {
                    ResetEffect();
                }
                if (_moveCount <= 20)
                {
                    if (_moveCount <= 6 && !_isStop)
                    {
                        _isStop = true;
                    }
                    _dur = _dur * 1.1f;
                    if (_dur >= 0.5f)
                    {
                        _dur = 0.5f;
                    }
                    if (_moveCount <= 5)
                    {
                        _dur *= 1.2f;
                    }
                }
                else
                {
                    _dur = _dur / 1.1f;
                    if (_dur <= 0.05f)
                    {
                        _dur = 0.05f;
                    }
                }
            }
        }
    }
Beispiel #6
0
    public bool CheckTutorialButtonActive(GameObject buttonObj, TUTORIAL_BUTTON_TYPE type)
    {
        if (CheckTutorialEnable == false && CheckTutorialBuildingEnable == false)
        {
            return(false);
        }

        bool isEnable = CheckTutorialType(new TUTORIAL_TRIGGER_TYPE[] {
            TUTORIAL_TRIGGER_TYPE.TYPE_TOUCH, TUTORIAL_TRIGGER_TYPE.TYPE_WAIT,
            TUTORIAL_TRIGGER_TYPE.TYPE_NONSERVER_WAIT, TUTORIAL_TRIGGER_TYPE.TYPE_DRAG_DROP
        });

        UIPlayAnimation uiAni  = buttonObj.GetComponent <UIPlayAnimation>();
        UIEventListener uiEv   = buttonObj.GetComponent <UIEventListener>();
        UIEventTrigger  uiTrig = buttonObj.GetComponent <UIEventTrigger>();
        UIButton        uiBtn  = buttonObj.GetComponent <UIButton>();

        TutorialInfo curTutInfo = null;

        switch (Tutorial.instance.TutorialType)
        {
        case TUTORIAL_TYPE.TYPE_BASIC: curTutInfo = m_curTutorialInfo; break;

        case TUTORIAL_TYPE.TYPE_BUILDING: curTutInfo = m_curTutorialBuildingInfo; break;
        }

        if (isEnable)
        {
            switch (type)
            {
            case TUTORIAL_BUTTON_TYPE.TYPE_ANIM:
                if (CheckMethodListEqualsName(curTutInfo, uiAni.onFinished))
                {
                    EventDelegate.Execute(uiAni.onFinished);
                    if (CheckTutorialType(TUTORIAL_TRIGGER_TYPE.TYPE_TOUCH))
                    {
                        switch (Tutorial.instance.TutorialType)
                        {
                        case TUTORIAL_TYPE.TYPE_BASIC: EndCurrentTutorialCode(true); break;

                        case TUTORIAL_TYPE.TYPE_BUILDING: EndSeqBuildingTrigger(true); break;
                        }
                    }
                }

                break;

            case TUTORIAL_BUTTON_TYPE.TYPE_EVENT:
                if (uiEv.onClick != null)
                {
                    if (curTutInfo.CheckMethodNameExists(uiEv.onClick.Method.Name))
                    {
                        uiEv.onClick(buttonObj);
                        if (CheckTutorialType(TUTORIAL_TRIGGER_TYPE.TYPE_TOUCH))
                        {
                            switch (Tutorial.instance.TutorialType)
                            {
                            case TUTORIAL_TYPE.TYPE_BASIC: EndCurrentTutorialCode(true); break;

                            case TUTORIAL_TYPE.TYPE_BUILDING: EndSeqBuildingTrigger(true); break;
                            }
                        }
                    }

                    else
                    {
                        bool isExists = (uiAni != null && CheckMethodListEqualsName(curTutInfo, uiAni.onFinished)) ||
                                        (uiBtn != null && CheckMethodListEqualsName(curTutInfo, uiBtn.onClick));
                        if (isExists)
                        {
                            uiEv.onClick(buttonObj);
                        }
                    }
                }

                break;

            case TUTORIAL_BUTTON_TYPE.TYPE_BUTTON:
                if (CheckMethodListEqualsName(curTutInfo, uiBtn.onClick))
                {
                    EventDelegate.Execute(uiBtn.onClick);
                    if (CheckTutorialType(TUTORIAL_TRIGGER_TYPE.TYPE_TOUCH))
                    {
                        switch (Tutorial.instance.TutorialType)
                        {
                        case TUTORIAL_TYPE.TYPE_BASIC: EndCurrentTutorialCode(true); break;

                        case TUTORIAL_TYPE.TYPE_BUILDING: EndSeqBuildingTrigger(true); break;
                        }
                    }
                }

                else
                {
                    bool isExists = (uiAni != null && CheckMethodListEqualsName(curTutInfo, uiAni.onFinished)) ||
                                    (uiEv != null && uiEv.onClick != null && curTutInfo.CheckMethodNameExists(uiEv.onClick.Method.Name));
                    if (isExists)
                    {
                        EventDelegate.Execute(uiBtn.onClick);
                    }
                }

                break;
            }
        }

        else
        {
            switch (StateManager.instance.m_curStateType)
            {
            case STATE_TYPE.STATE_TITLE:
            case STATE_TYPE.STATE_INTRO:
                return(false);

            default:
                switch (type)
                {
                case TUTORIAL_BUTTON_TYPE.TYPE_ANIM:
                    return(!CheckCommonMethodListEqualsName(uiAni.onFinished));

                case TUTORIAL_BUTTON_TYPE.TYPE_EVENT:
                    return(!CheckCommonMethodListEqualsName(uiEv.onClick.Method.Name));

                case TUTORIAL_BUTTON_TYPE.TYPE_BUTTON:
                    return(!CheckCommonMethodListEqualsName(uiBtn.onClick));
                }

                return(true);
            }
        }

        return(isEnable);
    }
Beispiel #7
0
 public void Set(bool state)
 {
     if (this.validator != null && !this.validator(state))
     {
         return;
     }
     if (!this.mStarted)
     {
         this.mIsActive    = state;
         this.startsActive = state;
         if (this.activeSprite != null)
         {
             this.activeSprite.alpha = ((!state) ? 0f : 1f);
         }
     }
     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[i];
                 if (uitoggle != this && uitoggle.group == this.group)
                 {
                     uitoggle.Set(false);
                 }
                 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.mIsActive) ? 0f : 1f);
             }
             else
             {
                 TweenAlpha.Begin(this.activeSprite.gameObject, 0.15f, (!this.mIsActive) ? 0f : 1f);
             }
         }
         if (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) ? Direction.Reverse : Direction.Forward, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable);
             if (activeAnimation != null && (this.instantTween || !NGUITools.GetActive(this)))
             {
                 activeAnimation.Finish();
             }
         }
         else if (this.activeAnimation != null)
         {
             ActiveAnimation activeAnimation2 = ActiveAnimation.Play(this.activeAnimation, null, (!state) ? Direction.Reverse : Direction.Forward, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable);
             if (activeAnimation2 != null && (this.instantTween || !NGUITools.GetActive(this)))
             {
                 activeAnimation2.Finish();
             }
         }
     }
 }
Beispiel #8
0
    public void EventBossOneOne()
    {
        GameObject[] bossList = GameObject.FindGameObjectsWithTag(Tags.boss);
        for (int i = 0; i < bossList.Length; i++)
        {
            bossList[i].GetComponent<BossController>().FoundPlayer();
        }
        UIBossBloodManager._instance.OnOpenButtonClick();

        EventDelegate unlockPlayer = new EventDelegate(this, "MakePlayerFree");


        EventDelegate closeTheRoad = new EventDelegate(this, "SetObjectActive");
        closeTheRoad.parameters[0] = new EventDelegate.Parameter(new GameObject[] { eventObject1, eventObject2 });
        closeTheRoad.parameters[1] = new EventDelegate.Parameter(true);
        closeTheRoad.parameters[2] = new EventDelegate.Parameter(1f);
        closeTheRoad.parameters[3] = new EventDelegate.Parameter(unlockPlayer);

        EventDelegate cameraLookAt = new EventDelegate(this, "CameraLookAt");
        cameraLookAt.parameters[0] = new EventDelegate.Parameter(PositionTarget[0].transform);
        cameraLookAt.parameters[1] = new EventDelegate.Parameter(1f);
        cameraLookAt.parameters[2] = new EventDelegate.Parameter(closeTheRoad);

        EventDelegate openTheParticleSystem = new EventDelegate(this, "SetParticleSystemActive");
        openTheParticleSystem.parameters[0] = new EventDelegate.Parameter(new GameObject[] { eventObject1, eventObject2 });
        openTheParticleSystem.parameters[1] = new EventDelegate.Parameter(true);
        openTheParticleSystem.parameters[2] = new EventDelegate.Parameter(0.5f);
        openTheParticleSystem.parameters[3] = new EventDelegate.Parameter(cameraLookAt);

        openTheParticleSystem.Execute();
    }
Beispiel #9
0
    private void Update()
    {
        float deltaTime = RealTime.deltaTime;

        if (deltaTime == 0f)
        {
            return;
        }
        if (this.mAnimator != null)
        {
            this.mAnimator.Update((this.mLastDirection != Direction.Reverse) ? deltaTime : (-deltaTime));
            if (this.isPlaying)
            {
                return;
            }
            this.mAnimator.enabled = false;
            base.enabled           = false;
        }
        else
        {
            if (!(this.mAnim != null))
            {
                base.enabled = false;
                return;
            }
            bool        flag       = false;
            IEnumerator enumerator = this.mAnim.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    object         obj            = enumerator.Current;
                    AnimationState animationState = (AnimationState)obj;
                    if (this.mAnim.IsPlaying(animationState.name))
                    {
                        float num = animationState.speed * deltaTime;
                        animationState.time += num;
                        if (num < 0f)
                        {
                            if (animationState.time > 0f)
                            {
                                flag = true;
                            }
                            else
                            {
                                animationState.time = 0f;
                            }
                        }
                        else if (animationState.time < animationState.length)
                        {
                            flag = true;
                        }
                        else
                        {
                            animationState.time = animationState.length;
                        }
                    }
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            this.mAnim.Sample();
            if (flag)
            {
                return;
            }
            base.enabled = false;
        }
        if (this.mNotify)
        {
            this.mNotify = false;
            if (ActiveAnimation.current == null)
            {
                ActiveAnimation.current = this;
                EventDelegate.Execute(this.onFinished);
                if (this.eventReceiver != null && !string.IsNullOrEmpty(this.callWhenFinished))
                {
                    this.eventReceiver.SendMessage(this.callWhenFinished, SendMessageOptions.DontRequireReceiver);
                }
                ActiveAnimation.current = null;
            }
            if (this.mDisableDirection != Direction.Toggle && this.mLastDirection == this.mDisableDirection)
            {
                NGUITools.SetActive(base.gameObject, false);
            }
        }
    }
 // 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);
             }
         }
     }
 }
        private IEnumerator LongClickCheck()
        {
            yield return(new WaitForSeconds(LongClickDelay));

            EventDelegate.Execute(onLongClickStart);
        }
        protected virtual void OnCustomLongPress(bool[] args)
        {
            if (!_started)
            {
                Start();
            }

            if (!isActivated && (LongPress || LongClick))
            {
                if (!args [0] && args [1])
                {
                    if (string.IsNullOrEmpty(_deactivatedWarningMessageOverride))
                    {
                        if (!string.IsNullOrEmpty(DefaultDeactivatedWarningMessage))
                        {
                            WarningHandler.Instance.Warning(DefaultDeactivatedWarningMessage);
                        }
                    }
                    else
                    {
                        WarningHandler.Instance.Warning(_deactivatedWarningMessageOverride);
                    }
                }
            }

            if (!isActivated)
            {
                return;
            }

            if (SupportDoubleClick && args[0])
            {
                if (_tooFastClick)
                {
                    return;
                }
            }

            if (LongClick)
            {
                OnLongClick(args[0]);
            }

            if (!LongPress)
            {
                return;
            }

            _callbackRegistered = false;

            StopTween();

            if (args[0])
            {
                _currentAnimationDuration = AnimationDuration;

                if (HasScaleAnimation)
                {
                    _tweenScale = DOTween.To(() => transform.localScale, x => transform.localScale = x, _hoveredScale, _currentAnimationDuration).SetAs(_tweenParams);
                }

                if (HasColorAnimation)
                {
                    for (byte i = 0; i < _defaultColor.Length; i++)
                    {
                        AnimateColors(i, _hoveredColor[i], _currentAnimationDuration, _tweenParams);
                    }
                }

                if (HasHighlightAnimation)
                {
                    _tweenHighlight = DOTween.To(() => HighlightSprite.alpha, x => HighlightSprite.alpha = x, 1f, _currentAnimationDuration).SetAs(_tweenParams);
                }

                if (_hasDownSound)
                {
                    MasterAudio.PlaySoundAndForget(_downSoundName);
                }
            }
            else
            {
                if (args[1])
                {
                    _currentAnimationDuration = AnimationDuration * 0.5f;

                    if (HasScaleAnimation)
                    {
                        _tweenScale = DOTween.To(() => transform.localScale, x => transform.localScale = x, _pressedScale, _currentAnimationDuration).SetAs(_callbackRegistered ? _tweenParams : _tweenParamsCallback);

                        if (!_callbackRegistered)
                        {
                            _callbackRegistered = true;
                        }
                    }

                    if (HasColorAnimation)
                    {
                        for (byte i = 0; i < _defaultColor.Length; i++)
                        {
                            AnimateColors(i, _pressedColor[i], _currentAnimationDuration, _callbackRegistered ? _tweenParams : _tweenParamsCallback);
                        }

                        if (!_callbackRegistered)
                        {
                            _callbackRegistered = true;
                        }
                    }

                    if (HasHighlightAnimation)
                    {
                        _tweenHighlight = DOTween.To(() => HighlightSprite.alpha, x => HighlightSprite.alpha = x, 1f, _currentAnimationDuration).SetAs(_callbackRegistered ? _tweenParams : _tweenParamsCallback);

                        if (!_callbackRegistered)
                        {
                            _callbackRegistered = true;
                        }
                    }

                    if (_hasClickSound)
                    {
                        MasterAudio.PlaySoundAndForget(_clickSoundName);
                    }

                    if ((UICamera.currentTouchID < 0 && UICamera.currentTouchID == -1) || UICamera.currentTouchID >= 0)
                    {
                        EventDelegate.Execute(onClick);
                    }
                    else if (UICamera.currentTouchID == -2)
                    {
                        EventDelegate.Execute(onLeftClick);
                    }
                }
                else
                {
                    _currentAnimationDuration = AnimationDuration;

                    if (HasScaleAnimation)
                    {
                        _tweenScale = DOTween.To(() => transform.localScale, x => transform.localScale = x, _defaultScale, _currentAnimationDuration).SetAs(_tweenParams);
                    }

                    if (HasColorAnimation)
                    {
                        for (byte i = 0; i < _defaultColor.Length; i++)
                        {
                            AnimateColors(i, _defaultColor[i], _currentAnimationDuration, _tweenParams);
                        }
                    }

                    if (HasHighlightAnimation)
                    {
                        _tweenHighlight = DOTween.To(() => HighlightSprite.alpha, x => HighlightSprite.alpha = x, 0f, _currentAnimationDuration).SetAs(_tweenParams);
                    }

                    if (_hasUpSound)
                    {
                        MasterAudio.PlaySoundAndForget(_upSoundName);
                    }
                }
            }

            _callbackRegistered = false;
        }
        protected virtual void OnClick()
        {
            if (!_started)
            {
                Start();
            }

            if (!isActivated)
            {
                if (string.IsNullOrEmpty(_deactivatedWarningMessageOverride))
                {
                    if (!string.IsNullOrEmpty(DefaultDeactivatedWarningMessage))
                    {
                        WarningHandler.Instance.Warning(DefaultDeactivatedWarningMessage);
                        if (_hasClickSound)
                        {
                            MasterAudio.PlaySoundAndForget(_clickSoundName);
                        }
                    }
                }
                else
                {
                    WarningHandler.Instance.Warning(_deactivatedWarningMessageOverride);
                    if (_hasClickSound)
                    {
                        MasterAudio.PlaySoundAndForget(_clickSoundName);
                    }
                }
            }

            if (!isActivated)
            {
                return;
            }

            if (LongPress)
            {
                return;
            }

            if (SupportDoubleClick)
            {
                if (_tooFastClick)
                {
                    StopCoroutine("RunDoubleClickWindow");
                    _tooFastClick       = false;
                    _alreadySentMessage = false;
                    OnDoubleClickInternal();
                    return;
                }
                else
                {
                    StartCoroutine("RunDoubleClickWindow");
                }
            }

            if (Toggle)
            {
                if (_isToggled)
                {
                    OnToggleOff();
                    return;
                }

                _isToggled = true;
            }

            StopTween();

            _callbackRegistered       = false;
            _currentAnimationDuration = AnimationDuration;


            if (HasScaleAnimation)
            {
                _tweenScale = DOTween.To(() => transform.localScale, x => transform.localScale = x, _pressedScale, _currentAnimationDuration).SetAs(_callbackRegistered ? _tweenParams : _tweenParamsCallback);

                if (!Toggle && !_callbackRegistered)
                {
                    _callbackRegistered = true;
                }
            }

            if (HasColorAnimation)
            {
                for (byte i = 0; i < _defaultColor.Length; i++)
                {
                    AnimateColors(i, _pressedColor[i], _currentAnimationDuration, _callbackRegistered ? _tweenParams : _tweenParamsCallback);

                    if (!Toggle && !_callbackRegistered)
                    {
                        _callbackRegistered = true;
                    }
                }
            }

            if (HasHighlightAnimation)
            {
                _tweenHighlight = DOTween.To(() => HighlightSprite.alpha, x => HighlightSprite.alpha = x, 1f, _currentAnimationDuration).SetAs(_callbackRegistered ? _tweenParams : _tweenParamsCallback);

                if (!Toggle && !_callbackRegistered)
                {
                    _callbackRegistered = true;
                }
            }

            if (_hasClickSound)
            {
                MasterAudio.PlaySoundAndForget(_clickSoundName);
            }

            if ((UICamera.currentTouchID < 0 && UICamera.currentTouchID == -1) || UICamera.currentTouchID >= 0)
            {
                EventDelegate.Execute(onClick);
            }
            else if (UICamera.currentTouchID == -2)
            {
                EventDelegate.Execute(onLeftClick);
            }

            _callbackRegistered = false;
        }
Beispiel #14
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)
        {
            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;

                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)
                        {
                            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 = null;
            }
        }
        else
        {
            Sample(mFactor, false);
        }
    }
Beispiel #15
0
    private void Update()
    {
        if (mActive)
        {
            if (mReset)
            {
                mCurrentOffset = 0;
                mReset         = false;
                mLabel         = GetComponent <UILabel>();
                mFullText      = mLabel.processedText;
                mFade.Clear();
                if (keepFullDimensions && scrollView != null)
                {
                    scrollView.UpdatePosition();
                }
            }
            while (mCurrentOffset < mFullText.Length && mNextChar <= RealTime.time)
            {
                int num = mCurrentOffset;
                charsPerSecond = Mathf.Max(1, charsPerSecond);
                while (NGUIText.ParseSymbol(mFullText, ref mCurrentOffset))
                {
                }
                mCurrentOffset++;
                if (mCurrentOffset >= mFullText.Length)
                {
                    break;
                }
                float num2 = 1f / (float)charsPerSecond;
                char  c    = (num >= mFullText.Length) ? '\n' : mFullText[num];
                if (c == '\n')
                {
                    num2 += delayOnNewLine;
                }
                else if (num + 1 == mFullText.Length || mFullText[num + 1] <= ' ')
                {
                    switch (c)
                    {
                    case '.':
                        if (num + 2 < mFullText.Length && mFullText[num + 1] == '.' && mFullText[num + 2] == '.')
                        {
                            num2 += delayOnPeriod * 3f;
                            num  += 2;
                        }
                        else
                        {
                            num2 += delayOnPeriod;
                        }
                        break;

                    case '!':
                    case '?':
                        num2 += delayOnPeriod;
                        break;
                    }
                }
                if (mNextChar == 0f)
                {
                    mNextChar = RealTime.time + num2;
                }
                else
                {
                    mNextChar += num2;
                }
                if (fadeInTime != 0f)
                {
                    FadeEntry item = default(FadeEntry);
                    item.index = num;
                    item.alpha = 0f;
                    item.text  = mFullText.Substring(num, mCurrentOffset - num);
                    mFade.Add(item);
                }
                else
                {
                    mLabel.text = ((!keepFullDimensions) ? mFullText.Substring(0, mCurrentOffset) : (mFullText.Substring(0, mCurrentOffset) + "[00]" + mFullText.Substring(mCurrentOffset)));
                    if (!keepFullDimensions && scrollView != null)
                    {
                        scrollView.UpdatePosition();
                    }
                }
            }
            if (mFade.size != 0)
            {
                int num3 = 0;
                while (num3 < mFade.size)
                {
                    FadeEntry value = mFade[num3];
                    value.alpha += RealTime.deltaTime / fadeInTime;
                    if (value.alpha < 1f)
                    {
                        mFade[num3] = value;
                        num3++;
                    }
                    else
                    {
                        mFade.RemoveAt(num3);
                    }
                }
                if (mFade.size == 0)
                {
                    if (keepFullDimensions)
                    {
                        mLabel.text = mFullText.Substring(0, mCurrentOffset) + "[00]" + mFullText.Substring(mCurrentOffset);
                    }
                    else
                    {
                        mLabel.text = mFullText.Substring(0, mCurrentOffset);
                    }
                }
                else
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    for (int i = 0; i < mFade.size; i++)
                    {
                        FadeEntry fadeEntry = mFade[i];
                        if (i == 0)
                        {
                            stringBuilder.Append(mFullText.Substring(0, fadeEntry.index));
                        }
                        stringBuilder.Append('[');
                        stringBuilder.Append(NGUIText.EncodeAlpha(fadeEntry.alpha));
                        stringBuilder.Append(']');
                        stringBuilder.Append(fadeEntry.text);
                    }
                    if (keepFullDimensions)
                    {
                        stringBuilder.Append("[00]");
                        stringBuilder.Append(mFullText.Substring(mCurrentOffset));
                    }
                    mLabel.text = stringBuilder.ToString();
                }
            }
            else if (mCurrentOffset == mFullText.Length)
            {
                current = this;
                EventDelegate.Execute(onFinished);
                current = null;
                mActive = false;
            }
        }
    }
Beispiel #16
0
    /// <summary>
    /// 商人救え出す
    /// </summary>
    public void EventShopOneOne()
    {
        EventDelegate unlockPlayer = new EventDelegate(this, "MakePlayerFree");

        EventDelegate talkEvent9 = new EventDelegate(this, "Talk");
        talkEvent9.parameters[0] = new EventDelegate.Parameter(9);
        talkEvent9.parameters[1] = new EventDelegate.Parameter(unlockPlayer);

        EventDelegate helpShopping = new EventDelegate(this, "EventHelpShopping");
        helpShopping.parameters[0] = new EventDelegate.Parameter(talkEvent9);

        EventDelegate talkEvent8 = new EventDelegate(this, "Talk");
        talkEvent8.parameters[0] = new EventDelegate.Parameter(8);
        talkEvent8.parameters[1] = new EventDelegate.Parameter(helpShopping);

        EventDelegate moveToShangRen = new EventDelegate(this, "MoveTo");
        moveToShangRen.parameters[0] = new EventDelegate.Parameter(player.transform);
        moveToShangRen.parameters[1] = new EventDelegate.Parameter(PositionTarget[1].position);
        moveToShangRen.parameters[2] = new EventDelegate.Parameter(0f);
        moveToShangRen.parameters[3] = new EventDelegate.Parameter(talkEvent8);

        EventDelegate talkEvent7 = new EventDelegate(this, "Talk");
        talkEvent7.parameters[0] = new EventDelegate.Parameter(7);
        talkEvent7.parameters[1] = new EventDelegate.Parameter(moveToShangRen);

        EventDelegate cameraLookAt = new EventDelegate(this, "CameraLookAt");
        cameraLookAt.parameters[0] = new EventDelegate.Parameter(PositionTarget[0].transform);
        cameraLookAt.parameters[1] = new EventDelegate.Parameter(2f);
        cameraLookAt.parameters[2] = new EventDelegate.Parameter(talkEvent7);

        cameraLookAt.Execute();
        GameController._instance.doneEvent(2);
    }
Beispiel #17
0
    /// <summary>
    /// Fade out or fade in the active sprite and notify the OnChange event listener.
    /// </summary>

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

                    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)
                {
                    activeSprite.alpha = mIsActive ? 1f : 0f;
                }
                else
                {
                    TweenAlpha.Begin(activeSprite.gameObject, 0.15f, mIsActive ? 1f : 0f);
                }
            }

            if (current == null)
            {
                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 = null;
            }

            // Play the checkmark animation
            if (activeAnimation != null)
            {
                ActiveAnimation aa = ActiveAnimation.Play(activeAnimation, state ? Direction.Forward : Direction.Reverse);
                if (instantTween)
                {
                    aa.Finish();
                }
            }
        }
    }
Beispiel #18
0
    IEnumerator webProcess(WWW www, EventDelegate eventd)
    {
        float timeSum = 0f;
        while(!www.isDone &&
              string.IsNullOrEmpty(www.error) &&
              timeSum < 10f) {
            timeSum += Time.deltaTime;
            yield return 0;
        }

        if(www.error == null && www.isDone)
        {
            Debug.Log(www.text);
        //			LobbyGiftCommander.mGift = Newtonsoft.Json.JsonConvert.DeserializeObject<LobbyGiftCommander.GiftListResponse>(www.text);
        }

        eventd.Execute();
    }
Beispiel #19
0
    // Show / Hide fade animation coroutine
    private IEnumerator FadeAnimation(FadeMethods method, float FadeDuration)
    {
        if (this.panel == null)
        {
            yield break;
        }

        // Check if we are trying to fade in and the window is already shown
        if (method == FadeMethods.In && this.panel.alpha == 1f)
        {
            yield break;
        }
        else if (method == FadeMethods.Out && this.panel.alpha == 0f)
        {
            yield break;
        }

        // Define that animation is in progress
        this.animationCurrentMethod = method;

        // Get the timestamp
        float startTime = Time.time;

        // Determine Fade in or Fade out
        if (method == FadeMethods.In)
        {
            // Calculate the time we need to fade in from the current alpha
            float internalDuration = (FadeDuration - (FadeDuration * this.panel.alpha));

            // Update the start time
            startTime -= (FadeDuration - internalDuration);

            // Fade In
            while (Time.time < (startTime + internalDuration))
            {
                float RemainingTime = (startTime + FadeDuration) - Time.time;
                float ElapsedTime   = FadeDuration - RemainingTime;

                // Update the alpha by the percentage of the time elapsed
                this.panel.alpha = (ElapsedTime / FadeDuration);

                yield return(0);
            }

            // Make sure it's 1
            this.panel.alpha = 1f;

            // Invoke them events
            current = this;
            EventDelegate.Execute(this.onShowComplete);
            current = null;
        }
        else if (method == FadeMethods.Out)
        {
            // Calculate the time we need to fade in from the current alpha
            float internalDuration = (FadeDuration * this.panel.alpha);

            // Update the start time
            startTime -= (FadeDuration - internalDuration);

            // Fade Out
            while (Time.time < (startTime + internalDuration))
            {
                float RemainingTime = (startTime + FadeDuration) - Time.time;

                // Update the alpha by the percentage of the remaing time
                this.panel.alpha = (RemainingTime / FadeDuration);

                yield return(0);
            }

            // Make sure it's 0
            this.panel.alpha = 0f;

            // Invoke them events
            current = this;
            EventDelegate.Execute(this.onHideComplete);
            current = null;

            this.contentHolder.gameObject.SetActive(false);
        }

        // No longer animating
        this.animationCurrentMethod = FadeMethods.None;
    }
Beispiel #20
0
 /// <summary>
 /// Executes the on assign event listener.
 /// </summary>
 protected virtual void ExecuteOnAssign()
 {
     current = this;
     EventDelegate.Execute(this.onAssign);
     current = null;
 }
Beispiel #21
0
    protected void DoUpdate()
    {
        float delta = ignoreTimeScale && !useFixedUpdate ? Time.unscaledDeltaTime : Time.deltaTime;
        float time  = ignoreTimeScale && !useFixedUpdate ? Time.unscaledTime : Time.time;

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

        if (time < mStartTime)
        {
            return;
        }
        if (OnStarted != null)
        {
            EventDelegate.Execute(OnStarted);
            OnStarted.Clear();
        }

        // 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;
                if (PingPangOneStop != null)
                {
                    PingPangOneStop(tp);
                }
            }
            else if (mFactor < 0f)
            {
                mFactor         = -mFactor;
                mFactor        -= Mathf.Floor(mFactor);
                mAmountPerDelta = -mAmountPerDelta;
                if (PingPangTwoStop != null)
                {
                    PingPangTwoStop(tp);
                    if (PingPangCoutSet != null)
                    {
                        PingPangCoutSet(data, cout, tp);
                    }
                }
            }
        }

        // 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);
        }
    }
Beispiel #22
0
 void LongPressedFunc()
 {
     EventDelegate.Execute(onClick);
 }
Beispiel #23
0
 private void Set(bool state)
 {
     if (!this.mStarted)
     {
         this.mIsActive    = state;
         this.startsActive = state;
         if (this.activeSprite != null)
         {
             this.activeSprite.alpha = ((!state) ? 0f : 1f);
         }
     }
     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[i];
                 if (uIToggle != this && uIToggle.group == this.group)
                 {
                     uIToggle.Set(false);
                 }
                 if (UIToggle.list.size != size)
                 {
                     size = UIToggle.list.size;
                     i    = 0;
                 }
                 else
                 {
                     i++;
                 }
             }
         }
         this.mIsActive = state;
         if (this.activeSprite != null)
         {
             if (this.instantTween)
             {
                 this.activeSprite.alpha = ((!this.mIsActive) ? 0f : 1f);
             }
             else
             {
                 TweenAlpha.Begin(this.activeSprite.gameObject, 0.15f, (!this.mIsActive) ? 0f : 1f);
             }
         }
         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 = null;
         if (this.activeAnimation != null)
         {
             ActiveAnimation.Play(this.activeAnimation, (!state) ? Direction.Reverse : Direction.Forward);
         }
     }
 }
Beispiel #24
0
    IEnumerator StartUI(SystemID varSystemID)
    {
        yield return(null);

        yield return(null);

        switch (varSystemID)
        {
        case SystemID.WaiGuan_WaiGuan:
            mToggle_Mount.value = true;
            if (EventDelegate.IsValid(mToggle_Mount.onChange))
            {
                EventDelegate.Execute(mToggle_Mount.onChange);
            }
            break;

        case SystemID.WaiGuan_WaiGuan_Mount:
        case SystemID.WaiGuan_WaiGuan_Mount_Mount:
            mToggle_Mount.value = true;
            if (EventDelegate.IsValid(mToggle_Mount.onChange))
            {
                EventDelegate.Execute(mToggle_Mount.onChange);
            }
            break;

        case SystemID.WaiGuan_Pet:
            mToggle_Pet.value = true;
            if (EventDelegate.IsValid(mToggle_Pet.onChange))
            {
                EventDelegate.Execute(mToggle_Pet.onChange);
            }
            break;

        case SystemID.WaiGuan_Wing:
            mToggle_Wing.value = true;
            if (EventDelegate.IsValid(mToggle_Wing.onChange))
            {
                EventDelegate.Execute(mToggle_Wing.onChange);
            }
            break;

        case SystemID.WaiGuan_ChengHao:
            mScrollBar_Toggle_WaiGuan.value = 1f;
            mToggle_Title.value             = true;
            break;

        case SystemID.WaiGuan_FaBao:          //外观-法宝
        case SystemID.WaiGuan_FaBao_JiHuo:    //外观-法宝
        case SystemID.WaiGuan_FaBao_JiHuo1:   //外观-法宝1
        case SystemID.WaiGuan_FaBao_JiHuo2:   //外观-法宝2
        case SystemID.WaiGuan_FaBao_JiHuo3:   //外观-法宝3
        case SystemID.WaiGuan_FaBao_CuiLian:  //外观-法器-淬炼
        case SystemID.WaiGuan_FaBao_CuiLian1: //外观-法宝1-淬炼
        case SystemID.WaiGuan_FaBao_CuiLian2: //外观-法宝2-淬炼
        case SystemID.WaiGuan_FaBao_CuiLian3: //外观-法宝3-淬炼
        case SystemID.WaiGuan_FaBao_ZhuLing:  //外观-法器-注灵
        case SystemID.WaiGuan_FaBao_ZhuLing1: //外观-法器-注灵
        case SystemID.WaiGuan_FaBao_ZhuLing2: //外观-法器-注灵
        case SystemID.WaiGuan_FaBao_ZhuLing3: //外观-法器-注灵
            mToggle_FaQi.value = true;
            mScrollBar_Toggle_WaiGuan.value = 0.35f;
            if (varSystemID == SystemID.WaiGuan_FaBao_JiHuo ||
                varSystemID == SystemID.WaiGuan_FaBao_JiHuo1 ||
                varSystemID == SystemID.WaiGuan_FaBao_JiHuo2 ||
                varSystemID == SystemID.WaiGuan_FaBao_JiHuo3 ||
                varSystemID == SystemID.WaiGuan_FaBao_CuiLian ||
                varSystemID == SystemID.WaiGuan_FaBao_CuiLian1 ||
                varSystemID == SystemID.WaiGuan_FaBao_CuiLian2 ||
                varSystemID == SystemID.WaiGuan_FaBao_CuiLian3 ||
                varSystemID == SystemID.WaiGuan_FaBao_ZhuLing ||
                varSystemID == SystemID.WaiGuan_FaBao_ZhuLing1 ||
                varSystemID == SystemID.WaiGuan_FaBao_ZhuLing2 ||
                varSystemID == SystemID.WaiGuan_FaBao_ZhuLing3)
            {
                Ui_FaoBao tempUi_FaoBao = UI_FaBao.GetComponent <Ui_FaoBao>();
                if (tempUi_FaoBao != null)
                {
                    tempUi_FaoBao.SetToggle(varSystemID);
                }
            }
            break;

        case SystemID.WaiGuan_WaiGuan_LingQi:
        case SystemID.WaiGuan_WaiGuan_LingQi_LingQi:
            mToggle_LingQi.value            = true;
            mScrollBar_Toggle_WaiGuan.value = 0.68f;
            break;

        case SystemID.WaiGuan_WaiGuan_ZuJi:
            mToggle_ZuJi.value = true;
            break;

        case SystemID.WaiGuan_HuanHua:
            mToggle_Clothes.value = true;
            if (EventDelegate.IsValid(mToggle_Clothes.onChange))
            {
                EventDelegate.Execute(mToggle_Clothes.onChange);
            }
            break;

        case SystemID.WaiGuan_HuanHua_ShiZhuang:
            mToggle_Clothes.value = true;
            if (EventDelegate.IsValid(mToggle_Clothes.onChange))
            {
                EventDelegate.Execute(mToggle_Clothes.onChange);
            }
            break;

        case SystemID.WaiGuan_HuanHua_Equip:
            mToggle_Wuqi_HuanHua.value = true;
            break;

        case SystemID.WaiGuan_HuanHua_Mount:
            mToggle_Mount_HuanHua.value = true;
            break;

        case SystemID.WaiGuan_HuanHua_LingQi:
            mToggle_LingQi_HuanHua.value = true;
            break;

        case SystemID.WaiGuan_HuanHua_ZuJi:
            mToggle_ZuJi_HuanHua.value = true;
            break;

        case SystemID.WaiGuan_HuanHua_Wings:
            mToggle_Wing_HuanHua.value = true;
            break;
        }
        if (IsFrist)
        {
            mToggle_Mount.optionCanBeNone          = false;
            mToggle_Pet.optionCanBeNone            = false;
            mToggle_Wing.optionCanBeNone           = false;
            mToggle_Title.optionCanBeNone          = false;
            mToggle_FaQi.optionCanBeNone           = false;
            mToggle_LingQi.optionCanBeNone         = false;
            mToggle_ZuJi.optionCanBeNone           = false;
            mToggle_Clothes.optionCanBeNone        = false;
            mToggle_Wuqi_HuanHua.optionCanBeNone   = false;
            mToggle_Mount_HuanHua.optionCanBeNone  = false;
            mToggle_ZuJi_HuanHua.optionCanBeNone   = false;
            mToggle_Wing_HuanHua.optionCanBeNone   = false;
            mToggle_LingQi_HuanHua.optionCanBeNone = false;
            mToggle_WaiGuan.optionCanBeNone        = false;
            mToggle_HuanHua.optionCanBeNone        = false;

            mToggle_Mount.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_Mount.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_Pet.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_Pet.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_Wing.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_Wing.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_Title.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_Title.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_FaQi.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_FaQi.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_LingQi.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_LingQi.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_ZuJi.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_ZuJi.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_Clothes.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_Clothes.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_Wuqi_HuanHua.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_Wuqi_HuanHua.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_Mount_HuanHua.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_Mount_HuanHua.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_LingQi_HuanHua.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_LingQi_HuanHua.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_ZuJi_HuanHua.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_ZuJi_HuanHua.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_Wing_HuanHua.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_Wing_HuanHua.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_WaiGuan.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_WaiGuan.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));
            mToggle_HuanHua.onChange.Add(new EventDelegate(() =>
            {
                if (mToggle_HuanHua.value)
                {
                    AudioManager.GetSingleton().PlayAudio(AudioPath.ClickItem);
                }
            }));

            IsFrist = false;

            ShowGuide();
        }
    }
Beispiel #25
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);
        }
    }
    /// <summary>
    /// Notify the target when the animation finishes playing.
    /// </summary>

    void Update()
    {
        float delta = RealTime.deltaTime;

        if (delta == 0f)
        {
            return;
        }

#if !UNITY_3_5
        if (mAnimator != null)
        {
            mAnimator.Update((mLastDirection == Direction.Reverse) ? -delta : delta);
            if (isPlaying)
            {
                return;
            }
            mAnimator.enabled = false;
            enabled           = false;
        }
        else if (mAnim != null)
#else
        if (mAnim != null)
#endif
        {
            bool playing = false;

            foreach (AnimationState state in mAnim)
            {
                if (!mAnim.IsPlaying(state.name))
                {
                    continue;
                }
                float movement = state.speed * delta;
                state.time += movement;

                if (movement < 0f)
                {
                    if (state.time > 0f)
                    {
                        playing = true;
                    }
                    else
                    {
                        state.time = 0f;
                    }
                }
                else
                {
                    if (state.time < state.length)
                    {
                        playing = true;
                    }
                    else
                    {
                        state.time = state.length;
                    }
                }
            }

            mAnim.Sample();
            if (playing)
            {
                return;
            }
            enabled = false;
        }
        else
        {
            enabled = false;
            return;
        }

        if (mNotify)
        {
            mNotify = false;

            current = this;
            EventDelegate.Execute(onFinished);

            // Deprecated functionality, kept for backwards compatibility
            if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished))
            {
                eventReceiver.SendMessage(callWhenFinished, SendMessageOptions.DontRequireReceiver);
            }

            current = null;

            if (mDisableDirection != Direction.Toggle && mLastDirection == mDisableDirection)
            {
                NGUITools.SetActive(gameObject, false);
            }
        }
    }
Beispiel #27
0
 void OnHide()
 {
     current = this;
     EventDelegate.Execute(onHide);
     EventDelegate.Remove(contextMenu.onSelection, OnMenuSelection);         // <-- In case the menu was hidden with no selection made
 }
Beispiel #28
0
    /// <summary>
    /// Update the visible slider.
    /// </summary>

    void Set(float input, bool force)
    {
        if (!mInitDone)
        {
            Init();
        }

        // Clamp the input
        float val = Mathf.Clamp01(input);

        if (val < 0.001f)
        {
            val = 0f;
        }

        float prevStep = value;

        // Save the raw value
        rawValue = val;

#if UNITY_EDITOR
        if (!Application.isPlaying)
        {
            return;
        }
#endif
        // Take steps into account
        float stepValue = value;

        // If the stepped value doesn't match the last one, it's time to update
        if (force || prevStep != stepValue)
        {
            Vector3 scale = mSize;

            if (direction == Direction.Horizontal)
            {
                scale.x *= stepValue;
            }
            else
            {
                scale.y *= stepValue;
            }

            if (mFGFilled != null && mFGFilled.type == UISprite.Type.Filled)
            {
                mFGFilled.fillAmount = stepValue;
            }
            else if (mFGWidget != null)
            {
                if (stepValue > 0.001f)
                {
                    mFGWidget.width   = Mathf.RoundToInt(scale.x);
                    mFGWidget.height  = Mathf.RoundToInt(scale.y);
                    mFGWidget.enabled = true;
                }
                else
                {
                    mFGWidget.enabled = false;
                }
            }
            else if (foreground != null)
            {
                mFGTrans.localScale = scale;
            }

            if (thumb != null)
            {
                Vector3 pos = thumb.localPosition;

                if (mFGFilled != null && mFGFilled.type == UISprite.Type.Filled)
                {
                    if (mFGFilled.fillDirection == UISprite.FillDirection.Horizontal)
                    {
                        pos.x = mFGFilled.invert ? mSize.x - scale.x : scale.x;
                    }
                    else if (mFGFilled.fillDirection == UISprite.FillDirection.Vertical)
                    {
                        pos.y = mFGFilled.invert ? mSize.y - scale.y : scale.y;
                    }
                    else
                    {
                        Debug.LogWarning("Slider thumb is only supported with Horizontal or Vertical fill direction", this);
                    }
                }
                else if (direction == Direction.Horizontal)
                {
                    pos.x = scale.x;
                }
                else
                {
                    pos.y = scale.y;
                }
                thumb.localPosition = pos;
            }

            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, stepValue, SendMessageOptions.DontRequireReceiver);
            }
            current = null;
        }
    }
Beispiel #29
0
 private void Update()
 {
     if (!this.mActive)
     {
         return;
     }
     if (this.mReset)
     {
         this.mCurrentOffset = 0;
         this.mReset         = false;
         this.mLabel         = base.GetComponent <UILabel>();
         this.mFullText      = this.mLabel.processedText;
         this.mFade.Clear();
         if (this.keepFullDimensions && this.scrollView != null)
         {
             this.scrollView.UpdatePosition();
         }
     }
     while (this.mCurrentOffset < this.mFullText.Length && this.mNextChar <= RealTime.time)
     {
         int num = this.mCurrentOffset;
         this.charsPerSecond = Mathf.Max(1, this.charsPerSecond);
         while (NGUIText.ParseSymbol(this.mFullText, ref this.mCurrentOffset))
         {
         }
         this.mCurrentOffset++;
         if (this.mCurrentOffset > this.mFullText.Length)
         {
             break;
         }
         float num2 = 1f / (float)this.charsPerSecond;
         char  c    = (num >= this.mFullText.Length) ? '\n' : this.mFullText[num];
         if (c == '\n')
         {
             num2 += this.delayOnNewLine;
         }
         else if (num + 1 == this.mFullText.Length || this.mFullText[num + 1] <= ' ')
         {
             if (c == '.')
             {
                 if (num + 2 < this.mFullText.Length && this.mFullText[num + 1] == '.' && this.mFullText[num + 2] == '.')
                 {
                     num2 += this.delayOnPeriod * 3f;
                     num  += 2;
                 }
                 else
                 {
                     num2 += this.delayOnPeriod;
                 }
             }
             else if (c == '!' || c == '?')
             {
                 num2 += this.delayOnPeriod;
             }
         }
         if (this.mNextChar == 0f)
         {
             this.mNextChar = RealTime.time + num2;
         }
         else
         {
             this.mNextChar += num2;
         }
         if (this.fadeInTime != 0f)
         {
             TypewriterEffect.FadeEntry item = default(TypewriterEffect.FadeEntry);
             item.index = num;
             item.alpha = 0f;
             item.text  = this.mFullText.Substring(num, this.mCurrentOffset - num);
             this.mFade.Add(item);
         }
         else
         {
             this.mLabel.text = ((!this.keepFullDimensions) ? this.mFullText.Substring(0, this.mCurrentOffset) : (this.mFullText.Substring(0, this.mCurrentOffset) + "[00]" + this.mFullText.Substring(this.mCurrentOffset)));
             if (!this.keepFullDimensions && this.scrollView != null)
             {
                 this.scrollView.UpdatePosition();
             }
         }
     }
     if (this.mFade.size != 0)
     {
         int i = 0;
         while (i < this.mFade.size)
         {
             TypewriterEffect.FadeEntry value = this.mFade[i];
             value.alpha += RealTime.deltaTime / this.fadeInTime;
             if (value.alpha < 1f)
             {
                 this.mFade[i] = value;
                 i++;
             }
             else
             {
                 this.mFade.RemoveAt(i);
             }
         }
         if (this.mFade.size == 0)
         {
             if (this.keepFullDimensions)
             {
                 this.mLabel.text = this.mFullText.Substring(0, this.mCurrentOffset) + "[00]" + this.mFullText.Substring(this.mCurrentOffset);
             }
             else
             {
                 this.mLabel.text = this.mFullText.Substring(0, this.mCurrentOffset);
             }
         }
         else
         {
             StringBuilder stringBuilder = new StringBuilder();
             for (int j = 0; j < this.mFade.size; j++)
             {
                 TypewriterEffect.FadeEntry fadeEntry = this.mFade[j];
                 if (j == 0)
                 {
                     stringBuilder.Append(this.mFullText.Substring(0, fadeEntry.index));
                 }
                 stringBuilder.Append('[');
                 stringBuilder.Append(NGUIText.EncodeAlpha(fadeEntry.alpha));
                 stringBuilder.Append(']');
                 stringBuilder.Append(fadeEntry.text);
             }
             if (this.keepFullDimensions)
             {
                 stringBuilder.Append("[00]");
                 stringBuilder.Append(this.mFullText.Substring(this.mCurrentOffset));
             }
             this.mLabel.text = stringBuilder.ToString();
         }
     }
     else if (this.mCurrentOffset == this.mFullText.Length)
     {
         TypewriterEffect.current = this;
         EventDelegate.Execute(this.onFinished);
         TypewriterEffect.current = null;
         this.mActive             = false;
     }
 }
Beispiel #30
0
    public bool AddSelectItem(string id)
    {
        bool isOver = true;

        if (selectType == SelectType.ItemUp)
        {
            isOver = false;
            if (selectNum >= 6)
            {
                return(false);
            }
        }
        else if (selectType == SelectType.ItemUpChange)
        {
            Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                icon.SetSelect(false);
            }
            selectList.Clear();
        }
        else if (selectType == SelectType.ItemMake)
        {
            Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                icon.SetSelect(false);
            }
            selectList.Clear();
        }
        else if (selectType == SelectType.GemOn)
        {
            Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                icon.SetSelect(false);
            }
            selectList.Clear();
        }
        else if (selectType == SelectType.GemMerge)
        {
            Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                icon.SetSelect(false);
            }
            selectList.Clear();
        }
        else if (selectType == SelectType.GemReplace)
        {
            Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                icon.SetSelect(false);
            }
            selectList.Clear();
        }
        else if (selectType == SelectType.ItemSell)
        {
            isOver = false;
        }
        else if (selectType == SelectType.EquipSelect)
        {
            if (selectNum >= 1)
            {
                return(false);
            }
        }

        if (selectList.ContainsKey(id))
        {
            selectList[id]++;
        }
        else
        {
            selectList.Add(id, 1);
        }
        ++selectNum;

        if (isOver)
        {
            gameObject.SetActive(false);
            if (btn_OK.onClick.Count > 0)
            {
                EventDelegate.Execute(btn_OK.onClick);
                btn_OK.onClick.Clear();
            }
        }

        return(true);
    }
    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);
            }
        }
    }
Beispiel #32
0
    /// <summary>
    /// 崩れている場所、片付け
    /// </summary>
    public void EventLastFloorTwoOne()
    {
        EventDelegate unlockPlayer = new EventDelegate(this, "MakePlayerFree");

        EventDelegate talkEvent13 = new EventDelegate(this, "Talk");
        talkEvent13.parameters[0] = new EventDelegate.Parameter(13);
        talkEvent13.parameters[1] = new EventDelegate.Parameter(unlockPlayer);

        EventDelegate moveRocks = new EventDelegate(this, "EventMoveRocks");
        moveRocks.parameters[0] = new EventDelegate.Parameter(talkEvent13);

        EventDelegate talkEvent12 = new EventDelegate(this, "Talk");
        talkEvent12.parameters[0] = new EventDelegate.Parameter(12);
        talkEvent12.parameters[1] = new EventDelegate.Parameter(moveRocks);

        EventDelegate moveToRocks = new EventDelegate(this, "MoveTo");
        moveToRocks.parameters[0] = new EventDelegate.Parameter(player.transform);
        moveToRocks.parameters[1] = new EventDelegate.Parameter(PositionTarget[2].position);
        moveToRocks.parameters[2] = new EventDelegate.Parameter(0f);
        moveToRocks.parameters[3] = new EventDelegate.Parameter(talkEvent12);

        EventDelegate talkEvent11 = new EventDelegate(this, "Talk");
        talkEvent11.parameters[0] = new EventDelegate.Parameter(11);
        talkEvent11.parameters[1] = new EventDelegate.Parameter(moveToRocks);

        EventDelegate cameraLookAt = new EventDelegate(this, "CameraLookAt");
        cameraLookAt.parameters[0] = new EventDelegate.Parameter(PositionTarget[1].transform);
        cameraLookAt.parameters[1] = new EventDelegate.Parameter(2f);
        cameraLookAt.parameters[2] = new EventDelegate.Parameter(talkEvent11);

        cameraLookAt.Execute();
        GameController._instance.doneEvent(3);
    }
    void Update()
    {
        if (!mActive)
        {
            return;
        }

        if (mReset)
        {
            mCurrentOffset = 0;
            mReset         = false;
            mLabel         = GetComponent <UILabel>();
            mFullText      = mLabel.processedText;
            mFade.Clear();

            if (keepFullDimensions && scrollView != null)
            {
                scrollView.UpdatePosition();
            }
        }

        while (mCurrentOffset < mFullText.Length && mNextChar <= RealTime.time)
        {
            int lastOffset = mCurrentOffset;
            charsPerSecond = Mathf.Max(1, charsPerSecond);

            // Automatically skip all symbols
            while (NGUIText.ParseSymbol(mFullText, ref mCurrentOffset))
            {
            }
            ++mCurrentOffset;

            // Reached the end? We're done.
            if (mCurrentOffset >= mFullText.Length)
            {
                break;
            }

            // Periods and end-of-line characters should pause for a longer time.
            float delay = 1f / charsPerSecond;
            char  c     = (lastOffset < mFullText.Length) ? mFullText[lastOffset] : '\n';

            if (c == '\n')
            {
                delay += delayOnNewLine;
            }
            else if (lastOffset + 1 == mFullText.Length || mFullText[lastOffset + 1] <= ' ')
            {
                if (c == '.')
                {
                    if (lastOffset + 2 < mFullText.Length && mFullText[lastOffset + 1] == '.' && mFullText[lastOffset + 2] == '.')
                    {
                        delay      += delayOnPeriod * 3f;
                        lastOffset += 2;
                    }
                    else
                    {
                        delay += delayOnPeriod;
                    }
                }
                else if (c == '!' || c == '?')
                {
                    delay += delayOnPeriod;
                }
            }

            if (mNextChar == 0f)
            {
                mNextChar = RealTime.time + delay;
            }
            else
            {
                mNextChar += delay;
            }

            if (fadeInTime != 0f)
            {
                // There is smooth fading involved
                FadeEntry fe = new FadeEntry();
                fe.index = lastOffset;
                fe.alpha = 0f;
                fe.text  = mFullText.Substring(lastOffset, mCurrentOffset - lastOffset);
                mFade.Add(fe);
            }
            else
            {
                // No smooth fading necessary
                mLabel.text = keepFullDimensions ?
                              mFullText.Substring(0, mCurrentOffset) + "[00]" + mFullText.Substring(mCurrentOffset) :
                              mFullText.Substring(0, mCurrentOffset);

                // If a scroll view was specified, update its position
                if (!keepFullDimensions && scrollView != null)
                {
                    scrollView.UpdatePosition();
                }
            }
        }

        // Alpha-based fading
        if (mFade.size != 0)
        {
            for (int i = 0; i < mFade.size;)
            {
                FadeEntry fe = mFade[i];
                fe.alpha += RealTime.deltaTime / fadeInTime;

                if (fe.alpha < 1f)
                {
                    mFade[i] = fe;
                    ++i;
                }
                else
                {
                    mFade.RemoveAt(i);
                }
            }

            if (mFade.size == 0)
            {
                if (keepFullDimensions)
                {
                    mLabel.text = mFullText.Substring(0, mCurrentOffset) + "[00]" + mFullText.Substring(mCurrentOffset);
                }
                else
                {
                    mLabel.text = mFullText.Substring(0, mCurrentOffset);
                }
            }
            else
            {
                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < mFade.size; ++i)
                {
                    FadeEntry fe = mFade[i];

                    if (i == 0)
                    {
                        sb.Append(mFullText.Substring(0, fe.index));
                    }

                    sb.Append('[');
                    sb.Append(NGUIText.EncodeAlpha(fe.alpha));
                    sb.Append(']');
                    sb.Append(fe.text);
                }

                if (keepFullDimensions)
                {
                    sb.Append("[00]");
                    sb.Append(mFullText.Substring(mCurrentOffset));
                }

                mLabel.text = sb.ToString();
            }
        }
        else if (mCurrentOffset == mFullText.Length)
        {
            current = this;
            EventDelegate.Execute(onFinished);
            current = null;
            mActive = false;
        }
    }
Beispiel #34
0
    /// <summary>
    /// 合成台修復
    /// </summary>
    public void EventShopTwoOne()
    {
        EventDelegate unlockPlayer = new EventDelegate(this, "MakePlayerFree");

        EventDelegate talkEvent15 = new EventDelegate(this, "Talk");
        talkEvent15.parameters[0] = new EventDelegate.Parameter(15);
        talkEvent15.parameters[1] = new EventDelegate.Parameter(unlockPlayer);

        EventDelegate cameraLookAt = new EventDelegate(this, "CameraLookAt");
        cameraLookAt.parameters[0] = new EventDelegate.Parameter(PositionTarget[3].transform);
        cameraLookAt.parameters[1] = new EventDelegate.Parameter(2f);
        cameraLookAt.parameters[2] = new EventDelegate.Parameter(talkEvent15);

        EventDelegate talkEvent14 = new EventDelegate(this, "Talk");
        talkEvent14.parameters[0] = new EventDelegate.Parameter(14);
        talkEvent14.parameters[1] = new EventDelegate.Parameter(cameraLookAt);

        EventDelegate moveToShangRen = new EventDelegate(this, "MoveTo");
        moveToShangRen.parameters[0] = new EventDelegate.Parameter(player.transform);
        moveToShangRen.parameters[1] = new EventDelegate.Parameter(PositionTarget[2].position);
        moveToShangRen.parameters[2] = new EventDelegate.Parameter(0f);
        moveToShangRen.parameters[3] = new EventDelegate.Parameter(talkEvent14);

        moveToShangRen.Execute();

        GameController._instance.doneEvent(4);
    }
Beispiel #35
0
 public void MsgReceived(string msg)
 {
     Debug.Log("Android Msg Received : " + msg);
     mMsg = msg;
     mEventDelegate.Execute();
 }
Beispiel #36
0
    public void EventBossOneTwo()
    {
        EventDelegate unlockPlayer = new EventDelegate(this, "MakePlayerFree");


        EventDelegate openTheRoad = new EventDelegate(this, "SetObjectActive");
        openTheRoad.parameters[0] = new EventDelegate.Parameter(new GameObject[] { eventObject1, eventObject2 });
        openTheRoad.parameters[1] = new EventDelegate.Parameter(false);
        openTheRoad.parameters[2] = new EventDelegate.Parameter(1f);
        openTheRoad.parameters[3] = new EventDelegate.Parameter(unlockPlayer);

        EventDelegate cameraLookAt = new EventDelegate(this, "CameraLookAt");
        cameraLookAt.parameters[0] = new EventDelegate.Parameter(PositionTarget[1].transform);
        cameraLookAt.parameters[1] = new EventDelegate.Parameter(1f);
        cameraLookAt.parameters[2] = new EventDelegate.Parameter(openTheRoad);

        EventDelegate closeTheParticleSystem = new EventDelegate(this, "SetParticleSystemActive");
        closeTheParticleSystem.parameters[0] = new EventDelegate.Parameter(new GameObject[] { eventObject1, eventObject2 });
        closeTheParticleSystem.parameters[1] = new EventDelegate.Parameter(false);
        closeTheParticleSystem.parameters[2] = new EventDelegate.Parameter(1f);
        closeTheParticleSystem.parameters[3] = new EventDelegate.Parameter(cameraLookAt);

        closeTheParticleSystem.Execute();
    }
	IEnumerator ShowBingoAni(string[] items, EventDelegate eventDelegate){
		for(int i = 0; i < items.Length; i++){
			transform.FindChild("Body").FindChild("Scroll View").FindChild("Board").FindChild("Items").FindChild(items[i])
				.GetComponent<ItemBingo>().Bingo();
			yield return new WaitForSeconds(0.2f);
		}
		transform.FindChild("Body").FindChild("Scroll View").FindChild("Board").FindChild("Result")
			.GetComponent<BingoResult>().Bingo();
		eventDelegate.Execute();
	}