Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Version 2.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
modio-jackson committed Nov 9, 2021
1 parent e45eb89 commit 9ef4c4b
Show file tree
Hide file tree
Showing 233 changed files with 7,304 additions and 6,310 deletions.
6 changes: 4 additions & 2 deletions Editor/ControlBindingDrawers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
{
var oldValue = (ViewControlBindings.ButtonTriggerCondition)property.intValue;
Enum enumNew = EditorGUI.EnumFlagsField(position, label, oldValue);
property.intValue = (int)Convert.ChangeType(enumNew, typeof(ViewControlBindings.ButtonTriggerCondition));
property.intValue = (int)Convert.ChangeType(
enumNew, typeof(ViewControlBindings.ButtonTriggerCondition));
}
}

Expand All @@ -27,7 +28,8 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
{
var oldValue = (ViewControlBindings.AxisTriggerCondition)property.intValue;
Enum enumNew = EditorGUI.EnumFlagsField(position, label, oldValue);
property.intValue = (int)Convert.ChangeType(enumNew, typeof(ViewControlBindings.AxisTriggerCondition));
property.intValue =
(int)Convert.ChangeType(enumNew, typeof(ViewControlBindings.AxisTriggerCondition));
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions Editor/EditorMenuItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public static void ClearCache()
[MenuItem("Tools/mod.io/Debugging/Clear All User Data", false)]
public static void ClearAllUserData()
{
UserDataStorage.ClearActiveUserData((success) =>
{
UserDataStorage.ClearActiveUserData((success) => {
LocalUser.instance = new LocalUser();
LocalUser.isLoaded = true;

Expand Down Expand Up @@ -73,15 +72,17 @@ public static void RemoveAllInstalledMods()
public static void ForceColorSchemeUpdate()
{
Resources.LoadAll<GraphicColorApplicator>(string.Empty);
GraphicColorApplicator[] g_applicators = Resources.FindObjectsOfTypeAll<GraphicColorApplicator>();
GraphicColorApplicator[] g_applicators =
Resources.FindObjectsOfTypeAll<GraphicColorApplicator>();
foreach(GraphicColorApplicator gca in g_applicators)
{
gca.UpdateColorScheme_withUndo();
}

// Apply to receivers
Resources.LoadAll<SelectableColorApplicator>(string.Empty);
SelectableColorApplicator[] s_applicators = Resources.FindObjectsOfTypeAll<SelectableColorApplicator>();
SelectableColorApplicator[] s_applicators =
Resources.FindObjectsOfTypeAll<SelectableColorApplicator>();
foreach(SelectableColorApplicator sca in s_applicators)
{
sca.UpdateColorScheme_withUndo();
Expand Down
23 changes: 13 additions & 10 deletions Editor/UI/EnumDropdownEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ public override void OnInspectorGUI()
Dropdown dropdown = enumDropdown.gameObject.GetComponent<Dropdown>();

// Early out
if(dropdown == null) { return; }
if(dropdown == null)
{
return;
}

// Build popup options
string[] popupOptions = new string[dropdown.options.Count+1];
string[] popupOptions = new string[dropdown.options.Count + 1];
popupOptions[0] = "[Not Assigned]";

for(int i = 0; i < dropdown.options.Count; ++i)
{
popupOptions[i+1] = dropdown.options[i].text;
popupOptions[i + 1] = dropdown.options[i].text;
}

// - Begin rendering -
Expand All @@ -56,8 +59,7 @@ public override void OnInspectorGUI()
// get stored data
if(!enumDropdown.TryGetPairForEnum(enumValues[i], out pair))
{
pair = new EnumDropdownBase.EnumSelectionPair()
{
pair = new EnumDropdownBase.EnumSelectionPair() {
selectionIndex = -1,
enumValue = enumValues[i],
};
Expand All @@ -67,9 +69,8 @@ public override void OnInspectorGUI()
int oldSelection = pair.selectionIndex;

++pair.selectionIndex;
pair.selectionIndex = EditorGUILayout.Popup(enumNames[i],
pair.selectionIndex,
popupOptions);
pair.selectionIndex =
EditorGUILayout.Popup(enumNames[i], pair.selectionIndex, popupOptions);
--pair.selectionIndex;

// assign to array & check changed
Expand All @@ -84,8 +85,10 @@ public override void OnInspectorGUI()
for(int i = 0; i < pairAssignments.Length; ++i)
{
var arrayElement = this.pairingArrayProperty.GetArrayElementAtIndex(i);
arrayElement.FindPropertyRelative("selectionIndex").intValue = pairAssignments[i].selectionIndex;
arrayElement.FindPropertyRelative("enumValue").intValue = pairAssignments[i].enumValue;
arrayElement.FindPropertyRelative("selectionIndex").intValue =
pairAssignments[i].selectionIndex;
arrayElement.FindPropertyRelative("enumValue").intValue =
pairAssignments[i].enumValue;
}

this.serializedObject.ApplyModifiedProperties();
Expand Down
13 changes: 5 additions & 8 deletions Editor/UI/ExplorerSortDropdownEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ private static void LoadStaticData()
List<FieldData> dataList = new List<FieldData>(props.Length);
foreach(var filterFieldProperty in props)
{
FieldData data = new FieldData()
{
FieldData data = new FieldData() {
fieldName = filterFieldProperty.Name,
fieldValue = (string)filterFieldProperty.GetValue(null),
};
Expand All @@ -43,8 +42,7 @@ private static void LoadStaticData()
GUIContent[] content = new GUIContent[dataList.Count];
for(int i = 0; i < content.Length; ++i)
{
content[i] = new GUIContent()
{
content[i] = new GUIContent() {
text = dataList[i].fieldName,
};
}
Expand All @@ -62,9 +60,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
string currentValue = property.stringValue;
int currentSelectionIndex = -1;

for(int i = 0;
i < fieldData.Length && currentSelectionIndex < 0;
++i)
for(int i = 0; i < fieldData.Length && currentSelectionIndex < 0; ++i)
{
if(fieldData[i].fieldValue == currentValue)
{
Expand All @@ -77,7 +73,8 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
currentSelectionIndex = 0;
}

int newSelectionIndex = EditorGUI.Popup(position, label, currentSelectionIndex, popupOptions);
int newSelectionIndex =
EditorGUI.Popup(position, label, currentSelectionIndex, popupOptions);

if(newSelectionIndex != currentSelectionIndex)
{
Expand Down
9 changes: 6 additions & 3 deletions Editor/UI/GenericTextComponentDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ public class GenericTextComponentDrawer : PropertyDrawer
// ---------[ GUI FUNCTIONALITY ]---------
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
SerializedProperty nestedComponentProperty = property.FindPropertyRelative("m_textDisplayComponent");
SerializedProperty nestedComponentProperty =
property.FindPropertyRelative("m_textDisplayComponent");

Object displayObject = nestedComponentProperty.objectReferenceValue;
Object assignedObject = EditorGUI.ObjectField(position, label, displayObject, typeof(GameObject), true);
Object assignedObject =
EditorGUI.ObjectField(position, label, displayObject, typeof(GameObject), true);

if(assignedObject != displayObject)
{
Expand All @@ -26,7 +28,8 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
}
else
{
selectedComponent = GenericTextComponent.FindCompatibleTextComponent(assignedGameObject);
selectedComponent =
GenericTextComponent.FindCompatibleTextComponent(assignedGameObject);

if(selectedComponent != null)
{
Expand Down
3 changes: 2 additions & 1 deletion Editor/UI/GraphicColorSchemeEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public override void OnInspectorGUI()
if(apply)
{
// Apply to receivers
GraphicColorApplicator[] applicators = Object.FindObjectsOfType<GraphicColorApplicator>();
GraphicColorApplicator[] applicators =
Object.FindObjectsOfType<GraphicColorApplicator>();
foreach(GraphicColorApplicator gca in applicators)
{
gca.UpdateColorScheme_withUndo();
Expand Down
77 changes: 35 additions & 42 deletions Editor/UI/MemberReferenceDropdownDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,29 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
// Generate Display Values
if(this.displayValues == null)
{
MemberReference.DropdownDisplayAttribute dropdownAttribute
= (MemberReference.DropdownDisplayAttribute)attribute;
MemberReference.DropdownDisplayAttribute dropdownAttribute =
(MemberReference.DropdownDisplayAttribute)attribute;


Debug.Assert(dropdownAttribute != null);

// Generate member info
FieldInfo[] rootFields
= dropdownAttribute.objectType.GetFields(BindingFlags.Instance | BindingFlags.Public);
FieldInfo[] rootFields = dropdownAttribute.objectType.GetFields(
BindingFlags.Instance | BindingFlags.Public);

PropertyInfo[] rootProperties
= dropdownAttribute.objectType.GetProperties(BindingFlags.Instance | BindingFlags.Public);
PropertyInfo[] rootProperties = dropdownAttribute.objectType.GetProperties(
BindingFlags.Instance | BindingFlags.Public);

string[] membersToIgnore = dropdownAttribute.membersToIgnore;
if(membersToIgnore == null)
{
membersToIgnore = new string[0];
}

List<MemberInfoPath> memberPaths = GenerateMemberInfoPathList(rootFields,
rootProperties,
membersToIgnore,
dropdownAttribute.displayEnumerables,
dropdownAttribute.displayNested,
string.Empty);
List<MemberInfoPath> memberPaths =
GenerateMemberInfoPathList(rootFields, rootProperties, membersToIgnore,
dropdownAttribute.displayEnumerables,
dropdownAttribute.displayNested, string.Empty);

// generate strings
List<string> displayNames = new List<string>(memberPaths.Count);
Expand All @@ -87,26 +85,27 @@ PropertyInfo[] rootProperties
{
++selectedIndex;

if(selection == memberPath) { break; }
if(selection == memberPath)
{
break;
}
}

if(selectedIndex > this.displayValues.Length)
{
selectedIndex = 0;
}

selectedIndex = EditorGUI.Popup(position, "Member Path", selectedIndex, this.displayValues);
selectedIndex =
EditorGUI.Popup(position, "Member Path", selectedIndex, this.displayValues);
memberPathProperty.stringValue = this.displayValues[selectedIndex];
}

// ---------[ UTILITY ]---------
/// <summary>Generates the MemberInfoPath data for the given MemberInfo.</summary>
private static List<MemberInfoPath> GenerateMemberInfoPathList(FieldInfo[] fieldInfoArray,
PropertyInfo[] propertyInfoArray,
string[] membersToIgnore,
bool displayEnumerables,
bool displayNested,
string pathPrefix)
private static List<MemberInfoPath> GenerateMemberInfoPathList(
FieldInfo[] fieldInfoArray, PropertyInfo[] propertyInfoArray, string[] membersToIgnore,
bool displayEnumerables, bool displayNested, string pathPrefix)
{
List<MemberInfoPath> retVal = new List<MemberInfoPath>();
List<MemberInfoPath> nested = new List<MemberInfoPath>();
Expand Down Expand Up @@ -140,18 +139,15 @@ private static List<MemberInfoPath> GenerateMemberInfoPathList(FieldInfo[] field
}

// add to list
MemberInfoPath mip = new MemberInfoPath()
{
MemberInfoPath mip = new MemberInfoPath() {
pathPrefix = pathPrefix,
memberType = field.FieldType,
info = field,
};
retVal.Add(mip);

// add nested?
if(displayNested
&& field.FieldType.IsClass
&& field.FieldType != typeof(string))
if(displayNested && field.FieldType.IsClass && field.FieldType != typeof(string))
{
nested.Add(mip);
}
Expand Down Expand Up @@ -185,17 +181,15 @@ private static List<MemberInfoPath> GenerateMemberInfoPathList(FieldInfo[] field
}

// add to list
MemberInfoPath mip = new MemberInfoPath()
{
MemberInfoPath mip = new MemberInfoPath() {
pathPrefix = pathPrefix,
memberType = property.PropertyType,
info = property,
};
retVal.Add(mip);

// add nested?
if(displayNested
&& property.PropertyType.IsClass
if(displayNested && property.PropertyType.IsClass
&& property.PropertyType != typeof(string))
{
nested.Add(mip);
Expand All @@ -207,17 +201,14 @@ private static List<MemberInfoPath> GenerateMemberInfoPathList(FieldInfo[] field
{
string prefix = pathPrefix + nestedInfo.info.Name + ".";

FieldInfo[] nestedFields
= nestedInfo.memberType.GetFields(BindingFlags.Instance | BindingFlags.Public);
PropertyInfo[] nestedProperties
= nestedInfo.memberType.GetProperties(BindingFlags.Instance | BindingFlags.Public);

retVal.AddRange(GenerateMemberInfoPathList(nestedFields,
nestedProperties,
membersToIgnore,
displayEnumerables,
displayNested,
prefix));
FieldInfo[] nestedFields =
nestedInfo.memberType.GetFields(BindingFlags.Instance | BindingFlags.Public);
PropertyInfo[] nestedProperties = nestedInfo.memberType.GetProperties(
BindingFlags.Instance | BindingFlags.Public);

retVal.AddRange(GenerateMemberInfoPathList(nestedFields, nestedProperties,
membersToIgnore, displayEnumerables,
displayNested, prefix));
}

return retVal;
Expand All @@ -226,7 +217,10 @@ PropertyInfo[] nestedProperties
/// <summary>Determins if a type is Enumerable.</summary>
private static bool IsTypeEnumerable(Type objectType)
{
if(objectType == typeof(string)) { return false; }
if(objectType == typeof(string))
{
return false;
}

foreach(Type i in objectType.GetInterfaces())
{
Expand All @@ -239,7 +233,6 @@ private static bool IsTypeEnumerable(Type objectType)

return false;
}

}

}
Expand Down
10 changes: 7 additions & 3 deletions Editor/UI/PluginSettingsEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,19 @@ public override void OnInspectorGUI()
}
if(GUILayout.Button("Insert URL for Production API"))
{
apiURLProperty.stringValue = APIClient.API_URL_PRODUCTIONSERVER + APIClient.API_VERSION;
apiURLProperty.stringValue =
APIClient.API_URL_PRODUCTIONSERVER + APIClient.API_VERSION;
}
EditorGUILayout.EndHorizontal();

serializedObject.ApplyModifiedProperties();


bool isProductionAPIURL = (apiURLProperty.stringValue == APIClient.API_URL_PRODUCTIONSERVER + APIClient.API_VERSION);
bool isTestAPIURL = (apiURLProperty.stringValue == APIClient.API_URL_TESTSERVER + APIClient.API_VERSION);
bool isProductionAPIURL =
(apiURLProperty.stringValue
== APIClient.API_URL_PRODUCTIONSERVER + APIClient.API_VERSION);
bool isTestAPIURL = (apiURLProperty.stringValue
== APIClient.API_URL_TESTSERVER + APIClient.API_VERSION);

using(new EditorGUI.DisabledScope(!isProductionAPIURL && !isTestAPIURL))
{
Expand Down
3 changes: 2 additions & 1 deletion Editor/UI/SelectableColorSchemeEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public override void OnInspectorGUI()
if(apply)
{
// Apply to receivers
SelectableColorApplicator[] applicators = Object.FindObjectsOfType<SelectableColorApplicator>();
SelectableColorApplicator[] applicators =
Object.FindObjectsOfType<SelectableColorApplicator>();
foreach(SelectableColorApplicator sca in applicators)
{
sca.UpdateColorScheme_withUndo();
Expand Down
2 changes: 0 additions & 2 deletions Editor/UI/SlidingToggleEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ public override void OnInspectorGUI()
EditorGUILayout.PropertyField(this.m_OnValueChangedProperty);

serializedObject.ApplyModifiedProperties();


}
}
}
Expand Down
Loading

0 comments on commit 9ef4c4b

Please sign in to comment.