Installed Surge, fixed compile errors, moved a bunch of external stuff into folder

This commit is contained in:
2025-09-10 10:53:04 +02:00
parent a3649c65b0
commit 52bd7ef585
433 changed files with 10589 additions and 4 deletions

View File

@@ -0,0 +1,113 @@
/// <summary>
/// SURGE FRAMEWORK
/// Author: Bob Berkebile
/// Email: bobb@pixelplacement.com
///
/// An elegant solution for allowing stronger code-controlled object visibility that doesn't depend on how an object was last left in the editor.
///
/// </summary>
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
namespace Pixelplacement
{
[RequireComponent (typeof (Initialization))]
public class DisplayObject : MonoBehaviour
{
//Private Variables:
private bool _activated;
//Public Properties:
/// <summary>
/// Wrapper for GameObject's ActiveSelf property for ease of use.
/// </summary>
public bool ActiveSelf
{
get
{
return gameObject.activeSelf;
}
set
{
SetActive(value);
}
}
//Public Methods:
/// <summary>
/// Registers this DisplayObject - should only be called by Initialization.
/// </summary>
public void Register ()
{
if (!_activated)
{
_activated = true;
gameObject.SetActive (false);
}
}
/// <summary>
/// Wrapper for GameObject's SetActive method for ease of use.
/// </summary>
public void SetActive (bool value)
{
_activated = true;
gameObject.SetActive (value);
}
/// <summary>
/// Solo this DisplayObject within other DisplayObjects at the same level in the hierarchy.
/// </summary>
public void Solo ()
{
Register();
if (transform.parent != null)
{
foreach (Transform item in transform.parent)
{
if (item == transform) continue;
DisplayObject displayObject = item.GetComponent<DisplayObject> ();
if (displayObject != null) displayObject.SetActive (false);
}
gameObject.SetActive (true);
}else{
foreach (var item in Resources.FindObjectsOfTypeAll<DisplayObject> ())
{
if (item.transform.parent == null)
{
if (item == this)
{
item.SetActive (true);
}else{
item.SetActive (false);
}
}
}
}
}
/// <summary>
/// Hides all DisplayObjects at the same level in the hierarchy as this DisplayObject.
/// </summary>
public void HideAll ()
{
if (transform.parent != null)
{
foreach (Transform item in transform.parent)
{
if (item.GetComponent<DisplayObject> () != null) item.gameObject.SetActive (false);
}
}else{
foreach (var item in Resources.FindObjectsOfTypeAll<DisplayObject> ())
{
if (item.transform.parent == null) item.gameObject.SetActive (false);
}
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 1c09009af25a0c84aa7360bbc94c9b59
timeCreated: 1479232771
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 107312
packageName: Surge
packageVersion: 1.0.48
assetPath: Assets/Pixelplacement/Surge/DisplayObject/DisplayObject.cs
uploadId: 467433

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 76df9d89226c52547a1d901d663c2ae9
folderAsset: yes
timeCreated: 1500598980
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,82 @@
/// <summary>
/// SURGE FRAMEWORK
/// Author: Bob Berkebile
/// Email: bobb@pixelplacement.com
///
/// Custom inspector for the DisplayObject class.
///
/// </summary>
using UnityEngine;
using System.Collections;
using UnityEditor;
namespace Pixelplacement
{
[CustomEditor (typeof (DisplayObject), true)]
public class DisplayObjectEditor : UnityEditor.Editor
{
//Private Variables:
DisplayObject _target;
//Init:
void OnEnable()
{
_target = target as DisplayObject;
}
//Inspector GUI:
public override void OnInspectorGUI()
{
DrawDefaultInspector ();
GUILayout.BeginHorizontal ();
DrawSoloButton ();
DrawShowButton ();
DrawHideButton ();
DrawHideAllButton ();
GUILayout.EndHorizontal ();
}
//GUI Draw Methods:
void DrawShowButton ()
{
GUI.color = Color.yellow;
if (GUILayout.Button ("Show"))
{
Undo.RegisterCompleteObjectUndo (_target, "Show DisplayObject");
_target.SetActive (true);
}
}
void DrawSoloButton ()
{
GUI.color = Color.green;
if (GUILayout.Button ("Solo"))
{
Undo.RegisterCompleteObjectUndo (_target, "Solo DisplayObject");
_target.Solo ();
}
}
void DrawHideButton ()
{
GUI.color = new Color (1, 0.5f, 0, 1);
if (GUILayout.Button ("Hide"))
{
Undo.RegisterCompleteObjectUndo (_target, "Hide DisplayObject");
_target.SetActive (false);
}
}
void DrawHideAllButton ()
{
GUI.color = Color.red;
if (GUILayout.Button ("Hide All"))
{
Undo.RegisterCompleteObjectUndo (_target, "Hide all DisplayObjects");
_target.HideAll ();
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 1494a48c2c33dfc499b2bfdd0ce24f5b
timeCreated: 1479232771
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 107312
packageName: Surge
packageVersion: 1.0.48
assetPath: Assets/Pixelplacement/Surge/DisplayObject/Editor/DisplayObjectEditor.cs
uploadId: 467433