1
This commit is contained in:
@@ -6,10 +6,9 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// 资源模块
|
||||
/// </summary>
|
||||
public class ModuleAssets<Data> {
|
||||
public class ModuleAssets<Data> : Module<ModuleAssets<Data>> {
|
||||
/// <summary> 数据列表 </summary>
|
||||
protected List<Data> datas = new List<Data>();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 更改事件 </summary>
|
||||
public virtual event Action OnChange;
|
||||
@@ -32,9 +31,6 @@ public class ModuleAssets<Data> {
|
||||
/// <summary> 加载数据 </summary>
|
||||
public virtual void Load() { throw new NotImplementedException(); }
|
||||
|
||||
/// <summary> 查询数据 </summary>
|
||||
public virtual Data Find(int index) { throw new NotImplementedException(); }
|
||||
public virtual Data Find(Guid guid) { throw new NotImplementedException(); }
|
||||
/// <summary> 循环列表 </summary>
|
||||
public virtual void ForEach(Action<Data> action) => Datas.ForEach(action);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@ public abstract class ModuleCamera : MonoBehaviour {
|
||||
public static readonly LayerMask DefaultLayerMask = ~(1 << 0) | 1 << 0;
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
protected abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 相机位置 </summary>
|
||||
public abstract Vector3 Position { get; set; }
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 核心模块,实现业务逻辑
|
||||
/// </summary>
|
||||
public class ModuleCore : Module<ModuleCore> {
|
||||
|
||||
#region 页面模块
|
||||
/// <summary> 不会被销毁的全局唯一页面模块 (UIDocument) </summary>
|
||||
public ModuleUIPage GlobalPage;
|
||||
/// <summary> 当前的主要页面模块 (UIDocument) </summary>
|
||||
public ModuleUIPage CurrentPage;
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 执行模块
|
||||
/// </summary>
|
||||
public abstract class ModuleExecute<Data> {
|
||||
/// <summary> 执行 </summary>
|
||||
public abstract void Compute(Data data);
|
||||
}
|
||||
@@ -6,21 +6,19 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// 数据处理器模块
|
||||
/// </summary>
|
||||
public class ModuleHandle<T> {
|
||||
public class ModuleHandle<Data> : Module<ModuleHandle<Data>> {
|
||||
/// <summary> 数据 </summary>
|
||||
protected T value;
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
protected Data value;
|
||||
|
||||
/// <summary> 当前数据 </summary>
|
||||
public virtual T Current => value;
|
||||
public virtual Data Current => value;
|
||||
/// <summary> 当前数据是否有效 </summary>
|
||||
public virtual bool IsValid => Current != null;
|
||||
|
||||
/// <summary> 改变当前数据 Event </summary>
|
||||
public virtual event Action<T> OnChange;
|
||||
public virtual event Action<Data> OnChange;
|
||||
/// <summary> 改变当前数据 </summary>
|
||||
public virtual void Change() => OnChange?.Invoke(value);
|
||||
/// <summary> 改变当前数据 </summary>
|
||||
public virtual void Change(T value) {this.value = value; OnChange?.Invoke(value); }
|
||||
public virtual void Change(Data value) { this.value = value; OnChange?.Invoke(value); }
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 输入模块
|
||||
/// </summary>
|
||||
public abstract class ModuleInput : MonoBehaviour {
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
protected abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
public abstract Vector2 MousePosition { get; }
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -6,15 +7,20 @@ using UnityEngine;
|
||||
/// 单个独立模块
|
||||
/// </summary>
|
||||
public abstract class ModuleSingle<Data> : MonoBehaviour {
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
protected virtual void Awake() { }
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
/// <summary> 模块单例 </summary>
|
||||
public static ModuleSingle<Data> I => instance;
|
||||
/// <summary> 模块单例 </summary>
|
||||
protected static ModuleSingle<Data> instance;
|
||||
/// <summary> 初始化 </summary>
|
||||
protected virtual void Awake() {
|
||||
if (instance != null) { Destroy(instance.gameObject); }
|
||||
instance = this;
|
||||
}
|
||||
|
||||
/// <summary> 打开 </summary>
|
||||
public virtual void Open(Data data) { }
|
||||
public virtual void Open(Data data) { throw new NotImplementedException(); }
|
||||
/// <summary> 完成 </summary>
|
||||
public virtual void Complete() { }
|
||||
public virtual void Complete() { throw new NotImplementedException(); }
|
||||
/// <summary> 关闭 </summary>
|
||||
public virtual void Close() { }
|
||||
public virtual void Close() { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SingleTest : ModuleSingle<string> {
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
I.Open("ss");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update() {
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 831967c83916dda4a9cc48e672e4599c
|
||||
guid: 7cd3fb8ca73868a46bf1ff920e0cdc13
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -8,8 +8,6 @@ using UnityEngine;
|
||||
public abstract class ModuleVisual<Data> : MonoBehaviour {
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
protected abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 更新可视化内容 </summary>
|
||||
public abstract void UpdateVisual(Data data);
|
||||
@@ -17,12 +15,13 @@ public abstract class ModuleVisual<Data> : MonoBehaviour {
|
||||
public abstract void ReleaseVisual(Data data);
|
||||
|
||||
/// <summary> 创建可视化内容 </summary>
|
||||
public void Create<T>(ref T value, Transform original, Transform parent) {
|
||||
public static void Create<T>(ref T value, Transform original, Transform parent) {
|
||||
if (value != null) { return; }
|
||||
Transform temp = CreateTransform(original, parent);
|
||||
value = temp.GetComponent<T>();
|
||||
}
|
||||
public Transform CreateTransform(Transform original, Transform parent) {
|
||||
/// <summary> 创建Transform </summary>
|
||||
public static Transform CreateTransform(Transform original, Transform parent) {
|
||||
Transform temp = Instantiate(original, parent);
|
||||
temp.gameObject.SetActive(true);
|
||||
return temp;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffdce56728c4f0943b14d5dd2f1a4434
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e5a783a4eff92d4da56483985f0a2a1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
/// <summary>
|
||||
/// UI控件
|
||||
/// </summary>
|
||||
public abstract class ModuleUIControl {
|
||||
/// <summary> 绑定的元素 </summary>
|
||||
public readonly VisualElement element;
|
||||
/// <summary> 基础实例 </summary>
|
||||
public ModuleUIControl(VisualElement element) => this.element = element;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 634630f2be3c7074db93baa4289bf093
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5213b7240a67ca7489050d7d0bc8a935
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
/// <summary>
|
||||
/// UI项
|
||||
/// </summary>
|
||||
public abstract class ModuleUIItem<Data> {
|
||||
/// <summary> 选择事件 </summary>
|
||||
public static event Action<Data> OnSelect;
|
||||
/// <summary> 触发事件 </summary>
|
||||
public static void Select(Data data) => OnSelect?.Invoke(data);
|
||||
/// <summary> 绑定的数据 </summary>
|
||||
public readonly Data value;
|
||||
/// <summary> 绑定的元素 </summary>
|
||||
public readonly VisualElement element;
|
||||
/// <summary> 基础实例 </summary>
|
||||
public ModuleUIItem(Data value, VisualElement element) {
|
||||
this.value = value;
|
||||
this.element = element;
|
||||
OnSelect += UIItem_OnSelect;
|
||||
}
|
||||
/// <summary> 触发选择事件 </summary>
|
||||
public virtual void Select() => OnSelect?.Invoke(value);
|
||||
/// <summary> 侦听选择事件 </summary>
|
||||
public virtual void UIItem_OnSelect(Data obj) {
|
||||
if (value.Equals(obj)) { SelectState(); }
|
||||
else { DefaultState(); }
|
||||
}
|
||||
/// <summary> 默认状态 </summary>
|
||||
public virtual void DefaultState() { }
|
||||
/// <summary> 选中状态 </summary>
|
||||
public virtual void SelectState() { }
|
||||
/// <summary> 释放 </summary>
|
||||
public virtual void Release() => OnSelect -= UIItem_OnSelect;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b31786a09cb95646a3068a93ad21834
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
-2
@@ -12,8 +12,6 @@ public abstract class ModuleUIPage : MonoBehaviour {
|
||||
public VisualElement root => document.rootVisualElement;
|
||||
/// <summary> 必须初始化 </summary>
|
||||
protected abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
/// <summary> 添加UI元素 </summary>
|
||||
public void Add(VisualElement child) => root.Add(child);
|
||||
/// <summary> 查询UI元素 </summary>
|
||||
+1
-1
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIGlobalPage : ModuleUIPage {
|
||||
protected override void Awake() => ModuleCore.GlobalPage = this;
|
||||
protected override void Awake() { }
|
||||
|
||||
private void Start() {
|
||||
string url = "https://neiyihuizhouilabtest.zgfzjy.cn/api/client/color/categroies";
|
||||
-4
@@ -12,8 +12,6 @@ public abstract class ModuleUIPanel : MonoBehaviour {
|
||||
public ModuleUIPage ModuleUIPage;
|
||||
/// <summary> 可选初始化 </summary>
|
||||
protected virtual void Awake() { }
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
public abstract VisualElement Element { get; }
|
||||
}
|
||||
@@ -25,8 +23,6 @@ public abstract class UIItem<Data> {
|
||||
public static event Action<Data> OnSelect;
|
||||
/// <summary> 触发事件 </summary>
|
||||
public static void Select(Data data) => OnSelect?.Invoke(data);
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
/// <summary> 绑定的数据 </summary>
|
||||
public readonly Data value;
|
||||
/// <summary> 绑定的元素 </summary>
|
||||
-2
@@ -12,8 +12,6 @@ public abstract class ModuleUIWindow<Data> : MonoBehaviour {
|
||||
public ModuleUIPage ModuleUIPage;
|
||||
/// <summary> 必须初始化 </summary>
|
||||
public abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 绑定的根元素 </summary>
|
||||
public abstract VisualElement Element { get; }
|
||||
@@ -6,6 +6,5 @@ using UnityEngine;
|
||||
/// 固定数据物体模块
|
||||
/// </summary>
|
||||
public abstract class ModuleFixed : MonoBehaviour {
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ using UnityEngine;
|
||||
public abstract class ModulePrefab<Data> : MonoBehaviour {
|
||||
/// <summary> 关联的数据 </summary>
|
||||
protected Data value;
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 关联的数据 </summary>
|
||||
public virtual Data Value => value;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 图层遮罩工具
|
||||
/// </summary>
|
||||
public static class LayerMaskTool {
|
||||
///// <summary> 板片 </summary>
|
||||
//public static readonly LayerMask Plate = 1 << LayerMask.NameToLayer("Plate");
|
||||
///// <summary> 形状 </summary>
|
||||
//public static readonly LayerMask Shape = 1 << LayerMask.NameToLayer("Shape");
|
||||
///// <summary> 安排点 </summary>
|
||||
//public static readonly LayerMask Arrange = 1 << LayerMask.NameToLayer("Arrange");
|
||||
///// <summary> 模特 </summary>
|
||||
//public static readonly LayerMask Model = 1 << LayerMask.NameToLayer("Model");
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d32659481db1a124c9b564f885ee75a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public static class LoopIndexTool {
|
||||
/// <summary> 头尾循环标准化索引 </summary>
|
||||
public static Data LoopIndex<Data>(this List<Data> list, int index) {
|
||||
return list[LoopIndex(index, list.Count)];
|
||||
}
|
||||
/// <summary> 头尾循环标准化索引 </summary>
|
||||
public static Data LoopIndex<Data>(this Data[] array, int index) {
|
||||
return array[LoopIndex(index, array.Length)];
|
||||
}
|
||||
/// <summary> 头尾循环标准化索引 </summary>
|
||||
public static int LoopIndex(int index, int maxIndex) {
|
||||
if (maxIndex == 0) { Debug.LogError("错误索引:maxIndex = 0"); return 0; }
|
||||
if (index < 0) { return LoopIndex(index + maxIndex, maxIndex); }
|
||||
if (index >= maxIndex) { return LoopIndex(index - maxIndex, maxIndex); }
|
||||
return index;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f410a5e521f087048804a823d1c02e6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 821f2aa73c2761649a4466ee441ad752
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
public class OutlineRendererFeature : ScriptableRendererFeature {
|
||||
/// <summary> 渲染设置 </summary>
|
||||
public OutlineSettings settings;
|
||||
/// <summary> 渲染Event </summary>
|
||||
public RenderPassEvent renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
|
||||
/// <summary> 渲染通道 </summary>
|
||||
private OutlineRendererPass OutlineBlendRenderPass;
|
||||
public override void Create() {
|
||||
OutlineBlendRenderPass = new OutlineRendererPass(settings);
|
||||
OutlineBlendRenderPass.renderPassEvent = renderPassEvent;
|
||||
}
|
||||
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) {
|
||||
OutlineBlendRenderPass.Setup(renderingData);
|
||||
renderer.EnqueuePass(OutlineBlendRenderPass);
|
||||
Dispose();
|
||||
}
|
||||
|
||||
#region 渲染设置
|
||||
[Serializable]
|
||||
public class OutlineSettings {
|
||||
[Tooltip("渲染对象")] public float size = 5;
|
||||
[Tooltip("渲染对象")] public Material unlit;
|
||||
[Tooltip("轮廓材质")] public Material outline;
|
||||
[Tooltip("混合颜色")] public Material color;
|
||||
[Tooltip("渲染对象")] public List<Transform> RenderObjs = new List<Transform>();
|
||||
/// <summary> 是否有效设置 </summary>
|
||||
public bool isValid => unlit != null && outline != null && color != null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 渲染通道
|
||||
public class OutlineRendererPass : ScriptableRenderPass {
|
||||
public const string ProfilerTag = "OutlineBlend";
|
||||
/// <summary> 临时纹理 </summary>
|
||||
public RTHandle TempRTHandel;
|
||||
/// <summary> 轮廓纹理 </summary>
|
||||
public RTHandle OutlineRTHandel;
|
||||
/// <summary> 渲染设置 </summary>
|
||||
public OutlineSettings settings;
|
||||
/// <summary> 渲染通道 </summary>
|
||||
public OutlineRendererPass(OutlineSettings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
/// <summary> 渲染前设置 </summary>
|
||||
public void Setup(in RenderingData renderingData) {
|
||||
if (!settings.isValid) { return; }
|
||||
settings.outline.SetFloat("_Size", settings.size);
|
||||
RenderTextureDescriptor descriptor = renderingData.cameraData.cameraTargetDescriptor;
|
||||
descriptor.depthBufferBits = (int)DepthBits.None;
|
||||
RenderingUtils.ReAllocateIfNeeded(ref OutlineRTHandel, descriptor, name: "OutlineRT");
|
||||
RenderingUtils.ReAllocateIfNeeded(ref TempRTHandel, descriptor, name: "TempRT");
|
||||
}
|
||||
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) {
|
||||
if (!settings.isValid) { return; }
|
||||
CommandBuffer command = CommandBufferPool.Get(ProfilerTag);
|
||||
//在临时纹理上渲染物体的轮廓
|
||||
CoreUtils.SetRenderTarget(command, TempRTHandel);
|
||||
DrawRenderer(command, settings.unlit);
|
||||
settings.outline.SetTexture("_MainTex", TempRTHandel);
|
||||
Blitter.BlitTexture(command, TempRTHandel, OutlineRTHandel, settings.outline, 0);
|
||||
//轮廓+颜色 混合到源上
|
||||
settings.color.SetTexture("_MainTex", OutlineRTHandel);
|
||||
Blit(command, ref renderingData, settings.color);
|
||||
context.ExecuteCommandBuffer(command);
|
||||
CommandBufferPool.Release(command);
|
||||
TempRTHandel.Release();
|
||||
OutlineRTHandel?.Release();
|
||||
}
|
||||
public void DrawRenderer(CommandBuffer command, Material material) {
|
||||
settings.RenderObjs.RemoveAll(obj => obj == null);
|
||||
for (int i = 0; i < settings.RenderObjs.Count; i++) {
|
||||
Transform obj = settings.RenderObjs[i];
|
||||
if (!obj.gameObject.activeInHierarchy) { continue; }
|
||||
DrawRenderer(obj, command, material);
|
||||
}
|
||||
}
|
||||
public void DrawRenderer(Transform obj, CommandBuffer command, Material material) {
|
||||
Renderer[] renderers = obj.GetComponentsInChildren<Renderer>();
|
||||
for (int i = 0; i < renderers.Length; i++) {
|
||||
command.DrawRenderer(renderers[i], material, 0, 0);
|
||||
}
|
||||
if (obj.TryGetComponent(out Renderer renderer)) {
|
||||
command.DrawRenderer(renderer, material, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a94c64b69e2e9d42af70e81f06c52a1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -106,21 +106,15 @@ namespace MuHua {
|
||||
tracker.style.width = CurrentPosition;
|
||||
UpdateFloatField();
|
||||
}
|
||||
internal void UpdateFloatField(ChangeEvent<float> evt) {
|
||||
float value = Mathf.Clamp(evt.newValue, MinValue, MaxValue);
|
||||
slidingValue = (value - MinValue) / (MaxValue - MinValue);
|
||||
tracker.style.width = CurrentPosition;
|
||||
SlidingValueChanged?.Invoke(Value);
|
||||
}
|
||||
internal void UpdateFloatField(bool value) {
|
||||
isDisplayInput = value;
|
||||
floatField.style.display = isDisplayInput ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
}
|
||||
internal void UpdateFloatField() {
|
||||
floatField.SetValueWithoutNotify(Value);
|
||||
floatField.value = Value;
|
||||
}
|
||||
internal float UpdateValue() {
|
||||
float value = Mathf.Lerp(MinValue, MaxValue, SlidingValue);
|
||||
float value = (MaxValue - MinValue) * SlidingValue;
|
||||
if (dataType == RoundDataType.保留两位小数) { value = (float)Math.Round(value, 2); }
|
||||
if (dataType == RoundDataType.整数) { value = Mathf.FloorToInt(value); }
|
||||
return Mathf.Clamp(value, MinValue, MaxValue);
|
||||
@@ -171,8 +165,6 @@ namespace MuHua {
|
||||
dragger.RegisterCallback<PointerUpEvent>((evt) => isDragger = false);
|
||||
dragger.RegisterCallback<PointerLeaveEvent>((evt) => isDragger = false);
|
||||
|
||||
floatField.RegisterCallback<ChangeEvent<float>>(UpdateFloatField);
|
||||
|
||||
container.RegisterCallback<PointerDownEvent>(ContainerDown);
|
||||
}
|
||||
private void DraggerDown(PointerDownEvent evt) {
|
||||
|
||||
@@ -752,7 +752,7 @@ PlayerSettings:
|
||||
embeddedLinuxEnableGamepadInput: 1
|
||||
hmiLogStartupTiming: 0
|
||||
hmiCpuConfiguration:
|
||||
apiCompatibilityLevel: 6
|
||||
apiCompatibilityLevel: 3
|
||||
activeInputHandler: 0
|
||||
windowsGamepadBackendHint: 0
|
||||
cloudProjectId:
|
||||
|
||||
Reference in New Issue
Block a user