浏览代码

Added UIEventManager page in the wizard

/feature-new-input-system
Thomas ICHÉ 3 年前
当前提交
3bf882c8
共有 4 个文件被更改,包括 55 次插入1 次删除
  1. 25
      Editor/WelcomeScreen/WelcomeScreen.Setup.cs
  2. 18
      Runtime/Managers/Implementations/UIEventManager.cs
  3. 2
      Runtime/AssemblyInfo.cs
  4. 11
      Runtime/AssemblyInfo.cs.meta

25
Editor/WelcomeScreen/WelcomeScreen.Setup.cs


public Action[] pages = new Action[]
{
WelcomePage, SettingAssetPage, UnpackPackagePage
WelcomePage, SettingAssetPage,
#if ENABLE_INPUT_SYSTEM
InputSystemPage,
#endif
UnpackPackagePage
};
static void WelcomePage()

GUILayout.Label(@"This wizard will help you set up your project so you can use and customize scripts.", Styles.body);
}
static void InputSystemPage()
{
GUILayout.Label("Input System package detected", Styles.title);
GUILayout.Space(12);
GUILayout.Label(@"It seems that you have the Input System configured for your project. In order to make it work with the UI Event Manager, we can create a configured prefab for you.", Styles.body);
GUILayout.Space(12);
if (GUILayout.Button("Create/Replace", GUILayout.Width(180), GUILayout.Height(32)))
{
if(AssetDatabase.LoadAssetAtPath<GameObject>("Assets/Resources/UIEventManager.prefab") == null
|| EditorUtility.DisplayDialog("Prefab already present", "UIEventManager already exists, overwrite?", "Yes", "No"))
{
var go = UIEventManager.CreateManagerObject();
var prefab = PrefabUtility.SaveAsPrefabAsset(go, "Assets/Resources/UIEventManager.prefab");
DestroyImmediate(go);
Selection.activeObject = prefab;
}
}
public const string kSettingsAssetPath = "Assets/Resources/GameplayIngredientsSettings.asset";

18
Runtime/Managers/Implementations/UIEventManager.cs


if(selectable != null)
selectable.Select();
}
internal static GameObject CreateManagerObject()
{
var go = new GameObject("UIEventManager");
var es = go.AddComponent<EventSystem>();
var uiem = go.AddComponent<UIEventManager>();
uiem.m_EventSystem = es;
#if ENABLE_LEGACY_INPUT_MANAGER
if(!go.TryGetComponent(out StandaloneInputModule sm))
sm = go.AddComponent<StandaloneInputModule>();
#endif
#if ENABLE_INPUT_SYSTEM
if (!go.TryGetComponent(out InputSystemUIInputModule ism))
ism = go.AddComponent<InputSystemUIInputModule>();
#endif
return go;
}
}
}

2
Runtime/AssemblyInfo.cs


using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("GameplayIngredients-Editor")]

11
Runtime/AssemblyInfo.cs.meta


fileFormatVersion: 2
guid: 5c86294b577ff95408da6bfe4ef53415
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存