Skip to content

Commit ccdc0cf

Browse files
committed
Add array mutable and immutable variables
1 parent a76ee57 commit ccdc0cf

File tree

176 files changed

+1969
-95
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+1969
-95
lines changed

Packages/SOVariables/Editor/Array.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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace RaCoding.Variables
2+
{
3+
public abstract class ArrayVariableEditor<T> : VariableEditor<T>
4+
{
5+
protected override void AssignResetValue()
6+
{
7+
resetValue.arraySize = value.arraySize;
8+
resetValue.ClearArray();
9+
for (int i = 0; i < value.arraySize; i++)
10+
{
11+
resetValue.InsertArrayElementAtIndex(i);
12+
AssignResetArrayElementValue(i);
13+
}
14+
}
15+
16+
protected abstract void AssignResetArrayElementValue(int index);
17+
}
18+
}

Packages/SOVariables/Editor/Array/ArrayVariableEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using UnityEditor;
2+
3+
namespace RaCoding.Variables
4+
{
5+
[CustomEditor(typeof(BoolArrayMutableVariable), editorForChildClasses: true)]
6+
public class BoolArrayVariableEditor : ArrayVariableEditor<bool[]>
7+
{
8+
protected override void AssignResetArrayElementValue(int index)
9+
{
10+
resetValue.GetArrayElementAtIndex(index).boolValue = value.GetArrayElementAtIndex(index).boolValue;
11+
}
12+
}
13+
}

Packages/SOVariables/Editor/Array/BoolArrayVariableEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
4+
namespace RaCoding.Variables
5+
{
6+
[CustomEditor(typeof(ByteArrayMutableVariable), editorForChildClasses: true)]
7+
public class ByteArrayVariableEditor : ArrayVariableEditor<byte[]>
8+
{
9+
protected override void AssignResetArrayElementValue(int index)
10+
{
11+
resetValue.GetArrayElementAtIndex(index).intValue = value.GetArrayElementAtIndex(index).intValue;
12+
}
13+
}
14+
}

Packages/SOVariables/Editor/Array/ByteArrayVariableEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
4+
namespace RaCoding.Variables
5+
{
6+
[CustomEditor(typeof(CharArrayMutableVariable), editorForChildClasses: true)]
7+
public class CharArrayVariableEditor : ArrayVariableEditor<char[]>
8+
{
9+
protected override void AssignResetArrayElementValue(int index)
10+
{
11+
resetValue.GetArrayElementAtIndex(index).intValue = value.GetArrayElementAtIndex(index).intValue;
12+
}
13+
}
14+
}

Packages/SOVariables/Editor/Array/CharArrayVariableEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
4+
namespace RaCoding.Variables
5+
{
6+
[CustomEditor(typeof(ColorArrayMutableVariable), editorForChildClasses: true)]
7+
public class ColorArrayVariableEditor : ArrayVariableEditor<Color[]>
8+
{
9+
protected override void AssignResetArrayElementValue(int index)
10+
{
11+
resetValue.GetArrayElementAtIndex(index).colorValue = value.GetArrayElementAtIndex(index).colorValue;
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)