1.向判定效果IInteraction中增强, 支持Hold类型判定, 这将是除Tap以外唯二的判定模式\n2.GameController现在能够打开带有Helper的项目根目录
This commit is contained in:
@@ -4,7 +4,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Cinemachine;
|
||||
using Convention;
|
||||
using Convention.WindowsUI.Variant;
|
||||
using Unity.Profiling;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
@@ -27,7 +26,17 @@ namespace Demo.Game
|
||||
public Action<float> SetSongCurrentTime { get; private set; } = _ => { };
|
||||
public bool IsMain { get; set; } = false;
|
||||
public bool IsAutoPlay { get; private set; } = false;
|
||||
public string ScriptEditor { get; private set; } = "{0}";
|
||||
/// <summary>
|
||||
/// 使用形如<b>"E:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe" {0}</b>来打开文件,
|
||||
/// {0}是必要的, 指代的是将要打开的文件
|
||||
/// </summary>
|
||||
public string WhichOpenScript { get; private set; } = "{0}";
|
||||
/// <summary>
|
||||
/// 使用形如<b>"E:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe" {0}</b>来打开项目存贮目录,
|
||||
/// {0}是必要的, 指代的是Helper的父目录, 同时也应该是项目的父目录, 同时配备有全局项目配置, 用于提供注释内容,
|
||||
/// 值为null时不会在启动时打开
|
||||
/// </summary>
|
||||
public string WhichOpenProject { get; private set; } = null;
|
||||
public ProjectDefaultFileStyle CurrentProjectDefaultFileStyle = default;
|
||||
|
||||
public float SongOffset;
|
||||
@@ -117,55 +126,70 @@ namespace Demo.Game
|
||||
SetupSongDuration = GameContent.instance.SetupSongDuration;
|
||||
SetSongCurrentTime = GameContent.instance.SetSongCurrentTime;
|
||||
SongOffset = GameContent.instance.SongOffset;
|
||||
}
|
||||
{
|
||||
IsHideTrackRender = (bool)MainConfig.FindItem(nameof(IsHideTrackRender), false);
|
||||
IsAutoPlay = GameContent.instance.IsAutoPlay;
|
||||
ScriptEditor = (string)MainConfig.FindItem(nameof(ScriptEditor), ScriptEditor);
|
||||
CurrentProjectDefaultFileStyle = content.CurrentProjectDefaultFileStyle;
|
||||
}
|
||||
|
||||
yield return null;
|
||||
|
||||
MainConfig.SaveProperties();
|
||||
|
||||
// Load Root Object
|
||||
{
|
||||
while (MainConfig.Contains("root") == false)
|
||||
// Open Project
|
||||
WhichOpenProject = (string)MainConfig.FindItem(nameof(WhichOpenProject), WhichOpenProject);
|
||||
if (string.IsNullOrEmpty(WhichOpenProject) == false)
|
||||
{
|
||||
string defaultRootPath = "root" + CurrentProjectDefaultFileStyle switch
|
||||
string path = string.Format($"{WhichOpenProject}", $"\"{Editor.EditorController.instance.PersistentDataPath}\"") ;
|
||||
try
|
||||
{
|
||||
ProjectDefaultFileStyle.PY => ".py",
|
||||
_ => ".h"
|
||||
};
|
||||
if (content.IsCreateNewProject)
|
||||
{
|
||||
MainConfig["root"] = defaultRootPath;
|
||||
if (MainConfig.CreateFile(defaultRootPath))
|
||||
{
|
||||
MainConfig.SaveProperties();
|
||||
break;
|
||||
}
|
||||
System.Diagnostics.Process.Start(path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Cannt open {path}", this);
|
||||
Debug.LogException(ex, this);
|
||||
}
|
||||
Debug.LogError($"{nameof(defaultRootPath)} is cannt create or config's root property is not exist", this);
|
||||
StartCoroutine(GameExit());
|
||||
yield break;
|
||||
}
|
||||
var rootFileName = (string)MainConfig.FindItem("root");
|
||||
var rootObject = new ToolFile(Path.Combine(content.RootSourceDir, rootFileName));
|
||||
rootObject.MustExistsPath();
|
||||
var rootGameObject = new GameObject(rootObject.GetName(true)).AddComponent<RootObject>();
|
||||
rootGameObject.transform.SetParent(transform);
|
||||
rootGameObject.ScriptName = rootObject.GetName(true);
|
||||
rootGameObject.audioSystem = MainAudio;
|
||||
rootGameObject.EnableScript(content.RootSourceDir, rootObject.GetFullPath(), this);
|
||||
try
|
||||
{
|
||||
yield return rootGameObject.LoadScript(rootObject.LoadAsText());
|
||||
IsHideTrackRender = (bool)MainConfig.FindItem(nameof(IsHideTrackRender), false);
|
||||
IsAutoPlay = GameContent.instance.IsAutoPlay;
|
||||
WhichOpenScript = (string)MainConfig.FindItem(nameof(WhichOpenScript), WhichOpenScript);
|
||||
CurrentProjectDefaultFileStyle = content.CurrentProjectDefaultFileStyle;
|
||||
}
|
||||
finally
|
||||
|
||||
yield return null;
|
||||
|
||||
MainConfig.SaveProperties();
|
||||
|
||||
// Load Root Object
|
||||
{
|
||||
MainObject = rootGameObject;
|
||||
while (MainConfig.Contains("root") == false)
|
||||
{
|
||||
string defaultRootPath = "root" + CurrentProjectDefaultFileStyle switch
|
||||
{
|
||||
ProjectDefaultFileStyle.PY => ".py",
|
||||
_ => ".h"
|
||||
};
|
||||
if (content.IsCreateNewProject)
|
||||
{
|
||||
MainConfig["root"] = defaultRootPath;
|
||||
if (MainConfig.CreateFile(defaultRootPath))
|
||||
{
|
||||
MainConfig.SaveProperties();
|
||||
break;
|
||||
}
|
||||
}
|
||||
Debug.LogError($"{nameof(defaultRootPath)} is cannt create or config's root property is not exist", this);
|
||||
StartCoroutine(GameExit());
|
||||
yield break;
|
||||
}
|
||||
var rootFileName = (string)MainConfig.FindItem("root");
|
||||
var rootObject = new ToolFile(Path.Combine(content.RootSourceDir, rootFileName));
|
||||
rootObject.MustExistsPath();
|
||||
var rootGameObject = new GameObject(rootObject.GetName(true)).AddComponent<RootObject>();
|
||||
rootGameObject.transform.SetParent(transform);
|
||||
rootGameObject.ScriptName = rootObject.GetName(true);
|
||||
rootGameObject.audioSystem = MainAudio;
|
||||
rootGameObject.EnableScript(content.RootSourceDir, rootObject.GetFullPath(), this);
|
||||
try
|
||||
{
|
||||
yield return rootGameObject.LoadScript(rootObject.LoadAsText());
|
||||
}
|
||||
finally
|
||||
{
|
||||
MainObject = rootGameObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user