• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CCControlState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Init

        public override bool Init()
        {
            if (base.Init())
            {
                _state = CCControlState.Normal;
                Enabled = true;
                Selected = false;
                Highlighted = false;

                TouchMode = CCTouchMode.OneByOne; // So we use a targeted delegate.
                // Initialise the tables
                _dispatchTable = new Dictionary<CCControlEvent, CCRawList<CCInvocation>>();
                return true;
            }
            return false;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:16,代码来源:CCControl.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CCEvent类代码示例发布时间:2022-05-24
下一篇:
C# CCControlEvent类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap