IsValid() static private method

static private IsValid ( Callback, callback ) : bool
callback Callback,
return bool
コード例 #1
0
 private void OnEnable()
 {
     if (EventDelegate.IsValid(onChange))
     {
         eventReceiver = null;
         functionName  = null;
     }
     if (font != null)
     {
         if (font.isDynamic)
         {
             trueTypeFont    = font.dynamicFont;
             fontStyle       = font.dynamicFontStyle;
             mUseDynamicFont = true;
         }
         else if (bitmapFont == null)
         {
             bitmapFont      = font;
             mUseDynamicFont = false;
         }
         font = null;
     }
     if (textScale != 0f)
     {
         fontSize  = ((!(bitmapFont != null)) ? 16 : Mathf.RoundToInt((float)bitmapFont.defaultSize * textScale));
         textScale = 0f;
     }
     if (trueTypeFont == null && bitmapFont != null && bitmapFont.isDynamic)
     {
         trueTypeFont = bitmapFont.dynamicFont;
         bitmapFont   = null;
     }
 }
コード例 #2
0
    /// <summary>
    /// Trigger all event notification callbacks.
    /// </summary>

    protected void TriggerCallbacks()
    {
        if (!mExecuting)
        {
            mExecuting = true;
            UIPopupList old = current;
            current = this;

            // Legacy functionality
            if (mLegacyEvent != null)
            {
                mLegacyEvent(mSelectedItem);
            }

            if (EventDelegate.IsValid(onChange))
            {
                EventDelegate.Execute(onChange);
            }
            else if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
            {
                // Legacy functionality support (for backwards compatibility)
                eventReceiver.SendMessage(functionName, mSelectedItem, SendMessageOptions.DontRequireReceiver);
            }
            current    = old;
            mExecuting = false;
        }
    }
コード例 #3
0
 private void OnEnable()
 {
     if (EventDelegate.IsValid(this.onChange))
     {
         this.eventReceiver = null;
         this.functionName  = null;
     }
     if (this.font != null)
     {
         if (this.font.isDynamic)
         {
             this.trueTypeFont    = this.font.dynamicFont;
             this.fontStyle       = this.font.dynamicFontStyle;
             this.mUseDynamicFont = true;
         }
         else if (this.bitmapFont == null)
         {
             this.bitmapFont      = this.font;
             this.mUseDynamicFont = false;
         }
         this.font = null;
     }
     if (this.textScale != 0f)
     {
         this.fontSize  = ((!(this.bitmapFont != null)) ? 16 : Mathf.RoundToInt((float)this.bitmapFont.defaultSize * this.textScale));
         this.textScale = 0f;
     }
     if (this.trueTypeFont == null && this.bitmapFont != null && this.bitmapFont.isDynamic)
     {
         this.trueTypeFont = this.bitmapFont.dynamicFont;
         this.bitmapFont   = null;
     }
 }
コード例 #4
0
    /// <summary>
    /// Set the progress bar's value. If setting the initial value, call Start() first.
    /// </summary>

    public void Set(float val, bool notify = true)
    {
        val = Mathf.Clamp01(val);

        if (mValue != val)
        {
            float before = value;
            mValue = val;

            if (mStarted && before != value)
            {
                ForceUpdate();

                if (notify && NGUITools.GetActive(this) && EventDelegate.IsValid(onChange))
                {
                    current = this;
                    EventDelegate.Execute(onChange);
                    current = null;
                }
            }
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                NGUITools.SetDirty(this);
            }
#endif
        }
    }
コード例 #5
0
ファイル: UIPopupList.cs プロジェクト: yxxyws/niuniu
 protected void TriggerCallbacks()
 {
     if (!this.mExecuting)
     {
         this.mExecuting = true;
         UIPopupList uIPopupList = UIPopupList.current;
         UIPopupList.current = this;
         if (this.mLegacyEvent != null)
         {
             this.mLegacyEvent(this.mSelectedItem);
         }
         if (EventDelegate.IsValid(this.onChange))
         {
             EventDelegate.Execute(this.onChange);
         }
         else
         {
             if (this.eventReceiver != null && !string.IsNullOrEmpty(this.functionName))
             {
                 this.eventReceiver.SendMessage(this.functionName, this.mSelectedItem, SendMessageOptions.DontRequireReceiver);
             }
         }
         UIPopupList.current = uIPopupList;
         this.mExecuting     = false;
     }
 }
コード例 #6
0
 private void OnEnable()
 {
     //IL_0057: Unknown result type (might be due to invalid IL or missing references)
     //IL_005c: Unknown result type (might be due to invalid IL or missing references)
     if (EventDelegate.IsValid(onChange))
     {
         eventReceiver = null;
         functionName  = null;
     }
     if (font != null)
     {
         if (font.isDynamic)
         {
             trueTypeFont    = font.dynamicFont;
             fontStyle       = font.dynamicFontStyle;
             mUseDynamicFont = true;
         }
         else if (bitmapFont == null)
         {
             bitmapFont      = font;
             mUseDynamicFont = false;
         }
         font = null;
     }
     if (textScale != 0f)
     {
         fontSize  = ((!(bitmapFont != null)) ? 16 : Mathf.RoundToInt((float)bitmapFont.defaultSize * textScale));
         textScale = 0f;
     }
     if (trueTypeFont == null && bitmapFont != null && bitmapFont.isDynamic)
     {
         trueTypeFont = bitmapFont.dynamicFont;
         bitmapFont   = null;
     }
 }
コード例 #7
0
 private void Start()
 {
     if (this.eventReceiver != (UnityEngine.Object)null && EventDelegate.IsValid(this.onFinished))
     {
         this.eventReceiver    = (GameObject)null;
         this.callWhenFinished = (String)null;
     }
 }
コード例 #8
0
 // Token: 0x060031C5 RID: 12741 RVA: 0x000F6958 File Offset: 0x000F4D58
 private void Start()
 {
     if (this.eventReceiver != null && EventDelegate.IsValid(this.onFinished))
     {
         this.eventReceiver    = null;
         this.callWhenFinished = null;
     }
 }
コード例 #9
0
ファイル: ActiveAnimation.cs プロジェクト: Coala1010/Chat-App
    /// <summary>
    /// Event receiver is only kept for backwards compatibility purposes. It's removed on start if new functionality is used.
    /// </summary>

    void Start()
    {
        if (eventReceiver != null && EventDelegate.IsValid(onFinished))
        {
            eventReceiver    = null;
            callWhenFinished = null;
        }
    }
コード例 #10
0
 private void Awake()
 {
     if (eventReceiver != null && EventDelegate.IsValid(onFinished))
     {
         eventReceiver    = null;
         callWhenFinished = null;
     }
 }
コード例 #11
0
ファイル: UIInput.cs プロジェクト: ArtReeX/memoria
 protected void ExecuteOnChange()
 {
     if (UIInput.current == (UnityEngine.Object)null && EventDelegate.IsValid(this.onChange))
     {
         UIInput.current = this;
         EventDelegate.Execute(this.onChange);
         UIInput.current = (UIInput)null;
     }
 }
コード例 #12
0
    static int IsValid(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        List <EventDelegate> arg0 = (List <EventDelegate>)LuaScriptMgr.GetNetObject(L, 1, typeof(List <EventDelegate>));
        bool o = EventDelegate.IsValid(arg0);

        LuaScriptMgr.Push(L, o);
        return(1);
    }
コード例 #13
0
ファイル: UIInput.cs プロジェクト: syncsyncsynchalt/BD-6Kr
 protected void ExecuteOnChange()
 {
     if (current == null && EventDelegate.IsValid(onChange))
     {
         current = this;
         EventDelegate.Execute(onChange);
         current = null;
     }
 }
コード例 #14
0
 protected void OnEnable()
 {
     if (mStarted && current == null && EventDelegate.IsValid(onChange))
     {
         current = this;
         EventDelegate.Execute(onChange);
         current = null;
     }
 }
コード例 #15
0
    private static int IsValid(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        List <EventDelegate> list = (List <EventDelegate>)LuaScriptMgr.GetNetObject(L, 1, typeof(List <EventDelegate>));
        bool b = EventDelegate.IsValid(list);

        LuaScriptMgr.Push(L, b);
        return(1);
    }
コード例 #16
0
 protected void ExecuteOnChange()
 {
     if (UIInput.current == null && EventDelegate.IsValid(this.onChange))
     {
         UIInput.current = this;
         EventDelegate.Execute(this.onChange);
         UIInput.current = null;
     }
 }
コード例 #17
0
ファイル: UIInput.cs プロジェクト: Smoothstep/VRChat
 protected void ExecuteOnChange()
 {
     if (!((UnityEngine.Object)UIInput.current == (UnityEngine.Object)null) || !EventDelegate.IsValid(this.onChange))
     {
         return;
     }
     UIInput.current = this;
     EventDelegate.Execute(this.onChange);
     UIInput.current = (UIInput)null;
 }
コード例 #18
0
 protected void ExecuteOnKeyTriggered(KeyCode key)
 {
     if (UIInput.current == null && EventDelegate.IsValid(this.onKeyTriggered))
     {
         UIInput.current = this;
         this.recentKey  = key;
         EventDelegate.Execute(this.onKeyTriggered);
         this.recentKey  = KeyCode.None;
         UIInput.current = null;
     }
 }
コード例 #19
0
ファイル: UIToggle.cs プロジェクト: 741645596/batgame
    /// <summary>
    /// Check or uncheck on click.
    /// </summary>

    void OnClick()
    {
        if (enabled)
        {
            value = !value;
        }
        if (EventDelegate.IsValid(onClick))
        {
            EventDelegate.Execute(onClick);
        }
    }
コード例 #20
0
    /// <summary>
    /// Trigger all event notification callbacks.
    /// </summary>

    protected void TriggerCallbacks()
    {
        current = this;

        if (EventDelegate.IsValid(onChange))
        {
            EventDelegate.Execute(onChange);
        }

        current = null;
    }
コード例 #21
0
ファイル: CustomPopUpList.cs プロジェクト: Peng-Zhiyuan/mylib
 public override void CloseSelf()
 {
     base.CloseSelf();
     if (onClose.Count > 0)
     {
         if (EventDelegate.IsValid(onClose))
         {
             EventDelegate.Execute(onClose);
         }
     }
 }
コード例 #22
0
 void OnEnable()
 {
     mTrigger = target as UIEventTrigger;
     EditorPrefs.SetBool("ET0", EventDelegate.IsValid(mTrigger.onHoverOver));
     EditorPrefs.SetBool("ET1", EventDelegate.IsValid(mTrigger.onHoverOut));
     EditorPrefs.SetBool("ET2", EventDelegate.IsValid(mTrigger.onPress));
     EditorPrefs.SetBool("ET3", EventDelegate.IsValid(mTrigger.onRelease));
     EditorPrefs.SetBool("ET4", EventDelegate.IsValid(mTrigger.onSelect));
     EditorPrefs.SetBool("ET5", EventDelegate.IsValid(mTrigger.onDeselect));
     EditorPrefs.SetBool("ET6", EventDelegate.IsValid(mTrigger.onClick));
     EditorPrefs.SetBool("ET7", EventDelegate.IsValid(mTrigger.onDoubleClick));
 }
コード例 #23
0
    void Awake()
    {
        // Remove deprecated functionality if new one is used
        if (eventReceiver != null && EventDelegate.IsValid(onFinished))
        {
            eventReceiver    = null;
            callWhenFinished = null;
#if UNITY_EDITOR
            UnityEditor.EditorUtility.SetDirty(this);
#endif
        }
    }
コード例 #24
0
    void Awake()
    {
        // Remove deprecated functionality if new one is used
        if (eventReceiver != null && EventDelegate.IsValid(onFinished))
        {
            eventReceiver    = null;
            callWhenFinished = null;
#if UNITY_EDITOR && !DLL_TYPE
            NGUITools.SetDirty(this);
#endif
        }
    }
コード例 #25
0
    /// <summary>
    /// Activate the initial state.
    /// </summary>

    public void Start()
    {
        if (mStarted)
        {
            return;
        }

        if (startsChecked)
        {
            startsChecked = false;
            startsActive  = true;
#if UNITY_EDITOR
            NGUITools.SetDirty(this);
#endif
        }

        // Auto-upgrade
        if (!Application.isPlaying)
        {
            if (checkSprite != null && activeSprite == null)
            {
                activeSprite = checkSprite;
                checkSprite  = null;
            }

            if (checkAnimation != null && activeAnimation == null)
            {
                activeAnimation = checkAnimation;
                checkAnimation  = null;
            }

            if (Application.isPlaying && activeSprite != null)
            {
                activeSprite.alpha = invertSpriteState ? (startsActive ? 0f : 1f) : (startsActive ? 1f : 0f);
            }

            if (EventDelegate.IsValid(onChange))
            {
                eventReceiver = null;
                functionName  = null;
            }
        }
        else
        {
            mIsActive = !startsActive;
            mStarted  = true;
            bool instant = instantTween;
            instantTween = true;
            Set(startsActive);
            instantTween = instant;
        }
    }
コード例 #26
0
    /// <summary>
    /// Activate the initial state.
    /// </summary>

    void Start()
    {
        if (startsChecked)
        {
            startsChecked = false;
            startsActive  = true;
#if UNITY_EDITOR
            NGUITools.SetDirty(this);
#endif
        }

#if UNITY_EDITOR
        // Auto-upgrade
        if (!Application.isPlaying)
        {
            if (checkSprite != null && activeSprite == null)
            {
                activeSprite = checkSprite;
                checkSprite  = null;
            }

            if (checkAnimation != null && activeAnimation == null)
            {
                activeAnimation = checkAnimation;
                checkAnimation  = null;
            }

            if (Application.isPlaying && activeSprite != null)
            {
                activeSprite.alpha = startsActive ? 1f : 0f;
            }

            if (radioButtonRoot != null && group == 0)
            {
                Debug.LogWarning(NGUITools.GetHierarchy(gameObject) +
                                 " uses a 'Radio Button Root'. You need to change it to use a 'group' instead.", this);
            }

            if (EventDelegate.IsValid(onChange))
            {
                eventReceiver = null;
                functionName  = null;
            }
        }
        else
#endif
        {
            mIsActive = !startsActive;
            mStarted  = true;
            Set(startsActive);
        }
    }
コード例 #27
0
ファイル: UITextList.cs プロジェクト: blue0830/18k
    /// <summary>
    /// Refill the text label based on what's currently visible.
    /// </summary>

    protected void UpdateVisibleText()
    {
        if (isValid)
        {
            if (mTotalLines == 0)
            {
                textLabel.text = "";
                return;
            }

            int maxLines = Mathf.FloorToInt((float)textLabel.height / lineHeight);
            int sh       = Mathf.Max(0, mTotalLines - maxLines);
            int offset   = Mathf.RoundToInt(mScroll * sh);
            if (offset < 0)
            {
                offset = 0;
            }

            StringBuilder final = new StringBuilder();

            for (int i = 0, imax = paragraphs.size; maxLines > 0 && i < imax; ++i)
            {
                Paragraph p = mParagraphs.buffer[i];

                for (int b = 0, bmax = p.lines.Length; maxLines > 0 && b < bmax; ++b)
                {
                    string s = p.lines[b];

                    if (offset > 0)
                    {
                        --offset;
                    }
                    else
                    {
                        if (final.Length > 0)
                        {
                            final.Append("\n");
                        }
                        final.Append(s);
                        --maxLines;
                    }
                }
            }
            textLabel.text = final.ToString();

            if (EventDelegate.IsValid(onChange))
            {
                EventDelegate.Execute(onChange);
            }
        }
    }
コード例 #28
0
    private void Awake()
    {
        UIButton component = base.GetComponent <UIButton>();

        if (component != null)
        {
            this.dragHighlight = component.dragHighlight;
        }
        if (this.eventReceiver != null && EventDelegate.IsValid(this.onFinished))
        {
            this.eventReceiver    = null;
            this.callWhenFinished = null;
        }
    }
コード例 #29
0
    private void Awake()
    {
        UIButton component = GetComponent <UIButton>();

        if (component != null)
        {
            dragHighlight = component.dragHighlight;
        }
        if (eventReceiver != null && EventDelegate.IsValid(onFinished))
        {
            eventReceiver    = null;
            callWhenFinished = null;
        }
    }
コード例 #30
0
ファイル: UIPlayAnimation.cs プロジェクト: ArtReeX/memoria
    private void Awake()
    {
        UIButton component = base.GetComponent <UIButton>();

        if (component != (UnityEngine.Object)null)
        {
            this.dragHighlight = component.dragHighlight;
        }
        if (this.eventReceiver != (UnityEngine.Object)null && EventDelegate.IsValid(this.onFinished))
        {
            this.eventReceiver    = (GameObject)null;
            this.callWhenFinished = (String)null;
        }
    }