从旧版中移植,Prefab未确认
This commit is contained in:
@@ -285,9 +285,11 @@ namespace Convention
|
||||
|
||||
public static Registering Register<T>(T target, Action completer, params Type[] dependences) => Register(typeof(T), target!, completer, dependences);
|
||||
|
||||
public static bool Contains(Type type) => Childs.TryGetValue(type, out var value) && value != null;
|
||||
public static bool Contains(Type type, bool alive) => Childs.TryGetValue(type, out var value) && (alive == false || value != null);
|
||||
|
||||
public static bool Contains<T>() => Contains(typeof(T));
|
||||
public static bool Contains(Type type) => Contains(type, true);
|
||||
|
||||
public static bool Contains<T>() => Contains(typeof(T), true);
|
||||
|
||||
public static object InternalGet(Type type) => Childs[type];
|
||||
|
||||
|
8
Convention/[Runtime]/Camera/SO.meta
Normal file
8
Convention/[Runtime]/Camera/SO.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0b1e2d16c11a17428f957d86291013b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
|
||||
namespace Convention
|
||||
{
|
||||
namespace SO
|
||||
{
|
||||
[CreateAssetMenu(fileName = "new TextureRenderingConfig", menuName = "Convention/Camera/TextureRenderingConfig", order = 0)]
|
||||
public class TextureRenderingCameraConfig : CameraInitializerConfig
|
||||
{
|
||||
[Tooltip("Value Name"), Setting] private string m_RenderTextureScaleName = "RenderTextureScale";
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
m_RenderTextureScaleName = "RenderTextureScale";
|
||||
this.values[m_RenderTextureScaleName] = 1f;
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
if (this.values.ContainsKey(m_RenderTextureScaleName) == false)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Invoke(Camera camera)
|
||||
{
|
||||
camera.targetTexture = new RenderTexture(
|
||||
(int)(camera.scaledPixelWidth * this.values[m_RenderTextureScaleName]),
|
||||
(int)(camera.scaledPixelHeight * this.values[m_RenderTextureScaleName]),
|
||||
GraphicsFormat.R16G16B16A16_SFloat, GraphicsFormat.D24_UNorm_S8_UInt
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 234eb658dcbbff94aaa51624bd64af0b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -2104,3 +2104,18 @@ namespace Convention
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Convention
|
||||
{
|
||||
public static partial class ConventionUtility
|
||||
{
|
||||
public static object GetDefault([In] Type type)
|
||||
{
|
||||
if (type.IsClass)
|
||||
return null;
|
||||
else
|
||||
return Activator.CreateInstance(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user