设置页面
This commit is contained in:
BIN
Assets/Scripts/.DS_Store
vendored
BIN
Assets/Scripts/.DS_Store
vendored
Binary file not shown.
BIN
Assets/Scripts/DynamicUI/.DS_Store
vendored
BIN
Assets/Scripts/DynamicUI/.DS_Store
vendored
Binary file not shown.
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
@@ -11,16 +12,26 @@ namespace Ichni.Editor
|
||||
{
|
||||
public GameObject hierarchyTabPrefab;
|
||||
public RectTransform tabContainer;
|
||||
public Button addFolderButton;
|
||||
public List<HierarchyTab> tabList;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
tabList = new List<HierarchyTab>();
|
||||
addFolderButton.onClick.AddListener(() =>
|
||||
{
|
||||
ElementFolder.GenerateElement("New Folder", Guid.NewGuid(), new List<string>(), true, null);
|
||||
});
|
||||
}
|
||||
|
||||
public HierarchyTab GenerateTab(GameElement targetElement, GameElement parentElement)
|
||||
{
|
||||
HierarchyTab tab = Instantiate(hierarchyTabPrefab, tabContainer).GetComponent<HierarchyTab>();
|
||||
//if(parentElement.connectedTab!=null)tab.transform.SetSiblingIndex(parentElement.connectedTab.transform.GetSiblingIndex());
|
||||
tab.SetTab(targetElement, parentElement);
|
||||
tabList.Add(tab);
|
||||
return tab;
|
||||
}
|
||||
|
||||
public void FindTab(GameElement targetElement, bool findparent = false)
|
||||
{
|
||||
if (targetElement.connectedTab != null)
|
||||
|
||||
BIN
Assets/Scripts/EditorGame/.DS_Store
vendored
BIN
Assets/Scripts/EditorGame/.DS_Store
vendored
Binary file not shown.
BIN
Assets/Scripts/EditorGame/Base/.DS_Store
vendored
BIN
Assets/Scripts/EditorGame/Base/.DS_Store
vendored
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -38,7 +39,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public void SaveBM()
|
||||
{
|
||||
matchedBM = new ProjectInformation_BM(projectName, creatorName, editorVersion,
|
||||
matchedBM = new ProjectInformation_BM(projectName, creatorName, PlayerSettings.bundleVersion,
|
||||
createTime, lastSaveTime, selectedThemeBundleList);
|
||||
}
|
||||
|
||||
|
||||
BIN
Assets/Scripts/EditorGame/GameElements/.DS_Store
vendored
BIN
Assets/Scripts/EditorGame/GameElements/.DS_Store
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -51,6 +51,7 @@ namespace Ichni
|
||||
public void LoadThemeBundles(List<string> list)
|
||||
{
|
||||
waitingBundleAmount = new IntReactiveProperty(list.Count);
|
||||
Debug.Log("Waiting for " + list.Count + " AssetBundles to load.");
|
||||
foreach (var bundle in list)
|
||||
{
|
||||
LoadThemeBundle(bundle);
|
||||
@@ -127,8 +128,8 @@ namespace Ichni
|
||||
}
|
||||
|
||||
yield return new WaitForEndOfFrame();
|
||||
waitingBundleAmount.Value--;
|
||||
print(themeBundleName + " Done!");
|
||||
waitingBundleAmount.Value--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Ichni.Editor
|
||||
public int musicVolume = 100;
|
||||
public int soundFXVolume = 100;
|
||||
|
||||
|
||||
public EditorSettings(int autoSaveInterval, int maximumAutoSaveCount, int musicVolume, int soundFXVolume)
|
||||
{
|
||||
this.autoSaveInterval = autoSaveInterval;
|
||||
@@ -23,12 +24,13 @@ namespace Ichni.Editor
|
||||
|
||||
public static void SaveSettings(EditorSettings settings)
|
||||
{
|
||||
ES3.Save("EditorSettings", settings, Application.streamingAssetsPath + "/EditorSettings.es3");
|
||||
ES3.Save("EditorSettings", settings, Application.persistentDataPath + "/EditorSettings.es3");
|
||||
}
|
||||
|
||||
public static void LoadSettings(ref EditorSettings settings)
|
||||
{
|
||||
settings = ES3.Load<EditorSettings>("EditorSettings", Application.streamingAssetsPath + "/EditorSettings.es3");
|
||||
settings = ES3.Load("EditorSettings", Application.persistentDataPath + "/EditorSettings.es3",
|
||||
new EditorSettings(300, 3, 100, 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,8 @@ using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.StartMenu
|
||||
{
|
||||
public partial class CreateEmptyProjectPage : MonoBehaviour
|
||||
public partial class CreateEmptyProjectPage : StartMenuPage
|
||||
{
|
||||
public CanvasGroup canvasGroup;
|
||||
public Tweener fadeIn, fadeOut;
|
||||
|
||||
public TMP_InputField projectNameInputField, creatorNameInputField, bpmInputField, songLocationInputField, delayInputField;
|
||||
public Button selectSongButton, autoFillSongPathButton;
|
||||
public Button createEmptyProjectButton;
|
||||
@@ -29,16 +26,10 @@ namespace Ichni.StartMenu
|
||||
public string songName;
|
||||
|
||||
public ThemeBundleSelector themeBundleSelector;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitializeAnimations();
|
||||
InitializeInfoUI();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame)
|
||||
if (canvasGroup.interactable && Keyboard.current.escapeKey.wasPressedThisFrame)
|
||||
{
|
||||
fadeOut.Restart();
|
||||
}
|
||||
@@ -87,9 +78,12 @@ namespace Ichni.StartMenu
|
||||
|
||||
public partial class CreateEmptyProjectPage
|
||||
{
|
||||
private void InitializeAnimations()
|
||||
protected override void InitializeAnimations()
|
||||
{
|
||||
fadeIn = canvasGroup.DOFade(1f, 0.5f)
|
||||
fadeIn = DOTween.Sequence();
|
||||
fadeOut = DOTween.Sequence();
|
||||
|
||||
fadeIn.Join(canvasGroup.DOFade(1f, 0.5f))
|
||||
.SetEase(Ease.InOutQuad)
|
||||
.SetAutoKill(false)
|
||||
.OnComplete(() =>
|
||||
@@ -98,7 +92,7 @@ namespace Ichni.StartMenu
|
||||
canvasGroup.blocksRaycasts = true;
|
||||
}).Pause();
|
||||
|
||||
fadeOut = canvasGroup.DOFade(0f, 0.5f)
|
||||
fadeOut.Join(canvasGroup.DOFade(0f, 0.5f))
|
||||
.SetEase(Ease.InOutQuad)
|
||||
.SetAutoKill(false)
|
||||
.OnPlay(() =>
|
||||
@@ -113,7 +107,7 @@ namespace Ichni.StartMenu
|
||||
.Pause();
|
||||
}
|
||||
|
||||
private void InitializeInfoUI()
|
||||
protected override void InitializeUI()
|
||||
{
|
||||
songLocationInputField.onEndEdit.AddListener((str) =>
|
||||
{
|
||||
@@ -126,13 +120,13 @@ namespace Ichni.StartMenu
|
||||
createEmptyProjectButton.onClick.AddListener(CreateEmptyProject);
|
||||
}
|
||||
|
||||
public void AutoFillSongPath()
|
||||
private void AutoFillSongPath()
|
||||
{
|
||||
string path = Application.streamingAssetsPath + "/Songs/";
|
||||
songLocationInputField.text = path;
|
||||
}
|
||||
|
||||
public void SelectSong()
|
||||
private void SelectSong()
|
||||
{
|
||||
songFile = new OpenFileName();
|
||||
songFile.structSize = Marshal.SizeOf(songFile);
|
||||
|
||||
81
Assets/Scripts/StartMenu/EditorSettingsPage.cs
Normal file
81
Assets/Scripts/StartMenu/EditorSettingsPage.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.Editor;
|
||||
using Michsky.MUIP;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.StartMenu
|
||||
{
|
||||
public partial class EditorSettingsPage : StartMenuPage
|
||||
{
|
||||
public EditorSettings editorSettings;
|
||||
public TMP_InputField autoSaveIntervalInputField, autoSaveCountInputField;
|
||||
public SliderManager musicVolumeSlider, sfxVolumeSlider;
|
||||
public Button exitButton;
|
||||
|
||||
private void InitializePage()
|
||||
{
|
||||
EditorSettings.LoadSettings(ref editorSettings);
|
||||
autoSaveIntervalInputField.text = editorSettings.autoSaveInterval.ToString();
|
||||
autoSaveCountInputField.text = editorSettings.maximumAutoSaveCount.ToString();
|
||||
musicVolumeSlider.mainSlider.value = editorSettings.musicVolume;
|
||||
sfxVolumeSlider.mainSlider.value = editorSettings.soundFXVolume;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class EditorSettingsPage
|
||||
{
|
||||
protected override void InitializeAnimations()
|
||||
{
|
||||
fadeIn = DOTween.Sequence();
|
||||
fadeOut = DOTween.Sequence();
|
||||
|
||||
fadeIn.Join(canvasGroup.DOFade(1f, 0.5f))
|
||||
.SetEase(Ease.InOutQuad)
|
||||
.SetAutoKill(false)
|
||||
.OnStart(InitializePage)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
canvasGroup.interactable = true;
|
||||
canvasGroup.blocksRaycasts = true;
|
||||
}).Pause();
|
||||
|
||||
fadeOut.Join(canvasGroup.DOFade(0f, 0.5f))
|
||||
.SetEase(Ease.InOutQuad)
|
||||
.SetAutoKill(false)
|
||||
.OnPlay(() =>
|
||||
{
|
||||
canvasGroup.interactable = false;
|
||||
canvasGroup.blocksRaycasts = false;
|
||||
})
|
||||
.OnComplete(() =>
|
||||
{
|
||||
StartMenuManager.instance.startPage.fadeIn.Restart();
|
||||
})
|
||||
.Pause();
|
||||
}
|
||||
|
||||
protected override void InitializeUI()
|
||||
{
|
||||
exitButton.onClick.AddListener(() =>
|
||||
{
|
||||
SetSettings();
|
||||
fadeOut.Restart();
|
||||
});
|
||||
}
|
||||
|
||||
private void SetSettings()
|
||||
{
|
||||
editorSettings.autoSaveInterval = int.Parse(autoSaveIntervalInputField.text);
|
||||
editorSettings.maximumAutoSaveCount = int.Parse(autoSaveCountInputField.text);
|
||||
editorSettings.musicVolume = (int)musicVolumeSlider.mainSlider.value;
|
||||
editorSettings.soundFXVolume = (int)sfxVolumeSlider.mainSlider.value;
|
||||
|
||||
EditorSettings.SaveSettings(editorSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/StartMenu/EditorSettingsPage.cs.meta
Normal file
11
Assets/Scripts/StartMenu/EditorSettingsPage.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1856d2da4fa454bc39c934451ba255f5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -9,6 +9,7 @@ namespace Ichni.StartMenu
|
||||
public static StartMenuManager instance;
|
||||
public StartPage startPage;
|
||||
public CreateEmptyProjectPage createEmptyProjectPage;
|
||||
public EditorSettingsPage editorSettingsPage;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
24
Assets/Scripts/StartMenu/StartMenuPage.cs
Normal file
24
Assets/Scripts/StartMenu/StartMenuPage.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.StartMenu
|
||||
{
|
||||
public abstract class StartMenuPage : MonoBehaviour
|
||||
{
|
||||
public CanvasGroup canvasGroup;
|
||||
public Sequence fadeIn, fadeOut;
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
InitializeAnimations();
|
||||
InitializeUI();
|
||||
}
|
||||
|
||||
protected abstract void InitializeAnimations();
|
||||
|
||||
protected abstract void InitializeUI();
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/StartMenu/StartMenuPage.cs.meta
Normal file
11
Assets/Scripts/StartMenu/StartMenuPage.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bba8df6a5e67645e6a3abe5a21284437
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -5,33 +5,21 @@ using DG.Tweening;
|
||||
using Michsky.MUIP;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.StartMenu
|
||||
{
|
||||
public partial class StartPage : MonoBehaviour
|
||||
public partial class StartPage : StartMenuPage
|
||||
{
|
||||
public RectTransform background;
|
||||
public CanvasGroup canvasGroup;
|
||||
|
||||
public ButtonManager createEmptyProjectButton;
|
||||
|
||||
public Sequence fadeIn, fadeOut;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitializeAnimations();
|
||||
createEmptyProjectButton.onClick.AddListener(GoToNewProjectPage);
|
||||
}
|
||||
|
||||
public void GoToNewProjectPage()
|
||||
{
|
||||
fadeOut.Restart();
|
||||
}
|
||||
public Button editorSettingsButton;
|
||||
}
|
||||
|
||||
public partial class StartPage
|
||||
{
|
||||
private void InitializeAnimations()
|
||||
protected override void InitializeAnimations()
|
||||
{
|
||||
fadeIn = DOTween.Sequence();
|
||||
fadeOut = DOTween.Sequence();
|
||||
@@ -55,11 +43,31 @@ namespace Ichni.StartMenu
|
||||
canvasGroup.interactable = false;
|
||||
canvasGroup.blocksRaycasts = false;
|
||||
})
|
||||
.OnComplete(() =>
|
||||
{
|
||||
StartMenuManager.instance.createEmptyProjectPage.fadeIn.Restart();
|
||||
})
|
||||
.Pause();
|
||||
}
|
||||
|
||||
protected override void InitializeUI()
|
||||
{
|
||||
createEmptyProjectButton.onClick.AddListener(GoToNewProjectPage);
|
||||
editorSettingsButton.onClick.AddListener(GoToEditorSettingsPage);
|
||||
}
|
||||
|
||||
private void GoToNewProjectPage()
|
||||
{
|
||||
fadeOut.onComplete = () =>
|
||||
{
|
||||
StartMenuManager.instance.createEmptyProjectPage.fadeIn.Restart();
|
||||
};
|
||||
fadeOut.Restart();
|
||||
}
|
||||
|
||||
private void GoToEditorSettingsPage()
|
||||
{
|
||||
fadeOut.onComplete = () =>
|
||||
{
|
||||
StartMenuManager.instance.editorSettingsPage.fadeIn.Restart();
|
||||
};
|
||||
fadeOut.Restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user