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


C# UIWindow.GetChildComponent方法代码示例

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


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

示例1: OnCreate

    public override void OnCreate()
    {
        base.OnCreate();

        m_heartUI = UIWindowManager.Singleton.CreateWindow<UIWindow>("UIMapHeart", UIWindowManager.Anchor.TopLeft);

        m_backGroundTrans = mUIObject.transform;
        
        m_stageBtns = new Transform[GlobalVars.TotalStageCount];

        GlobalVars.AvailabeStageCount = PlayerPrefs.GetInt("StageAvailableCount");
        if (GlobalVars.AvailabeStageCount == 0)
        {
            GlobalVars.AvailabeStageCount = 1;
        }
		GlobalVars.StageStarArray = PlayerPrefsExtend.GetIntArray("StageStars", 0, 100);
        GlobalVars.StageScoreArray = PlayerPrefsExtend.GetIntArray("StageScores", 0, 100);
		GlobalVars.StageFailedArray = PlayerPrefsExtend.GetIntArray("StageFailed", 0, 100);
        GlobalVars.LastStage = GlobalVars.AvailabeStageCount;
		
		if(!PlayerPrefs.HasKey("Coins"))
		{
			GlobalVars.Coins = 10;
			PlayerPrefs.SetInt("Coins", 0);
		}
		else
		{
			GlobalVars.Coins = PlayerPrefs.GetInt("Coins");
		}
		
		GlobalVars.PurchasedItemArray = PlayerPrefsExtend.GetIntArray("PurchasedItemArray", 0, 2);
		
		springPanel = mUIObject.AddComponent<SpringPanel>();
        UIPanel panel = mUIObject.GetComponent<UIPanel>();
        panel.baseClipRegion = new Vector4(0, 0, CapsApplication.Singleton.Width, CapsApplication.Singleton.Height);

        m_timeNumber = UIToolkits.FindChild(m_heartUI.mUIObject.transform, "TimeNumber").gameObject;
        m_fullText = UIToolkits.FindChild(m_heartUI.mUIObject.transform, "HeartFull").gameObject;
        m_minNumber = m_heartUI.GetChildComponent<NumberDrawer>("MinNumber");
        m_secNumber = m_heartUI.GetChildComponent<NumberDrawer>("SecNumber");
    }
开发者ID:hiyijia,项目名称:CapsUnity,代码行数:41,代码来源:UIMap.cs

示例2: OnCreate

    public override void OnCreate()
    {
        base.OnCreate();
        m_mainMenuExtend = UIWindowManager.Singleton.CreateWindow<UIWindow>("UIMainMenuExtend", UIWindowManager.Anchor.Left);

        m_quitBtn = m_mainMenuExtend.GetChildComponent<UIButton>("QuitBtn");
        m_soundBtn = m_mainMenuExtend.GetChildComponent<UIButton>("SoundBtn");
        m_musicBtn = m_mainMenuExtend.GetChildComponent<UIButton>("MusicBtn");

        m_soundIcon = m_mainMenuExtend.GetChildComponent<UISprite>("SoundIcon");
        m_musicIcon = m_mainMenuExtend.GetChildComponent<UISprite>("MusicIcon");

        m_mainMenuBtnText = m_mainMenuExtend.GetChildComponent<UISprite>("QuitBtnText");

        m_mainMenuExtend.AddChildComponentMouseClick("QuitBtn", OnQuitClicked);
        m_mainMenuExtend.AddChildComponentMouseClick("HelpBtn", delegate()
        {
            UIWindowManager.Singleton.GetUIWindow<UIHowToPlay>().ShowWindow();
            m_mainMenuExtend.HideWindow();
        });

        m_mainMenuExtend.AddChildComponentMouseClick("SoundBtn", delegate()
        {
            GlobalVars.UseSFX = !GlobalVars.UseSFX;
            PlayerPrefs.SetInt("SFX", GlobalVars.UseSFX == true ? 1 : 0);
            RefreshIcons();
        });

        m_mainMenuExtend.AddChildComponentMouseClick("MusicBtn", delegate()
        {
            GlobalVars.UseMusic = !GlobalVars.UseMusic;
            PlayerPrefs.SetInt("Music", GlobalVars.UseMusic == true ? 1 : 0);
            if (GlobalVars.UseMusic == false)       //关闭音乐
            {
                UIToolkits.StopMusic();
            }
            else                                    //播放音乐
            {
                if (!UIToolkits.IsPlayingMusic())
                {
                    if (CapsApplication.Singleton.CurStateEnum != StateEnum.Game)
                    {
                        UIToolkits.PlayMusic(CapsConfig.CurAudioList.MapMusic);
                    }
                    else
                    {
                        GameLogic.Singleton.PlayMusic();
                    }
                }
            }
            RefreshIcons();
        });

        m_mainMenuExtend.AddChildComponentMouseClick("MainBtn", HideExtendMainMenu);

        m_mainMenuExtend.AddChildComponentMouseClick("HideBtn", HideExtendMainMenu);



        AddChildComponentMouseClick("MainBtn", delegate()
        {
            m_mainMenuExtend.ShowWindow();
			RefreshIcons();
            if (CapsApplication.Singleton.CurStateEnum != StateEnum.Game && !UIWindowManager.Singleton.GetUIWindow<UIMap>().Visible)        //Login画面
            {
                m_quitBtn.gameObject.SetActive(false);
            }
            else
            {
                m_quitBtn.gameObject.SetActive(true);
            }

            if (CapsApplication.Singleton.CurStateEnum == StateEnum.Game)
            {
                GameLogic.Singleton.PauseGame();
            }

            HideWindow();
        });
    }
开发者ID:kofight,项目名称:CapsUnity,代码行数:80,代码来源:UIMainMenu.cs

示例3: OnCreate

    public override void OnCreate()
    {
        base.OnCreate();

        m_newStageNumber = -1;

        m_heartUI = UIWindowManager.Singleton.CreateWindow<UIWindow>("UIMapHeart", UIWindowManager.Anchor.TopLeft);

        m_backGroundTrans = mUIObject.transform;
        
        m_stageBtns = new Transform[GlobalVars.TotalStageCount];
		m_stageNumbers = new Transform[GlobalVars.TotalStageCount];

        GlobalVars.AvailabeStageCount = PlayerPrefs.GetInt("StageAvailableCount");
        GlobalVars.HeadStagePos = PlayerPrefs.GetInt("HeadStagePos");

        if (GlobalVars.AvailabeStageCount == 0)
        {
            GlobalVars.AvailabeStageCount = 1;
        }
        if (GlobalVars.AvailabeStageCount > GlobalVars.TotalStageCount)
        {
            GlobalVars.AvailabeStageCount = GlobalVars.TotalStageCount;
        }
        if (GlobalVars.HeadStagePos > GlobalVars.TotalStageCount)
        {
            GlobalVars.HeadStagePos = GlobalVars.TotalStageCount;
        }
        if (GlobalVars.HeadStagePos == 0)
        {
            GlobalVars.HeadStagePos = 1;
        }
		GlobalVars.StageStarArray = PlayerPrefsExtend.GetIntArray("StageStars", 0, 100);
        GlobalVars.StageScoreArray = PlayerPrefsExtend.GetIntArray("StageScores", 0, 100);
		GlobalVars.StageFailedArray = PlayerPrefsExtend.GetIntArray("StageFailed", 0, 100);
        GlobalVars.LastStage = GlobalVars.AvailabeStageCount;
		
		if(!PlayerPrefs.HasKey("Coins"))
		{
			GlobalVars.Coins = 10;
			PlayerPrefs.SetInt("Coins", 0);
		}
		else
		{
			GlobalVars.Coins = PlayerPrefs.GetInt("Coins");
		}
		
		GlobalVars.PurchasedItemArray = PlayerPrefsExtend.GetIntArray("PurchasedItemArray", 0, 2);

        m_mapObj = mUIObject.transform.FindChild("MapObj").gameObject;
        springPanel = m_mapObj.AddComponent<SpringPanel>();
        springPanel.strength = 1000;
        UIPanel panel = m_mapObj.GetComponent<UIPanel>();
        //panel.baseClipRegion = new Vector4(0, 0, CapsApplication.Singleton.Width, CapsApplication.Singleton.Height);

        //心面板
        m_timeNumber = UIToolkits.FindChild(m_heartUI.mUIObject.transform, "TimeNumber").gameObject;
        m_minNumber = m_heartUI.GetChildComponent<NumberDrawer>("MinNumber");
        m_secNumber = m_heartUI.GetChildComponent<NumberDrawer>("SecNumber");
        UIButton heartBtn = m_heartUI.GetChildComponent<UIButton>("HeartBtn");
        EventDelegate.Set(heartBtn.onClick, delegate()
        {
            if (GlobalVars.HeartCount == 5)
            {
                return;
            }

            if (GlobalVars.UseSFX)
            {
                NGUITools.PlaySound(CapsConfig.CurAudioList.ButtonClip);
            }

            UINoMoreHearts noMoreHeartUI = UIWindowManager.Singleton.GetUIWindow<UINoMoreHearts>();
            UIStageInfo stageInfoUI = UIWindowManager.Singleton.GetUIWindow<UIStageInfo>();

            if (stageInfoUI.Visible)
            {
                stageInfoUI.HideWindow();
            }

            noMoreHeartUI.NeedOpenStageInfoAfterClose = false;
            noMoreHeartUI.ShowWindow();
        });

        //金币面板
        m_coinNumber = m_heartUI.GetChildComponent<NumberDrawer>("MoneyNumber");
        UIButton button = m_heartUI.GetChildComponent<UIButton>("StoreBtn");
        EventDelegate.Set(button.onClick, delegate()
        {
            if (GlobalVars.UseSFX)
            {
                NGUITools.PlaySound(CapsConfig.CurAudioList.ButtonClip);
            }

            UIStore storeUI = UIWindowManager.Singleton.GetUIWindow<UIStore>();
            UIStageInfo stageInfoUI = UIWindowManager.Singleton.GetUIWindow<UIStageInfo>();

            if (stageInfoUI.Visible)
            {
                stageInfoUI.HideWindow();
//.........这里部分代码省略.........
开发者ID:kofight,项目名称:CapsUnity,代码行数:101,代码来源:UIMap.cs


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