initial game submission

This commit is contained in:
Caleb Sandford deQuincey
2025-06-11 13:04:35 +01:00
parent 47944971ca
commit e9c9bc4409
3041 changed files with 328378 additions and 71117 deletions

View File

@@ -0,0 +1,102 @@
using UnityEngine;
using UnityEditor;
using UnityEditor.PackageManager;
using UnityGLTF.Plugins;
namespace UnityGLTF
{
[CustomEditor(typeof(GLTFPlugin), true)]
public class GLTFPluginEditor: Editor
{
// Follows the default implementation of OnInspectorGUI, but skips the script field
public override void OnInspectorGUI()
{
serializedObject.Update();
var iterator = serializedObject.GetIterator();
// skip script field
iterator.NextVisible(true);
while (iterator.NextVisible(false))
EditorGUILayout.PropertyField(iterator, true);
serializedObject.ApplyModifiedProperties();
}
}
internal abstract class PackageInstallEditor : GLTFPluginEditor
{
private bool isInstalling = false;
protected abstract string PackageName { get; }
private static GUIStyle IndentedButton;
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
var t = target as GLTFPlugin;
if (!t || string.IsNullOrEmpty(t.Warning))
{
var rect = GUILayoutUtility.GetLastRect();
if (Event.current.type == EventType.ContextClick && rect.Contains(Event.current.mousePosition))
{
var menu = new GenericMenu();
menu.AddItem(new GUIContent("Uninstall Package"), false, () => {
Client.Remove(PackageName);
});
menu.ShowAsContext();
Event.current.Use();
}
return;
}
if (isInstalling)
{
EditorGUI.BeginDisabledGroup(true);
GUILayout.Button("Installing...");
EditorGUI.EndDisabledGroup();
return;
}
EditorGUI.indentLevel++;
if (IndentedButton == null)
{
IndentedButton = new GUIStyle(EditorStyles.miniButton);
IndentedButton.margin = new RectOffset(EditorGUI.indentLevel * 16, 0, 0, 0);
}
if (GUILayout.Button("Install " + PackageName, IndentedButton))
{
isInstalling = true;
var request = Client.Add(PackageName);
void WatchInstall()
{
if (!request.IsCompleted) return;
isInstalling = false;
if (request.Status >= StatusCode.Failure)
Debug.LogError(request.Error.message);
EditorApplication.update -= WatchInstall;
}
EditorApplication.update += WatchInstall;
}
EditorGUI.indentLevel--;
}
}
[CustomEditor(typeof(DracoImport))]
internal class DracoImportEditor : PackageInstallEditor
{
protected override string PackageName => "com.unity.cloud.draco";
}
[CustomEditor(typeof(MeshoptImport))]
internal class MeshoptImportEditor : PackageInstallEditor
{
protected override string PackageName => "com.unity.meshopt.decompress";
}
[CustomEditor(typeof(Ktx2Import))]
internal class Ktx2ImportEditor : PackageInstallEditor
{
protected override string PackageName => "com.unity.cloud.ktx";
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5df1106545064293aebd7efc2fc87905
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityGLTF.Plugins;
namespace UnityGLTF
{
internal static class RegisteredImportPlugins
{
internal static readonly List<GLTFImportPlugin> Plugins = new List<GLTFImportPlugin>();
[InitializeOnLoadMethod]
public static void Init()
{
}
private static void OnAfterGUI(GltfSettingsProvider obj)
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c336fc934d29489b99919ae62cb2a2c8
timeCreated: 1680101663