Delete dead PropertiesPanel reflection inspector
This commit is contained in:
parent
1f12fe0f16
commit
9c63c0a1af
13 changed files with 46 additions and 164 deletions
|
|
@ -12,59 +12,35 @@ public class FieldDriver : MonoBehaviour
|
|||
public float2 Push;
|
||||
public float FrontTwist;
|
||||
public float RearTwist;
|
||||
[Inspectable]
|
||||
public float TestMagnitude;
|
||||
[Inspectable]
|
||||
public float FlowSpeed;
|
||||
[Inspectable]
|
||||
public float FlowSpeedThrottleExponent;
|
||||
[Inspectable]
|
||||
public float WaveThrottleExponent;
|
||||
|
||||
public int MaxHits;
|
||||
[Inspectable]
|
||||
public ExponentialCurve MagnitudeTimeScaling;
|
||||
|
||||
[Inspectable]
|
||||
public float MeleeRange;
|
||||
[Inspectable]
|
||||
public float MeleeRangeExponent;
|
||||
[Inspectable]
|
||||
public float MeleeFlatness;
|
||||
[Inspectable]
|
||||
public float MeleeShaping;
|
||||
[Inspectable]
|
||||
public float MeleeDuration;
|
||||
[Inspectable]
|
||||
public float MeleeAngle;
|
||||
[Inspectable]
|
||||
public float MeleeAngleExponent;
|
||||
|
||||
[Inspectable]
|
||||
public float TendrilBaseRadius = 3;
|
||||
[Inspectable]
|
||||
public float TendrilTipRadius = .1f;
|
||||
[Inspectable]
|
||||
public float TendrilExtensionExponent = .75f;
|
||||
[Inspectable]
|
||||
public float TendrilExtendBaseAnimationExponent = .5f;
|
||||
[Inspectable]
|
||||
public float TendrilBaseDamping = 2;
|
||||
[Inspectable]
|
||||
public float TendrilTipRadiusAnimationExponent = 2f;
|
||||
[Inspectable]
|
||||
public float TendrilFadeExponent = 2;
|
||||
// [Inspectable]
|
||||
// public float GrabScaleAnimationExponent = .5f;
|
||||
|
||||
[Inspectable]
|
||||
public float GrabExtendTime;
|
||||
[Inspectable]
|
||||
public float GrabEnvelopTime;
|
||||
[Inspectable]
|
||||
public float GrabPullTime;
|
||||
|
||||
[Inspectable]
|
||||
public RectTransform.Axis RefractionAxis = RectTransform.Axis.Horizontal;
|
||||
|
||||
private Material _field;
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using System;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class EntityTypeRestrictionAttribute : Attribute
|
||||
{
|
||||
public readonly HullType Type;
|
||||
|
||||
public EntityTypeRestrictionAttribute(HullType type)
|
||||
{
|
||||
Type = type;
|
||||
}
|
||||
}
|
||||
|
||||
// public class CategoryAttribute : Attribute
|
||||
// {
|
||||
// public readonly Type Type;
|
||||
//
|
||||
// public CategoryAttribute(Type type)
|
||||
// {
|
||||
// Type = type;
|
||||
// }
|
||||
// }
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f68edb6415593e542b4ba42ff5bec0c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[Inspectable, EntityTypeRestriction(HullType.Ship)]
|
||||
public class AetherDrive : Behavior
|
||||
{
|
||||
private readonly float3 _rotorDiameter;
|
||||
|
|
|
|||
|
|
@ -143,11 +143,9 @@ public enum StatModifierType
|
|||
Multiplier
|
||||
}
|
||||
|
||||
[Inspectable]
|
||||
public class StatReference
|
||||
{
|
||||
public string Target;
|
||||
|
||||
[Inspectable]
|
||||
public string Stat;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,46 +7,34 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using Unity.Mathematics;
|
||||
|
||||
[Inspectable]
|
||||
public class Faction : INamedEntry
|
||||
{
|
||||
public string FactionKey;
|
||||
|
||||
[Inspectable]
|
||||
public string Name;
|
||||
|
||||
[Inspectable]
|
||||
public string ShortName;
|
||||
|
||||
[Inspectable]
|
||||
public string Description;
|
||||
|
||||
[Inspectable]
|
||||
public string Logo;
|
||||
|
||||
// [Inspectable]
|
||||
// public bool PlayerHostile;
|
||||
|
||||
[Inspectable]
|
||||
public float3 PrimaryColor;
|
||||
|
||||
[Inspectable]
|
||||
public float3 SecondaryColor;
|
||||
public string GeonameFileKey;
|
||||
public string BossHullItemKey;
|
||||
|
||||
[Inspectable]
|
||||
public int InfluenceDistance = 4;
|
||||
|
||||
public Dictionary<string, float> AllegianceByKey = new Dictionary<string, float>();
|
||||
|
||||
[Inspectable]
|
||||
public uint OverworldMusic;
|
||||
|
||||
[Inspectable]
|
||||
public uint CombatMusic;
|
||||
|
||||
[Inspectable]
|
||||
public uint BossMusic;
|
||||
|
||||
public string EntryName
|
||||
|
|
|
|||
|
|
@ -11,13 +11,10 @@ using static Unity.Mathematics.math;
|
|||
[Serializable]
|
||||
public class ExponentialCurve
|
||||
{
|
||||
[Inspectable]
|
||||
public float Exponent;
|
||||
|
||||
[Inspectable]
|
||||
public float Multiplier;
|
||||
|
||||
[Inspectable]
|
||||
public float Constant;
|
||||
|
||||
public float Evaluate(float value) => Multiplier * pow(value, Exponent) + Constant;
|
||||
|
|
@ -26,13 +23,10 @@ public class ExponentialCurve
|
|||
[Serializable]
|
||||
public class ExponentialLerp
|
||||
{
|
||||
[Inspectable]
|
||||
public float Exponent;
|
||||
|
||||
[Inspectable]
|
||||
public float Minimum;
|
||||
|
||||
[Inspectable]
|
||||
public float Maximum;
|
||||
|
||||
public float Evaluate(float value) => Minimum + pow(saturate(value), Exponent) * (Maximum - Minimum);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ using static Unity.Mathematics.math;
|
|||
using float2 = Unity.Mathematics.float2;
|
||||
using int2 = Unity.Mathematics.int2;
|
||||
|
||||
[Inspectable]
|
||||
public class Shape
|
||||
{
|
||||
public bool[,] Cells;
|
||||
|
|
@ -257,15 +256,14 @@ public class Shape
|
|||
}
|
||||
}
|
||||
|
||||
[Inspectable]
|
||||
public class HardpointData : ITintInspector
|
||||
{
|
||||
[Inspectable] public HardpointType Type;
|
||||
[Inspectable] public int2 Position;
|
||||
[Inspectable] public Shape Shape = new Shape();
|
||||
[Inspectable] public string Transform;
|
||||
[Inspectable] public ItemRotation Rotation;
|
||||
[Inspectable] public float Armor;
|
||||
public HardpointType Type;
|
||||
public int2 Position;
|
||||
public Shape Shape = new Shape();
|
||||
public string Transform;
|
||||
public ItemRotation Rotation;
|
||||
public float Armor;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
using System;
|
||||
|
||||
[AttributeUsage(AttributeTargets.All, Inherited = false)]
|
||||
public class InspectableAttribute : Attribute { }
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d078a6b39f8c440fabe8d43881207c5d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -7,7 +7,6 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using GameCult.Aetheria.State.Unity;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
|
|
@ -702,53 +701,6 @@ public class PropertiesPanel : MonoBehaviour
|
|||
RefreshValues();
|
||||
}
|
||||
|
||||
public void Inspect(object obj, bool inspectablesOnly = false, bool topLevel = true)
|
||||
{
|
||||
var fields = obj.GetType().GetFields();
|
||||
foreach (var field in fields)
|
||||
Inspect(obj, field, inspectablesOnly);
|
||||
|
||||
// if(topLevel)
|
||||
// foreach (var field in _propertyFields)
|
||||
// field.transform.SetSiblingIndex(_propertyFields.IndexOf(field));
|
||||
|
||||
RefreshValues();
|
||||
}
|
||||
|
||||
public void Inspect(object obj, FieldInfo field, bool inspectablesOnly = false)
|
||||
{
|
||||
var inspectable = field.GetCustomAttribute<InspectableAttribute>();
|
||||
if (inspectable == null && inspectablesOnly) return;
|
||||
var type = field.FieldType;
|
||||
|
||||
if (type == typeof(float))
|
||||
{
|
||||
AddProperty(field.Name.SplitCamelCase(), () => ((float) field.GetValue(obj)).ToString("0.##"));
|
||||
}
|
||||
else if (type == typeof(int))
|
||||
{
|
||||
AddProperty(field.Name.SplitCamelCase(), () => ((int) field.GetValue(obj)).ToString());
|
||||
}
|
||||
else if (type.IsEnum)
|
||||
{
|
||||
AddProperty(field.Name.SplitCamelCase(), () => Enum.GetName(type, field.GetValue(obj)).SplitCamelCase());
|
||||
}
|
||||
else if (type == typeof(string))
|
||||
{
|
||||
AddProperty(field.Name.SplitCamelCase(), () => (string) field.GetValue(obj));
|
||||
}
|
||||
else if (field.FieldType == typeof(bool)) AddProperty(field.Name.SplitCamelCase(), () => ((bool) field.GetValue(obj)).ToString());
|
||||
else if (type.GetCustomAttribute<InspectableAttribute>() != null)
|
||||
{
|
||||
// if(!_propertyFields.Any() || !_propertyFields.Last().gameObject.name.ToUpper().Contains("DIVIDER"))
|
||||
// _propertyFields.Add(Divider.Instantiate<Prototype>());
|
||||
var list = AddList(field.Name);
|
||||
list.Inspect(field.GetValue(obj), inspectablesOnly, false);
|
||||
}
|
||||
else
|
||||
Debug.Log($"Field \"{field.Name}\" has unknown type {field.FieldType.Name}. No inspector was generated.");
|
||||
}
|
||||
|
||||
public void RefreshValues()
|
||||
{
|
||||
RefreshPropertyValues?.Invoke();
|
||||
|
|
|
|||
Loading…
Reference in a new issue