Skip to content

Commit bbcb854

Browse files
committed
fix(stat-container): added missing interfaces and fixed a stat container GUI display bug
The GUI would not display when stats container was inherited
1 parent 6447915 commit bbcb854

16 files changed

Lines changed: 11106 additions & 108 deletions

File tree

Assets/Examples/CombatExample/RobotBoyIdleSprite.png.meta

Lines changed: 67 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 11500000, guid: 95f28e895cfd4a92894a74b1a6e507fe, type: 3}
13+
m_Name: ExampleContainerInheritance
14+
m_EditorClassIdentifier:
15+
collection: {fileID: 11400000, guid: 0cda059b3069840fe94a9480fa84c45c, type: 2}
16+
overrides:
17+
overrides:
18+
- definition: {fileID: 11400000, guid: 27355736af3274d11a63b95b6a5a14cf, type: 2}
19+
value:
20+
_valueInt:
21+
value: 22
22+
_valueIntCurve:
23+
value:
24+
serializedVersion: 2
25+
m_Curve: []
26+
m_PreInfinity: 2
27+
m_PostInfinity: 2
28+
m_RotationOrder: 4
29+
_valueFloat:
30+
value: 0
31+
_valueFloatCurve:
32+
value:
33+
serializedVersion: 2
34+
m_Curve: []
35+
m_PreInfinity: 2
36+
m_PostInfinity: 2
37+
m_RotationOrder: 4
38+
type: 0
39+
- definition: {fileID: 11400000, guid: 3cf3e661c93fb496ca382be87b943584, type: 2}
40+
value:
41+
_valueInt:
42+
value: 22
43+
_valueIntCurve:
44+
value:
45+
serializedVersion: 2
46+
m_Curve: []
47+
m_PreInfinity: 2
48+
m_PostInfinity: 2
49+
m_RotationOrder: 4
50+
_valueFloat:
51+
value: 0
52+
_valueFloatCurve:
53+
value:
54+
serializedVersion: 2
55+
m_Curve: []
56+
m_PreInfinity: 2
57+
m_PostInfinity: 2
58+
m_RotationOrder: 4
59+
type: 2

Assets/Examples/ExampleContainerInheritance.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using CleverCrow.Fluid.StatsSystem.StatsContainers;
2+
using UnityEngine;
3+
4+
namespace CleverCrow.Fluid.StatsSystem{
5+
/// <summary>
6+
/// Sample container for testing objects that inherit from StatsContainer in the GUI
7+
/// </summary>
8+
[CreateAssetMenu(fileName = "ExampleContainerInheritance", menuName = "Fluid/Stats/Example/Stats Container Inheritance")]
9+
public class ExampleContainerInheritance : StatsContainer {
10+
}
11+
}

Assets/Examples/ExampleContainerInheritance.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/com.fluid.stats/Editor/Scripts/CustomEditors/StatsContainerEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using UnityEngine.SceneManagement;
99

1010
namespace CleverCrow.Fluid.StatsSystem.Editors {
11-
[CustomEditor(typeof(StatsContainer))]
11+
[CustomEditor(typeof(StatsContainer), true)]
1212
public class StatsContainerEditor : Editor {
1313
private bool _debug;
1414

Assets/com.fluid.stats/Runtime/StatsContainer/IStatsContainer.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33

44
namespace CleverCrow.Fluid.StatsSystem.StatsContainers {
55
public interface IStatsContainer {
6+
/// <summary>
7+
/// ID of the container
8+
/// </summary>
9+
string Id { get; }
10+
11+
/// <summary>
12+
/// All available records. Modify directly with extreme caution
13+
/// </summary>
14+
StatRecordCollection Records { get; }
15+
616
StatsContainer CreateRuntimeCopy ();
717

818
StatRecord GetRecord (string definitionId);

Assets/com.fluid.stats/Runtime/StatsContainer/StatsContainer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
namespace CleverCrow.Fluid.StatsSystem.StatsContainers {
66
[CreateAssetMenu(fileName = "StatsContainer", menuName = "Fluid/Stats/Container")]
77
public class StatsContainer : ScriptableObject, IStatsContainer {
8+
public virtual string Id => name.Replace("(Copy)", "");
89
private class StatRecordEvent : UnityEvent<StatRecord> {}
910
private Dictionary<StatRecord, StatRecordEvent> _events = new Dictionary<StatRecord, StatRecordEvent>();
1011

1112
[Tooltip("This collection will be combined with the default stats from settings")]
1213
public StatDefinitionCollection collection;
1314

1415
public StatRecordCollection records = new StatRecordCollection();
15-
16+
public StatRecordCollection Records => records;
1617
public StatDefinitionOverrideCollection overrides = new StatDefinitionOverrideCollection();
1718

1819
public bool IsSetup { get; private set; }

Packages/manifest.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
"dependencies": {
33
"clever-crow.nsubstitute": "2.0.3",
44
"com.fluid.adnc-utilities": "1.0.0",
5-
"com.unity.collab-proxy": "1.3.9",
6-
"com.unity.ide.rider": "2.0.7",
7-
"com.unity.ide.visualstudio": "2.0.7",
8-
"com.unity.ide.vscode": "1.2.3",
9-
"com.unity.test-framework": "1.1.24",
10-
"com.unity.testtools.codecoverage": "1.0.0",
11-
"com.unity.textmeshpro": "3.0.4",
12-
"com.unity.timeline": "1.4.6",
5+
"com.unity.ai.navigation": "1.1.1",
6+
"com.unity.collab-proxy": "1.17.7",
7+
"com.unity.ide.rider": "3.0.16",
8+
"com.unity.ide.visualstudio": "2.0.16",
9+
"com.unity.ide.vscode": "1.2.5",
10+
"com.unity.test-framework": "1.1.33",
11+
"com.unity.testtools.codecoverage": "1.2.1",
12+
"com.unity.textmeshpro": "3.0.6",
13+
"com.unity.timeline": "1.7.2",
1314
"com.unity.ugui": "1.0.0",
1415
"com.unity.modules.ai": "1.0.0",
1516
"com.unity.modules.androidjni": "1.0.0",

0 commit comments

Comments
 (0)