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


C# UIButton.Disable方法代码示例

本文整理汇总了C#中UIButton.Disable方法的典型用法代码示例。如果您正苦于以下问题:C# UIButton.Disable方法的具体用法?C# UIButton.Disable怎么用?C# UIButton.Disable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIButton的用法示例。


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

示例1: Start

        public override void Start()
        {
            base.Start ();
            Debug.PrintMessage ("Start");
            this.size = new Vector2 (WIDTH, HEIGHT);
            this.backgroundSprite = "MenuPanel";
            this.canFocus = true;
            this.isInteractive = true;
            this.BringToFront ();
            this.relativePosition = new Vector3 (50, 50);
            this.Show ();
            this.cachedName = cacheName;

            m_challengePanel = (ChallengePanel) this.GetUIView ().AddUIComponent (typeof(ChallengePanel));
            Debug.PrintMessage("Start() - Does ChallengePanel Exists? " + (m_challengePanel != null).ToString());
            m_challengePanel.manager = this;
            m_challengePanel.OnChallengeStarted += () => {m_selectButton.Disable ();};
            m_challengePanel.OnChallengeEnded += () => {m_selectButton.Enable ();};

            m_challengePanel.Hide ();

            m_title = this.AddUIComponent<UILabel> ();
            m_title.text = "CHALLENGES OPTIONS";
            m_title.relativePosition = new Vector3 (WIDTH / 2 - m_title.width / 2, HEAD / 2 - m_title.height / 2);
            m_title.textAlignment = UIHorizontalAlignment.Center;

            m_dragHandle = this.AddUIComponent<UIDragHandle> ();
            m_dragHandle.size = new Vector2(WIDTH,HEIGHT);
            m_dragHandle.relativePosition = Vector3.zero;
            m_dragHandle.target = this;

            m_closeButton = this.AddUIComponent<UIButton> ();
            m_closeButton.normalBgSprite = "buttonclose";
            m_closeButton.hoveredBgSprite = "buttonclosehover";
            m_closeButton.pressedBgSprite = "buttonclosepressed";
            m_closeButton.relativePosition = new Vector3 (WIDTH - 35, 5,10);
            m_closeButton.eventClick += (component, eventParam) => {
                this.Hide();
            };

            m_challengeListPanel = this.AddUIComponent<UIPanel> ();
            m_challengeListPanel.size = new Vector2 (LIST_PANEL_WIDTH, LIST_PANEL_HEIGHT);
            m_challengeListPanel.relativePosition = new Vector3 (0, HEAD);

            m_challengeBrowser = m_challengeListPanel.AddUIComponent<UIListBox> ();
            m_challengeBrowser.size = new Vector2 (LIST_PANEL_WIDTH - SPACING * 2, LIST_PANEL_HEIGHT - SELECT_BUTTON_HEIGHT - SPACING * 2);
            m_challengeBrowser.relativePosition = new Vector3 (SPACING, SPACING);

            m_challengeBrowser.normalBgSprite = "GenericPanelDark";
            //m_challengeBrowser.bottomColor = Color.green;

            m_challengeBrowser.itemHighlight = "ListItemHighlight";
            m_challengeBrowser.itemHover = "ListItemHover";
            m_challengeBrowser.itemPadding.left = 10;
            m_challengeBrowser.itemPadding.top = 4;
            m_challengeBrowser.listPadding.top = 10;
            m_challengeBrowser.listPadding.bottom = 10;
            m_challengeBrowser.colorizeSprites = true;

            LoadChallenges ();

            m_selectButton = m_challengeListPanel.AddUIComponent<UIButton> ();
            m_selectButton.text = "START";
            m_selectButton.size = new Vector2 (LIST_PANEL_WIDTH - SPACING * 2, SELECT_BUTTON_HEIGHT - SPACING);
            m_selectButton.textScale = 1.25f;
            m_selectButton.textVerticalAlignment = UIVerticalAlignment.Middle;
            m_selectButton.textHorizontalAlignment = UIHorizontalAlignment.Center;
            m_selectButton.normalBgSprite = "ButtonMenu";
            m_selectButton.hoveredBgSprite = "ButtonMenuHovered";
            m_selectButton.pressedBgSprite = "ButtonMenuPressed";
            m_selectButton.disabledBgSprite = "ButtonMenuDisabled";
            m_selectButton.color = Color.green;
            m_selectButton.focusedColor = m_selectButton.color;
            m_selectButton.hoveredColor = m_selectButton.color;
            m_selectButton.pressedColor = m_selectButton.color;
            m_selectButton.relativePosition = new Vector3 (SPACING, LIST_PANEL_HEIGHT - SELECT_BUTTON_HEIGHT);
            m_selectButton.Disable ();
            m_selectButton.eventClick += ChallengeSelected;

            m_refresh = this.AddUIComponent<UIButton> ();
            m_refresh.size = new Vector2 (60,24);
            m_refresh.text = "Refresh";
            m_refresh.textScale = 0.875f;
            m_refresh.normalBgSprite = "ButtonMenu";
            m_refresh.hoveredBgSprite = "ButtonMenuHovered";
            m_refresh.pressedBgSprite = "ButtonMenuPressed";
            m_refresh.disabledBgSprite = "ButtonMenuDisabled";
            //m_refresh.color = new Color32(255,0,0,255);
            //m_refresh.focusedColor = m_refresh.color;
            //m_refresh.hoveredColor = m_refresh.color;
            //m_refresh.pressedColor = m_refresh.color;
            m_refresh.relativePosition = m_closeButton.relativePosition + new Vector3 (-60 -SPACING,6f);
            m_refresh.eventClick += (component, eventParam) => {LoadChallenges();};

            m_challengeDetailsPanel = this.AddUIComponent<UIPanel> ();
            m_challengeDetailsPanel.size = new Vector2 (WIDTH - LIST_PANEL_WIDTH, HEIGHT - HEAD);
            //m_challengeDetailsPanel.backgroundSprite = "GenericPanel";
            m_challengeDetailsPanel.relativePosition = new Vector3 (LIST_PANEL_WIDTH, HEAD);

            m_challengeName = m_challengeDetailsPanel.AddUIComponent<UILabel> ();
//.........这里部分代码省略.........
开发者ID:CWMlolzlz,项目名称:Challenges,代码行数:101,代码来源:ChallengeManagerPanel.cs

示例2: Start

        public override void Start()
        {
            base.Start ();
            Debug.PrintMessage ("Creating ChallengePanel");
            this.width = WIDTH;
            this.height = HEAD;
            if (m_challenge != null && m_challenge.Goals != null) { //covers case when the panel reassignes hieght to be head even with a challenge being loaded
                this.height = HEAD + GoalProgressPanel.SPACING + m_challenge.Goals.Length * (GoalProgressPanel.HEIGHT+GoalProgressPanel.SPACING);
            }
            this.backgroundSprite = "MenuPanel";
            this.Hide ();
            this.relativePosition = new Vector3 (10,GetUIView().fixedHeight - height - 135);

            m_titleLabel = this.AddUIComponent<UILabel> ();
            m_titleLabel.text = "Challenges";
            m_titleLabel.textScale = 1.25f;
            m_titleLabel.size = new Vector2 (WIDTH,HEAD);
            m_titleLabel.relativePosition = new Vector3(SPACING,SPACING);

            m_drag = this.AddUIComponent<UIDragHandle> ();
            m_drag.width = this.width;
            m_drag.height = HEAD;
            m_drag.relativePosition = new Vector3(0,0,10);
            m_drag.target = this;

            m_closeButton = this.AddUIComponent<UIButton> ();
            m_closeButton.size = new Vector2 (CLOSE_BUTTON_SIZE, CLOSE_BUTTON_SIZE);
            m_closeButton.normalBgSprite = "buttonclose";
            m_closeButton.hoveredBgSprite = "buttonclosehover";
            m_closeButton.pressedBgSprite = "buttonclosepressed";
            m_closeButton.relativePosition = new Vector3 (WIDTH - 3f - m_closeButton.width, 5);
            Debug.PrintMessage(m_closeButton.size);
            m_closeButton.eventClick += (component, eventParam) => {
                this.Hide ();
            };

            m_startButton = this.AddUIComponent<UIButton> ();
            m_startButton.size = new Vector2 (BUTTON_WIDTH,BUTTON_HEIGHT);
            m_startButton.text = "Start";
            m_startButton.textScale = 0.875f;
            m_startButton.normalBgSprite = "ButtonMenu";
            m_startButton.hoveredBgSprite = "ButtonMenuHovered";
            m_startButton.pressedBgSprite = "ButtonMenuPressed";
            m_startButton.disabledBgSprite = "ButtonMenuDisabled";
            m_startButton.color = Color.green;
            m_startButton.focusedColor = m_startButton.color;
            m_startButton.hoveredColor = m_startButton.color;
            m_startButton.pressedColor = m_startButton.color;
            m_startButton.relativePosition = m_closeButton.relativePosition + new Vector3 (-BUTTON_WIDTH -SPACING,6f);

            //m_startButton.eventClick += StartChallenge;
            m_startButton.Disable ();
            m_startButton.Hide ();

            m_endButton = this.AddUIComponent<UIButton> ();
            m_endButton.size = m_startButton.size;
            m_endButton.text = "Forfeit";
            m_endButton.textScale = 0.875f;
            m_endButton.normalBgSprite = "ButtonMenu";
            m_endButton.hoveredBgSprite = "ButtonMenuHovered";
            m_endButton.pressedBgSprite = "ButtonMenuPressed";
            m_endButton.disabledBgSprite = "ButtonMenuDisabled";
            m_endButton.color = new Color32(255,0,0,255);
            m_endButton.focusedColor = m_endButton.color;
            m_endButton.hoveredColor = m_endButton.color;
            m_endButton.pressedColor = m_endButton.color;
            m_endButton.relativePosition = m_startButton.relativePosition;
            m_endButton.eventClick += AskForfeit;
            //m_startButton.disabledColor = Color.gray;
            //m_endButton.Disable ();
            //m_endButton.Hide ();
        }
开发者ID:CWMlolzlz,项目名称:Challenges,代码行数:72,代码来源:ChallengePanel.cs


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