本文整理汇总了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");
}
示例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();
});
}
示例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();
//.........这里部分代码省略.........