Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
2023.5.hotfix
  • Loading branch information
stephenlucerne authored and meeelting committed May 15, 2023
0 parents commit 0eb44ed
Show file tree
Hide file tree
Showing 1,245 changed files with 208,973 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Documentation.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Documentation/FONT_EULA.pdf
Binary file not shown.
7 changes: 7 additions & 0 deletions Documentation/FONT_EULA.pdf.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Documentation/Full_Documentation.pdf
Binary file not shown.
7 changes: 7 additions & 0 deletions Documentation/Full_Documentation.pdf.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions Documentation/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 mod.io Proprietary Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions Documentation/LICENSE.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

356 changes: 356 additions & 0 deletions Documentation/UPGRADING.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Documentation/UPGRADING.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Editor/ModIO.EditorCode.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 77 additions & 0 deletions Editor/ModIO.EditorCode/EditorMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;

using ModIO.Implementation;
using ModIO.Implementation.Platform;

namespace ModIO.EditorCode
{

/// <summary>summary</summary>
public static class EditorMenu
{
static EditorMenu()
{
new MenuItem("Tools/mod.io/Edit Settings", false, 0);
}

[MenuItem("Tools/mod.io/Edit Settings", false, 0)]
public static void EditSettingsAsset()
{
var settingsAsset = GetConfigAsset();

EditorGUIUtility.PingObject(settingsAsset);
Selection.activeObject = settingsAsset;
}


internal static SettingsAsset GetConfigAsset()
{
var settingsAsset = Resources.Load<SettingsAsset>(SettingsAsset.FilePath);

// if it doesnt exist we create one
if(settingsAsset == null)
{
// create asset
settingsAsset = ScriptableObject.CreateInstance<SettingsAsset>();

// ensure the directories exist before trying to create the asset
if(!AssetDatabase.IsValidFolder("Assets/Resources"))
{
AssetDatabase.CreateFolder("Assets", "Resources");
}
if(!AssetDatabase.IsValidFolder("Assets/Resources/mod.io"))
{
AssetDatabase.CreateFolder("Assets/Resources", "mod.io");
}

AssetDatabase.CreateAsset(settingsAsset, $@"Assets/Resources/{SettingsAsset.FilePath}.asset");

//create a data representation of the Settings Asset
SerializedObject so = new SerializedObject(settingsAsset);

//Find properties and apply default values
SerializedProperty serverSettingsProperty = so.FindProperty("serverSettings");
serverSettingsProperty.FindPropertyRelative("serverURL").stringValue = "https://api.mod.io/v1";;
serverSettingsProperty.FindPropertyRelative("languageCode").stringValue = "en";

//Apply new values while ensuring the user cannot use "undo" to erase the initial values.
so.ApplyModifiedPropertiesWithoutUndo();

//Grab any asset changes and unload unused assets
AssetDatabase.Refresh();
}

return settingsAsset;
}

[MenuItem("Tools/mod.io/Debug/Clear Data", false, 0)]
public static void ClearStoredData()
{
// Only used for the editor
SystemIOWrapper.DeleteDirectory(EditorDataService.GlobalRootDirectory);
}
}
}
#endif
11 changes: 11 additions & 0 deletions Editor/ModIO.EditorCode/EditorMenu.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 90 additions & 0 deletions Editor/ModIO.EditorCode/SettingsAssetEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#if UNITY_EDITOR
using ModIO.Implementation;
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(SettingsAsset))]
public class SettingsAssetEditor : Editor
{
private SerializedProperty serverURL;
private SerializedProperty gameId;
private SerializedProperty gameKey;
private SerializedProperty languageCode;

private void OnEnable()
{
//get references to SerializedProperties
var serverSettingsProperty = serializedObject.FindProperty("serverSettings");
serverURL = serverSettingsProperty.FindPropertyRelative("serverURL");
gameId = serverSettingsProperty.FindPropertyRelative("gameId");
gameKey = serverSettingsProperty.FindPropertyRelative("gameKey");
languageCode = serverSettingsProperty.FindPropertyRelative("languageCode");
}

public override void OnInspectorGUI()
{
//Grab any changes to the original object data
this.serializedObject.UpdateIfRequiredOrScript();

SettingsAsset myTarget = (SettingsAsset)target;

base.OnInspectorGUI();

EditorGUILayout.Space();

GUIStyle labelStyle = new GUIStyle();
labelStyle.alignment = TextAnchor.MiddleCenter;
labelStyle.fontStyle = FontStyle.Bold;
labelStyle.normal.textColor = Color.white;

EditorGUILayout.LabelField("Server Settings", labelStyle);
if(myTarget.serverSettings.gameId == 0 || string.IsNullOrWhiteSpace(myTarget.serverSettings.gameKey))
{
EditorGUILayout.HelpBox("Once you've created a game profile on mod.io (or test.mod.io) "
+ "you can input the game ID and Key below in order for the plugin "
+ "to retrieve mods and information associated to your game.",
MessageType.Info);
}

EditorGUILayout.PropertyField(serverURL, new GUIContent("Server URL"));
EditorGUILayout.PropertyField(gameId,new GUIContent("Game ID"));
gameKey.stringValue = EditorGUILayout.PasswordField("API Key", gameKey.stringValue);
EditorGUILayout.PropertyField(languageCode, new GUIContent("Language code"));


EditorGUILayout.Space();
EditorGUILayout.Space();

EditorGUILayout.BeginHorizontal();
if(GUILayout.Button("Insert URL for Test API"))
{
serverURL.stringValue = "https://api.test.mod.io/v1";

//remove focus from other fields
GUI.FocusControl(null);
}
if(GUILayout.Button("Insert URL for Production API"))
{
serverURL.stringValue = "https://api.mod.io/v1";
//remove focus from other fields
GUI.FocusControl(null);
}
EditorGUILayout.EndHorizontal();

if(GUILayout.Button("Locate ID and API Key"))
{
if(myTarget.serverSettings.serverURL == "https://api.test.mod.io/v1")
{
Application.OpenURL("https://test.mod.io/apikey");
}
else
{
Application.OpenURL("https://mod.io/apikey");
}
}

//Save the new values
this.serializedObject.ApplyModifiedProperties();
}
}
#endif
11 changes: 11 additions & 0 deletions Editor/ModIO.EditorCode/SettingsAssetEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0eb44ed

Please sign in to comment.