当前位置: 首页>>代码示例>>C#>>正文


C# CCControlState类代码示例

本文整理汇总了C#中CCControlState的典型用法代码示例。如果您正苦于以下问题:C# CCControlState类的具体用法?C# CCControlState怎么用?C# CCControlState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CCControlState类属于命名空间,在下文中一共展示了CCControlState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetBackgroundSpriteFrameForState

        /**
     * Sets the background spriteFrame to use for the specified button state.
     *
     * @param spriteFrame The background spriteFrame to use for the specified state.
     * @param state The state that uses the specified image. The values are described
     * in "CCControlState".
     */

        public virtual void SetBackgroundSpriteFrameForState(CCSpriteFrame spriteFrame, CCControlState state)
        {
            CCScale9Sprite sprite = new CCScale9SpriteFrame(spriteFrame);
            SetBackgroundSpriteForState(sprite, state);
        }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:13,代码来源:CCControlButton.cs

示例2: GetBackgroundSpriteForState

        /**
    * Returns the background sprite used for a state.
    *
    * @param state The state that uses the background sprite. Possible values are
    * described in "CCControlState".
    */

        public virtual CCScale9Sprite GetBackgroundSpriteForState(CCControlState state)
        {
            CCScale9Sprite backgroundSprite;
            if (m_backgroundSpriteDispatchTable.TryGetValue(state, out backgroundSprite))
            {
                return backgroundSprite;
            }
            if (m_backgroundSpriteDispatchTable.TryGetValue(CCControlState.Normal, out backgroundSprite))
            {
                return backgroundSprite;
            }
            return null;
        }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:20,代码来源:CCControlButton.cs

示例3: SetBackgroundSpriteForState

        /**
        * Sets the background sprite to use for the specified button state.
        *
        * @param sprite The background sprite to use for the specified state.
        * @param state The state that uses the specified image. The values are described
        * in "CCControlState".
        */

        public virtual void SetBackgroundSpriteForState(CCScale9Sprite sprite, CCControlState state)
        {
            CCSize oldPreferredSize = m_preferredSize;

            CCScale9Sprite previousBackgroundSprite;
            if (m_backgroundSpriteDispatchTable.TryGetValue(state, out previousBackgroundSprite))
            {
                RemoveChild(previousBackgroundSprite, true);
                m_backgroundSpriteDispatchTable.Remove(state);
            }

            m_backgroundSpriteDispatchTable.Add(state, sprite);
            sprite.Visible = false;
            sprite.AnchorPoint = new CCPoint(0.5f, 0.5f);
            AddChild(sprite);

            if (m_preferredSize.Width != 0 || m_preferredSize.Height != 0)
            {
                if (oldPreferredSize.Equals(m_preferredSize))
                {
                    // Force update of preferred size
                    sprite.PreferredSize = new CCSize(oldPreferredSize.Width + 1, oldPreferredSize.Height + 1);
                }

                sprite.PreferredSize = m_preferredSize;
            }

            // If the current state if equal to the given state we update the layout
            if (State == state)
            {
                NeedsLayout();
            }
        }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:41,代码来源:CCControlButton.cs

示例4: SetTitleBmFontForState

        /**
     * Sets the font of the label, changes the label to a CCLabelBMFont if neccessary.
     * @param fntFile The name of the font to change to
     * @param state The state that uses the specified fntFile. The values are described
     * in "CCControlState".
     */

        public virtual void SetTitleBmFontForState(string fntFile, CCControlState state)
        {
            string title = GetTitleForState(state);
            if (title == null)
            {
                title = String.Empty;
            }
            SetTitleLabelForState(new CCLabelBMFont(title, fntFile), state);
        }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:16,代码来源:CCControlButton.cs

示例5: GetTitleBmFontForState

 public virtual string GetTitleBmFontForState(CCControlState state)
 {
     var label = (ICCLabelProtocol) GetTitleLabelForState(state);
     var labelBmFont = label as CCLabelBMFont;
     if (labelBmFont != null)
     {
         return labelBmFont.FntFile;
     }
     return String.Empty;
 }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:10,代码来源:CCControlButton.cs

示例6: SetTitleTtfSizeForState

 public virtual void SetTitleTtfSizeForState(float size, CCControlState state)
 {
     var label = (ICCLabelProtocol) GetTitleLabelForState(state);
     if (label != null)
     {
         var labelTtf = label as CCLabelTTF;
         if (labelTtf != null)
         {
             labelTtf.FontSize = size;
         }
     }
 }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:12,代码来源:CCControlButton.cs

示例7: GetTitleTtfSizeForState

 public virtual float GetTitleTtfSizeForState(CCControlState state)
 {
     var labelTtf = GetTitleLabelForState(state) as CCLabelTTF;
     if (labelTtf != null)
     {
         return labelTtf.FontSize;
     }
     return 0;
 }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:9,代码来源:CCControlButton.cs

示例8: SetTitleLabelForState

        /**
    * Sets the title label to use for the specified state.
    * If a property is not specified for a state, the default is to use
    * the CCButtonStateNormal value.
    *
    * @param title The title label to use for the specified state.
    * @param state The state that uses the specified title. The values are described
    * in "CCControlState".
    */

        public virtual void SetTitleLabelForState(CCNode titleLabel, CCControlState state)
        {
            CCNode previousLabel;
            if (m_titleLabelDispatchTable.TryGetValue(state, out previousLabel))
            {
                RemoveChild(previousLabel, true);
                m_titleLabelDispatchTable.Remove(state);
            }

            m_titleLabelDispatchTable.Add(state, titleLabel);
            titleLabel.Visible = false;
            titleLabel.AnchorPoint = new CCPoint(0.5f, 0.5f);
            AddChild(titleLabel, 1);

            // If the current state if equal to the given state we update the layout
            if (State == state)
            {
                NeedsLayout();
            }
        }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:30,代码来源:CCControlButton.cs

示例9: GetTitleTtfForState

 public virtual string GetTitleTtfForState(CCControlState state)
 {
     var label = (ICCLabelProtocol) GetTitleLabelForState(state);
     var labelTtf = label as CCLabelTTF;
     if (labelTtf != null)
     {
         return labelTtf.FontName;
     }
     return String.Empty;
 }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:10,代码来源:CCControlButton.cs

示例10: SetTitleColorForState

        /**
    * Sets the color of the title to use for the specified state.
    *
    * @param color The color of the title to use for the specified state.
    * @param state The state that uses the specified color. The values are described
    * in "CCControlState".
    */

        public virtual void SetTitleColorForState(CCColor3B color, CCControlState state)
        {
            if (m_titleColorDispatchTable.ContainsKey(state))
            {
                m_titleColorDispatchTable.Remove(state);
            }

            m_titleColorDispatchTable.Add(state, color);

            // If the current state if equal to the given state we update the layout
            if (State == state)
            {
                NeedsLayout();
            }
        }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:23,代码来源:CCControlButton.cs

示例11: GetTitleLabelForState

        /**
    * Returns the title label used for a state.
    *
    * @param state The state that uses the title label. Possible values are described
    * in "CCControlState".
    */

        public virtual CCNode GetTitleLabelForState(CCControlState state)
        {
            CCNode titleLabel;
            if (m_titleLabelDispatchTable.TryGetValue(state, out titleLabel))
            {
                return titleLabel;
            }
            if (m_titleLabelDispatchTable.TryGetValue(CCControlState.Normal, out titleLabel))
            {
                return titleLabel;
            }
            return null;
        }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:20,代码来源:CCControlButton.cs

示例12: GetTitleColorForState

        /**
    * Returns the title color used for a state.
    *
    * @param state The state that uses the specified color. The values are described
    * in "CCControlState".
    *
    * @return The color of the title for the specified state.
    */

        public virtual CCColor3B GetTitleColorForState(CCControlState state)
        {
            if (m_titleColorDispatchTable != null)
            {
                CCColor3B color;

                if (m_titleColorDispatchTable.TryGetValue(state, out color))
                {
                    return color;
                }

                if (m_titleColorDispatchTable.TryGetValue(CCControlState.Normal, out color))
                {
                    return color;
                }
            }
            return CCTypes.CCWhite;
        }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:27,代码来源:CCControlButton.cs

示例13: SetTitleForState

        /**
    * Sets the title string to use for the specified state.
    * If a property is not specified for a state, the default is to use
    * the CCButtonStateNormal value.
    *
    * @param title The title string to use for the specified state.
    * @param state The state that uses the specified title. The values are described
    * in "CCControlState".
    */

        public virtual void SetTitleForState(string title, CCControlState state)
        {
            if (m_titleDispatchTable.ContainsKey(state))
            {
                m_titleDispatchTable.Remove(state);
            }

            if (!String.IsNullOrEmpty(title))
            {
                m_titleDispatchTable.Add(state, title);
            }

            // If the current state if equal to the given state we update the layout
            if (State == state)
            {
                NeedsLayout();
            }
        }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:28,代码来源:CCControlButton.cs

示例14: GetTitleForState

        /**
        * Returns the title used for a state.
        *
        * @param state The state that uses the title. Possible values are described in
        * "CCControlState".
        *
        * @return The title for the specified state.
        */

        public virtual string GetTitleForState(CCControlState state)
        {
            if (m_titleDispatchTable != null)
            {
                string title;
                if (m_titleDispatchTable.TryGetValue(state, out title))
                {
                    return title;
                }
                if (m_titleDispatchTable.TryGetValue(CCControlState.Normal, out title))
                {
                    return title;
                }
            }
            return String.Empty;
        }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:25,代码来源:CCControlButton.cs

示例15: Init

        public override bool Init()
        {
            if (base.Init())
            {
                //this->setTouchEnabled(true);
                //m_bIsTouchEnabled=true;
                // Initialise instance variables
                m_eState = CCControlState.Normal;
                Enabled = true;
                Selected = false;
                Highlighted = false;

                // Set the touch dispatcher priority by default to 1
                DefaultTouchPriority = 1;
                // Initialise the tables
                m_pDispatchTable = new Dictionary<CCControlEvent, RawList<CCInvocation>>();
                return true;
            }
            return false;
        }
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:20,代码来源:CCControl.cs


注:本文中的CCControlState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。