-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# com.rest.blockadelabs | ||
|
||
[![openupm](https://img.shields.io/npm/v/com.rest.blockadelabs?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.rest.blockadelabs/) | ||
|
||
A BlockadeLabs package for the [Unity](https://unity.com/) Game Engine. | ||
|
||
## Installing | ||
|
||
### Via Unity Package Manager and OpenUPM | ||
|
||
- Open your Unity project settings | ||
- Select the `Package Manager` | ||
![scoped-registries](images/package-manager-scopes.png) | ||
- Add the OpenUPM package registry: | ||
- Name: `OpenUPM` | ||
- URL: `https://package.openupm.com` | ||
- Scope(s): | ||
- `com.rest` | ||
- `com.utilities` | ||
- Open the Unity Package Manager window | ||
- Change the Registry from Unity to `My Registries` | ||
- Add the `BlockadeLabs` package | ||
|
||
### Via Unity Package Manager and Git url | ||
|
||
- Open your Unity Package Manager | ||
- Add package from git url: `https://github.com/RageAgainstThePixel/com.rest.blockadelabs.git#upm` | ||
|
||
## Documentation | ||
|
||
### Project Setup | ||
|
||
```csharp | ||
// TODO | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "BlockadeLabs.Editor", | ||
"rootNamespace": "BlockadeLabs.Editor", | ||
"references": [ | ||
"GUID:0e64303a4898a4d4ba94306e88e6c025", | ||
"GUID:7958db66189566541a6363568aee1575", | ||
"GUID:28b599e4adde9c94a9b9667d7b08fe83" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using System; | ||
using UnityEditor; | ||
using Utilities.Rest.Editor; | ||
|
||
namespace BlockadeLabs.Editor | ||
{ | ||
[CustomEditor(typeof(BlockadeLabsConfiguration))] | ||
public class BlockadeLabsConfigurationInspector : BaseConfigurationInspector<BlockadeLabsConfiguration> | ||
{ | ||
private static bool triggerReload; | ||
|
||
private SerializedProperty apiKey; | ||
private SerializedProperty proxyDomain; | ||
|
||
#region Project Settings Window | ||
|
||
[SettingsProvider] | ||
private static SettingsProvider Preferences() | ||
=> GetSettingsProvider(nameof(BlockadeLabs), CheckReload); | ||
|
||
#endregion Project Settings Window | ||
|
||
#region Inspector Window | ||
|
||
private void OnEnable() | ||
{ | ||
GetOrCreateInstance(target); | ||
|
||
try | ||
{ | ||
apiKey = serializedObject.FindProperty(nameof(apiKey)); | ||
proxyDomain = serializedObject.FindProperty(nameof(proxyDomain)); | ||
} | ||
catch (Exception) | ||
{ | ||
// Ignored | ||
} | ||
} | ||
|
||
private void OnDisable() => CheckReload(); | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
serializedObject.Update(); | ||
EditorGUILayout.Space(); | ||
EditorGUI.indentLevel++; | ||
EditorGUI.BeginChangeCheck(); | ||
|
||
EditorGUILayout.PropertyField(apiKey); | ||
EditorGUILayout.PropertyField(proxyDomain); | ||
|
||
if (EditorGUI.EndChangeCheck()) | ||
{ | ||
triggerReload = true; | ||
} | ||
|
||
EditorGUI.indentLevel--; | ||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
|
||
#endregion Inspector Window | ||
|
||
private static void CheckReload() | ||
{ | ||
if (triggerReload) | ||
{ | ||
triggerReload = false; | ||
EditorUtility.RequestScriptReload(); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 StephenHodgson | ||
|
||
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. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("BlockadeLabs.Tests")] | ||
[assembly: InternalsVisibleTo("BlockadeLabs.Editor")] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "BlockadeLabs", | ||
"rootNamespace": "BlockadeLabs", | ||
"references": [ | ||
"GUID:a6609af893242c7438d701ddd4cce46a", | ||
"GUID:7958db66189566541a6363568aee1575" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Security.Authentication; | ||
using UnityEngine; | ||
using Utilities.WebRequestRest.Interfaces; | ||
|
||
namespace BlockadeLabs | ||
{ | ||
[Serializable] | ||
public sealed class BlockadeLabsAuthInfo : IAuthInfo | ||
{ | ||
public BlockadeLabsAuthInfo(string apiKey) | ||
{ | ||
if (string.IsNullOrWhiteSpace(apiKey)) | ||
{ | ||
throw new InvalidCredentialException(nameof(apiKey)); | ||
} | ||
|
||
this.apiKey = apiKey; | ||
} | ||
|
||
[SerializeField] | ||
private string apiKey; | ||
|
||
/// <summary> | ||
/// The API key, required to access the service. | ||
/// </summary> | ||
public string ApiKey => apiKey; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.