Play() static public method

Play the specified animation.
static public Play ( Animation anim, Direction, playDirection ) : ActiveAnimation,
anim Animation
playDirection Direction,
return ActiveAnimation,
Ejemplo n.º 1
0
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!anim.gameObject.activeInHierarchy)
        {
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }
            NGUITools.SetActive(anim.gameObject, true);
        }
        ActiveAnimation component = anim.GetComponent <ActiveAnimation>();

        if (component == null)
        {
            component = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        else
        {
            component.enabled = true;
        }
        component.mAnim             = anim;
        component.mDisableDirection = (Direction)disableCondition;
        component.Play(clipName, playDirection);
        return(component);
    }
Ejemplo n.º 2
0
    public void pushBackground(UIViewController controller)
    {
        AnimationClip showAnimClip = null, hideAnimClip = null;

        if (controller != null)
        {
            GetNavigationAnimation(controller, true, out showAnimClip, out hideAnimClip);
        }

        if (controller != null)
        {
            Animation currentTarget = controller.GetComponent <Animation>();
            if (controller.showForwardAnimation != null)
            {
                showAnimClip = controller.showForwardAnimation;
            }

            if (currentTarget != null && showAnimClip != null)
            {
                var anim = ActiveAnimation.Play(currentTarget, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable);
                controller.OnAppear();

                anim.onFinished = (a) =>
                {
                    currentController.OnAppeared();
                };
            }
        }
    }
Ejemplo n.º 3
0
        private void OnAnimalPlayAnimation(IEvent ievent)
        {
            var e         = ievent as ElfPlayAnimationEvent;
            var animName  = e.Type == 0 ? "ShowFormationInfo" : "ShowElfList";
            var direction = e.IsForward ? Direction.Forward : Direction.Reverse;

            if (e.IsInstant)
            {
                var enumerator = FormationAnimation.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    var state = (AnimationState)enumerator.Current;
                    if (state.name == animName)
                    {
                        state.time = e.IsForward ? state.length : 0;
                        if (!e.IsForward)
                        {
                            state.speed = -Mathf.Abs(state.speed);
                        }
                        FormationAnimation.Play(animName);
                        FormationAnimation.Sample();
                        break;
                    }
                }
            }
            else
            {
                ActiveAnimation.Play(FormationAnimation, animName, direction);
            }
        }
Ejemplo n.º 4
0
    private void activateController(UIViewController controller, bool state)
    {
        if (viewControllers.Contains(controller))
        {
            controller.gameObject.SetActive(state);

            if (state)
            {
                currentController = controller;
                PushToStack(controller, "");

                AnimationClip showAnimClip = null, hideAnimClip = null;
                if (controller != null)
                {
                    GetNavigationAnimation(controller, true, out showAnimClip, out hideAnimClip);
                }

                Animation currentTarget = controller.GetComponent <Animation>();
                if (showAnimClip != null)
                {
                    var anim = ActiveAnimation.Play(currentTarget, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable);
                    currentController.OnAppear();

                    anim.onFinished = (a) =>
                    {
                        currentController.OnAppeared();
                    };
                }
            }
        }
    }
Ejemplo n.º 5
0
    public void dismissBackground(UIViewController view)
    {
        AnimationClip showAnimClip = null, hideAnimClip = null;

        if (view != null)
        {
            GetNavigationAnimation(view, true, out showAnimClip, out hideAnimClip);

            if (view.hideForwardAnimation != null)
            {
                hideAnimClip = view.hideForwardAnimation;
            }

            Animation currentTarget = view.GetComponent <Animation>();
            if (currentTarget != null && hideAnimClip != null)
            {
                var anim = ActiveAnimation.Play(currentTarget, hideAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.DoNothing, AnimationOrTween.DisableCondition.DisableAfterForward);

                view.OnDissapear();

                anim.onFinished = (a) =>
                {
                    view.OnDisappeared();
                };
            }
        }
    }
Ejemplo n.º 6
0
    public void GameOver()
    {
        int trindecIndex = UnityEngine.Random.Range(0, trindecPhrases.Length);

        trindecLabel.text   = trindecPhrases[trindecIndex];
        ScoreLabels[1].text = score.ToString();

        ActiveAnimation.Play(menuAnimation1, AnimationOrTween.Direction.Forward);
        GoAnimation2.Play();

        if (playing)
        {
            playing = false;
        }

#if UNITY_ANDROID
        if (tapjoy.enabled)
        {
            if (recordBroken)
            {
                tapjoy.ShowOnRecordPlacement();
            }
            else if (Random.Range(0, 15) == 5) // && Attempts < 30)
            {
                tapjoy.ShowGameOverPlacement();
            }
        }
#endif
    }
Ejemplo n.º 7
0
    public void PlayAnimation(string animationName, AnimationOrTween.Direction type, UnityAction action = null)
    {
        ActiveAnimation activeAnimation = ActiveAnimation.Play(panelAnimation, animationName, type);

        m_Action = action;
        EventDelegate.Add(activeAnimation.onFinished, () => OnAnimation(activeAnimation), true);
    }
Ejemplo n.º 8
0
 private void Play(Boolean forward)
 {
     if (target == null)
     {
         target = GetComponentInChildren <Animation>();
     }
     if (target != null)
     {
         if (clearSelection && UICamera.selectedObject == gameObject)
         {
             UICamera.selectedObject = null;
         }
         Int32           num             = -(Int32)playDirection;
         Direction       direction       = (Direction)((!forward) ? num : ((Int32)playDirection));
         ActiveAnimation activeAnimation = ActiveAnimation.Play(target, clipName, direction, ifDisabledOnPlay, disableWhenFinished);
         if (activeAnimation == null)
         {
             return;
         }
         if (resetOnPlay)
         {
             activeAnimation.Reset();
         }
         activeAnimation.onFinished = onFinished;
         if (eventReceiver != null && !String.IsNullOrEmpty(callWhenFinished))
         {
             activeAnimation.eventReceiver    = eventReceiver;
             activeAnimation.callWhenFinished = callWhenFinished;
         }
         else
         {
             activeAnimation.eventReceiver = null;
         }
     }
 }
Ejemplo n.º 9
0
 public void Play(bool forward, bool onlyIfDifferent)
 {
     if (this.target || this.animator)
     {
         if (onlyIfDifferent)
         {
             if (this.mActivated == forward)
             {
                 return;
             }
             this.mActivated = forward;
         }
         if (this.clearSelection && UICamera.selectedObject == base.gameObject)
         {
             UICamera.selectedObject = null;
         }
         int             num             = (int)(-(int)this.playDirection);
         Direction       direction       = (Direction)((!forward) ? num : ((int)this.playDirection));
         ActiveAnimation activeAnimation = (!this.target) ? ActiveAnimation.Play(this.animator, this.clipName, direction, this.ifDisabledOnPlay, this.disableWhenFinished) : ActiveAnimation.Play(this.target, this.clipName, direction, this.ifDisabledOnPlay, this.disableWhenFinished);
         if (activeAnimation != null)
         {
             if (this.resetOnPlay)
             {
                 activeAnimation.Reset();
             }
             for (int i = 0; i < this.onFinished.Count; i++)
             {
                 EventDelegate.Add(activeAnimation.onFinished, new EventDelegate.Callback(this.OnFinished), true);
             }
         }
     }
 }
Ejemplo n.º 10
0
    public static ActiveAnimation Play(Animation anim, string clipName, AnimationOrTween.Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!NGUITools.GetActive(anim.gameObject))
        {
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }
            NGUITools.SetActive(anim.gameObject, true);
            UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren <UIPanel>();
            int       index  = 0;
            int       length = componentsInChildren.Length;
            while (index < length)
            {
                componentsInChildren[index].Refresh();
                index++;
            }
        }
        ActiveAnimation component = anim.GetComponent <ActiveAnimation>();

        if (component == null)
        {
            component = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        component.mAnim             = anim;
        component.mDisableDirection = (AnimationOrTween.Direction)disableCondition;
        component.eventReceiver     = null;
        component.callWhenFinished  = null;
        component.onFinished        = null;
        component.Play(clipName, playDirection);
        return(component);
    }
 // Token: 0x06000059 RID: 89 RVA: 0x00016A60 File Offset: 0x00014C60
 private void Play(bool forward)
 {
     if (this.target == null)
     {
         this.target = base.GetComponentInChildren <Animation>();
     }
     if (this.target != null)
     {
         if (this.clearSelection && UICamera.selectedObject == base.gameObject)
         {
             UICamera.selectedObject = null;
         }
         int             num             = (int)(-(int)this.playDirection);
         Direction       direction       = (Direction)((!forward) ? num : ((int)this.playDirection));
         ActiveAnimation activeAnimation = ActiveAnimation.Play(this.target, this.clipName, direction, this.ifDisabledOnPlay, this.disableWhenFinished);
         if (activeAnimation == null)
         {
             return;
         }
         if (this.resetOnPlay)
         {
             activeAnimation.Reset();
         }
         activeAnimation.onFinished = this.onFinished;
         if (this.eventReceiver != null && !string.IsNullOrEmpty(this.callWhenFinished))
         {
             activeAnimation.eventReceiver    = this.eventReceiver;
             activeAnimation.callWhenFinished = this.callWhenFinished;
         }
         else
         {
             activeAnimation.eventReceiver = null;
         }
     }
 }
Ejemplo n.º 12
0
 public void PlayBtnAnimation()
 {
     if (MyHead.SoldierBtnAnimation != null)
     {
         ActiveAnimation.Play(MyHead.SoldierBtnAnimation, AnimationOrTween.Direction.Forward);
     }
 }
 public void Play(bool forward, bool onlyIfDifferent)
 {
     //IL_004b: Unknown result type (might be due to invalid IL or missing references)
     if (Object.op_Implicit(target) || Object.op_Implicit(animator))
     {
         if (onlyIfDifferent)
         {
             if (mActivated == forward)
             {
                 return;
             }
             mActivated = forward;
         }
         if (clearSelection && UICamera.selectedObject == this.get_gameObject())
         {
             UICamera.selectedObject = null;
         }
         int             num             = 0 - playDirection;
         Direction       direction       = (Direction)((!forward) ? num : ((int)playDirection));
         ActiveAnimation activeAnimation = (!Object.op_Implicit(target)) ? ActiveAnimation.Play(animator, clipName, direction, ifDisabledOnPlay, disableWhenFinished) : ActiveAnimation.Play(target, clipName, direction, ifDisabledOnPlay, disableWhenFinished);
         if (activeAnimation != null)
         {
             if (resetOnPlay)
             {
                 activeAnimation.Reset();
             }
             for (int i = 0; i < onFinished.Count; i++)
             {
                 EventDelegate.Add(activeAnimation.onFinished, OnFinished, true);
             }
         }
     }
 }
Ejemplo n.º 14
0
    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>

    static public ActiveAnimation Play(Animation anim, string clipName, Direction playDirection,
                                       EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!NGUITools.GetActive(anim.gameObject))
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }

            // Enable the game object before animating it
            NGUITools.SetActive(anim.gameObject, true);

            // Refresh all panels right away so that there is no one frame delay
            UIPanel[] panels = anim.gameObject.GetComponentsInChildren <UIPanel>();
            for (int i = 0, imax = panels.Length; i < imax; ++i)
            {
                panels[i].Refresh();
            }
        }

        ActiveAnimation aa = anim.GetComponent <ActiveAnimation>();

        if (aa == null)
        {
            aa = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        aa.mAnim             = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.onFinished.Clear();
        aa.Play(clipName, playDirection);
        return(aa);
    }
Ejemplo n.º 15
0
    //public bool m_bTimePauseByGameTime = false;  // v0.9


    void Behaviour_Idle()
    {
        if (elapseTime == 0)
        {
            TimerCountDownBar.value = 0;
            m_fCurrentIdleWaitTime  = Random.Range(1.5f, 2.5f);
        }

        if (m_bTimePauseByGameTime == false)        // v0.9
        {
            elapseTime += Time.deltaTime;
        }


        if (elapseTime > m_fCurrentIdleWaitTime)
        //if(  elapseTime  > 2 )
        {
            elapseTime             = 0;
            m_fCurrentIdleWaitTime = 2f;

            Animation       Anm = CarBillBoard.gameObject.GetComponent <Animation>();
            Direction       dir = Direction.Forward;
            ActiveAnimation anim0;
            anim0 = ActiveAnimation.Play(Anm, "Animation_Blink", dir, EnableCondition.EnableThenPlay, DisableCondition.DoNotDisable);
            //ActiveAnimation.Play(  Anm, AnimationOrTween.Direction.Forward);
            anim0.eventReceiver = gameObject;
            //anim0.callWhenFinished = "AnimationLoop";

            updateDelegate = Behaviour_Changing;
        }
    }
Ejemplo n.º 16
0
    public void TogglePOI(bool on)
    {
        Debug.Log("FACT PANEL:" + on);
        //POI1.SetActive(on);
        //currentAnimation = POI1.GetComponent<Animation>();
        //currentAnimation.Play();
        if (on)
        {
            anim = ActiveAnimation.Play(factPanelTween, "", Direction.Forward, EnableCondition.DoNothing, DisableCondition.DoNotDisable);

            //Popup_Fact.SetActive(true);
            // CM.SharkCameraToggle(false);

            Button_Back.SetActive(false);
            Title_Hotspot.SetActive(false);
            Button_Menu.SetActive(false);
            //SharkParent.SetActive(false);
            //anim = ActiveAnimation.Play(currentAnimation, "", Direction.Forward,EnableCondition.DoNothing,DisableCondition.DoNotDisable);
            //anim = ActiveAnimation.Play(currentAnimation, "", Direction.Toggle,EnableCondition.DoNothing,DisableCondition.DoNotDisable);
        }

        else
        {
            anim = ActiveAnimation.Play(factPanelTween, "", Direction.Reverse, EnableCondition.DoNothing, DisableCondition.DoNotDisable);

            //Popup_Fact.SetActive(false);
            // CM.SharkCameraToggle(true);

            Button_Back.SetActive(true);
            Title_Hotspot.SetActive(true);
            //Button_Menu.SetActive(true);
            //SharkParent.SetActive(true);
            //anim = ActiveAnimation.Play(currentAnimation, "", Direction.Reverse,EnableCondition.DoNothing,DisableCondition.DoNotDisable);
        }
    }
Ejemplo n.º 17
0
    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>

    static public ActiveAnimation Play(Animation anim, string clipName, Direction playDirection,
                                       EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!anim.gameObject.activeSelf)
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }

            // Enable the game object before animating it
            anim.gameObject.SetActive(true);
        }

        ActiveAnimation aa = anim.GetComponent <ActiveAnimation>();

        if (aa != null)
        {
            aa.enabled = true;
        }
        else
        {
            aa = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        aa.mAnim             = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.Play(clipName, playDirection);
        return(aa);
    }
Ejemplo n.º 18
0
    public void screenTransition(int toScreen)
    {
        if (toScreen == 1)
        {
            currentScreen = 1;

            CM.SharkCameraToggle(false);
            CM.ARCameraToggle(false);

            anim = ActiveAnimation.Play(screenTween1, "", Direction.Forward, EnableCondition.DoNothing, DisableCondition.DoNotDisable);
            anim = ActiveAnimation.Play(screenTween2, "", Direction.Forward, EnableCondition.DoNothing, DisableCondition.DoNotDisable);
        }

        else if (toScreen == 0)
        {
            currentScreen = 0;

            CM.SharkCameraToggle(false);
            CM.ARCameraToggle(false);

            anim = ActiveAnimation.Play(screenTween1, "", Direction.Reverse, EnableCondition.DoNothing, DisableCondition.DoNotDisable);
            anim = ActiveAnimation.Play(screenTween2, "", Direction.Reverse, EnableCondition.DoNothing, DisableCondition.DoNotDisable);
        }

        SelectCharacterModel();
    }
    void LateUpdate()
    {
        while (balls.Count > 0)
        {
            BallScriptPointer        ball = balls.Dequeue();
            List <BallScriptPointer> gm   = new List <BallScriptPointer> ();
            if (calculateDFS(ball, gm) >= 2)
            {
                bool gonnablow = false;

                foreach (BallScriptPointer pball in gm)
                {
                    if (!pball.getBall().isbasic)
                    {
                        ball.getBall().setBang();
                        gonnablow = true;
                        break;
                    }
                }
                if (gonnablow)
                {
                    foreach (BallScriptPointer pball in gm)
                    {
                        ActiveAnimation.Play(pball.getGameObject().GetComponent <Animation>(), "BallBeamSuper", AnimationOrTween.Direction.Forward);
                    }
                }
            }
        }
    }
Ejemplo n.º 20
0
 private void Play(bool forward)
 {
     if (this.target == null)
     {
         this.target = base.GetComponentInChildren <Animation>();
     }
     if (this.target != null)
     {
         if (this.clearSelection && (UICamera.selectedObject == base.gameObject))
         {
             UICamera.selectedObject = null;
         }
         int             num           = (int)-this.playDirection;
         Direction       playDirection = !forward ? ((Direction)num) : this.playDirection;
         ActiveAnimation animation     = ActiveAnimation.Play(this.target, this.clipName, playDirection, this.ifDisabledOnPlay, this.disableWhenFinished);
         if (this.resetOnPlay)
         {
             animation.Reset();
         }
         if ((this.eventReceiver != null) && !string.IsNullOrEmpty(this.callWhenFinished))
         {
             animation.eventReceiver    = this.eventReceiver;
             animation.callWhenFinished = this.callWhenFinished;
         }
     }
 }
Ejemplo n.º 21
0
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!NGUITools.GetActive(anim.gameObject))
        {
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }
            NGUITools.SetActive(anim.gameObject, true);
            UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren <UIPanel>();
            int       i   = 0;
            int       num = componentsInChildren.Length;
            while (i < num)
            {
                componentsInChildren[i].Refresh();
                i++;
            }
        }
        ActiveAnimation activeAnimation = anim.GetComponent <ActiveAnimation>();

        if (activeAnimation == null)
        {
            activeAnimation = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        activeAnimation.mAnim             = anim;
        activeAnimation.mDisableDirection = (Direction)disableCondition;
        activeAnimation.eventReceiver     = null;
        activeAnimation.callWhenFinished  = null;
        activeAnimation.onFinished        = null;
        activeAnimation.Play(clipName, playDirection);
        return(activeAnimation);
    }
Ejemplo n.º 22
0
    /// <summary>
    /// Start playing the animation.
    /// </summary>

    public void Play(bool forward)
    {
        if (target != null)
        {
            mActive = 0;

            if (clearSelection && UICamera.selectedObject == gameObject)
            {
                UICamera.selectedObject = null;
            }

            int             pd   = -(int)playDirection;
            Direction       dir  = forward ? playDirection : ((Direction)pd);
            ActiveAnimation anim = ActiveAnimation.Play(target, clipName, dir, ifDisabledOnPlay, disableWhenFinished);

            if (anim != null)
            {
                if (resetOnPlay)
                {
                    anim.Reset();
                }

                for (int i = 0; i < onFinished.Count; ++i)
                {
                    ++mActive;
                    EventDelegate.Add(anim.onFinished, OnFinished, true);
                }
            }
        }
    }
    void Play(bool forward)
    {
        if (target == null)
        {
            target = GetComponentInChildren <Animation>();
        }

        if (target != null)
        {
            if (clearSelection && UICamera.selectedObject == gameObject)
            {
                UICamera.selectedObject = null;
            }

            int             pd   = -(int)playDirection;
            Direction       dir  = forward ? playDirection : ((Direction)pd);
            ActiveAnimation anim = ActiveAnimation.Play(target, clipName, dir, ifDisabledOnPlay, disableWhenFinished);
            if (resetOnPlay)
            {
                anim.Reset();
            }

            // Copy the event receiver
            if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished))
            {
                anim.eventReceiver    = eventReceiver;
                anim.callWhenFinished = callWhenFinished;
            }
        }
    }
Ejemplo n.º 24
0
 public void Play(bool forward, bool onlyIfDifferent)
 {
     if ((bool)target || (bool)animator)
     {
         if (onlyIfDifferent)
         {
             if (mActivated == forward)
             {
                 return;
             }
             mActivated = forward;
         }
         if (clearSelection && UICamera.selectedObject == base.gameObject)
         {
             UICamera.selectedObject = null;
         }
         int             num             = 0 - playDirection;
         Direction       direction       = (Direction)((!forward) ? num : ((int)playDirection));
         ActiveAnimation activeAnimation = (!(bool)target) ? ActiveAnimation.Play(animator, clipName, direction, ifDisabledOnPlay, disableWhenFinished) : ActiveAnimation.Play(target, clipName, direction, ifDisabledOnPlay, disableWhenFinished);
         if (activeAnimation != null)
         {
             if (resetOnPlay)
             {
                 activeAnimation.Reset();
             }
             for (int i = 0; i < onFinished.Count; i++)
             {
                 EventDelegate.Add(activeAnimation.onFinished, OnFinished, oneShot: true);
             }
         }
     }
 }
Ejemplo n.º 25
0
 public void PlayAnimation()
 {
     UnityEngine.Transform tf = transform.Find("Label");
     if (tf != null)
     {
         Animation   a = tf.GetComponent <Animation>();
         UITweener[] t = tf.GetComponentsInChildren <UITweener>();
         if (a != null && t.Length == 0)
         {
             anim = ActiveAnimation.Play(a, a.clip.name, AnimationOrTween.Direction.Forward,
                                         AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DisableAfterForward);
             EventDelegate.Add(anim.onFinished, AnimaionFinish, true);
         }
         else
         {
             anim = null;
             int count = t.Length;
             if (t != null && count > 0)
             {
                 for (int i = 0; i < count; ++i)
                 {
                     t[i].ResetToBeginning();
                     t[i].PlayForward();
                 }
             }
         }
     }
 }
Ejemplo n.º 26
0
    /// <summary>
    /// Fade out or fade in the checkmark and notify the target of OnChecked event.
    /// </summary>

    void Set(bool state)
    {
        if (!mStarted)
        {
            mChecked      = state;
            startsChecked = state;
            if (checkSprite != null)
            {
                checkSprite.alpha = state ? 1f : 0f;
            }
        }
        else if (mChecked != state)
        {
            // Uncheck all other checkboxes
            if (radioButtonRoot != null && state)
            {
                UICheckbox[] cbs = radioButtonRoot.GetComponentsInChildren <UICheckbox>(true);

                for (int i = 0, imax = cbs.Length; i < imax; ++i)
                {
                    UICheckbox cb = cbs[i];
                    if (cb != this && cb.radioButtonRoot == radioButtonRoot)
                    {
                        cb.Set(false);
                    }
                }
            }

            // Remember the state
            mChecked = state;

            // Tween the color of the checkmark
            if (checkSprite != null)
            {
                TweenAlpha.Begin(checkSprite.gameObject, 0.15f, mChecked ? 1f : 0f);
            }

            current = this;

            // Notify the delegate
            if (onStateChange != null)
            {
                onStateChange(mChecked);
            }

            // Send out the event notification
            if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
            {
                eventReceiver.SendMessage(functionName, mChecked, SendMessageOptions.DontRequireReceiver);
            }
            current = null;

            // Play the checkmark animation
            if (checkAnimation != null)
            {
                ActiveAnimation.Play(checkAnimation, state ? Direction.Forward : Direction.Reverse);
            }
        }
    }
Ejemplo n.º 27
0
 private void Set(bool state)
 {
     if (!mStarted)
     {
         mChecked      = state;
         startsChecked = state;
         if (checkSprite != null)
         {
             checkSprite.alpha = ((!state) ? 0f : 1f);
         }
     }
     else
     {
         if (mChecked == state)
         {
             return;
         }
         if (radioButtonRoot != null && state)
         {
             UICheckbox[] componentsInChildren = radioButtonRoot.GetComponentsInChildren <UICheckbox>(includeInactive: true);
             int          i = 0;
             for (int num = componentsInChildren.Length; i < num; i++)
             {
                 UICheckbox uICheckbox = componentsInChildren[i];
                 if (uICheckbox != this && uICheckbox.radioButtonRoot == radioButtonRoot)
                 {
                     uICheckbox.Set(state: false);
                 }
             }
         }
         mChecked = state;
         if (checkSprite != null)
         {
             if (instantTween)
             {
                 checkSprite.alpha = ((!mChecked) ? 0f : 1f);
             }
             else
             {
                 TweenAlpha.Begin(checkSprite.gameObject, 0.15f, (!mChecked) ? 0f : 1f);
             }
         }
         current = this;
         if (onStateChange != null)
         {
             onStateChange(mChecked);
         }
         if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
         {
             eventReceiver.SendMessage(functionName, mChecked, SendMessageOptions.DontRequireReceiver);
         }
         current = null;
         if (checkAnimation != null)
         {
             ActiveAnimation.Play(checkAnimation, state ? Direction.Forward : Direction.Reverse);
         }
     }
 }
Ejemplo n.º 28
0
    public void HideMenu(MENUACTION menuaction = MENUACTION.MA_NONE)
    {
        state          = false;
        LastMenuAction = menuaction;

        ToggleButtonSettings(false);

        ActiveAnimation.Play(GetComponent <Animation>(), "Window - Forward", AnimationOrTween.Direction.Forward).onFinished.Add(new EventDelegate(this, "MenuActionAfterAnimationFinished"));
    }
Ejemplo n.º 29
0
    private void Set(bool state)
    {
        if (!mStarted)
        {
            mChecked      = state;
            startsChecked = state;
            if (checkSprite != null)
            {
                checkSprite.alpha = !state ? 0f : 1f;
            }
        }
        else if (mChecked != state)
        {
            if (radioButtonRoot != null && state)
            {
                var componentsInChildren = radioButtonRoot.GetComponentsInChildren <UICheckbox>(true);
                var index  = 0;
                var length = componentsInChildren.Length;
                while (index < length)
                {
                    var checkbox = componentsInChildren[index];
                    if (checkbox != this && checkbox.radioButtonRoot == radioButtonRoot)
                    {
                        checkbox.Set(false);
                    }

                    index++;
                }
            }

            mChecked = state;
            if (checkSprite != null)
            {
                if (instantTween)
                {
                    checkSprite.alpha = !mChecked ? 0f : 1f;
                }
                else
                {
                    TweenAlpha.Begin(checkSprite.gameObject, 0.15f, !mChecked ? 0f : 1f);
                }
            }

            current = this;
            onStateChange?.Invoke(mChecked);
            if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
            {
                eventReceiver.SendMessage(functionName, mChecked, SendMessageOptions.DontRequireReceiver);
            }

            current = null;
            if (checkAnimation != null)
            {
                ActiveAnimation.Play(checkAnimation, !state ? Direction.Reverse : Direction.Forward);
            }
        }
    }
Ejemplo n.º 30
0
    void Continue()
    {
        //menuAnimation1.Play();
        ActiveAnimation.Play(menuAnimation1, AnimationOrTween.Direction.Reverse);
        pauseAnimation3.Play();

        playing        = true;
        Time.timeScale = TimeScale;
    }