ok it kinda works now
This commit is contained in:
parent
42bcf245b5
commit
7d96793e2c
|
|
@ -4505,6 +4505,8 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_gameSelectionEventRef: {fileID: 1119871594}
|
_gameSelectionEventRef: {fileID: 1119871594}
|
||||||
|
_headerObject: {fileID: 1039002537}
|
||||||
|
_headerText: {fileID: 93287373}
|
||||||
--- !u!1 &170980090
|
--- !u!1 &170980090
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -21412,6 +21414,8 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_categoryRef: {fileID: 167275725}
|
_categoryRef: {fileID: 167275725}
|
||||||
|
_spacing: -55
|
||||||
|
_headerOffset: 61
|
||||||
--- !u!1 &889256060
|
--- !u!1 &889256060
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -26829,7 +26833,7 @@ MonoBehaviour:
|
||||||
posDif: 15
|
posDif: 15
|
||||||
ignoreSelectCount: 2
|
ignoreSelectCount: 2
|
||||||
_newGameEventSelector: {fileID: 516264814}
|
_newGameEventSelector: {fileID: 516264814}
|
||||||
_cateGoryRef: {fileID: 167275725}
|
_categoryManager: {fileID: 879299405}
|
||||||
--- !u!114 &1154875948
|
--- !u!114 &1154875948
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace HeavenStudio.Editor
|
namespace HeavenStudio.Editor
|
||||||
|
|
@ -7,6 +8,26 @@ namespace HeavenStudio.Editor
|
||||||
public class GameSelectionCategory : MonoBehaviour
|
public class GameSelectionCategory : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private NewGameSelectionEvent _gameSelectionEventRef;
|
[SerializeField] private NewGameSelectionEvent _gameSelectionEventRef;
|
||||||
|
[SerializeField] private GameObject _headerObject;
|
||||||
|
[SerializeField] private TMP_Text _headerText;
|
||||||
|
|
||||||
|
public void SetHeaderText(string text)
|
||||||
|
{
|
||||||
|
_headerText.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HeaderSetActive(bool active)
|
||||||
|
{
|
||||||
|
_headerObject.SetActive(active);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddEvent(Minigames.GameAction action)
|
||||||
|
{
|
||||||
|
NewGameSelectionEvent spawnedEvent = Instantiate(_gameSelectionEventRef, transform);
|
||||||
|
spawnedEvent.SetText(action.displayName);
|
||||||
|
spawnedEvent.SetActiveGearIcon(action.parameters != null && action.parameters.Count > 0);
|
||||||
|
spawnedEvent.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,67 @@ namespace HeavenStudio.Editor
|
||||||
{
|
{
|
||||||
public class GameSelectionCategoryManager : MonoBehaviour
|
public class GameSelectionCategoryManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[Header("Components")]
|
||||||
[SerializeField] private GameSelectionCategory _categoryRef;
|
[SerializeField] private GameSelectionCategory _categoryRef;
|
||||||
|
|
||||||
|
[Header("Properties")]
|
||||||
|
[SerializeField] private float _spacing = 0f;
|
||||||
|
[SerializeField] private float _headerOffset = 39.8f;
|
||||||
|
|
||||||
|
private List<GameSelectionCategory> _categories = new();
|
||||||
|
|
||||||
|
public void StartCategories(List<Minigames.GameAction> actions, string gameName)
|
||||||
|
{
|
||||||
|
string lastHeader = string.Empty;
|
||||||
|
GameSelectionCategory lastHeaderObject = null;
|
||||||
|
float currentY = _categoryRef.transform.localPosition.y;
|
||||||
|
|
||||||
|
// eventually add the switch games here
|
||||||
|
|
||||||
|
for (int i = 0; i < actions.Count; i++)
|
||||||
|
{
|
||||||
|
var action = actions[i];
|
||||||
|
if (action.hidden || action.actionName == "switchGame") continue;
|
||||||
|
|
||||||
|
if ((i == 0 && gameName != "gameManager") || (gameName == "gameManager" && i == 1) || (action.categoryName != lastHeader && action.categoryName != string.Empty))
|
||||||
|
{
|
||||||
|
if ((i != 0 && gameName != "gameManager") || (gameName == "gameManager" && i != 1))
|
||||||
|
{
|
||||||
|
Canvas.ForceUpdateCanvases();
|
||||||
|
currentY += _spacing - lastHeaderObject.GetComponent<RectTransform>().rect.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastHeader = action.categoryName;
|
||||||
|
GameSelectionCategory spawnedCategory = Instantiate(_categoryRef, transform);
|
||||||
|
lastHeaderObject = spawnedCategory;
|
||||||
|
_categories.Add(spawnedCategory);
|
||||||
|
|
||||||
|
if (lastHeader != string.Empty)
|
||||||
|
{
|
||||||
|
spawnedCategory.SetHeaderText(lastHeader);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spawnedCategory.HeaderSetActive(false);
|
||||||
|
currentY += _headerOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
spawnedCategory.transform.localPosition = new Vector3(spawnedCategory.transform.localPosition.x, currentY);
|
||||||
|
spawnedCategory.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastHeaderObject.AddEvent(action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DestroyCategories()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _categories.Count; i++)
|
||||||
|
{
|
||||||
|
Destroy(_categories[i].gameObject);
|
||||||
|
}
|
||||||
|
_categories.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -458,7 +458,7 @@ namespace HeavenStudio.Editor
|
||||||
|
|
||||||
[Header("New Game Event Selection")]
|
[Header("New Game Event Selection")]
|
||||||
[SerializeField] private GameObject _newGameEventSelector;
|
[SerializeField] private GameObject _newGameEventSelector;
|
||||||
[SerializeField] private GameSelectionCategory _cateGoryRef;
|
[SerializeField] private GameSelectionCategoryManager _categoryManager;
|
||||||
|
|
||||||
private bool _usingOld = false;
|
private bool _usingOld = false;
|
||||||
|
|
||||||
|
|
@ -480,37 +480,12 @@ namespace HeavenStudio.Editor
|
||||||
private void SelectGameNew(int index)
|
private void SelectGameNew(int index)
|
||||||
{
|
{
|
||||||
NewDestroyEvents();
|
NewDestroyEvents();
|
||||||
NewAddEvents();
|
NewAddEvents(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NewAddEvents(int index = 0)
|
private void NewAddEvents(int index = 0)
|
||||||
{
|
{
|
||||||
/*if (!EventCaller.FXOnlyGames().Contains(SelectedMinigame))
|
_categoryManager.StartCategories(SelectedMinigame.actions, SelectedMinigame.name);
|
||||||
{
|
|
||||||
NewGameSelectionEvent sg = Instantiate(_newEventRef, _newEventsParent).GetComponent<NewGameSelectionEvent>();
|
|
||||||
sg.SetText("Switch Game");
|
|
||||||
sg.gameObject.SetActive(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
index++;
|
|
||||||
if (SelectedMinigame.name == "gameManager") index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < SelectedMinigame.actions.Count; i++)
|
|
||||||
{
|
|
||||||
var action = SelectedMinigame.actions[i];
|
|
||||||
if (action.actionName == "switchGame" || action.hidden) continue;
|
|
||||||
|
|
||||||
//NewGameSelectionEvent g = Instantiate(_newEventRef, _newEventsParent).GetComponent<NewGameSelectionEvent>();
|
|
||||||
g.SetText(action.displayName);
|
|
||||||
|
|
||||||
if (action.parameters != null && action.parameters.Count > 0)
|
|
||||||
g.SetActiveGearIcon(true);
|
|
||||||
|
|
||||||
g.gameObject.SetActive(true);
|
|
||||||
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NewDestroyEvents()
|
private void NewDestroyEvents()
|
||||||
|
|
@ -520,10 +495,7 @@ namespace HeavenStudio.Editor
|
||||||
transform.GetChild(i).GetChild(0).gameObject.SetActive(false);
|
transform.GetChild(i).GetChild(0).gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*for (int i = 0; i < _newEventsParent.childCount; i++)
|
_categoryManager.DestroyCategories();
|
||||||
{
|
|
||||||
Destroy(_newEventsParent.GetChild(i).gameObject);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Disable()
|
public void Disable()
|
||||||
|
|
|
||||||
|
|
@ -556,7 +556,8 @@ namespace HeavenStudio
|
||||||
this.preFunction = prescheduleFunction ?? delegate { };
|
this.preFunction = prescheduleFunction ?? delegate { };
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
this.preFunctionLength = preFunctionLength;
|
this.preFunctionLength = preFunctionLength;
|
||||||
this.categoryName = categoryName;
|
if (categoryName != null) this.categoryName = categoryName;
|
||||||
|
else this.categoryName = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
//todo: converting to new versions of GameActions
|
//todo: converting to new versions of GameActions
|
||||||
|
|
@ -781,7 +782,10 @@ namespace HeavenStudio
|
||||||
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "colorA", "valA" })
|
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "colorA", "valA" })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
),
|
)
|
||||||
|
{
|
||||||
|
categoryName = "Test 1"
|
||||||
|
},
|
||||||
new GameAction("filter", "Filter", 1f, true,
|
new GameAction("filter", "Filter", 1f, true,
|
||||||
new List<Param>()
|
new List<Param>()
|
||||||
{
|
{
|
||||||
|
|
@ -819,7 +823,10 @@ namespace HeavenStudio
|
||||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"),
|
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"),
|
||||||
new Param("axis", GameCamera.CameraAxis.All, "Axis", "The axis to move the camera on" )
|
new Param("axis", GameCamera.CameraAxis.All, "Axis", "The axis to move the camera on" )
|
||||||
}
|
}
|
||||||
),
|
)
|
||||||
|
{
|
||||||
|
categoryName = "Test2"
|
||||||
|
},
|
||||||
new("stretch camera", "Stretch Camera")
|
new("stretch camera", "Stretch Camera")
|
||||||
{
|
{
|
||||||
resizable = true,
|
resizable = true,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue