Skip to content
Permalink
Browse files

Merge branch 'dev'

  • Loading branch information
Melodatron committed Mar 19, 2020
2 parents 350c944 + 545879a commit b2cf6fb16b30e4159f8756673aa48474079a4b6a
Showing with 1,132 additions and 326 deletions.
  1. +3 −0 CHANGELOG.md
  2. +35 −0 Editor/ControlBindingDrawers.cs
  3. +13 −0 Editor/ControlBindingDrawers.cs.meta
  4. +98 −0 Editor/UI/EnumDropdownEditor.cs
  5. +13 −0 Editor/UI/EnumDropdownEditor.cs.meta
  6. +3 −5 Editor/UI/GraphicColorSchemeEditor.cs
  7. +3 −5 Editor/UI/SelectableColorSchemeEditor.cs
  8. +15 −7 Runtime/API/RequestParameters/SubmitReportParameters.cs
  9. +8 −0 Runtime/APIClient.cs
  10. +14 −5 Runtime/Editable Objects/EditableReport.cs
  11. +14 −0 Runtime/Enums/ReportType.cs
  12. +13 −0 Runtime/Enums/ReportType.cs.meta
  13. +2 −13 Runtime/LocalUser.cs
  14. +22 −2 Runtime/ModIOVersion.cs
  15. +19 −4 Runtime/UI/BrowserViews/ExplorerView.cs
  16. +6 −0 Runtime/UI/BrowserViews/IBrowserView.cs
  17. +6 −0 Runtime/UI/BrowserViews/InspectorView.cs
  18. +17 −0 Runtime/UI/BrowserViews/LoginDialog.cs
  19. +24 −0 Runtime/UI/BrowserViews/MessageDialog.cs
  20. +160 −25 Runtime/UI/BrowserViews/ReportDialog.cs
  21. +4 −0 Runtime/UI/BrowserViews/ReportTypeDropdown.cs
  22. +13 −0 Runtime/UI/BrowserViews/ReportTypeDropdown.cs.meta
  23. +6 −0 Runtime/UI/BrowserViews/SubscriptionsView.cs
  24. +27 −27 Runtime/UI/BrowserViews/ViewControlBindings.cs
  25. +13 −6 Runtime/UI/Mod/Elements/ModEnabledDisplay.cs
  26. +2 −2 Runtime/UI/Mod/Elements/ModSubscribedDisplay.cs
  27. +6 −1 Runtime/UI/ModBrowser.cs
  28. +87 −19 Runtime/UI/NavigationManager.cs
  29. +109 −0 Runtime/UI/Utility/EnumDropdown.cs
  30. +13 −0 Runtime/UI/Utility/EnumDropdown.cs.meta
  31. +44 −0 Runtime/UI/Utility/ScrollFloatSetter.cs
  32. +13 −0 Runtime/UI/Utility/ScrollFloatSetter.cs.meta
  33. +1 −1 Runtime/UserDataStorage.cs
  34. +279 −177 Samples~/ModBrowser/2017.3/Prefabs/_ModBrowser.prefab
  35. +5 −5 Samples~/ModBrowser/Theming/Basic Buttons/Cancel Button.asset
  36. +5 −5 Samples~/ModBrowser/Theming/Basic Buttons/Confirm Button.asset
  37. +2 −2 Samples~/ModBrowser/Theming/Basic Buttons/Dark Button.asset
  38. +3 −3 Samples~/ModBrowser/Theming/Basic Buttons/Light Button.asset
  39. +2 −2 Samples~/ModBrowser/Theming/Basic Buttons/Subscribe Button.asset
  40. +3 −3 Samples~/ModBrowser/Theming/Login Weblinks.asset
  41. +1 −1 Samples~/ModBrowser/Theming/Mod Item Download Bar.asset
  42. +3 −3 Samples~/ModBrowser/Theming/Overlay UI Dropdowns/Dropdown Button.asset
  43. +3 −3 Samples~/ModBrowser/Theming/Overlay UI Dropdowns/Dropdown Item.asset
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Editor] PluginSettings directory previews.
- [UI] NavigationManager to assist controller support for the UI.
- [UI] Controller supported version of the Mod Browser prefab.
- [UI] Report Mod Dialog.

### Removed
- [Core] UserAuthenticationData - Replaced by LocalUser and UserAccountManagement functionality.
@@ -27,8 +28,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- [UI] DownloadView now reactivates correct in OnEnable.
- [UI] ExplorerView now correctly loads default sort.
- [UI] ExplorerView page changes now handle out-of-bounds parameters.
- [UI] InspectorView changelog is now rich-text enabled.
- [UI] FileSize has been correctly labeled in the Inspector View details table.
- [UI] StateToggleDisplays are now grabbed using GetComponents in other components.

## [2.1.1] - 2020-02-12
### Added
@@ -0,0 +1,35 @@
#if UNITY_EDITOR

using System;

using UnityEngine;
using UnityEditor;

namespace ModIO.UI.EditorCode
{
[CustomPropertyDrawer(typeof(ViewControlBindings.ButtonTriggerCondition))]
public class ButtonTriggerConditionDrawer : PropertyDrawer
{
// ---------[ GUI FUNCTIONALITY ]---------
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var oldValue = (ViewControlBindings.ButtonTriggerCondition)property.intValue;
Enum enumNew = EditorGUI.EnumFlagsField(position, label, oldValue);
property.intValue = (int)Convert.ChangeType(enumNew, typeof(ViewControlBindings.ButtonTriggerCondition));
}
}

[CustomPropertyDrawer(typeof(ViewControlBindings.AxisTriggerCondition))]
public class AxisTriggerConditionDrawer : PropertyDrawer
{
// ---------[ GUI FUNCTIONALITY ]---------
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var oldValue = (ViewControlBindings.AxisTriggerCondition)property.intValue;
Enum enumNew = EditorGUI.EnumFlagsField(position, label, oldValue);
property.intValue = (int)Convert.ChangeType(enumNew, typeof(ViewControlBindings.AxisTriggerCondition));
}
}
}

#endif // UNITY_EDITOR

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,98 @@
#if UNITY_EDITOR

using UnityEngine;
using UnityEngine.UI;
using UnityEditor;

namespace ModIO.UI.EditorCode
{
/// <summary>Custom editor for the EnumDropdownBase-derived components.</summary>
[CustomEditor(typeof(EnumDropdownBase), true)]
public class EnumDropdownEditor : Editor
{
SerializedProperty pairingArrayProperty = null;

private void OnEnable()
{
this.pairingArrayProperty = this.serializedObject.FindProperty("enumSelectionPairings");
}

public override void OnInspectorGUI()
{
this.serializedObject.Update();

EnumDropdownBase enumDropdown = (EnumDropdownBase)this.target;
Dropdown dropdown = enumDropdown.gameObject.GetComponent<Dropdown>();

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

// Build popup options
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;
}

// - Begin rendering -
// Table Headers
var origFontStyle = EditorStyles.label.fontStyle;
EditorStyles.label.fontStyle = FontStyle.Bold;
EditorGUILayout.LabelField("Enum Value", "Dropdown Option");
EditorStyles.label.fontStyle = origFontStyle;

// Enum options
bool isChanged = false;
string[] enumNames = enumDropdown.GetEnumNames();
int[] enumValues = enumDropdown.GetEnumValues();
var pairAssignments = new EnumDropdownBase.EnumSelectionPair[enumNames.Length];

for(int i = 0; i < enumValues.Length; ++i)
{
EnumDropdownBase.EnumSelectionPair pair;

// get stored data
if(!enumDropdown.TryGetPairForEnum(enumValues[i], out pair))
{
pair = new EnumDropdownBase.EnumSelectionPair()
{
selectionIndex = -1,
enumValue = enumValues[i],
};
}

// render popup
int oldSelection = pair.selectionIndex;

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

// assign to array & check changed
pairAssignments[i] = pair;
isChanged |= (oldSelection != pair.selectionIndex);
}

// - Update -
if(isChanged)
{
this.pairingArrayProperty.arraySize = pairAssignments.Length;
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;
}

this.serializedObject.ApplyModifiedProperties();
}
}
}
}


#endif // UNITY_EDITOR

Some generated files are not rendered by default. Learn more.

@@ -6,25 +6,23 @@
namespace ModIO.UI.EditorCode
{
[CustomEditor(typeof(GraphicColorScheme))]
[CanEditMultipleObjects]
public class GraphicColorSchemeEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
serializedObject.Update();

bool apply = GUILayout.Button("Apply to Scene");
bool apply = GUILayout.Button("Update Applicators");

if(apply)
{
// Apply to receivers
GraphicColorApplicator[] applicators = Object.FindObjectsOfType<GraphicColorApplicator>();
foreach(GraphicColorApplicator gca in applicators)
{
if(gca.scheme == this.target)
{
gca.UpdateColorScheme_withUndo();
}
gca.UpdateColorScheme_withUndo();
}
}
}
@@ -6,25 +6,23 @@
namespace ModIO.UI.EditorCode
{
[CustomEditor(typeof(SelectableColorScheme))]
[CanEditMultipleObjects]
public class SelectableColorSchemeEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
serializedObject.Update();

bool apply = GUILayout.Button("Apply to Scene");
bool apply = GUILayout.Button("Update Applicators");

if(apply)
{
// Apply to receivers
SelectableColorApplicator[] applicators = Object.FindObjectsOfType<SelectableColorApplicator>();
foreach(SelectableColorApplicator sca in applicators)
{
if(sca.scheme == this.target)
{
sca.UpdateColorScheme_withUndo();
}
sca.UpdateColorScheme_withUndo();
}
}
}
@@ -20,28 +20,36 @@ public int id
}
}
// [REQUIRED] The type of report you are submitting. Must be one of the following values:
public int type
public ReportType type
{
set
{
this.SetStringValue("type", value);
this.SetStringValue("type", (int)value);
}
}
// [REQUIRED] Informative title for your report.
// [REQUIRED] Detailed description of your report. Make sure you include all relevant information and links to help moderators investigate and respond appropiately.
public string summary
{
set
{
this.SetStringValue("summary", value);
}
}
// Contact details: Name of the user submitting the report. Recommended for DMCA reports.
public string name
{
set
{
this.SetStringValue("name", value);
}
}
// [REQUIRED] Detailed description of your report. Make sure you include all relevant information and links to help moderators investigate and respond appropiately.
public string summary
// Contact details: Method of contacting the user submitting the report. Recommended for DMCA reports.
public string contact
{
set
{
this.SetStringValue("summary", value);
this.SetStringValue("contact", value);
}
}
}
}
}
@@ -27,6 +27,8 @@ public static class APIClient
/// <summary>URL for the production server</summary>
public const string API_URL_PRODUCTIONSERVER = "https://api.mod.io/";

/// <summary>Version information to provide in the request header.</summary>
public static readonly string USER_AGENT_HEADER = "modioUnityPlugin-" + ModIOVersion.Current.ToString("X.Y.Z");

/// <summary>Collection of the HTTP request header keys used by Unity.</summary>
public static readonly string[] UNITY_REQUEST_HEADER_KEYS = new string[]
@@ -228,6 +230,7 @@ public static string GenerateRequestDebugString(UnityWebRequest webRequest)
}

webRequest.SetRequestHeader("Accept-Language", APIClient.languageCode);
webRequest.SetRequestHeader("user-agent", APIClient.USER_AGENT_HEADER);

return webRequest;
}
@@ -257,6 +260,7 @@ public static string GenerateRequestDebugString(UnityWebRequest webRequest)
UnityWebRequest webRequest = UnityWebRequest.Get(constructedURL);
webRequest.SetRequestHeader("Authorization", "Bearer " + LocalUser.OAuthToken);
webRequest.SetRequestHeader("Accept-Language", APIClient.languageCode);
webRequest.SetRequestHeader("user-agent", APIClient.USER_AGENT_HEADER);

return webRequest;
}
@@ -280,6 +284,7 @@ public static string GenerateRequestDebugString(UnityWebRequest webRequest)
webRequest.method = UnityWebRequest.kHttpVerbPUT;
webRequest.SetRequestHeader("Authorization", "Bearer " + LocalUser.OAuthToken);
webRequest.SetRequestHeader("Accept-Language", APIClient.languageCode);
webRequest.SetRequestHeader("user-agent", APIClient.USER_AGENT_HEADER);

#if DEBUG
if(PluginSettings.data.logAllRequests)
@@ -324,6 +329,7 @@ public static string GenerateRequestDebugString(UnityWebRequest webRequest)
UnityWebRequest webRequest = UnityWebRequest.Post(endpointURL, form);
webRequest.SetRequestHeader("Authorization", "Bearer " + LocalUser.OAuthToken);
webRequest.SetRequestHeader("Accept-Language", APIClient.languageCode);
webRequest.SetRequestHeader("user-agent", APIClient.USER_AGENT_HEADER);

#if DEBUG
if(PluginSettings.data.logAllRequests)
@@ -361,6 +367,7 @@ public static string GenerateRequestDebugString(UnityWebRequest webRequest)
webRequest.method = UnityWebRequest.kHttpVerbDELETE;
webRequest.SetRequestHeader("Authorization", "Bearer " + LocalUser.OAuthToken);
webRequest.SetRequestHeader("Accept-Language", APIClient.languageCode);
webRequest.SetRequestHeader("user-agent", APIClient.USER_AGENT_HEADER);

#if DEBUG
if(PluginSettings.data.logAllRequests)
@@ -531,6 +538,7 @@ private struct AccessTokenObject { public string access_token; }

UnityWebRequest webRequest = UnityWebRequest.Post(endpointURL, form);
webRequest.SetRequestHeader("Accept-Language", APIClient.languageCode);
webRequest.SetRequestHeader("user-agent", APIClient.USER_AGENT_HEADER);

#if DEBUG
if(PluginSettings.data.logAllRequests)
@@ -6,15 +6,19 @@ namespace ModIO
[Serializable]
public class EditableResourceTypeField : EditableField<ReportedResourceType> {}

[Serializable]
public class EditableReportTypeField : EditableField<ReportType> {}

[Serializable]
public class EditableReport
{
// ---------[ FIELDS ]---------
public ModIO.EditableResourceTypeField resourceType = new ModIO.EditableResourceTypeField();
public EditableIntField resourceId = new EditableIntField();
public EditableBoolField isDMCA = new EditableBoolField();
public EditableStringField name = new EditableStringField();
public EditableStringField summary = new EditableStringField();
public EditableResourceTypeField resourceType = new EditableResourceTypeField();
public EditableIntField resourceId = new EditableIntField();
public EditableReportTypeField reportType = new EditableReportTypeField();
public EditableStringField summary = new EditableStringField();
public EditableStringField name = new EditableStringField();
public EditableIntField contact = new EditableIntField();

public static string ResourceTypeToAPIString(ReportedResourceType resourceType)
{
@@ -38,5 +42,10 @@ public static string ResourceTypeToAPIString(ReportedResourceType resourceType)
}
}
}


// ---------[ Obsolete ]---------
[System.Obsolete("No longer supported. Use EditableReport.reportType instead.", true)]
public EditableBoolField isDMCA = null;
}
}
@@ -0,0 +1,14 @@
namespace ModIO
{
/// <summary>Describes a reason for a content report submission.</summary>
public enum ReportType
{
DMCA = 1,
NotWorking = 2,
RudeContent = 3,
IllegalContent = 4,
StolenContent = 5,
FalseInformation = 6,
Other = 7,
}
}

0 comments on commit b2cf6fb

Please sign in to comment.
You can’t perform that action at this time.