本文整理汇总了C#中UIButton.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# UIButton.GetComponent方法的具体用法?C# UIButton.GetComponent怎么用?C# UIButton.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIButton
的用法示例。
在下文中一共展示了UIButton.GetComponent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
monsterScrollList = GameObject.Find("MonsterScrollList").GetComponent<UIScrollList>();
statsPanel = GameObject.Find("MonsterInfoPanel").GetComponent<UIPanel>();
magnitudeBar = statsPanel.transform.FindChild("damage").FindChild("damageBar").GetComponent<UIProgressBar>();
attackSpeedBar = statsPanel.transform.FindChild("attackSpeed").FindChild("attackSpeedBar").GetComponent<UIProgressBar>();
attackRangeBar = statsPanel.transform.FindChild("range").FindChild("rangeBar").GetComponent<UIProgressBar>();
movementSpeedBar = statsPanel.transform.FindChild("moveSpeed").FindChild("moveSpeedBar").GetComponent<UIProgressBar>();
healthBar = statsPanel.transform.FindChild("health").FindChild("healthBar").GetComponent<UIProgressBar>();
spawnRate = statsPanel.transform.FindChild("spawnRate").GetComponent<SpriteText>();
monsterName = statsPanel.transform.FindChild("name").GetComponent<SpriteText>();
monsterSprite = statsPanel.transform.FindChild("sprite").GetComponent<tk2dSprite>();
goldCost = statsPanel.transform.FindChild("goldCost").GetComponent<SpriteText>();
confirmButton = statsPanel.transform.FindChild("okayButton").GetComponent<UIButton>();
confirmButtonImage = confirmButton.GetComponent<tk2dSprite>();
monsterSaleConfirmationPanel = GameObject.Find("SellConfirmationPanel").GetComponent<UIPanel>();
monsterSaleConfirmButton = monsterSaleConfirmationPanel.transform.FindChild("okayButton").GetComponent<UIButton>();
monsterSaleCancelButton = monsterSaleConfirmationPanel.transform.FindChild("cancelButton").GetComponent<UIButton>();
monsterSaleConfirmButton.scriptWithMethodToInvoke = this;
monsterSaleCancelButton.scriptWithMethodToInvoke = this;
monsterSaleConfirmButton.methodToInvoke = "MonsterSaleConfirmed";
monsterSaleCancelButton.methodToInvoke = "MonsterSaleCancelled";
scrollListCamera = monsterScrollList.renderCamera;
levelManager = GameObject.Find("LevelManager").GetComponent<LevelManager>();
listPanel = GameObject.Find("MonsterSelectionPanel").GetComponent<UIPanel>();
Transform attackEffectParent = GameObject.Find("attackEffectIcons").transform.FindChild("icons");
actionEffectIcons = attackEffectParent.GetComponentsInChildren<tk2dSprite>();
if (playerStatusManager == null)
playerStatusManager = GameObject.Find("PlayerStatusManager").GetComponent<PlayerStatusManager>();
entityFactory = EntityFactory.GetInstance();
monsterSelectedCallback = null;
LoadMonsterScrollPanel();
}
示例2: InitPanel
public virtual bool InitPanel()
{
try
{
// Get Title
_title = transform.Find("Caption").GetComponent<UILabel>();
// Get Description
_description = transform.Find("Scrollable Panel/Message").GetComponent<UILabel>();
// Remove Close Button
GameObject.Destroy(transform.Find("Caption/Close").gameObject);
// Hide scrollbar
_scrollbar = transform.Find("Scrollbar").GetComponent<UIScrollbar>();
_scrollbar.opacity = 0;
// Change Dont show text
_dontShowAgainCheckbox = transform.Find("DontShow").GetComponent<UICheckBox>();
transform.Find("DontShow/OnOff").GetComponent<UILabel>().text = "Don't show on future updates";
// Change ok to Options
_okButton = transform.Find("Ok").GetComponent<UIButton>();
GameObject.Destroy(_okButton.GetComponent<BindEvent>());
// Change cancel to Later
_cancelButton = transform.Find("Cancel").GetComponent<UIButton>();
GameObject.Destroy(_cancelButton.GetComponent<BindEvent>());
// Get fireworks
ParadoxUnlockPanel paradoxPanel = UIView.GetAView().GetComponentInChildren<ParadoxUnlockPanel>();
if (paradoxPanel != null)
{
m_fireworks = paradoxPanel.m_Fireworks;
if (m_fireworks != null)
{
Renderer[] componentsInChildren = this.m_fireworks.GetComponentsInChildren<Renderer>();
m_fireworkMaterials = new Material[componentsInChildren.Length];
for (int i = 0; i < componentsInChildren.Length; ++i)
{
m_fireworkMaterials[i] = componentsInChildren[i].material;
}
}
}
// Add panel to dynamic panels library
this.name = this.GetType().Name;
UIDynamicPanels.DynamicPanelInfo panelInfo = new UIDynamicPanels.DynamicPanelInfo();
typeof(UIDynamicPanels.DynamicPanelInfo).GetFieldByName("m_Name").SetValue(panelInfo, this.name);
typeof(UIDynamicPanels.DynamicPanelInfo).GetFieldByName("m_PanelRoot").SetValue(panelInfo, this.GetComponent<UIPanel>());
typeof(UIDynamicPanels.DynamicPanelInfo).GetFieldByName("m_IsModal").SetValue(panelInfo, true);
panelInfo.viewOwner = UIView.GetAView();
panelInfo.AddInstance(this.GetComponent<UIPanel>());
Dictionary<string, UIDynamicPanels.DynamicPanelInfo> cachedPanels = typeof(UIDynamicPanels).GetFieldByName("m_CachedPanels").GetValue(UIView.library) as Dictionary<string, UIDynamicPanels.DynamicPanelInfo>;
if (!cachedPanels.ContainsKey(panelInfo.name))
cachedPanels.Add(panelInfo.name, panelInfo);
return true;
}
catch (Exception)
{
// TODO: log error
return false;
}
}