This commit is contained in:
Mister_Nebula 2020-12-24 16:05:54 +00:00
parent 5c9c55c4ca
commit 804a1a826b
5 changed files with 28 additions and 38 deletions

View File

@ -1,8 +1,6 @@
using OWML.Utils;
using QSB.Utility;
using QSB.WorldSync;
using UnityEngine;
using UnityEngine.UI;
namespace QSB.ElevatorSync
{

View File

@ -1,7 +1,6 @@
using OWML.Utils;
using QSB.Utility;
using QSB.WorldSync;
using System.Linq;
using UnityEngine.UI;
namespace QSB.QuantumSync

View File

@ -1,8 +1,5 @@
using OWML.Utils;
using QSB.Utility;
using QSB.WorldSync;
using System.Linq;
using UnityEngine.UI;
namespace QSB.QuantumSync
{

View File

@ -1,9 +1,5 @@
using OWML.Common;
using OWML.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;

View File

@ -4,36 +4,36 @@ using UnityEngine.UI;
namespace QSB.Utility
{
public class DebugZOverride : MonoBehaviour
{
private const string shaderTestMode = "unity_GUIZTestMode";
public class DebugZOverride : MonoBehaviour
{
private const string shaderTestMode = "unity_GUIZTestMode";
private readonly UnityEngine.Rendering.CompareFunction desiredUIComparison = UnityEngine.Rendering.CompareFunction.Always;
private Graphic[] uiElementsToApplyTo;
private Dictionary<Material, Material> materialMappings = new Dictionary<Material, Material>();
private Graphic[] uiElementsToApplyTo;
private readonly Dictionary<Material, Material> materialMappings = new Dictionary<Material, Material>();
protected virtual void Start()
{
uiElementsToApplyTo = gameObject.GetComponentsInChildren<Graphic>();
foreach (var graphic in uiElementsToApplyTo)
{
var material = graphic.materialForRendering;
if (material == null)
{
continue;
}
protected virtual void Start()
{
uiElementsToApplyTo = gameObject.GetComponentsInChildren<Graphic>();
foreach (var graphic in uiElementsToApplyTo)
{
var material = graphic.materialForRendering;
if (material == null)
{
continue;
}
Material materialCopy;
if (!materialMappings.ContainsKey(material))
{
materialCopy = new Material(material);
materialMappings.Add(material, materialCopy);
}
else
{
materialCopy = materialMappings[material];
}
materialCopy.SetInt(shaderTestMode, (int)desiredUIComparison);
graphic.material = materialCopy;
}
}
}
{
materialCopy = new Material(material);
materialMappings.Add(material, materialCopy);
}
else
{
materialCopy = materialMappings[material];
}
materialCopy.SetInt(shaderTestMode, (int)desiredUIComparison);
graphic.material = materialCopy;
}
}
}
}