mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-25 02:55:15 +00:00
Editor: General enum property support. Hex input field functionality for color picker.
This commit is contained in:
parent
8671bb5cce
commit
a7dfb48dbc
7 changed files with 40 additions and 10 deletions
|
@ -40,4 +40,9 @@ public class ColorPreview : MonoBehaviour
|
|||
if (colorPicker != null)
|
||||
colorPicker.onColorChanged -= OnColorChanged;
|
||||
}
|
||||
|
||||
public void SetColorFromTMP()
|
||||
{
|
||||
SetColorFromHex(hex.text);
|
||||
}
|
||||
}
|
|
@ -3925,7 +3925,19 @@ MonoBehaviour:
|
|||
m_CharacterLimit: 0
|
||||
m_OnEndEdit:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1535224921}
|
||||
m_TargetAssemblyTypeName: ColorPreview, Assembly-CSharp-firstpass
|
||||
m_MethodName: SetColorFromTMP
|
||||
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
|
||||
m_OnSubmit:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
|
|
|
@ -12,6 +12,12 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
|
|||
// use PlayerActionObject for the actual tweezers but this isn't playable rn so IDC
|
||||
public class RhythmTweezers : Minigame
|
||||
{
|
||||
public enum VegetableType
|
||||
{
|
||||
Onion,
|
||||
Potato
|
||||
}
|
||||
|
||||
[Header("References")]
|
||||
public Transform VegetableHolder;
|
||||
public SpriteRenderer Vegetable;
|
||||
|
|
|
@ -8,6 +8,12 @@ namespace RhythmHeavenMania.Games.Spaceball
|
|||
{
|
||||
public class Spaceball : Minigame
|
||||
{
|
||||
public enum CostumeType {
|
||||
Standard,
|
||||
Bunny,
|
||||
SphereHead
|
||||
}
|
||||
|
||||
public GameObject Ball;
|
||||
public GameObject BallsHolder;
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace RhythmHeavenMania.Editor
|
|||
{
|
||||
prefab = FloatP;
|
||||
}
|
||||
else if (objType == typeof(RhythmHeavenMania.Util.EasingFunction.Ease))
|
||||
else if (objType.IsEnum)
|
||||
{
|
||||
prefab = DropdownP;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
@ -84,12 +85,12 @@ namespace RhythmHeavenMania.Editor
|
|||
parameterManager.entity[propertyName] = slider.value;
|
||||
});
|
||||
}
|
||||
else if (objType == typeof(EasingFunction.Ease))
|
||||
else if (objType.IsEnum)
|
||||
{
|
||||
List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>();
|
||||
for (int i = 0; i < System.Enum.GetValues(typeof(EasingFunction.Ease)).Length; i++)
|
||||
for (int i = 0; i < System.Enum.GetValues(objType).Length; i++)
|
||||
{
|
||||
string name = System.Enum.GetNames(typeof(EasingFunction.Ease))[i];
|
||||
string name = System.Enum.GetNames(objType)[i];
|
||||
TMP_Dropdown.OptionData optionData = new TMP_Dropdown.OptionData();
|
||||
|
||||
optionData.text = name;
|
||||
|
@ -97,11 +98,11 @@ namespace RhythmHeavenMania.Editor
|
|||
dropDownData.Add(optionData);
|
||||
}
|
||||
dropdown.AddOptions(dropDownData);
|
||||
dropdown.value = ((int)(EasingFunction.Ease)parameterManager.entity[propertyName]);
|
||||
dropdown.value = ((int)Enum.Parse(objType, parameterManager.entity[propertyName].ToString()));
|
||||
|
||||
dropdown.onValueChanged.AddListener(delegate
|
||||
{
|
||||
parameterManager.entity[propertyName] = (EasingFunction.Ease)dropdown.value;
|
||||
parameterManager.entity[propertyName] = Enum.ToObject(objType, dropdown.value);
|
||||
});
|
||||
}
|
||||
else if (objType == typeof(Color))
|
||||
|
|
|
@ -150,7 +150,7 @@ namespace RhythmHeavenMania
|
|||
new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(eventCaller.currentEntity.beat, true, eventCaller.currentEntity.type); }, 3),
|
||||
new GameAction("costume", delegate { Spaceball.instance.Costume(eventCaller.currentEntity.type); }, 1f, false, new List<Param>()
|
||||
{
|
||||
new Param("type", new EntityTypes.Integer(0, 2), "Type")
|
||||
new Param("type", Spaceball.CostumeType.Standard, "Type")
|
||||
} ),
|
||||
new GameAction("alien", delegate { Spaceball.instance.alien.Show(eventCaller.currentEntity.beat); } ),
|
||||
new GameAction("camera", delegate { Spaceball.instance.OverrideCurrentZoom(); }, 4, true, new List<Param>()
|
||||
|
@ -205,13 +205,13 @@ namespace RhythmHeavenMania
|
|||
new GameAction("long hair", delegate { RhythmTweezers.instance.SpawnLongHair(eventCaller.currentEntity.beat); }, 0.5f),
|
||||
new GameAction("next vegetable", delegate { var e = eventCaller.currentEntity; RhythmTweezers.instance.NextVegetable(e.beat, e.type, e.colorA, e.colorB); }, 0.5f, false, new List<Param>()
|
||||
{
|
||||
new Param("type", new EntityTypes.Integer(0, 1), "Type"),
|
||||
new Param("type", RhythmTweezers.VegetableType.Onion, "Type"),
|
||||
new Param("colorA", RhythmTweezers.defaultOnionColor, "Onion Color"),
|
||||
new Param("colorB", RhythmTweezers.defaultPotatoColor, "Potato Color")
|
||||
} ),
|
||||
new GameAction("change vegetable", delegate { var e = eventCaller.currentEntity; RhythmTweezers.instance.ChangeVegetableImmediate(e.type, e.colorA, e.colorB); }, 0.5f, false, new List<Param>()
|
||||
{
|
||||
new Param("type", new EntityTypes.Integer(0, 1), "Type"),
|
||||
new Param("type", RhythmTweezers.VegetableType.Onion, "Type"),
|
||||
new Param("colorA", RhythmTweezers.defaultOnionColor, "Onion Color"),
|
||||
new Param("colorB", RhythmTweezers.defaultPotatoColor, "Potato Color")
|
||||
} ),
|
||||
|
|
Loading…
Reference in a new issue