Skip to content

Commit

Permalink
com.rest.blockadelabs 1.0.0-preview.1 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson committed Jun 10, 2023
0 parents commit 50f9926
Show file tree
Hide file tree
Showing 51 changed files with 1,432 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Documentation~/README.md
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&registry_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
```
Binary file added Documentation~/images/package-manager-scopes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.

1 change: 1 addition & 0 deletions Editor/AssemblyInfo.cs
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.
11 changes: 11 additions & 0 deletions Editor/AssemblyInfo.cs.meta

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

20 changes: 20 additions & 0 deletions Editor/BlockadeLabs.Editor.asmdef
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
}
7 changes: 7 additions & 0 deletions Editor/BlockadeLabs.Editor.asmdef.meta

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

74 changes: 74 additions & 0 deletions Editor/BlockadeLabsConfigurationInspector.cs
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();
}
}
}
}
11 changes: 11 additions & 0 deletions Editor/BlockadeLabsConfigurationInspector.cs.meta

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

21 changes: 21 additions & 0 deletions LICENSE.md
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.
7 changes: 7 additions & 0 deletions LICENSE.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 Runtime.meta

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

6 changes: 6 additions & 0 deletions Runtime/AssemblyInfo.cs
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")]
11 changes: 11 additions & 0 deletions Runtime/AssemblyInfo.cs.meta

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

17 changes: 17 additions & 0 deletions Runtime/BlockadeLabs.asmdef
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
}
7 changes: 7 additions & 0 deletions Runtime/BlockadeLabs.asmdef.meta

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

29 changes: 29 additions & 0 deletions Runtime/BlockadeLabsAuthInfo.cs
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;
}
}
11 changes: 11 additions & 0 deletions Runtime/BlockadeLabsAuthInfo.cs.meta

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

Loading

0 comments on commit 50f9926

Please sign in to comment.