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


C# UIButton.GetComponent方法代码示例

本文整理汇总了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();
	}
开发者ID:stevesolomon,项目名称:MicroDungeonPrototype,代码行数:46,代码来源:MonsterGUIManager.cs

示例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;
            }
        }
开发者ID:Katalyst6,项目名称:CSL.TransitAddonMod,代码行数:66,代码来源:Notification.cs


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