浏览代码

Work on Welcome Screen Wizard, Merged all configuration into GameplayIngredientSettings asset

/main
Thomas Iché 5 年前
当前提交
6e83c5e8
共有 10 个文件被更改,包括 125 次插入41 次删除
  1. 8
      Editor/MenuItems.cs
  2. 56
      Editor/WelcomeScreen/WelcomeScreen.cs
  3. 6
      Runtime/LevelScripting/Callable.cs
  4. 11
      Runtime/Managers/Manager.cs
  5. 2
      Runtime/Settings/GameplayIngredientsSettings.cs.meta
  6. 8
      Runtime/Settings.meta
  7. 62
      Runtime/Settings/GameplayIngredientsSettings.cs
  8. 13
      Runtime/Managers/ManagerExclusionList.cs
  9. 0
      /Runtime/Settings/GameplayIngredientsSettings.cs.meta

8
Editor/MenuItems.cs


return PlayFromHere.IsReady;
}
#region EXCLUSION LIST
[MenuItem("Assets/Create/Gameplay Ingredients/Manager Exclusion List")]
static void CreateExclusionList()
{
AssetFactory.CreateAssetInProjectWindow<ManagerExclusionList>(string.Empty, "ManagerExclusionList.asset");
}
#endregion
#region GROUP_UNGROUP
const int kGroupMenuIndex = 500;

56
Editor/WelcomeScreen/WelcomeScreen.cs


this.position = new Rect((Screen.width / 2.0f) - WindowWidth/2, (Screen.height / 2.0f) - WindowHeight/2, WindowWidth, WindowHeight);
this.minSize = new Vector2(WindowWidth, WindowHeight);
this.maxSize = new Vector2(WindowWidth, WindowHeight);
if (!GameplayIngredientsSettings.hasSettingAsset)
wizardMode = WizardMode.FirstTimeSetup;
}
private void OnDestroy()
{
EditorApplication.update -= ShowAtStartup;
}
private enum WizardMode

Configuration = 2,
}
[SerializeField]
private WizardMode wizardMode = WizardMode.TipOfTheDay;
private void OnGUI()

{
GUILayout.FlexibleSpace();
if (GUILayout.Button(" Tips ", Styles.buttonLeft)) wizardMode = WizardMode.TipOfTheDay;
EditorGUI.BeginDisabledGroup(true);
EditorGUI.BeginDisabledGroup(true);
if (GUILayout.Button(" Configuration ", Styles.buttonRight)) wizardMode = WizardMode.Configuration;
EditorGUI.EndDisabledGroup();
GUILayout.FlexibleSpace();

using (new GUILayout.VerticalScope(EditorStyles.helpBox))
{
var tip = tips[tipIndex];
GUILayout.Label(tip.Title, Styles.tipTitle);
GUILayout.Label(tip.Title, Styles.title);
GUILayout.Label(tip.Body, Styles.tipBody);
GUILayout.Label(tip.Body, Styles.body);
GUILayout.FlexibleSpace();
using (new GUILayout.HorizontalScope())
{

void FirstTimeSetupGUI()
{
GUILayout.Label("First Time Setup", EditorStyles.boldLabel);
GUILayout.FlexibleSpace();
using (new GUILayout.VerticalScope(EditorStyles.helpBox))
{
GUILayout.Label("Welcome to Gameplay Ingredients !", Styles.title);
GUILayout.Space(12);
GUILayout.Label(@"This wizard will help you set up your project so you can use and customize scripts.
GameplayIngredients is a framework that comes with a variety of features : these can be configured in a <b>GameplayIngredientsSettings</b> asset.
This asset needs to be stored in a Resources folder.
While this is not mandatory we advise you to create it in order to be able to modify it.
", Styles.body);
GUILayout.Space(8);
using (new GUILayout.HorizontalScope())
{
GUILayout.FlexibleSpace();
if (GUILayout.Button("Create GameplayIngredientsSettings Asset"))
{
GameplayIngredientsSettings asset = Instantiate<GameplayIngredientsSettings>(GameplayIngredientsSettings.defaultSettings);
AssetDatabase.CreateAsset(asset, "Assets/Resources/GameplayIngredientsSettings.asset");
Selection.activeObject = asset;
}
}
GUILayout.FlexibleSpace();
}
}
void ConfigurationGUI()
{

public static GUIStyle buttonLeft;
public static GUIStyle buttonMid;
public static GUIStyle buttonRight;
public static GUIStyle tipTitle;
public static GUIStyle tipBody;
public static GUIStyle title;
public static GUIStyle body;
static Styles()
{

buttonMid.fontSize = 12;
buttonRight.fontSize = 12;
tipTitle = new GUIStyle(EditorStyles.label);
tipTitle.fontSize = 22;
title = new GUIStyle(EditorStyles.label);
title.fontSize = 22;
tipBody = new GUIStyle(EditorStyles.label);
tipBody.fontSize = 12;
tipBody.wordWrap = true;
body = new GUIStyle(EditorStyles.label);
body.fontSize = 12;
body.wordWrap = true;
body.richText = true;
}
}
}

6
Runtime/LevelScripting/Callable.cs


{
foreach (var call in calls)
{
#if CALLABLE_DEBUG
if (Debug.isDebugBuild || Application.isEditor)
if (GameplayIngredientsSettings.currentSettings.verboseCalls)
#endif
Debug.LogError("Cannot execute call: Null or Missing");
Debug.LogError($"Cannot execute Call: Null or Missing");
}
}

11
Runtime/Managers/Manager.cs


if(s_Managers.ContainsKey(typeof(T)))
return (T)s_Managers[typeof(T)];
else
{
Debug.LogError($"Manager of type '{typeof(T)}' could not be accessed. Check the excludedManagers list in your GameplayIngredientsSettings configuration file.");
}
}
static readonly Type[] kAllManagerTypes = GetAllManagerTypes();

{
var exclusionList = Resources.Load<ManagerExclusionList>("ManagerExclusionList");
var exclusionList = GameplayIngredientsSettings.currentSettings.excludedeManagers;
if(exclusionList != null && exclusionList.ExcludedManagers.ToList().Contains(type.Name))
if(exclusionList != null && exclusionList.ToList().Contains(type.Name))
Debug.LogWarning($"Found Manager : {type.Name} in Exclusion List, ignoring Creation");
Debug.Log($"Manager : {type.Name} is in GameplayIngredientSettings.excludedeManagers List: ignoring Creation");
var attrib =type.GetCustomAttribute<ManagerDefaultPrefabAttribute>();
var attrib = type.GetCustomAttribute<ManagerDefaultPrefabAttribute>();
GameObject gameObject;
if(attrib != null)

2
Runtime/Settings/GameplayIngredientsSettings.cs.meta


fileFormatVersion: 2
guid: 74a9c3ba3041de044a8b71667c2e17a8
guid: 9b86121d23ed10e40bcfa3df03459c5c
MonoImporter:
externalObjects: {}