本文整理汇总了C#中MenuButton.handler方法的典型用法代码示例。如果您正苦于以下问题:C# MenuButton.handler方法的具体用法?C# MenuButton.handler怎么用?C# MenuButton.handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuButton
的用法示例。
在下文中一共展示了MenuButton.handler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawGUI
// Totally overried draing of window so the buttons can have pictures
public override void DrawGUI()
{
if(childMenu != null) {
childMenu.DrawGUI();
}
if(!bIsOpen) {
return;
}
GUI.BeginGroup(panel);
GUI.DrawTexture(new Rect(0.0f, 0.0f, panel.width, panel.height), panelBackground);
GUI.Label(new Rect(10.0f, 15.0f, panel.width, panel.height), panelName);
Rect buttonRect = new Rect(10.0f, 35.0f, buttonWidth, 25.0f);
const float buttonOffset = 5.0f;
MenuButton selectedButton = new MenuButton("", null);
bool bMadeSelection = false;
foreach(MenuButton buttonOption in options) {
// Cache which button was pressed, because the handler may modiy the options list
if(GUI.Button(buttonRect, buttonOption.text)) {
selectedButton = buttonOption;
bMadeSelection = true;
break;
}
// Draw the description of the button next to it
GUI.Label(new Rect(buttonRect.x + buttonRect.width + 25.0f, buttonRect.y, panel.width, panel.height), buttonOption.info);
buttonRect.y += buttonRect.height + buttonOffset;
}
// If a selection is made, call the handler
if(bMadeSelection) {
selectedButton.handler(selectedButton);
}
GUI.EndGroup();
}