Spaceball camera and more entity parameters. (ugly UI)

This commit is contained in:
Braedon 2022-02-03 22:25:18 -05:00
parent e0db2a446e
commit 9722ce7122
9 changed files with 97 additions and 46 deletions

View file

@ -3160,6 +3160,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
caption: {fileID: 5490985} caption: {fileID: 5490985}
slider: {fileID: 2067224779} slider: {fileID: 2067224779}
inputField: {fileID: 1182082595}
parameterManager: {fileID: 830452354} parameterManager: {fileID: 830452354}
--- !u!1 &411779173 --- !u!1 &411779173
GameObject: GameObject:
@ -6970,6 +6971,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
eventSelector: {fileID: 1056099131} eventSelector: {fileID: 1056099131}
gridGameSelector: {fileID: 1154875947}
IntegerP: {fileID: 396879232} IntegerP: {fileID: 396879232}
entity: entity:
beat: 0 beat: 0
@ -9428,14 +9430,14 @@ MonoBehaviour:
m_VerticalScrollbarEventHandler: {fileID: 0} m_VerticalScrollbarEventHandler: {fileID: 0}
m_LayoutGroup: {fileID: 0} m_LayoutGroup: {fileID: 0}
m_ScrollSensitivity: 1 m_ScrollSensitivity: 1
m_ContentType: 0 m_ContentType: 2
m_InputType: 0 m_InputType: 0
m_AsteriskChar: 42 m_AsteriskChar: 42
m_KeyboardType: 0 m_KeyboardType: 4
m_LineType: 0 m_LineType: 0
m_HideMobileInput: 0 m_HideMobileInput: 0
m_HideSoftKeyboard: 0 m_HideSoftKeyboard: 0
m_CharacterValidation: 0 m_CharacterValidation: 2
m_RegexValue: m_RegexValue:
m_GlobalPointSize: 14 m_GlobalPointSize: 14
m_CharacterLimit: 0 m_CharacterLimit: 0
@ -11140,6 +11142,7 @@ MonoBehaviour:
ScreenRenderTexture: {fileID: 8400000, guid: d3f3d6ca32122da4d9e3a8e7aa2ede16, type: 2} ScreenRenderTexture: {fileID: 8400000, guid: d3f3d6ca32122da4d9e3a8e7aa2ede16, type: 2}
Screen: {fileID: 558010761} Screen: {fileID: 558010761}
GridGameSelector: {fileID: 1154875943} GridGameSelector: {fileID: 1154875943}
eventSelectorBG: {fileID: 110654310}
Timeline: {fileID: 1861169747} Timeline: {fileID: 1861169747}
GameEventSelectorTitle: {fileID: 246861490} GameEventSelectorTitle: {fileID: 246861490}
NewBTN: {fileID: 1683100750} NewBTN: {fileID: 1683100750}
@ -15217,19 +15220,7 @@ MonoBehaviour:
m_Value: 0 m_Value: 0
m_OnValueChanged: m_OnValueChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls: []
- m_Target: {fileID: 396879234}
m_TargetAssemblyTypeName: RhythmHeavenMania.Editor.EventPropertyPrefab, Assembly-CSharp
m_MethodName: TestChange
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &2127582756 --- !u!1 &2127582756
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -51,13 +51,14 @@ namespace RhythmHeavenMania.Games.Spaceball
private void Start() private void Start()
{ {
allCameraEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "cameraZoom" }); allCameraEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "camera" });
GameCamera.instance.camera.transform.localPosition = new Vector3(0, 0, -10);
UpdateCameraZoom(); // can't believe this shit actually works
} }
private void Update() private void Update()
{ {
/*try if (allCameraEvents.Count > 0)
{ {
if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0) if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0)
{ {
@ -72,11 +73,11 @@ namespace RhythmHeavenMania.Games.Spaceball
if (normalizedBeat > Minigame.EndTime()) if (normalizedBeat > Minigame.EndTime())
{ {
lastCamDistance = GameCamera.instance.camera.transform.localPosition.z; // lastCamDistance = GameCamera.instance.camera.transform.localPosition.z;
} }
else else
{ {
if (currentZoomCamLength <= 0) if (currentZoomCamLength < 0)
{ {
GameCamera.instance.camera.transform.localPosition = new Vector3(0, 0, currentZoomCamDistance); GameCamera.instance.camera.transform.localPosition = new Vector3(0, 0, currentZoomCamDistance);
} }
@ -87,10 +88,6 @@ namespace RhythmHeavenMania.Games.Spaceball
} }
} }
} }
catch (System.Exception ex)
{
// this technically isn't game breaking so oh well
}*/
} }
private void UpdateCameraZoom() private void UpdateCameraZoom()
@ -122,6 +119,11 @@ namespace RhythmHeavenMania.Games.Spaceball
} }
} }
public void OverrideCurrentZoom()
{
// lastCamDistance = GameCamera.instance.camera.transform.localPosition.z;
}
public void Shoot(float beat, bool high, int type) public void Shoot(float beat, bool high, int type)
{ {
GameObject ball = Instantiate(Ball); GameObject ball = Instantiate(Ball);

View file

@ -146,7 +146,7 @@ namespace RhythmHeavenMania.Editor
private void SelectEvents() private void SelectEvents()
{ {
if (!Input.GetKey(KeyCode.LeftShift) && !Timeline.instance.InteractingWithEvents()) Selections.instance.DeselectAll(); if (!Input.GetKey(KeyCode.LeftShift) && !Timeline.instance.InteractingWithEvents() && !Timeline.instance.MouseInRectTransform(Editor.instance.eventSelectorBG)) Selections.instance.DeselectAll();
int selected = 0; int selected = 0;

View file

@ -32,6 +32,7 @@ namespace RhythmHeavenMania.Editor
[SerializeField] private RenderTexture ScreenRenderTexture; [SerializeField] private RenderTexture ScreenRenderTexture;
[SerializeField] private RawImage Screen; [SerializeField] private RawImage Screen;
[SerializeField] private RectTransform GridGameSelector; [SerializeField] private RectTransform GridGameSelector;
public RectTransform eventSelectorBG;
[Header("Components")] [Header("Components")]
[SerializeField] private Timeline Timeline; [SerializeField] private Timeline Timeline;
@ -133,7 +134,7 @@ namespace RhythmHeavenMania.Editor
} }
} }
if (Timeline.instance.timelineState.selected == true) if (Timeline.instance.timelineState.selected)
{ {
if (Input.GetMouseButtonUp(0)) if (Input.GetMouseButtonUp(0))
{ {
@ -156,19 +157,6 @@ namespace RhythmHeavenMania.Editor
} }
} }
if (Input.GetMouseButtonUp(1))
{
List<TimelineEventObj> selectedEvents = Timeline.instance.eventObjs.FindAll(c => c.selected == true);
if (selectedEvents.Count > 0)
{
for (int i = 0; i < selectedEvents.Count; i++)
{
// EventParameterManager.instance.StartParams(selectedEvents[i].entity);
}
}
}
if (Input.GetKey(KeyCode.LeftControl)) if (Input.GetKey(KeyCode.LeftControl))
{ {
if (Input.GetKeyDown(KeyCode.O)) if (Input.GetKeyDown(KeyCode.O))

View file

@ -2,18 +2,23 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using RhythmHeavenMania.Editor.Track;
namespace RhythmHeavenMania.Editor namespace RhythmHeavenMania.Editor
{ {
public class EventParameterManager : MonoBehaviour public class EventParameterManager : MonoBehaviour
{ {
[Header("General References")] [Header("General References")]
[SerializeField] private GameObject eventSelector; [SerializeField] private GameObject eventSelector;
[SerializeField] private GridGameSelector gridGameSelector;
[Header("Property Prefabs")] [Header("Property Prefabs")]
[SerializeField] private GameObject IntegerP; [SerializeField] private GameObject IntegerP;
public Beatmap.Entity entity; public Beatmap.Entity entity;
private bool active;
public static EventParameterManager instance { get; set; } public static EventParameterManager instance { get; set; }
private void Awake() private void Awake()
@ -21,8 +26,29 @@ namespace RhythmHeavenMania.Editor
instance = this; instance = this;
} }
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
if (!Timeline.instance.MouseInRectTransform(Editor.instance.eventSelectorBG) && active)
{
Disable();
}
}
}
public void Disable()
{
active = false;
eventSelector.SetActive(true);
DestroyParams();
Editor.instance.SetGameEventTitle($"Select game event for {gridGameSelector.SelectedMinigame}");
}
public void StartParams(Beatmap.Entity entity) public void StartParams(Beatmap.Entity entity)
{ {
active = true;
AddParams(entity); AddParams(entity);
} }
@ -39,10 +65,7 @@ namespace RhythmHeavenMania.Editor
Editor.instance.SetGameEventTitle($"Properties for {entity.datamodel}"); Editor.instance.SetGameEventTitle($"Properties for {entity.datamodel}");
for (int i = 1; i < transform.childCount; i++) DestroyParams();
{
Destroy(transform.GetChild(i).gameObject);
}
for (int i = 0; i < action.parameters.Count; i++) for (int i = 0; i < action.parameters.Count; i++)
{ {
@ -52,6 +75,8 @@ namespace RhythmHeavenMania.Editor
AddParam(propertyName, param, caption); AddParam(propertyName, param, caption);
} }
active = true;
} }
} }
@ -72,5 +97,14 @@ namespace RhythmHeavenMania.Editor
var property = input.GetComponent<EventPropertyPrefab>(); var property = input.GetComponent<EventPropertyPrefab>();
property.SetProperties(propertyName, type, caption); property.SetProperties(propertyName, type, caption);
} }
private void DestroyParams()
{
active = false;
for (int i = 1; i < transform.childCount; i++)
{
Destroy(transform.GetChild(i).gameObject);
}
}
} }
} }

View file

@ -26,10 +26,16 @@ namespace RhythmHeavenMania.Editor
slider.minValue = integer.min; slider.minValue = integer.min;
slider.maxValue = integer.max; slider.maxValue = integer.max;
slider.value = Mathf.RoundToInt(System.Convert.ToSingle(parameterManager.entity[propertyName]));
inputField.text = slider.value.ToString();
slider.onValueChanged.AddListener(delegate { TestChange(); });
} }
public void TestChange() public void TestChange()
{ {
print("bru");
inputField.text = slider.value.ToString(); inputField.text = slider.value.ToString();
parameterManager.entity[propertyName] = (int)slider.value; parameterManager.entity[propertyName] = (int)slider.value;
} }

View file

@ -473,8 +473,11 @@ namespace RhythmHeavenMania.Editor.Track
entity.track = (int)(g.transform.localPosition.y / LayerHeight() * -1); entity.track = (int)(g.transform.localPosition.y / LayerHeight() * -1);
} }
if (addEvent) if (addEvent)
{ {
Beatmap.Entity tempEntity = entity;
if (entity == null) if (entity == null)
{ {
Beatmap.Entity en = new Beatmap.Entity(); Beatmap.Entity en = new Beatmap.Entity();
@ -483,12 +486,32 @@ namespace RhythmHeavenMania.Editor.Track
GameManager.instance.Beatmap.entities.Add(en); GameManager.instance.Beatmap.entities.Add(en);
GameManager.instance.SortEventsList(); GameManager.instance.SortEventsList();
tempEntity = en;
} }
else else
{ {
GameManager.instance.Beatmap.entities.Add(entity); GameManager.instance.Beatmap.entities.Add(entity);
GameManager.instance.SortEventsList(); GameManager.instance.SortEventsList();
} }
// default param value
var game = EventCaller.instance.GetMinigame(eventName.Split(0));
var ep = EventCaller.instance.GetGameAction(game, eventName.Split(1)).parameters;
if (ep != null)
{
for (int i = 0; i < ep.Count; i++)
{
object returnVal = ep[i].parameter;
if (ep[i].parameter.GetType() == typeof(EntityTypes.Integer))
{
returnVal = ((EntityTypes.Integer)ep[i].parameter).val;
}
tempEntity[ep[i].propertyName] = returnVal;
}
}
} }
eventObjs.Add(eventObj); eventObjs.Add(eventObj);
@ -500,6 +523,9 @@ namespace RhythmHeavenMania.Editor.Track
public void DestroyEventObject(Beatmap.Entity entity) public void DestroyEventObject(Beatmap.Entity entity)
{ {
if (EventParameterManager.instance.entity == entity)
EventParameterManager.instance.Disable();
eventObjs.Remove(entity.eventObj); eventObjs.Remove(entity.eventObj);
GameManager.instance.Beatmap.entities.Remove(entity); GameManager.instance.Beatmap.entities.Remove(entity);
Timeline.instance.eventObjs.Remove(entity.eventObj); Timeline.instance.eventObjs.Remove(entity.eventObj);

View file

@ -135,7 +135,7 @@ namespace RhythmHeavenMania.Editor.Track
{ {
if (!Input.GetKey(KeyCode.LeftShift)) if (!Input.GetKey(KeyCode.LeftShift))
{ {
Selections.instance.Deselect(this); // Selections.instance.Deselect(this);
} }
} }
@ -249,6 +249,10 @@ namespace RhythmHeavenMania.Editor.Track
// OnComplete(); // OnComplete();
} }
} }
else if (Input.GetMouseButton(1))
{
EventParameterManager.instance.StartParams(entity);
}
} }
public void OnUp() public void OnUp()

View file

@ -127,7 +127,7 @@ namespace RhythmHeavenMania
new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(eventCaller.currentBeat, true, eventCaller.currentType); }, 3), new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(eventCaller.currentBeat, true, eventCaller.currentType); }, 3),
new GameAction("costume", delegate { Spaceball.instance.Costume(eventCaller.currentType); }, 1f, false, new List<Param>() { new Param("type", new EntityTypes.Integer(0, 2), "type") } ), new GameAction("costume", delegate { Spaceball.instance.Costume(eventCaller.currentType); }, 1f, false, new List<Param>() { new Param("type", new EntityTypes.Integer(0, 2), "type") } ),
new GameAction("alien", delegate { Spaceball.instance.alien.Show(eventCaller.currentBeat); } ), new GameAction("alien", delegate { Spaceball.instance.alien.Show(eventCaller.currentBeat); } ),
new GameAction("camera", delegate { }, 4, true ), new GameAction("camera", delegate { Spaceball.instance.OverrideCurrentZoom(); }, 4, true, new List<Param>() { new Param("valA", new EntityTypes.Integer(1, 320, 10), "zoom") } ),
new GameAction("prepare dispenser", delegate { Spaceball.instance.PrepareDispenser(); }, 1 ), new GameAction("prepare dispenser", delegate { Spaceball.instance.PrepareDispenser(); }, 1 ),
}), }),
new Minigame("karateman", "Karate Man", "70A8D8", false, false, new List<GameAction>() new Minigame("karateman", "Karate Man", "70A8D8", false, false, new List<GameAction>()