[Fix] All in one + add dice

This commit is contained in:
2026-02-23 22:24:46 +07:00
parent 4f942cd7c0
commit 2f9e082d75
1593 changed files with 474068 additions and 31 deletions
@@ -0,0 +1,188 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Rendering;
using UnityEngine.UI;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.UIElements.InputSystem;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.UI;
#endif
namespace AllIn1SpriteShader
{
public class All1ShaderDemoController : MonoBehaviour
{
[SerializeField] private DemoCircleExpositor[] expositors = null;
[SerializeField] private Text expositorsTitle = null, expositorsTitleOutline = null;
public float expositorDistance;
private int currExpositor;
[SerializeField] private GameObject background = null;
private Material backgroundMat;
[SerializeField] private float colorLerpSpeed = 0;
private Color[] targetColors;
private Color[] currentColors;
private EventSystem eventSystem;
// Custom sort axis fields
private Camera mainCamera;
private TransparencySortMode originalSortMode;
private Vector3 originalSortAxis;
private bool sortingWasModified = false;
void Start()
{
EventSystem eventSystemInScene = GameObject.FindAnyObjectByType<EventSystem>();
if (eventSystemInScene != null)
{
GameObject.Destroy(eventSystemInScene.gameObject);
}
GameObject goEventSystem = new GameObject("Event System");
eventSystem = goEventSystem.AddComponent<EventSystem>();
#if ENABLE_INPUT_SYSTEM
goEventSystem.AddComponent<InputSystemUIInputModule>();
#elif ENABLE_LEGACY_INPUT_MANAGER
goEventSystem.AddComponent<StandaloneInputModule>();
#endif
// Setup custom sort axis
SetupCustomSortAxis();
currExpositor = 0;
SetExpositorText();
for (int i = 0; i < expositors.Length; i++) expositors[i].transform.position = new Vector3(0, expositorDistance * i, 0);
backgroundMat = background.GetComponent<Image>().material;
targetColors = new Color[4];
targetColors[0] = backgroundMat.GetColor("_GradTopLeftCol");
targetColors[1] = backgroundMat.GetColor("_GradTopRightCol");
targetColors[2] = backgroundMat.GetColor("_GradBotLeftCol");
targetColors[3] = backgroundMat.GetColor("_GradBotRightCol");
currentColors = targetColors.Clone() as Color[];
}
void Update()
{
GetInput();
currentColors[0] = Color.Lerp(currentColors[0], targetColors[(0 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime);
currentColors[1] = Color.Lerp(currentColors[1], targetColors[(1 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime);
currentColors[2] = Color.Lerp(currentColors[2], targetColors[(2 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime);
currentColors[3] = Color.Lerp(currentColors[3], targetColors[(3 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime);
backgroundMat.SetColor("_GradTopLeftCol", currentColors[0]);
backgroundMat.SetColor("_GradTopRightCol", currentColors[1]);
backgroundMat.SetColor("_GradBotLeftCol", currentColors[2]);
backgroundMat.SetColor("_GradBotRightCol", currentColors[3]);
}
private void GetInput()
{
if (AllIn1InputSystem.GetKeyDown(KeyCode.LeftArrow) || AllIn1InputSystem.GetKeyDown(KeyCode.A))
{
expositors[currExpositor].ChangeTarget(-1);
}
else if (AllIn1InputSystem.GetKeyDown(KeyCode.RightArrow) || AllIn1InputSystem.GetKeyDown(KeyCode.D))
{
expositors[currExpositor].ChangeTarget(1);
}
else if (AllIn1InputSystem.GetKeyDown(KeyCode.UpArrow) || AllIn1InputSystem.GetKeyDown(KeyCode.W))
{
ChangeExpositor(-1);
}
else if (AllIn1InputSystem.GetKeyDown(KeyCode.DownArrow) || AllIn1InputSystem.GetKeyDown(KeyCode.S))
{
ChangeExpositor(1);
}
}
private void ChangeExpositor(int offset)
{
currExpositor += offset;
if (currExpositor > expositors.Length - 1) currExpositor = 0;
else if (currExpositor < 0) currExpositor = expositors.Length - 1;
SetExpositorText();
}
private void SetExpositorText()
{
expositorsTitle.text = expositors[currExpositor].name;
expositorsTitleOutline.text = expositors[currExpositor].name;
}
public int GetCurrExpositor() { return currExpositor; }
private void SetupCustomSortAxis()
{
mainCamera = Camera.main;
if (mainCamera == null)
{
Debug.LogWarning("All1ShaderDemoController: Main camera not found. Custom sort axis will not be applied.");
return;
}
// Save original settings
originalSortMode = mainCamera.transparencySortMode;
originalSortAxis = mainCamera.transparencySortAxis;
// Detect render pipeline
string pipelineType = GetRenderPipelineType();
try
{
// Apply custom sort axis for all pipelines
// This is a Camera property that works across all render pipelines
mainCamera.transparencySortMode = TransparencySortMode.CustomAxis;
mainCamera.transparencySortAxis = new Vector3(0, 0, 1);
sortingWasModified = true;
//Debug.Log($"All1ShaderDemoController: Custom sort axis applied successfully ({mainCamera.transparencySortAxis}) for {pipelineType}");
}
catch (System.Exception e)
{
Debug.LogWarning($"All1ShaderDemoController: Failed to apply custom sort axis for {pipelineType}. Error: {e.Message}");
sortingWasModified = false;
}
}
private string GetRenderPipelineType()
{
RenderPipelineAsset currentRP = UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline;
if (currentRP == null)
{
return "Built-in Render Pipeline";
}
string rpTypeName = currentRP.GetType().Name;
if (rpTypeName.Contains("Universal") || rpTypeName.Contains("URP"))
{
return "Universal Render Pipeline (URP)";
}
else if (rpTypeName.Contains("HD") || rpTypeName.Contains("HighDefinition"))
{
return "High Definition Render Pipeline (HDRP)";
}
else
{
return $"Custom SRP ({rpTypeName})";
}
}
private void OnDestroy()
{
// Restore original camera settings
if (sortingWasModified && mainCamera != null)
{
mainCamera.transparencySortMode = originalSortMode;
mainCamera.transparencySortAxis = originalSortAxis;
}
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: b549ed925b49d274c876184f60faabdf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs
uploadId: 857600
@@ -0,0 +1,57 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace AllIn1SpriteShader
{
public class All1TextureOffsetOverTime : MonoBehaviour
{
[SerializeField] private string texturePropertyName = "_MainTex";
[SerializeField] private Vector2 offsetSpeed = Vector2.zero;
[SerializeField, Header("If missing will search object Sprite Renderer or UI Image")]
private Material mat;
private int textureShaderId;
private Vector2 currOffset = Vector2.zero;
private void Start()
{
//Get material if missing
if (mat == null)
{
SpriteRenderer sr = GetComponent<SpriteRenderer>();
if (sr != null) mat = sr.material;
else
{
Image i = GetComponent<Image>();
if (i != null) mat = i.material;
}
}
//Show error message if material or textureName property error
//Otherwise cache shader property ID
if (mat == null) DestroyComponentAndLogError(gameObject.name + " has no valid Material, deleting All1TextureOffsetOverTIme component");
else
{
if (mat.HasProperty(texturePropertyName)) textureShaderId = Shader.PropertyToID(texturePropertyName);
else DestroyComponentAndLogError(gameObject.name + "'s Material doesn't have a " + texturePropertyName + " property");
}
}
public void Update()
{
//Update currOffset and update shader property
currOffset.x += offsetSpeed.x * Time.deltaTime;
currOffset.y += offsetSpeed.y * Time.deltaTime;
mat.SetTextureOffset(textureShaderId, currOffset);
}
private void DestroyComponentAndLogError(string logError)
{
Debug.LogError(logError);
Destroy(this);
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f3804424ee2f162418d9294faf7ba055
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs
uploadId: 857600
@@ -0,0 +1,16 @@
using UnityEngine;
namespace AllIn1SpriteShader.Demo.Scripts
{
public class AllIn1AutoRotate : MonoBehaviour
{
[SerializeField] private float rotationSpeed = 30f;
[SerializeField] private Vector3 rotationAxis = Vector3.up;
[SerializeField] private bool useLocalRotation;
private void Update()
{
transform.Rotate(rotationAxis * (rotationSpeed * Time.deltaTime), useLocalRotation ? Space.Self : Space.World);
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f2560c72fbbcfe44195e240286d1d4e5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs
uploadId: 857600
@@ -0,0 +1,80 @@
using UnityEngine;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
#endif
namespace AllIn1SpriteShader
{
public static class AllIn1InputSystem
{
#if ENABLE_INPUT_SYSTEM
public static bool GetKeyDown(KeyCode keyCode)
{
Key key = InputKeyConverter.GetKeyFromKeycode(keyCode);
bool res = Keyboard.current[key].wasPressedThisFrame;
return res;
}
public static bool GetKey(KeyCode keyCode)
{
Key key = InputKeyConverter.GetKeyFromKeycode(keyCode);
bool res = Keyboard.current[key].isPressed;
return res;
}
public static float GetMouseXAxis()
{
Vector2 delta = Mouse.current.delta.ReadValue();
float res = delta.x * 0.1f;
return res;
}
public static float GetMouseYAxis()
{
Vector2 delta = Mouse.current.delta.ReadValue();
float res = delta.y * 0.1f;
return res;
}
public static float GetMouseScroll()
{
Vector2 scrollValue = Mouse.current.scroll.ReadValue();
float res = scrollValue.y * 0.1f;
return res;
}
#elif ENABLE_LEGACY_INPUT_MANAGER
public static bool GetKeyDown(KeyCode keyCode)
{
bool res = Input.GetKeyDown(keyCode);
return res;
}
public static bool GetKey(KeyCode keyCode)
{
bool res = Input.GetKey(keyCode);
return res;
}
public static float GetMouseXAxis()
{
float res = Input.GetAxis("Mouse X");
return res;
}
public static float GetMouseYAxis()
{
float res = Input.GetAxis("Mouse Y");
return res;
}
public static float GetMouseScroll()
{
float res = Input.GetAxis("Mouse ScrollWheel");
return res;
}
#endif
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 3c82e579907176d47a26bd6ed1d1457f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1InputSystem.cs
uploadId: 857600
@@ -0,0 +1,62 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace AllIn1SpriteShader
{
public class AllIn1ScrollProperty : MonoBehaviour
{
[SerializeField] private string numericPropertyName = "_RotateUvAmount";
[SerializeField] private float scrollSpeed = 0f;
[Space, SerializeField] private bool applyModulo = false;
[SerializeField] private float modulo = 1f;
[Space, SerializeField, Header("If missing will search object Sprite Renderer or UI Image")]
private Material mat;
private int propertyShaderID;
private float currValue;
public void Start()
{
//Get material if missing
if (mat == null)
{
SpriteRenderer sr = GetComponent<SpriteRenderer>();
if (sr != null) mat = sr.material;
else
{
Image i = GetComponent<Image>();
if (i != null) mat = i.material;
}
}
//Show error message if material or numericPropertyName property error
//Otherwise cache shader property ID
if (mat == null) DestroyComponentAndLogError(gameObject.name + " has no valid Material, deleting All1TextureOffsetOverTIme component");
else
{
if (mat.HasProperty(numericPropertyName)) propertyShaderID = Shader.PropertyToID(numericPropertyName);
else DestroyComponentAndLogError(gameObject.name + "'s Material doesn't have a " + numericPropertyName + " property");
currValue = mat.GetFloat(propertyShaderID);
}
}
private void Update()
{
//Update currOffset and update shader property
currValue += scrollSpeed * Time.deltaTime;
if (applyModulo) currValue %= modulo;
mat.SetFloat(propertyShaderID, currValue);
}
private void DestroyComponentAndLogError(string logError)
{
Debug.LogError(logError);
Destroy(this);
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 384dba07353e1f242b467b6857a1e3d4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs
uploadId: 857600
@@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace AllIn1SpriteShader
{
public class Demo2AutoScroll : MonoBehaviour
{
private Transform[] children;
public float totalTime;
public GameObject sceneDescription = null;
void Start()
{
sceneDescription.SetActive(false);
Camera.main.fieldOfView = 60f;
children = GetComponentsInChildren<Transform>();
for (int i = 0; i < children.Length; i++)
{
if (children[i].gameObject != gameObject)
{
children[i].gameObject.SetActive(false);
children[i].localPosition = Vector3.zero;
}
}
totalTime = totalTime / (float)children.Length;
StartCoroutine(ScrollElements());
}
IEnumerator ScrollElements()
{
int i = 0;
while (true)
{
if (children[i].gameObject == gameObject)
{
i = (i + 1) % children.Length;
continue;
}
children[i].gameObject.SetActive(true);
yield return new WaitForSeconds(totalTime);
children[i].gameObject.SetActive(false);
i = (i + 1) % children.Length;
}
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: cc188be2d64e8d041aed6f375d92c463
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs
uploadId: 857600
@@ -0,0 +1,86 @@
using System;
using System.Collections;
using System.Reflection;
using UnityEngine;
namespace AllIn1SpriteShader
{
public class DemoCamera : MonoBehaviour
{
[SerializeField] private Transform targetedItem = null;
[SerializeField] private All1ShaderDemoController demoController = null;
[SerializeField] private float speed = 0;
private Vector3 offset;
private Vector3 target;
private bool canUpdate = false;
private void Awake()
{
EnablePostProcessingForURP();
offset = transform.position - targetedItem.position;
StartCoroutine(SetCamAfterStart());
}
private void EnablePostProcessingForURP()
{
#if UNITY_2019_3_OR_NEWER
try
{
Type urpCameraDataType = Type.GetType("UnityEngine.Rendering.Universal.UniversalAdditionalCameraData, Unity.RenderPipelines.Universal.Runtime");
if (urpCameraDataType == null)
{
return;
}
Camera cam = GetComponent<Camera>();
if (cam == null)
{
Debug.LogWarning("[DemoCamera] No Camera component found on GameObject", this);
return;
}
Component urpCameraData = cam.GetComponent(urpCameraDataType);
if (urpCameraData == null)
{
urpCameraData = cam.gameObject.AddComponent(urpCameraDataType);
Debug.Log("[DemoCamera] Added UniversalAdditionalCameraData component for URP post processing", this);
}
PropertyInfo renderPostProcessingProperty = urpCameraDataType.GetProperty("renderPostProcessing");
if (renderPostProcessingProperty != null && renderPostProcessingProperty.CanWrite)
{
bool currentValue = (bool)renderPostProcessingProperty.GetValue(urpCameraData);
if (!currentValue)
{
renderPostProcessingProperty.SetValue(urpCameraData, true);
Debug.Log("[DemoCamera] Enabled URP post processing on camera", this);
}
}
else
{
Debug.LogWarning("[DemoCamera] Could not find or access 'renderPostProcessing' property. URP version might not support this feature.", this);
}
}
catch (Exception e)
{
Debug.LogWarning($"[DemoCamera] Failed to enable URP post processing: {e.Message}", this);
}
#endif
}
private void Update()
{
if (!canUpdate) return;
target.y = demoController.GetCurrExpositor() * demoController.expositorDistance;
transform.position = Vector3.Lerp(transform.position, target, speed * Time.deltaTime);
}
private IEnumerator SetCamAfterStart()
{
yield return null;
transform.position = targetedItem.position + offset;
target = transform.position;
canUpdate = true;
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: fcb2e887baa071545bad04c7b0e87cce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs
uploadId: 857600
@@ -0,0 +1,54 @@
using UnityEngine;
namespace AllIn1SpriteShader
{
public class DemoCircleExpositor : MonoBehaviour
{
[SerializeField] private float radius = 40f;
[SerializeField] private float rotateSpeed = 10f;
private float zOffset = 0f;
private Transform[] items;
private int count = 0;
private int currentTarget = 0;
private float offsetRotation, iniY;
private Quaternion dummyRotation;
void Start()
{
dummyRotation = transform.rotation;
iniY = transform.position.y;
items = new Transform[transform.childCount];
foreach (Transform child in transform)
{
items[count] = child;
count++;
}
offsetRotation = 360.0f / count;
for (int i = 0; i < count; i++)
{
float angle = i * Mathf.PI * 2f / count;
Vector3 newPos = new Vector3(Mathf.Sin(angle) * radius, iniY, -Mathf.Cos(angle) * radius);
items[i].position = newPos;
}
zOffset = radius - 40f;
transform.position = new Vector3(transform.position.x, transform.position.y, zOffset);
}
private void Update()
{
transform.rotation = Quaternion.Slerp(transform.rotation, dummyRotation, rotateSpeed * Time.deltaTime);
}
public void ChangeTarget(int offset)
{
currentTarget += offset;
if (currentTarget > items.Length - 1) currentTarget = 0;
else if (currentTarget < 0) currentTarget = items.Length - 1;
dummyRotation *= Quaternion.Euler(Vector3.up * (offset * offsetRotation));
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 6972382efdee4c642812251660f0c4bb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs
uploadId: 857600
@@ -0,0 +1,14 @@
using UnityEngine;
namespace AllIn1SpriteShader
{
public class DemoItem : MonoBehaviour
{
static readonly Vector3 lookAtZ = new Vector3(0, 0, 1);
void Update()
{
transform.LookAt(transform.position + lookAtZ);
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 98b644315d7a92842b89e04f55c48e02
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs
uploadId: 857600
@@ -0,0 +1,39 @@
using UnityEngine;
namespace AllIn1SpriteShader
{
public class DemoRandomColorSwap : MonoBehaviour
{
private Material mat;
private readonly int colorSwapRed = Shader.PropertyToID("_ColorSwapRed");
private readonly int colorSwapGreen = Shader.PropertyToID("_ColorSwapGreen");
private readonly int colorSwapBlue = Shader.PropertyToID("_ColorSwapBlue");
void Start()
{
SpriteRenderer sr = GetComponent<SpriteRenderer>();
if (sr != null)
{
mat = GetComponent<Renderer>().material;
if (mat != null) InvokeRepeating(nameof(NewColor), 0.0f, 0.6f);
else
{
Debug.LogError("No material found");
Destroy(this);
}
}
}
private void NewColor()
{
mat.SetColor(colorSwapRed, GenerateColor());
mat.SetColor(colorSwapGreen, GenerateColor());
mat.SetColor(colorSwapBlue, GenerateColor());
}
private Color GenerateColor()
{
return new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1f);
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4ef3964599ee48c4ea5a4ecf012ed949
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs
uploadId: 857600
@@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace AllIn1SpriteShader
{
public class DemoRepositionExpositor : MonoBehaviour
{
[SerializeField] private float paddingX = 10f;
[ContextMenu("RepositionExpositor")]
private void RepositionExpositor()
{
int i = 0;
Vector3 tempLocalPos = Vector3.zero;
foreach (Transform child in transform)
{
tempLocalPos.x = i * paddingX;
child.localPosition = tempLocalPos;
i++;
}
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 681095680e77fad40a6dd907b8ba358b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs
uploadId: 857600
@@ -0,0 +1,331 @@
using UnityEngine;
namespace AllIn1SpriteShader
{
public static class InputKeyConverter
{
#if ENABLE_INPUT_SYSTEM
public static UnityEngine.InputSystem.Key GetKeyFromKeycode(KeyCode keyCode)
{
UnityEngine.InputSystem.Key res = UnityEngine.InputSystem.Key.Space;
switch (keyCode)
{
case KeyCode.A:
res = UnityEngine.InputSystem.Key.A;
break;
case KeyCode.B:
res = UnityEngine.InputSystem.Key.B;
break;
case KeyCode.C:
res = UnityEngine.InputSystem.Key.C;
break;
case KeyCode.D:
res = UnityEngine.InputSystem.Key.D;
break;
case KeyCode.E:
res = UnityEngine.InputSystem.Key.E;
break;
case KeyCode.F:
res = UnityEngine.InputSystem.Key.F;
break;
case KeyCode.G:
res = UnityEngine.InputSystem.Key.G;
break;
case KeyCode.H:
res = UnityEngine.InputSystem.Key.H;
break;
case KeyCode.I:
res = UnityEngine.InputSystem.Key.I;
break;
case KeyCode.J:
res = UnityEngine.InputSystem.Key.J;
break;
case KeyCode.K:
res = UnityEngine.InputSystem.Key.K;
break;
case KeyCode.L:
res = UnityEngine.InputSystem.Key.L;
break;
case KeyCode.M:
res = UnityEngine.InputSystem.Key.M;
break;
case KeyCode.N:
res = UnityEngine.InputSystem.Key.N;
break;
case KeyCode.O:
res = UnityEngine.InputSystem.Key.O;
break;
case KeyCode.P:
res = UnityEngine.InputSystem.Key.P;
break;
case KeyCode.Q:
res = UnityEngine.InputSystem.Key.Q;
break;
case KeyCode.R:
res = UnityEngine.InputSystem.Key.R;
break;
case KeyCode.S:
res = UnityEngine.InputSystem.Key.S;
break;
case KeyCode.T:
res = UnityEngine.InputSystem.Key.T;
break;
case KeyCode.U:
res = UnityEngine.InputSystem.Key.U;
break;
case KeyCode.V:
res = UnityEngine.InputSystem.Key.V;
break;
case KeyCode.W:
res = UnityEngine.InputSystem.Key.W;
break;
case KeyCode.X:
res = UnityEngine.InputSystem.Key.X;
break;
case KeyCode.Y:
res = UnityEngine.InputSystem.Key.Y;
break;
case KeyCode.Z:
res = UnityEngine.InputSystem.Key.Z;
break;
case KeyCode.Alpha0:
res = UnityEngine.InputSystem.Key.Digit0;
break;
case KeyCode.Alpha1:
res = UnityEngine.InputSystem.Key.Digit1;
break;
case KeyCode.Alpha2:
res = UnityEngine.InputSystem.Key.Digit2;
break;
case KeyCode.Alpha3:
res = UnityEngine.InputSystem.Key.Digit3;
break;
case KeyCode.Alpha4:
res = UnityEngine.InputSystem.Key.Digit4;
break;
case KeyCode.Alpha5:
res = UnityEngine.InputSystem.Key.Digit5;
break;
case KeyCode.Alpha6:
res = UnityEngine.InputSystem.Key.Digit6;
break;
case KeyCode.Alpha7:
res = UnityEngine.InputSystem.Key.Digit7;
break;
case KeyCode.Alpha8:
res = UnityEngine.InputSystem.Key.Digit8;
break;
case KeyCode.Alpha9:
res = UnityEngine.InputSystem.Key.Digit9;
break;
case KeyCode.Space:
res = UnityEngine.InputSystem.Key.Space;
break;
case KeyCode.Return:
res = UnityEngine.InputSystem.Key.Enter;
break;
case KeyCode.Escape:
res = UnityEngine.InputSystem.Key.Escape;
break;
case KeyCode.Backspace:
res = UnityEngine.InputSystem.Key.Backspace;
break;
case KeyCode.Tab:
res = UnityEngine.InputSystem.Key.Tab;
break;
case KeyCode.LeftShift:
res = UnityEngine.InputSystem.Key.LeftShift;
break;
case KeyCode.RightShift:
res = UnityEngine.InputSystem.Key.RightShift;
break;
case KeyCode.LeftControl:
res = UnityEngine.InputSystem.Key.LeftCtrl;
break;
case KeyCode.RightControl:
res = UnityEngine.InputSystem.Key.RightCtrl;
break;
case KeyCode.LeftAlt:
res = UnityEngine.InputSystem.Key.LeftAlt;
break;
case KeyCode.RightAlt:
res = UnityEngine.InputSystem.Key.RightAlt;
break;
case KeyCode.LeftCommand:
res = UnityEngine.InputSystem.Key.LeftCommand;
break;
case KeyCode.RightCommand:
res = UnityEngine.InputSystem.Key.RightCommand;
break;
case KeyCode.LeftWindows:
res = UnityEngine.InputSystem.Key.LeftWindows;
break;
case KeyCode.RightWindows:
res = UnityEngine.InputSystem.Key.RightWindows;
break;
case KeyCode.UpArrow:
res = UnityEngine.InputSystem.Key.UpArrow;
break;
case KeyCode.DownArrow:
res = UnityEngine.InputSystem.Key.DownArrow;
break;
case KeyCode.LeftArrow:
res = UnityEngine.InputSystem.Key.LeftArrow;
break;
case KeyCode.RightArrow:
res = UnityEngine.InputSystem.Key.RightArrow;
break;
case KeyCode.F1:
res = UnityEngine.InputSystem.Key.F1;
break;
case KeyCode.F2:
res = UnityEngine.InputSystem.Key.F2;
break;
case KeyCode.F3:
res = UnityEngine.InputSystem.Key.F3;
break;
case KeyCode.F4:
res = UnityEngine.InputSystem.Key.F4;
break;
case KeyCode.F5:
res = UnityEngine.InputSystem.Key.F5;
break;
case KeyCode.F6:
res = UnityEngine.InputSystem.Key.F6;
break;
case KeyCode.F7:
res = UnityEngine.InputSystem.Key.F7;
break;
case KeyCode.F8:
res = UnityEngine.InputSystem.Key.F8;
break;
case KeyCode.F9:
res = UnityEngine.InputSystem.Key.F9;
break;
case KeyCode.F10:
res = UnityEngine.InputSystem.Key.F10;
break;
case KeyCode.F11:
res = UnityEngine.InputSystem.Key.F11;
break;
case KeyCode.F12:
res = UnityEngine.InputSystem.Key.F12;
break;
case KeyCode.Insert:
res = UnityEngine.InputSystem.Key.Insert;
break;
case KeyCode.Delete:
res = UnityEngine.InputSystem.Key.Delete;
break;
case KeyCode.Home:
res = UnityEngine.InputSystem.Key.Home;
break;
case KeyCode.End:
res = UnityEngine.InputSystem.Key.End;
break;
case KeyCode.PageUp:
res = UnityEngine.InputSystem.Key.PageUp;
break;
case KeyCode.PageDown:
res = UnityEngine.InputSystem.Key.PageDown;
break;
case KeyCode.Keypad0:
res = UnityEngine.InputSystem.Key.Numpad0;
break;
case KeyCode.Keypad1:
res = UnityEngine.InputSystem.Key.Numpad1;
break;
case KeyCode.Keypad2:
res = UnityEngine.InputSystem.Key.Numpad2;
break;
case KeyCode.Keypad3:
res = UnityEngine.InputSystem.Key.Numpad3;
break;
case KeyCode.Keypad4:
res = UnityEngine.InputSystem.Key.Numpad4;
break;
case KeyCode.Keypad5:
res = UnityEngine.InputSystem.Key.Numpad5;
break;
case KeyCode.Keypad6:
res = UnityEngine.InputSystem.Key.Numpad6;
break;
case KeyCode.Keypad7:
res = UnityEngine.InputSystem.Key.Numpad7;
break;
case KeyCode.Keypad8:
res = UnityEngine.InputSystem.Key.Numpad8;
break;
case KeyCode.Keypad9:
res = UnityEngine.InputSystem.Key.Numpad9;
break;
case KeyCode.KeypadDivide:
res = UnityEngine.InputSystem.Key.NumpadDivide;
break;
case KeyCode.KeypadMultiply:
res = UnityEngine.InputSystem.Key.NumpadMultiply;
break;
case KeyCode.KeypadMinus:
res = UnityEngine.InputSystem.Key.NumpadMinus;
break;
case KeyCode.KeypadPlus:
res = UnityEngine.InputSystem.Key.NumpadPlus;
break;
case KeyCode.KeypadEnter:
res = UnityEngine.InputSystem.Key.NumpadEnter;
break;
case KeyCode.KeypadPeriod:
res = UnityEngine.InputSystem.Key.NumpadPeriod;
break;
case KeyCode.CapsLock:
res = UnityEngine.InputSystem.Key.CapsLock;
break;
case KeyCode.ScrollLock:
res = UnityEngine.InputSystem.Key.ScrollLock;
break;
case KeyCode.Pause:
res = UnityEngine.InputSystem.Key.Pause;
break;
case KeyCode.Quote:
res = UnityEngine.InputSystem.Key.Quote;
break;
case KeyCode.Comma:
res = UnityEngine.InputSystem.Key.Comma;
break;
case KeyCode.Minus:
res = UnityEngine.InputSystem.Key.Minus;
break;
case KeyCode.Period:
res = UnityEngine.InputSystem.Key.Period;
break;
case KeyCode.Slash:
res = UnityEngine.InputSystem.Key.Slash;
break;
case KeyCode.Semicolon:
res = UnityEngine.InputSystem.Key.Semicolon;
break;
case KeyCode.Equals:
res = UnityEngine.InputSystem.Key.Equals;
break;
case KeyCode.LeftBracket:
res = UnityEngine.InputSystem.Key.LeftBracket;
break;
case KeyCode.RightBracket:
res = UnityEngine.InputSystem.Key.RightBracket;
break;
case KeyCode.Backslash:
res = UnityEngine.InputSystem.Key.Backslash;
break;
case KeyCode.BackQuote:
res = UnityEngine.InputSystem.Key.Backquote;
break;
default:
res = UnityEngine.InputSystem.Key.Space;
break;
}
return res;
}
#endif
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: cccdf44e0a2330943a3295398ea7d21c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/InputKeyConverter.cs
uploadId: 857600
@@ -0,0 +1,15 @@
using UnityEditor;
using UnityEngine;
namespace AllIn1SpriteShader
{
public class MissingScriptsRemover : MonoBehaviour
{
private void Awake()
{
#if UNITY_EDITOR
GameObjectUtility.RemoveMonoBehavioursWithMissingScript(gameObject);
#endif
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 90cc15f056763f54d825836fc0dda30b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 156513
packageName: All In 1 Sprite Shader
packageVersion: 4.661
assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/MissingScriptsRemover.cs
uploadId: 857600