예제 #1
0
	IEnumerator Start() 
	{
		UniRPGGlobal.Instance.OnMenusLoaded(); // tell UnIRPG that the menu is loaded

		gui = UniRPGGlobal.DB.menuGUIData.GetComponent<DefaultMainMenuGUIData>();

		// init New Screen defaults
		newCharacter = UniRPGGlobal.MainMenuData.GetDefaultPlayerCharacter(UniRPGGlobal.DB.playerCanSelectCharacter);
		if (newCharacter == null) Debug.LogError("Could not find a default player character. There must be at least one Actor (PlayerCharacter) set as 'Avail at Start'");

		if (UniRPGGlobal.DB.playerCanSelectClass)
		{
			if (newCharacter != null) newClass = UniRPGGlobal.MainMenuData.GetDefaultPlayerClass(newCharacter.Actor);
		}

		// wait a frame before doing the following
		yield return null;

		CalcRecs();

		// ready
		SetState(State.MainMenu);

		AudioListener.volume = UniRPGGlobal.DB.audioMainVolume;

		// start random song
		if (gui.menuMusic.Count > 0)
		{
			int id = 0;
			if (gui.menuMusic.Count > 1) id = Random.Range(0, gui.menuMusic.Count);
			music = camObject.AddComponent<AudioSource>();
			music.clip = gui.menuMusic[id];
			music.volume = UniRPGGlobal.DB.musicVolume;
			music.bypassEffects = true;
			music.bypassReverbZones = true;
			music.bypassListenerEffects = true;
			music.loop = true;
			music.Play();
		}

		// create buton click audio source if needed
		if (gui.sfxButton)
		{
			sfxButton = camObject.AddComponent<AudioSource>();
			sfxButton.clip = gui.sfxButton;
			sfxButton.volume = UniRPGGlobal.DB.guiAudioVolume;
			sfxButton.playOnAwake = false;
			sfxButton.bypassEffects = true;
			sfxButton.bypassReverbZones = true;
			sfxButton.bypassListenerEffects = true;
			sfxButton.loop = false;
		}
	}
예제 #2
0
	private void DrawOptions(DefaultMainMenuGUIData menuData)
	{
		GUILayout.Space(15);
		GUILayout.Label("Options Screen", UniRPGEdGui.Head2Style);

		EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.Width(236));
		{	// Menu offset and such
			UniRPGEdGui.LookLikeControls(50, 120);
			GUILayout.Label("Options Area", UniRPGEdGui.Head4Style);
			EditorGUILayout.Space();
			menuData.trOptions = ElementTransformField(menuData.trOptions, null, false, true, true, true, false);
		}
		EditorGUILayout.EndVertical();
		EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.Width(236));
		{
			UniRPGEdGui.LookLikeControls();
			GUILayout.Label("Sound options to show", UniRPGEdGui.Head4Style);
			EditorGUILayout.Space();
			menuData.showAudioMainVolume = EditorGUILayout.Toggle("Main volume", menuData.showAudioMainVolume);
			menuData.showMusicVolume = EditorGUILayout.Toggle("Music volume", menuData.showMusicVolume);
			menuData.showGUIAudioVolume = EditorGUILayout.Toggle("GUI volume", menuData.showGUIAudioVolume);
			menuData.showFXAudioVolume = EditorGUILayout.Toggle("Effects volume", menuData.showFXAudioVolume);
			menuData.showEnviroAudioVolume = EditorGUILayout.Toggle("Environment volume", menuData.showEnviroAudioVolume);
		}
		EditorGUILayout.EndVertical();
	}
예제 #3
0
	private void DrawNewGameSettings(DefaultMainMenuGUIData menuData)
	{
		UniRPGEdGui.LookLikeControls(50, 120);
		
		GUILayout.Space(15);
		GUILayout.Label("New Game Screen", UniRPGEdGui.Head2Style);

		EditorGUILayout.BeginHorizontal();
		{
			EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.MaxWidth(236));
			{
				menuData.trNewButtonsArea = ElementTransformField(menuData.trNewButtonsArea, "Button & Name Area", false, true, true, true, true);
			}
			EditorGUILayout.EndVertical();
			EditorGUILayout.Space();
			EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.MaxWidth(236));
			{
				menuData.trNewCharaArea = ElementTransformField(menuData.trNewCharaArea, "Character List Area", false, true, true, true, true);
			}
			EditorGUILayout.EndVertical();
			EditorGUILayout.Space();
			EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.MaxWidth(236));
			{
				menuData.trNewClassArea = ElementTransformField(menuData.trNewClassArea, "Classes List Area", false, true, true, true, true);
			}
			EditorGUILayout.EndVertical();
			GUILayout.FlexibleSpace();
		}
		EditorGUILayout.EndHorizontal();
		
		EditorGUILayout.Space();
		EditorGUILayout.BeginHorizontal();
		{
			EditorGUILayout.BeginVertical();
			{
				EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.Width(236));
				{	// Background Image
					GUILayout.Label("Character Background", UniRPGEdGui.Head4Style);
					menuData.newGameCharaBackFab = EditorGUILayout.ObjectField(menuData.newGameCharaBackFab, typeof(GameObject), false) as GameObject;
					EditorGUILayout.HelpBox("An object that will be used as the background/floor for the character to stand on.", MessageType.Info);
				}
				EditorGUILayout.EndVertical();

				EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.Width(236));
				{	// Background Image
					GUILayout.Label("Background", UniRPGEdGui.Head4Style);
					menuData.texNewGameBack = EditorGUILayout.ObjectField(menuData.texNewGameBack, typeof(Texture2D), false, GUILayout.Width(180), GUILayout.Height(120)) as Texture2D;
					EditorGUILayout.HelpBox("Stretched to fill screen. Only used when Character Background is not set.", MessageType.Info);
				}
				EditorGUILayout.EndVertical();
			}
			EditorGUILayout.EndVertical();
			EditorGUILayout.Space();
			EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.MaxWidth(236));
			{
				menuData.trNewCharaInfoArea = ElementTransformField(menuData.trNewCharaInfoArea, "Character Info Area", false, true, true, true, true);
			}
			EditorGUILayout.EndVertical();
			EditorGUILayout.Space();
			EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.MaxWidth(236));
			{
				menuData.trNewClassInfoArea = ElementTransformField(menuData.trNewClassInfoArea, "Classes Info Area", false, true, true, true, true);
			}
			EditorGUILayout.EndVertical();
			GUILayout.FlexibleSpace();
		}
		EditorGUILayout.EndHorizontal();
	}
예제 #4
0
	// ================================================================================================================
	#region Main Menu

	private void DrawMenuSettings(DefaultMainMenuGUIData menuData)
	{
		GUILayout.Space(15);
		GUILayout.Label("Main Menu", UniRPGEdGui.Head2Style);

		EditorGUILayout.BeginHorizontal();
		{
			EditorGUILayout.BeginVertical();
			{
				EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.Width(236));
				{
					UniRPGEdGui.LookLikeControls(100);
					menuData.labelContinue = EditorGUILayout.TextField("Continue", menuData.labelContinue);
					menuData.labelNewGame = EditorGUILayout.TextField("New Game", menuData.labelNewGame);
					menuData.labelOptions = EditorGUILayout.TextField("Options", menuData.labelOptions);
					menuData.labelExit = EditorGUILayout.TextField("Exit", menuData.labelExit);
					EditorGUILayout.Space();
					menuData.labelSelectChara = EditorGUILayout.TextField("Select Chara", menuData.labelSelectChara);
					menuData.labelSelectClass = EditorGUILayout.TextField("Select Class", menuData.labelSelectClass);
				}
				EditorGUILayout.EndVertical();
				EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.Width(236));
				{	// Menu offset and such
					UniRPGEdGui.LookLikeControls(50, 120);
					GUILayout.Label("Menu Area", UniRPGEdGui.Head4Style);
					EditorGUILayout.Space();
					menuData.trMenu = ElementTransformField(menuData.trMenu, null, false, true, true, true, true);
				}
				EditorGUILayout.EndVertical();
				EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.Width(236));
				{	// Background Image
					GUILayout.Label("Background", UniRPGEdGui.Head4Style);
					menuData.texMenuBack = EditorGUILayout.ObjectField(menuData.texMenuBack, typeof(Texture2D), false, GUILayout.Width(180), GUILayout.Height(120)) as Texture2D;
					EditorGUILayout.HelpBox("Stretched to fill screen.", MessageType.Info);
				}
				EditorGUILayout.EndVertical();
				EditorGUILayout.Space();
			}
			EditorGUILayout.EndVertical();
			EditorGUILayout.Space();

			EditorGUILayout.BeginVertical();
			{
				EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.Width(236));
				{	// Logo Image
					GUILayout.Label("Logo", UniRPGEdGui.Head4Style);
					menuData.texLogo = TextureWithTransformCheck(null, menuData.texLogo, menuData.trLogo, GUILayout.Width(180), GUILayout.Height(120));
					menuData.trLogo = ElementTransformField(menuData.trLogo);
				}
				EditorGUILayout.EndVertical();
				EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.Width(236));
				{
					UniRPGEdGui.LookLikeControls(100);
					GUILayout.Label("Menu Sounds", UniRPGEdGui.Head4Style);
					menuData.sfxButton = (AudioClip)EditorGUILayout.ObjectField("Button sound", menuData.sfxButton, typeof(AudioClip), false);

					EditorGUILayout.Space();
					EditorGUILayout.BeginHorizontal();
					{
						GUILayout.Label("Menu Music", UniRPGEdGui.Head4Style);
						EditorGUILayout.Space();
						if (UniRPGEdGui.IconButton(" Add Clip", UniRPGEdGui.Icon_Plus, EditorStyles.miniButton)) menuData.menuMusic.Add(null);
						GUILayout.FlexibleSpace();
					}
					EditorGUILayout.EndHorizontal();
					EditorGUILayout.Space();
					int del = -1;
					for (int i = 0; i < menuData.menuMusic.Count; i++)
					{
						EditorGUILayout.BeginHorizontal();
						{
							menuData.menuMusic[i] = (AudioClip)EditorGUILayout.ObjectField(menuData.menuMusic[i], typeof(AudioClip), false);
							if (GUILayout.Button("x", EditorStyles.miniButton)) del = i;
						}
						EditorGUILayout.EndHorizontal();
						if (del >= 0) menuData.menuMusic.RemoveAt(del);
					}
				}
				EditorGUILayout.EndVertical();
			}
			EditorGUILayout.EndVertical();
			GUILayout.FlexibleSpace();
		}
		EditorGUILayout.EndHorizontal();
	}
예제 #5
0
	private void DrawBasicSettings(DefaultMainMenuGUIData menuData, DefaultGameGUIData ingameData)
	{
		UniRPGEdGui.LookLikeControls(50, 120);

		GUILayout.Space(15);
		GUILayout.Label("Basic Settings", UniRPGEdGui.Head2Style);

		EditorGUILayout.BeginVertical(UniRPGEdGui.BoxStyle, GUILayout.MaxWidth(236));
		{
			EditorGUILayout.LabelField("Theme", "Default Fantasy");
			EditorGUILayout.Space();

			EditorGUILayout.BeginHorizontal();
			{
				GUILayout.FlexibleSpace();
				if (GUILayout.Button("Reset Theme", GUILayout.Width(120))) InitDefaults(menuData.gameObject, ingameData.gameObject);
				GUILayout.FlexibleSpace();
			}
			EditorGUILayout.EndHorizontal();
			EditorGUILayout.Space();

			menuData.skin = (GUISkin)EditorGUILayout.ObjectField("Skin", menuData.skin, typeof(GUISkin), false);
			EditorGUILayout.Space();
			UniRPGEdGui.IntVector2Field("Design Size", "width", "height", ref menuData.width, ref menuData.height, 200);

			ingameData.skin = menuData.skin;
			ingameData.width = menuData.width;
			ingameData.height = menuData.height;
		}
		EditorGUILayout.EndVertical();
	}