本文整理汇总了C#中UIWindow.AddChildComponentMouseClick方法的典型用法代码示例。如果您正苦于以下问题:C# UIWindow.AddChildComponentMouseClick方法的具体用法?C# UIWindow.AddChildComponentMouseClick怎么用?C# UIWindow.AddChildComponentMouseClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIWindow
的用法示例。
在下文中一共展示了UIWindow.AddChildComponentMouseClick方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
});
}