本文整理汇总了C#中UnityEngine.UI.Button类的典型用法代码示例。如果您正苦于以下问题:C# Button类的具体用法?C# Button怎么用?C# Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Button类属于UnityEngine.UI命名空间,在下文中一共展示了Button类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Awake
void Awake()
{
Transform PanelMessageContainer0 = transform.FindChild("PanelMessageContainer");
messageContainer = PanelMessageContainer0.GetComponent<RectTransform>();
Transform PanelSystemContainer00 = PanelMessageContainer0.FindChild("PanelSystemContainer");
systemContainer = PanelSystemContainer00.GetComponent<RectTransform>();
Transform PanelSystemRichEdit000 = PanelSystemContainer00.FindChild("PanelSystemRichEdit");
systemRichEdit = PanelSystemRichEdit000.GetComponent<RectTransform>();
Transform PanelChatContainer01 = PanelMessageContainer0.FindChild("PanelChatContainer");
chatContainer = PanelChatContainer01.GetComponent<RectTransform>();
Transform PanelChatRichEdit010 = PanelChatContainer01.FindChild("PanelChatRichEdit");
chatRichEdit = PanelChatRichEdit010.GetComponent<RectTransform>();
Transform PanelChatButtonContainer011 = PanelChatContainer01.FindChild("PanelChatButtonContainer");
chatButtonContainer = PanelChatButtonContainer011.GetComponent<RectTransform>();
Transform InputFieldChat0110 = PanelChatButtonContainer011.FindChild("InputFieldChat");
Transform TextChatInputText01100 = InputFieldChat0110.FindChild("ChatInputText");
chatInputText = TextChatInputText01100.GetComponent<Text>();
Transform ButtonChatFace0111 = PanelChatButtonContainer011.FindChild("ButtonChatFace");
buttonChatFace = ButtonChatFace0111.GetComponent<Button>();
buttonChatFace.onClick.AddListener(OnButtonChatFaceClicked);
Transform ButtonSend0112 = PanelChatButtonContainer011.FindChild("ButtonSend");
buttonSend = ButtonSend0112.GetComponent<Button>();
buttonSend.onClick.AddListener(OnButtonSendClicked);
Transform PanelMainButtonContainer1 = transform.FindChild("PanelMainButtonContainer");
mainButtonContainer = PanelMainButtonContainer1.GetComponent<RectTransform>();
Transform ButtonSystem10 = PanelMainButtonContainer1.FindChild("ButtonSystem");
buttonSystem = ButtonSystem10.GetComponent<Button>();
buttonSystem.onClick.AddListener(OnButtonSystemClicked);
Transform ButtonChat11 = PanelMainButtonContainer1.FindChild("ButtonChat");
buttonChat = ButtonChat11.GetComponent<Button>();
buttonChat.onClick.AddListener(OnButtonChatClicked);
}
开发者ID:ideadreamDefy,项目名称:Defy,代码行数:35,代码来源:ChatBoxControl.cs
示例2: EnableButton
// Use this for initialization
public void EnableButton()
{
ThisButton = gameObject.AddComponent<UnityEngine.UI.Button>();
ThisButton.transition = Selectable.Transition.None;
ThisButton.onClick.RemoveAllListeners();
ThisButton.onClick.AddListener( () => OnAClick() );
}
开发者ID:CloudyIce,项目名称:violet-light,代码行数:8,代码来源:StartButton.cs
示例3: Awake
// Use this for initialization
void Awake() {
if (instance != null && instance != this) {
// If that is the case, we destroy other instances
Destroy(gameObject);
}
if (instance == null) {
instance = this;
mainPanel = transform.Find("MainPanel").gameObject;
settingsPanel = transform.Find("Settings").gameObject;
controlsPanel = transform.Find("ControlsPanel").gameObject;
menuConfirmPanel = transform.Find("MenuConfirm").gameObject;
desktopConfirmPanel = transform.Find("DesktopConfirm").gameObject;
background = transform.Find("Background").gameObject;
resumeButton = transform.Find("MainPanel/ResumeButton").GetComponent<UnityEngine.UI.Button>();
settingsButton = transform.Find("MainPanel/SettingsButton").GetComponent<UnityEngine.UI.Button>();
controlsButton = transform.Find("MainPanel/ControlsButton").GetComponent<UnityEngine.UI.Button>();
menuButton = transform.Find("MainPanel/MenuButton").GetComponent<UnityEngine.UI.Button>();
quitButton = transform.Find("MainPanel/QuitButton").GetComponent<UnityEngine.UI.Button>();
settingsBackButton = transform.Find("Settings/BackButton").GetComponent<UnityEngine.UI.Button>();
controlsBackButton = transform.Find("ControlsPanel/BackButton").GetComponent<UnityEngine.UI.Button>();
/*
controlsKeyboardButton = transform.Find("ControlsPanel/KeyboardButton").GetComponent<UnityEngine.UI.Button>();
controlsPadButton = transform.Find("ControlsPanel/PadButton").GetComponent<UnityEngine.UI.Button>();
*/
}
}
开发者ID:ForsakenGS,项目名称:LostKids,代码行数:32,代码来源:PausePanel.cs
示例4: Start
private void Start()
{
gridRect = GetComponentInParent<RectTransform>();
gridCanvas = GetComponentInParent<Canvas>();
gridLayout = GetComponentInParent<GridLayoutGroup>();
gridRect.pivot = new Vector2(0, 0);
gridRect.position = new Vector3(terrainMesh.transform.position.x, 6.0f, terrainMesh.transform.position.z);
gridRect.anchorMin = new Vector2(terrainMesh.transform.position.x, terrainMesh.transform.position.z);
gridRect.anchorMax = new Vector2(terrainMesh.terrainData.size.x, terrainMesh.terrainData.size.z);
gridLayout.CalculateLayoutInputHorizontal();
Debug.Log(string.Format("Origin: {0}, Size: {1}, Cell size: {2}\n", gridRect.position.ToString(), gridRect.rect.size.ToString(), gridLayout.cellSize));
buttonTemplate = GetComponentInChildren<Button>();
for (int y = 0; y < gridRect.rect.y; y++)
{
for (int x = 0; x < gridRect.rect.x; x++)
{
Vector3 pos = new Vector3(x, 0, y); // * spacing;
Button b = (Button)Instantiate(buttonTemplate, pos, Quaternion.identity);
//b.gameObject.AddComponent<LayoutElement>();
//b.name = "Button " + x.ToString() + "," + y.ToString();
//b.GetComponentInChildren<Text>().text = b.name;
gridLayout.SetLayoutHorizontal();
}
}
}
开发者ID:LowEnergyCycle,项目名称:TUBSCOM,代码行数:30,代码来源:CombatGrid.cs
示例5: OnStateEnter
override public void OnStateEnter(Animator animator, AnimatorStateInfo animatorStateInfo, int layerIndex)
{
if (firstField == null)
{
var firstFieldTransform = animator.transform.Find(firstFieldPath);
if (firstFieldTransform != null)
{
firstField = firstFieldTransform.GetComponent<InputField>();
}
}
if (submitButton == null)
{
var submitButtonTransform = animator.transform.Find(submitButtonPath);
if (submitButtonTransform != null)
{
submitButton = submitButtonTransform.GetComponent<Button>();
}
}
if (firstField != null)
{
firstField.Select();
}
}
开发者ID:ttesla,项目名称:gj-unity-api,代码行数:25,代码来源:KeyboardNavigableForm.cs
示例6: Awake
public override void Awake()
{
base.Awake();
if (gameObject.transform is RectTransform)
{
var input = gameObject.GetComponent<InputField>();
if (input != null)
{
input.onEndEdit.AddListener((text)=> OnClick());
return;
}
button = GetComponent<UnityEngine.UI.Button>();
if (button == null)
{
if (GetComponent<UnityEngine.UI.Toggle>() == null)
{
button = gameObject.AddComponent<UnityEngine.UI.Button>();
button.interactable = true;
button.transition = Selectable.Transition.None;
}
}
if (button != null && button.onClick.GetPersistentEventCount() == 0)
{
button.onClick.AddListener(OnClick);
}
}
}
开发者ID:StarkTT,项目名称:TestTask,代码行数:29,代码来源:NguiOnClickBinding.cs
示例7: Start
// Use this for initialization
void Start()
{
if (this.player == null)
return;
this.stats_panel = transform.Find("Stats").gameObject;
this.undefined_panel = transform.Find("Undefined").gameObject;
this.name_text = transform.Find("Name").GetComponent<Text>();
this.defi_text = transform.Find("Defi").Find("Text").GetComponent<Text>();
this.name_text.text = this.player.Name;
this.defi_text.text = "Defi";
//this.manager = GameObject.Find("Manager").GetComponent<PhiManager>();
InstantiateSwungMen();
SetUpStats();
this.buy = transform.Find("Buy").GetComponent<Button>();
this.unlocked = Settings.Instance.Default_player.ContainsKey(this.player.UID);
if (this.unlocked)
{
this.undefined_panel.SetActive(false);
BoughtButton();
}
else
{
this.swungMen.SetActive(false);
}
}
开发者ID:CanPayU,项目名称:SuperSwungBall,代码行数:28,代码来源:ChallengeController.cs
示例8: CopyButton
public void CopyButton(MenuButton _element)
{
uiButton = _element.uiButton;
uiText = _element.uiText;
label = _element.label;
hotspotLabel = _element.hotspotLabel;
hotspotLabelID = _element.hotspotLabelID;
anchor = _element.anchor;
textEffects = _element.textEffects;
buttonClickType = _element.buttonClickType;
simulateInput = _element.simulateInput;
simulateValue = _element.simulateValue;
doFade = _element.doFade;
switchMenuTitle = _element.switchMenuTitle;
inventoryBoxTitle = _element.inventoryBoxTitle;
shiftInventory = _element.shiftInventory;
loopJournal = _element.loopJournal;
actionList = _element.actionList;
inputAxis = _element.inputAxis;
clickTexture = _element.clickTexture;
clickAlpha = _element.clickAlpha;
shiftAmount = _element.shiftAmount;
onlyShowWhenEffective = _element.onlyShowWhenEffective;
allowContinuousClick = _element.allowContinuousClick;
parameterID = _element.parameterID;
parameterValue = _element.parameterValue;
base.Copy (_element);
}
开发者ID:IJkeB,项目名称:Ekster_Final,代码行数:29,代码来源:MenuButton.cs
示例9: Start
void Start()
{
button = GetComponent<UnityEngine.UI.Button>();
text = GetComponentInChildren<Text>();
canvasGroup = GetComponent<CanvasGroup>();
normalGlow = glow.color;
}
开发者ID:wx3,项目名称:galacdecks,代码行数:7,代码来源:EndTurnButton.cs
示例10: Start
void Start()
{
quitMenu = quitMenu.GetComponent<Canvas>();
quitMenu.enabled = false;
startText = startText.GetComponent<Button>();
exitText = exitText.GetComponent<Button>();
}
开发者ID:TKey530,项目名称:ProjectYore,代码行数:7,代码来源:MainMenu.cs
示例11: SetEnabled
public void SetEnabled(Button button, bool enabled)
{
if (enabled)
Enable(button);
else
Disable(button);
}
开发者ID:Magicolo,项目名称:PseudoFramework,代码行数:7,代码来源:UISkin.cs
示例12: Start
// Use this for initialization
private void Start()
{
this.unlocked = false;
// fuck compiler warnings :D
if (this.unlocked) { }
this.upgraded = false;
this.upgradeName = this.GetComponentInChildren<Text>();
this.unlockButton = this.GetComponent<Button>();
this.unlockButton.image.sprite = this.regularImg;
this.upgrade = this.upgradeObj.GetComponent<IUpgrade>();
this.upgradeName.text = this.upgrade.Name;
foreach (Skill s in this.requiredSkills)
{
s.unlockSkill = this;
//_RequiredUnlocks += 1;
}
if (this.requiredSkills.Length != 0)
{
this.unlockButton.image.sprite = this.lockedImg;
this.unlockButton.interactable = false;
}
}
开发者ID:SHEePYTaGGeRNeP,项目名称:ProftaakMobileGDT,代码行数:29,代码来源:Skill.cs
示例13: Start
void Start()
{
HeaderText = this.GetComponentsInChildren<Text>().First(t => t.name == "headertext");
HeaderText.text = Card.Name;
PlayButton = this.GetComponentsInChildren<Button>().First(i => i.name == "PlayButton");
PlayButton.onClick.AddListener(HandleClick);
}
开发者ID:rickbatka,项目名称:birds,代码行数:7,代码来源:CardController.cs
示例14: Awake
public void Awake()
{
_button = GetComponent<Button>();
IsInteractable = _button.interactable;
StateChanged();
}
开发者ID:osangar88,项目名称:GameFramework,代码行数:7,代码来源:SyncState.cs
示例15: ButtonObject
public ButtonObject(string buttonImageFileName, string text, Action onClick)
{
Go = Resources.Load(Settings.Instance.PREFAB_PATH + "Button") as GameObject;
// Go.SetActive(false);
Go = GameObject.Instantiate<GameObject>(Go);
_image = Go.GetComponent<Image>();
Sprite sprite = Resources.Load<Sprite>(Settings.Instance.UI_IMAGE_PATH + buttonImageFileName);
if (_image && sprite)
{
_image.sprite = sprite;
}
else
{
Debug.Log("Do not find image file");
}
_text = Go.GetComponentInChildren<Text>();
_text.text = text;
_button = Go.GetComponent<Button>();
if(_button)
{
_button.onClick.AddListener(new UnityEngine.Events.UnityAction(onClick));
}
}
开发者ID:weimingtom,项目名称:SVNovelEngine,代码行数:28,代码来源:ButtonObject.cs
示例16: Awake
void Awake()
{
_uiText_GameTime = GameObject.Find("Text_GameTime").GetComponent<Text>();
_uiText_OrbitalJumps = GameObject.Find("Text_OrbitalJumps").GetComponent<Text>();
_uiButton_Continue = GameObject.Find("Btn_Continue").GetComponent<Button>();
_uiButton_Continue.onClick.AddListener(HideCompleteLevelMenu);
}
开发者ID:ai-ry,项目名称:orbit,代码行数:8,代码来源:LevelUI.cs
示例17: UISlot
/**
* The default Constructor.
*/
public UISlot()
{
uiButton = null;
uiButtonID = 0;
uiText = null;
uiImage = null;
sprite = null;
}
开发者ID:mcbodge,项目名称:eidolon,代码行数:11,代码来源:UISlot.cs
示例18: Awake
void Awake()
{
_win = this.GetComponent<Canvas>();
_label = this.GetComponentInChildren<Text>();
_win.enabled = false;
_yes = GameObject.Find("Yes").GetComponent<Button>();
}
开发者ID:sabrinagreenlee,项目名称:JaneBound,代码行数:8,代码来源:ConfirmationWindow.cs
示例19: SetUpElementProperties
public override void SetUpElementProperties ()
{
base.SetUpElementProperties ();
if (button == null) {
button = gameObject.GetComponent<Button> ();
}
rectTransform.sizeDelta = new Vector2 (140, 20);
}
开发者ID:DanishKizilbash,项目名称:Cosmos4X,代码行数:8,代码来源:ButtonElement.cs
示例20: Start
// Use this for initialization
void Start () {
audioSource = gameObject.AddComponent<AudioSource>();
button = GetComponent<Button>();
// button.onClick.AddListener ( () => {ClickSound();});
}
开发者ID:Kundara,项目名称:project1,代码行数:9,代码来源:ButtonSounds.cs
注:本文中的UnityEngine.UI.Button类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论