可配置模块
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using AibisDream.FixSystem;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.SystemEditor
|
||||
{
|
||||
[CustomEditor(typeof(BodyModuleSystem))]
|
||||
public class BodyModuleSystemEditor : SystemHasDataEditor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
var example = (BodyModuleSystem)target;
|
||||
|
||||
base.OnInspectorGUI();
|
||||
GUILayout.Label("修改");
|
||||
|
||||
if (GUILayout.Button("添加一个新模块"))
|
||||
{
|
||||
example.AddBodyModule();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bfe60c0be744740a6df2bee152c5dc0
|
||||
timeCreated: 1732921141
|
||||
@@ -1,33 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
/// <summary>
|
||||
/// 齿轮系统编辑器
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(GearController))]
|
||||
public class GearSystemEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
GearController controller = (GearController)target;
|
||||
|
||||
GUILayout.Label("关卡编辑功能");
|
||||
if (GUILayout.Button("添加一个齿轮轴"))
|
||||
{
|
||||
Debug.Log("添加齿轮轴");
|
||||
}
|
||||
|
||||
if (GUILayout.Button("添加一个浮动的齿轮"))
|
||||
{
|
||||
Debug.Log("添加浮动齿轮");
|
||||
}
|
||||
|
||||
GUILayout.Label("关卡加载/编辑");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
using AibisDream.Framework;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.SystemEditor
|
||||
{
|
||||
[CustomEditor(typeof(SystemHasData), true)]
|
||||
public class SystemHasDataEditor : Editor
|
||||
{
|
||||
private int _selectedIndex;
|
||||
private string _inputText = "";
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
// 获取目标对象
|
||||
SystemHasData example = (SystemHasData)target;
|
||||
|
||||
// 绘制默认的 Inspector
|
||||
DrawDefaultInspector();
|
||||
|
||||
GUILayout.Label("数据加载与保存");
|
||||
// 绘制下拉选择和输入框
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
int newIndex = EditorGUILayout.Popup(_selectedIndex, example.GetDataKeyOptions());
|
||||
_inputText = EditorGUILayout.TextField(_inputText);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (newIndex != _selectedIndex)
|
||||
{
|
||||
_selectedIndex = newIndex;
|
||||
_inputText = example.GetDataKeyOptions()[newIndex];
|
||||
}
|
||||
|
||||
// 保存按钮
|
||||
if (GUILayout.Button("保存"))
|
||||
{
|
||||
Undo.RecordObject(example, "Save Input Value");
|
||||
example.CurDataKey = _inputText;
|
||||
example.Save();
|
||||
Debug.Log("Saved: " + _inputText);
|
||||
}
|
||||
|
||||
// 加载按钮
|
||||
if (GUILayout.Button("加载"))
|
||||
{
|
||||
example.CurDataKey = _inputText;
|
||||
_selectedIndex = System.Array.IndexOf(example.GetDataKeyOptions(), _inputText);
|
||||
if (_selectedIndex < 0) _selectedIndex = 0;
|
||||
example.Load();
|
||||
Debug.Log("Loaded: " + _inputText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ed77cdf9a26442990dbc9904c51d905
|
||||
timeCreated: 1732899623
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,229 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1462281046183125317
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5177852888421363108}
|
||||
- component: {fileID: 942590100883659357}
|
||||
m_Layer: 0
|
||||
m_Name: Socket
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5177852888421363108
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1462281046183125317}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.005, y: -0.011, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7084584428788688235}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &942590100883659357
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1462281046183125317}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 5
|
||||
m_Sprite: {fileID: 9131045294461249809, guid: 6de0a74e5b5268b4998dc7a5c687fb95, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 1
|
||||
--- !u!1 &2359294975205654025
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7084584428788688235}
|
||||
- component: {fileID: 6698795021239649397}
|
||||
m_Layer: 0
|
||||
m_Name: Default Module
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7084584428788688235
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2359294975205654025}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 1, y: 1, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2560478297392028634}
|
||||
- {fileID: 5177852888421363108}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &6698795021239649397
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2359294975205654025}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 485fe5a69106f8146a3ef9ca070f306d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
data:
|
||||
moduleName:
|
||||
modulePicPath:
|
||||
modulePos:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
socketPos:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
waveformType: 0
|
||||
waveHasError: 0
|
||||
--- !u!1 &7933871335801960612
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2560478297392028634}
|
||||
- component: {fileID: 3687148484723382491}
|
||||
m_Layer: 0
|
||||
m_Name: Module Pic
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2560478297392028634
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7933871335801960612}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7084584428788688235}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &3687148484723382491
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7933871335801960612}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 4
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1.32, y: 1.11}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 0
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de6db0026fa152946b2d033cd4e76b7e
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,320 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1299151124194456251
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3641060396765317556}
|
||||
- component: {fileID: 7836700930816346096}
|
||||
- component: {fileID: 6334611288363270407}
|
||||
m_Layer: 0
|
||||
m_Name: EventSystem
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3641060396765317556
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1299151124194456251}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7611243318142021168}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &7836700930816346096
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1299151124194456251}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_FirstSelected: {fileID: 0}
|
||||
m_sendNavigationEvents: 1
|
||||
m_DragThreshold: 10
|
||||
--- !u!114 &6334611288363270407
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1299151124194456251}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_SendPointerHoverToParent: 1
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
m_CancelButton: Cancel
|
||||
m_InputActionsPerSecond: 10
|
||||
m_RepeatDelay: 0.5
|
||||
m_ForceModuleActive: 0
|
||||
--- !u!1 &4214753503693131867
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7611243318142021168}
|
||||
m_Layer: 0
|
||||
m_Name: Editor Mode Func
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7611243318142021168
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4214753503693131867}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6120444917757515705}
|
||||
- {fileID: 3641060396765317556}
|
||||
- {fileID: 8556345213791081418}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &8168536426589423301
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8556345213791081418}
|
||||
- component: {fileID: 7037918505330246345}
|
||||
- component: {fileID: 1411876041170289596}
|
||||
- component: {fileID: 5795012028576405938}
|
||||
- component: {fileID: 3799972374739294581}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8556345213791081418
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8168536426589423301}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7611243318142021168}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!20 &7037918505330246345
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8168536426589423301}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_Iso: 200
|
||||
m_ShutterSpeed: 0.005
|
||||
m_Aperture: 16
|
||||
m_FocusDistance: 10
|
||||
m_FocalLength: 50
|
||||
m_BladeCount: 5
|
||||
m_Curvature: {x: 2, y: 11}
|
||||
m_BarrelClipping: 0.25
|
||||
m_Anamorphism: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 1
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!81 &1411876041170289596
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8168536426589423301}
|
||||
m_Enabled: 1
|
||||
--- !u!114 &5795012028576405938
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8168536426589423301}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_RenderShadows: 1
|
||||
m_RequiresDepthTextureOption: 2
|
||||
m_RequiresOpaqueTextureOption: 2
|
||||
m_CameraType: 0
|
||||
m_Cameras: []
|
||||
m_RendererIndex: -1
|
||||
m_VolumeLayerMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 1
|
||||
m_VolumeTrigger: {fileID: 0}
|
||||
m_VolumeFrameworkUpdateModeOption: 2
|
||||
m_RenderPostProcessing: 0
|
||||
m_Antialiasing: 0
|
||||
m_AntialiasingQuality: 2
|
||||
m_StopNaN: 0
|
||||
m_Dithering: 0
|
||||
m_ClearDepth: 1
|
||||
m_AllowXRRendering: 1
|
||||
m_AllowHDROutput: 1
|
||||
m_UseScreenCoordOverride: 0
|
||||
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_RequiresDepthTexture: 0
|
||||
m_RequiresColorTexture: 0
|
||||
m_Version: 2
|
||||
m_TaaSettings:
|
||||
quality: 3
|
||||
frameInfluence: 0.1
|
||||
jitterScale: 1
|
||||
mipBias: 0
|
||||
varianceClampScale: 0.9
|
||||
contrastAdaptiveSharpening: 0
|
||||
--- !u!114 &3799972374739294581
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8168536426589423301}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 56666c5a40171f54783dd416a44f42bf, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_EventMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_MaxRayIntersections: 0
|
||||
--- !u!1001 &5790406710898921353
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 7611243318142021168}
|
||||
m_Modifications:
|
||||
- target: {fileID: 336529723513575472, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 8.62
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 336529723513575472, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -4.72
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 336529723513575472, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 336529723513575472, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 336529723513575472, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 336529723513575472, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 336529723513575472, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 336529723513575472, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 336529723513575472, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 336529723513575472, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6247080755836924787, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Audio Manager
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
--- !u!4 &6120444917757515705 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 336529723513575472, guid: b8280919ceaa0a2489020c94c7376cd0, type: 3}
|
||||
m_PrefabInstance: {fileID: 5790406710898921353}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13f00ab6092291d49a9312e52873d80b
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1725
-750
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ namespace AibisDream
|
||||
public class DialogController : Singleton<DialogController>
|
||||
{
|
||||
private const string BookManager = "BookManager";
|
||||
|
||||
|
||||
private DialogueRunner dialogueRunner;
|
||||
private VariableStorageBehaviour _variableStorage;
|
||||
|
||||
@@ -41,20 +41,17 @@ namespace AibisDream
|
||||
OnDialogueComplete?.Invoke();
|
||||
}
|
||||
}
|
||||
get
|
||||
{
|
||||
return _isTalking;
|
||||
}
|
||||
get { return _isTalking; }
|
||||
}
|
||||
|
||||
// 对话框被阻塞时不能继续对话框交互
|
||||
public bool IsBlock { get; private set; }
|
||||
|
||||
public bool quickRunMode;
|
||||
|
||||
|
||||
// 暂停对话
|
||||
public bool isInPause;
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
public static UnityAction OnDialogueStart;
|
||||
@@ -70,8 +67,16 @@ namespace AibisDream
|
||||
bookManager.OnBookClosed += () => { IsBlock = false; };
|
||||
bookManager.OnBookOpen += () => { IsBlock = true; };
|
||||
|
||||
dialogueRunner.onDialogueStart.AddListener(() => { OnDialogueStart?.Invoke(); IsTalking = true;});
|
||||
dialogueRunner.onDialogueComplete.AddListener(() => { OnDialogueComplete?.Invoke(); IsTalking = false;});
|
||||
dialogueRunner.onDialogueStart.AddListener(() =>
|
||||
{
|
||||
OnDialogueStart?.Invoke();
|
||||
IsTalking = true;
|
||||
});
|
||||
dialogueRunner.onDialogueComplete.AddListener(() =>
|
||||
{
|
||||
OnDialogueComplete?.Invoke();
|
||||
IsTalking = false;
|
||||
});
|
||||
//dialogueRunner.AddCommandListener(_ => { IsTalking = false; });
|
||||
|
||||
// 对话结束时切下一个SO
|
||||
@@ -116,31 +121,28 @@ namespace AibisDream
|
||||
dialogueRunner.SetProject(yarnProject);
|
||||
dialogueRunner.StartDialogue("Start");
|
||||
}
|
||||
|
||||
public void StartDialogNode(string nodeName)
|
||||
{
|
||||
if(CheckIfNodeExistInCurrentYarnProject(nodeName))
|
||||
{
|
||||
dialogueRunner.StartDialogue(nodeName);
|
||||
|
||||
}
|
||||
|
||||
if (CheckIfNodeExistInCurrentYarnProject(nodeName))
|
||||
{
|
||||
dialogueRunner.StartDialogue(nodeName);
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckIfNodeExistInCurrentYarnProject(string nodeName)
|
||||
{
|
||||
YarnProject currentProject = dialogueRunner.yarnProject;
|
||||
string[] nodeNames = currentProject.NodeNames;
|
||||
if (Array.Exists(nodeNames, name => name == nodeName))
|
||||
if (Array.Exists(nodeNames, item => item == nodeName))
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"节点 {nodeName} 不存在!");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#region 选项指令
|
||||
@@ -225,7 +227,7 @@ namespace AibisDream
|
||||
Debug.LogWarning($"命令 {commandName} 不存在");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册暂停命令
|
||||
/// </summary>
|
||||
@@ -258,15 +260,14 @@ namespace AibisDream
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 命令名
|
||||
|
||||
|
||||
[YarnCommand("NextYarn")]
|
||||
public static void NextYarn()
|
||||
{
|
||||
DialogController.Instance.StartCoroutine(GameLoopManager.Instance.NextSceneSo());
|
||||
DialogController.Instance.StartCoroutine(GameLoopManager.Instance.NextSceneSo());
|
||||
}
|
||||
|
||||
[YarnCommand("switch_tv")]
|
||||
@@ -316,7 +317,6 @@ namespace AibisDream
|
||||
// {
|
||||
// return MainSceneController.Instance.MoveToFix();
|
||||
// }
|
||||
|
||||
[YarnCommand("load_scene")]
|
||||
public static IEnumerator LoadScene(string sceneName, float duration = 1)
|
||||
{
|
||||
@@ -328,7 +328,7 @@ namespace AibisDream
|
||||
DialogCanvasManager.Instance.SwitchDialogView(sceneName == "ClinicScene"
|
||||
? DialogViewType.Bubble
|
||||
: DialogViewType.OldBox);
|
||||
if(sceneName=="ClinicScene")
|
||||
if (sceneName == "ClinicScene")
|
||||
{
|
||||
AudioManager.PlayAmb1Audio("amb_room");
|
||||
}
|
||||
@@ -336,8 +336,8 @@ namespace AibisDream
|
||||
{
|
||||
AudioManager.PlayAmb1Audio("amb_main");
|
||||
}
|
||||
AudioManager.PlayAmb2Audio("amb_general");
|
||||
|
||||
AudioManager.PlayAmb2Audio("amb_general");
|
||||
}
|
||||
|
||||
[YarnCommand("unload_scene")]
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public interface ISocket
|
||||
{
|
||||
public void PlugIn();
|
||||
public void PlugOut();
|
||||
public Vector3 GetSocketPos();
|
||||
}
|
||||
|
||||
public class BaseSocket : MonoBehaviour, ISocket
|
||||
{
|
||||
public void PlugIn()
|
||||
{
|
||||
Debug.Log("Plug Back InitSocket");
|
||||
}
|
||||
|
||||
public void PlugOut()
|
||||
{
|
||||
Debug.Log("Plug Out InitSocket");
|
||||
}
|
||||
|
||||
public Vector3 GetSocketPos()
|
||||
{
|
||||
return transform.position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AibisDream.Framework;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public class BodyModule : MonoBehaviour
|
||||
public class BodyModule : MonoBehaviour, ISocket
|
||||
{
|
||||
#region 组件引用
|
||||
|
||||
private const string SocketObjName = "Socket";
|
||||
public Socket Socket { get; private set; }
|
||||
private const string ModulePicName = "Module Pic";
|
||||
private Transform _socketPos;
|
||||
|
||||
#endregion
|
||||
|
||||
public Vector3 SocketPos => Socket.transform.position;
|
||||
|
||||
// 模块基本数据
|
||||
[SerializeField] public BodyModuleData moduleData;
|
||||
|
||||
public ISocketCommand curPlugInCommand;
|
||||
|
||||
#region Module状态
|
||||
|
||||
public bool isPlugIn;
|
||||
public bool isFirstPlugIn;
|
||||
public string curCommandType;
|
||||
|
||||
#endregion
|
||||
[SerializeField] public BodyModuleData data;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -36,24 +26,123 @@ namespace AibisDream.FixSystem
|
||||
|
||||
private void InitReference()
|
||||
{
|
||||
Socket = transform.Find(SocketObjName).GetComponent<Socket>();
|
||||
_socketPos = transform.Find(SocketObjName);
|
||||
}
|
||||
|
||||
#region 插槽功能
|
||||
|
||||
public void PlugIn()
|
||||
{
|
||||
|
||||
// 插入后先播放wave
|
||||
ShowWave();
|
||||
// 然后触发Yarn节点
|
||||
// DialogController.Instance.StartDialogNode(data.PlugInNodeName);
|
||||
}
|
||||
|
||||
public void PlugOut()
|
||||
{
|
||||
// 先关闭wave
|
||||
CloseWave();
|
||||
// TODO 触发Yarn节点(似乎目前没有拔出对话?)
|
||||
}
|
||||
|
||||
public void DeepIn()
|
||||
{
|
||||
if (!data.waveHasError) return;
|
||||
// 如果有错误并且已经深入了
|
||||
DialogController.Instance.StartDialogNode(data.DeepInNodeName);
|
||||
}
|
||||
|
||||
private void CloseWave()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Get<OscilloscopeSystem>().StopWave();
|
||||
}
|
||||
|
||||
private void ShowWave()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Get<OscilloscopeSystem>().PlayWave(data.waveformType, data.waveHasError);
|
||||
}
|
||||
|
||||
public Vector3 GetSocketPos()
|
||||
{
|
||||
return _socketPos.position;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 模块数据保存与卸载
|
||||
|
||||
public void Load(BodyModuleData newData)
|
||||
{
|
||||
var modulePic = transform.Find(ModulePicName).GetComponent<SpriteRenderer>();
|
||||
var socketPos = transform.Find(SocketObjName);
|
||||
|
||||
gameObject.name = newData.moduleName;
|
||||
// 初始化位置与外形
|
||||
transform.localPosition = newData.ModulePos;
|
||||
modulePic.sprite = newData.ModulePic;
|
||||
socketPos.localPosition = newData.SocketPos;
|
||||
// 数据同步
|
||||
data = newData;
|
||||
}
|
||||
|
||||
public BodyModuleData Save()
|
||||
{
|
||||
var modulePic = transform.Find(ModulePicName).GetComponent<SpriteRenderer>();
|
||||
var socketPos = transform.Find(SocketObjName);
|
||||
|
||||
return new BodyModuleData
|
||||
{
|
||||
moduleName = data.moduleName,
|
||||
modulePicPath = ResourceKit.SavePsdSprite(modulePic.sprite),
|
||||
ModulePos = transform.localPosition,
|
||||
SocketPos = socketPos.localPosition,
|
||||
waveformType = data.waveformType,
|
||||
waveHasError = data.waveHasError
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct BodyModuleData
|
||||
{
|
||||
public const string PlugInNodeTemplate = "{0}PlugIn";
|
||||
public const string DeepInTemplate = "{0}DeepIn";
|
||||
|
||||
// ID
|
||||
public string moduleName;
|
||||
|
||||
// 外形信息
|
||||
public string modulePicPath;
|
||||
public SerializableVector3 modulePos;
|
||||
public SerializableVector3 socketPos;
|
||||
|
||||
// 功能信息
|
||||
public WaveformType waveformType;
|
||||
|
||||
|
||||
public bool waveHasError;
|
||||
|
||||
public List<string> modulePicList;
|
||||
// 只读
|
||||
[JsonIgnore] public string PlugInNodeName => string.Format(PlugInNodeTemplate, moduleName);
|
||||
[JsonIgnore] public string DeepInNodeName => string.Format(DeepInTemplate, moduleName);
|
||||
|
||||
public Vector3 modulePos;
|
||||
[JsonIgnore]
|
||||
public Sprite ModulePic =>
|
||||
!string.IsNullOrEmpty(modulePicPath) ? ResourceKit.LoadSpriteFromPsd(modulePicPath) : null;
|
||||
|
||||
[JsonIgnore]
|
||||
public Vector3 ModulePos
|
||||
{
|
||||
get => modulePos.ToVector3();
|
||||
set => modulePos = new SerializableVector3(value);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public Vector3 SocketPos
|
||||
{
|
||||
get => socketPos.ToVector3();
|
||||
set => socketPos = new SerializableVector3(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,40 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.Utility;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public class BodyModuleSystem : MonoBehaviour
|
||||
public class BodyModuleSystem : SystemHasData
|
||||
{
|
||||
public static string DataPath = Application.streamingAssetsPath + "/LevelData/BodyModuleSystem/";
|
||||
|
||||
#region 内部索引
|
||||
|
||||
public BodyModule[] BodyModules { get; private set; }
|
||||
public CableSystem CableSystem { get; private set; }
|
||||
public GameObject bodyModulePrefab;
|
||||
public Transform bodyModuleGroup;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 对外暴露事件
|
||||
#region 数据保存相关
|
||||
|
||||
public UnityEvent<Socket> PlugInEvent => CableSystem.plugInEvent;
|
||||
public UnityEvent<Socket> PlugOutEvent => CableSystem.plugOutEvent;
|
||||
public override string CurDataKey { get; set; }
|
||||
private string[] _keyOptions;
|
||||
|
||||
public UnityEvent PlugStartDrag => CableSystem.plugStartDrag;
|
||||
public UnityEvent PlugEndDrag => CableSystem.plugEndDrag;
|
||||
|
||||
#endregion
|
||||
|
||||
[SerializeField]
|
||||
public BodyModuleSystemConfig config = BodyModuleSystemConfig.GeneDefaultConfig();
|
||||
|
||||
#region 事件
|
||||
|
||||
[HideInInspector] public UnityEvent<ISocket> plugInEvent;
|
||||
[HideInInspector] public UnityEvent<ISocket> plugOutEvent;
|
||||
|
||||
#endregion
|
||||
|
||||
[SerializeField] public float plugSnappingRange = 1f;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -36,6 +46,8 @@ namespace AibisDream.FixSystem
|
||||
// 处理内部索引
|
||||
BodyModules = transform.GetComponentsInChildren<BodyModule>();
|
||||
CableSystem = transform.Find("Cable System").GetComponent<CableSystem>();
|
||||
bodyModuleGroup = transform.Find("Body Module Group");
|
||||
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
}
|
||||
|
||||
@@ -49,11 +61,11 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
var closestDistance = Mathf.Infinity;
|
||||
BodyModule closestModule = null;
|
||||
|
||||
|
||||
// 寻找最接近的BodyModule
|
||||
foreach (var bodyModule in BodyModules)
|
||||
{
|
||||
float tempDistance = Vector3.Distance(sourcePos, bodyModule.SocketPos);
|
||||
float tempDistance = Vector3.Distance(sourcePos, bodyModule.GetSocketPos());
|
||||
|
||||
if (tempDistance < closestDistance)
|
||||
{
|
||||
@@ -61,9 +73,9 @@ namespace AibisDream.FixSystem
|
||||
closestModule = bodyModule;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 判断距离是否在目标范围内,在的话就返回,不在的话返回个空的
|
||||
if (closestDistance < config.plugSnappingRange && closestModule)
|
||||
if (closestDistance < plugSnappingRange && closestModule)
|
||||
{
|
||||
targetModule = closestModule;
|
||||
return true;
|
||||
@@ -74,7 +86,111 @@ namespace AibisDream.FixSystem
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 深入检查
|
||||
/// </summary>
|
||||
public void HandleDeepIn()
|
||||
{
|
||||
if (CableSystem.curBodyModule)
|
||||
{
|
||||
CableSystem.curBodyModule.DeepIn();
|
||||
}
|
||||
}
|
||||
|
||||
#region 数据加载与保存
|
||||
|
||||
public override string[] GetDataKeyOptions()
|
||||
{
|
||||
return _keyOptions ??= ConfigUtil.Instance.GetFileNames(DataPath);
|
||||
}
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
if (string.IsNullOrEmpty(CurDataKey))
|
||||
{
|
||||
Debug.Log("配置项名称为空");
|
||||
return;
|
||||
}
|
||||
|
||||
string formattedKey = JsonUtil.FormatAsJsonPath(CurDataKey);
|
||||
if (!ConfigUtil.Instance.TryLoadConfig<BodyModuleSystemData>(DataPath + formattedKey,
|
||||
out var data))
|
||||
{
|
||||
Debug.Log("没有找到配置项");
|
||||
return;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
// 现将当前配置保存为temp避免丢失
|
||||
if (CurDataKey != "temp.json")
|
||||
{
|
||||
SaveByKey("temp.json");
|
||||
}
|
||||
#endif
|
||||
|
||||
// 加载数据
|
||||
LoadData(data);
|
||||
}
|
||||
|
||||
private void LoadData(BodyModuleSystemData systemData)
|
||||
{
|
||||
var oldModules = GetComponentsInChildren<BodyModule>();
|
||||
// 先销毁旧的Module
|
||||
foreach (var oldModule in oldModules)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
DestroyImmediate(oldModule.gameObject);
|
||||
#else
|
||||
Destory(oldModule);
|
||||
#endif
|
||||
}
|
||||
|
||||
// 再加载新的Module
|
||||
foreach (var newModuleData in systemData.moduleDataArray)
|
||||
{
|
||||
BodyModule newModule = Instantiate(bodyModulePrefab, bodyModuleGroup).GetComponent<BodyModule>();
|
||||
newModule.Load(newModuleData);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Save()
|
||||
{
|
||||
if (string.IsNullOrEmpty(CurDataKey)) return;
|
||||
|
||||
SaveByKey(CurDataKey);
|
||||
if (!_keyOptions.Contains(CurDataKey))
|
||||
{
|
||||
// 重新读取key
|
||||
_keyOptions = ConfigUtil.Instance.GetFileNames(DataPath);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveByKey(string key)
|
||||
{
|
||||
var oldModules = GetComponentsInChildren<BodyModule>();
|
||||
var moduleDataArray = new BodyModuleData[oldModules.Length];
|
||||
for (int i = 0; i < oldModules.Length; i++)
|
||||
{
|
||||
moduleDataArray[i] = oldModules[i].Save();
|
||||
}
|
||||
|
||||
var systemData = new BodyModuleSystemData
|
||||
{
|
||||
moduleDataArray = moduleDataArray
|
||||
};
|
||||
|
||||
string formattedKey = JsonUtil.FormatAsJsonPath(key);
|
||||
ConfigUtil.Instance.SaveConfig(systemData, DataPath + formattedKey);
|
||||
}
|
||||
|
||||
public void AddBodyModule()
|
||||
{
|
||||
Instantiate(bodyModulePrefab, bodyModuleGroup);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 插线系统是否插在插槽里
|
||||
/// </summary>
|
||||
@@ -83,20 +199,10 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
return CableSystem.curSocket != null;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct BodyModuleSystemConfig
|
||||
{
|
||||
public float plugSnappingRange;
|
||||
|
||||
public static BodyModuleSystemConfig GeneDefaultConfig()
|
||||
{
|
||||
return new BodyModuleSystemConfig
|
||||
{
|
||||
plugSnappingRange = 1f
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct BodyModuleSystemData
|
||||
{
|
||||
public BodyModuleData[] moduleDataArray;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using Yarn.Unity;
|
||||
|
||||
@@ -12,7 +11,7 @@ namespace AibisDream.FixSystem
|
||||
public Plug PlugRef { get; private set; }
|
||||
public Cable CableRef { get; private set; }
|
||||
public Transform CableRootPos { get; private set; }
|
||||
public Socket InitSocket { get; private set; }
|
||||
public ISocket InitSocket { get; private set; }
|
||||
|
||||
public BodyModuleSystem BodyModuleSystem { get; private set; }
|
||||
|
||||
@@ -23,21 +22,10 @@ namespace AibisDream.FixSystem
|
||||
public bool isInDialog = false;
|
||||
public bool isActive = true;
|
||||
|
||||
[HideInInspector] public Socket curSocket;
|
||||
[HideInInspector] public ISocket curSocket;
|
||||
[HideInInspector] public BodyModule curBodyModule;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 事件
|
||||
|
||||
public UnityEvent<Socket> plugInEvent;
|
||||
public UnityEvent<Socket> plugOutEvent;
|
||||
|
||||
public UnityEvent plugStartDrag;
|
||||
public UnityEvent plugEndDrag;
|
||||
|
||||
#endregion
|
||||
|
||||
public Vector3 InitSocketPos => InitSocket.transform.position;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -66,7 +54,7 @@ namespace AibisDream.FixSystem
|
||||
PlugRef = transform.Find("Plug").GetComponent<Plug>();
|
||||
CableRef = transform.Find("Cable").GetComponent<Cable>();
|
||||
CableRootPos = transform.Find("Cable Root Pos").transform;
|
||||
InitSocket = transform.Find("Init Socket").GetComponent<Socket>();
|
||||
InitSocket = transform.Find("Init Socket").GetComponent<ISocket>();
|
||||
|
||||
BodyModuleSystem = transform.parent.GetComponent<BodyModuleSystem>();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using AibisDream.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using UnityEngine;
|
||||
using Yarn.Unity;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public static class FixYarnCommandEx
|
||||
{
|
||||
[YarnCommand("start_system")]
|
||||
public static void StartSystem(string systemName, string dataKey)
|
||||
{
|
||||
switch (systemName)
|
||||
{
|
||||
case "BodyModuleSystem":
|
||||
StartBodyModuleSystem(dataKey);
|
||||
break;
|
||||
case "GearSystem":
|
||||
StartGearSystem(dataKey);
|
||||
break;
|
||||
case "EngineSystem":
|
||||
StartGearSystem(dataKey);
|
||||
break;
|
||||
default:
|
||||
Debug.Log($"该系统不存在: {systemName}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void StartBodyModuleSystem(string dataKey)
|
||||
{
|
||||
var bodySystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
||||
bodySystem.CurDataKey = dataKey;
|
||||
bodySystem.Load();
|
||||
}
|
||||
|
||||
private static void StartGearSystem(string dataKey)
|
||||
{
|
||||
var gearSystem = FixSystemCenter.SystemDic.Get<GearController>();
|
||||
}
|
||||
|
||||
private static void StartEngineSystem(string dataKey)
|
||||
{
|
||||
var engineSystem = FixSystemCenter.SystemDic.Get<EngineSystem>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03e3e3472f5f40a8a9e93b5c793591d4
|
||||
timeCreated: 1732917739
|
||||
@@ -1,5 +1,7 @@
|
||||
using TMPro;
|
||||
using AibisDream.Utility;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
@@ -12,6 +14,7 @@ namespace AibisDream.FixSystem
|
||||
private ScanLine _scanLine;
|
||||
private SpriteRenderer _screen;
|
||||
private WaveSlider _waveSlider;
|
||||
private SpriteButton _deepinButton;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -19,6 +22,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
public bool isScanning;
|
||||
public bool isPlaying;
|
||||
public bool canScan;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -35,10 +39,19 @@ namespace AibisDream.FixSystem
|
||||
_scanLine = transform.Find("Scan Line").GetComponent<ScanLine>();
|
||||
_screen = transform.Find("Screen").GetComponent<SpriteRenderer>();
|
||||
_waveSlider = transform.Find("Wave Slider").GetComponent<WaveSlider>();
|
||||
_deepinButton = new SpriteButton(transform.Find("Deepin Button").gameObject, false);
|
||||
|
||||
_waveformLine.SetLineSize(_screen.bounds.size.x, _screen.bounds.size.y);
|
||||
_scanLine.SetScreenSize(_screen.bounds.size.x, _screen.bounds.size.y);
|
||||
_screenText.text = "";
|
||||
|
||||
_deepinButton.OnButtonDown += StartScan;
|
||||
_scanLine.ScanErrorEvent += OnScanSuccess;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_deepinButton.CheckButtonClick();
|
||||
}
|
||||
|
||||
#region 对外开放
|
||||
@@ -52,6 +65,8 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
_waveSlider.InitSlider();
|
||||
isPlaying = true;
|
||||
canScan = hasError;
|
||||
_deepinButton.SetActive(canScan);
|
||||
|
||||
var initialRandomPhase = Mathf.PI * Random.Range(7, 13) * 0.1f;
|
||||
_waveformLine.PlayWave(waveformType, initialRandomPhase, hasError);
|
||||
@@ -63,6 +78,9 @@ namespace AibisDream.FixSystem
|
||||
public void StopWave()
|
||||
{
|
||||
isPlaying = false;
|
||||
canScan = false;
|
||||
isScanning = false;
|
||||
_deepinButton.SetActive(false);
|
||||
_waveSlider.InitSlider();
|
||||
|
||||
_waveformLine.StopWave();
|
||||
@@ -85,9 +103,20 @@ namespace AibisDream.FixSystem
|
||||
/// </summary>
|
||||
public void StartScan()
|
||||
{
|
||||
if (!canScan) return;
|
||||
|
||||
float spikeX = _waveformLine.GetSpikeX();
|
||||
StartCoroutine(_scanLine.ScanForError(spikeX));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描成功后
|
||||
/// </summary>
|
||||
public void OnScanSuccess()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Get<BodyModuleSystem>().HandleDeepIn();
|
||||
_ = CommonUtil.Delay(2000, StopWave);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示消息
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace AibisDream.FixSystem
|
||||
_plugRootPos = transform.Find("Plug Root Pos");
|
||||
}
|
||||
|
||||
public void InitPlug(Socket initSocket)
|
||||
public void InitPlug(ISocket initSocket)
|
||||
{
|
||||
InsertSocket(initSocket);
|
||||
}
|
||||
@@ -47,10 +47,10 @@ namespace AibisDream.FixSystem
|
||||
/// 插入某个socket
|
||||
/// </summary>
|
||||
/// <param name="targetSocket">目标socket</param>
|
||||
private void InsertSocket(Socket targetSocket)
|
||||
private void InsertSocket(ISocket targetSocket)
|
||||
{
|
||||
// 修改插头位置
|
||||
transform.position = targetSocket.transform.position;
|
||||
transform.position = targetSocket.GetSocketPos();
|
||||
_cableSystem.CableRef.SetEndPos(transform);
|
||||
|
||||
// 处理插槽插入
|
||||
@@ -59,9 +59,13 @@ namespace AibisDream.FixSystem
|
||||
_sprite.enabled = false;
|
||||
|
||||
// 触发事件
|
||||
_cableSystem.plugInEvent?.Invoke(targetSocket);
|
||||
_cableSystem.BodyModuleSystem.plugInEvent?.Invoke(targetSocket);
|
||||
|
||||
_cableSystem.curSocket = targetSocket;
|
||||
if (targetSocket is BodyModule bodyModule)
|
||||
{
|
||||
_cableSystem.curBodyModule = bodyModule;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -76,8 +80,10 @@ namespace AibisDream.FixSystem
|
||||
AudioManager.RandomPlayInteraction("plug_out");
|
||||
_sprite.enabled = true;
|
||||
// 触发事件
|
||||
_cableSystem.plugOutEvent?.Invoke(_cableSystem.curSocket);
|
||||
_cableSystem.BodyModuleSystem.plugOutEvent?.Invoke(_cableSystem.curSocket);
|
||||
|
||||
|
||||
_cableSystem.curBodyModule = null;
|
||||
_cableSystem.curSocket = null;
|
||||
}
|
||||
|
||||
@@ -89,9 +95,6 @@ namespace AibisDream.FixSystem
|
||||
// 未被拖拽也返回
|
||||
if (!_isDragging) return;
|
||||
|
||||
// 这一行感觉不需要,毕竟传递的是引用
|
||||
// _cableSystem.CableRef.SetEndPos(transform);
|
||||
|
||||
transform.position = CommonUtil.GetMouseWorldPos(eventData.position, transform);
|
||||
}
|
||||
|
||||
@@ -103,8 +106,7 @@ namespace AibisDream.FixSystem
|
||||
// 开启拖拽
|
||||
_isDragging = true;
|
||||
// 进行插拔动作
|
||||
if (_cableSystem.curSocket) PullUpSocket();
|
||||
_cableSystem.plugStartDrag?.Invoke();
|
||||
if (_cableSystem.curSocket != null) PullUpSocket();
|
||||
|
||||
// 调整插头形状
|
||||
AdjustPlugPos();
|
||||
@@ -122,16 +124,14 @@ namespace AibisDream.FixSystem
|
||||
if (_cableSystem.TryFindClosestModule(transform.position, out var targetModule))
|
||||
{
|
||||
// 找到了就插入目标Module
|
||||
InsertSocket(targetModule.Socket);
|
||||
_cableSystem.plugEndDrag?.Invoke();
|
||||
InsertSocket(targetModule);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 没找到就插回初始Socket,需要播动画
|
||||
transform.DOMove(_cableSystem.InitSocketPos, 0.1f).OnComplete(() =>
|
||||
transform.DOMove(_cableSystem.InitSocket.GetSocketPos(), 0.1f).OnComplete(() =>
|
||||
{
|
||||
InsertSocket(_cableSystem.InitSocket);
|
||||
_cableSystem.plugEndDrag?.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
private const float ScanSpeed = 2f;
|
||||
|
||||
private event Action ScanErrorEvent;
|
||||
public event Action ScanErrorEvent;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace AibisDream.FixSystem
|
||||
private void InitComponentRefs()
|
||||
{
|
||||
_line = GetComponent<LineRenderer>();
|
||||
_line.enabled = false;
|
||||
_line.positionCount = 2;
|
||||
}
|
||||
|
||||
public IEnumerator ScanForError(float spikeX)
|
||||
@@ -108,11 +110,11 @@ namespace AibisDream.FixSystem
|
||||
|
||||
public void SetScreenSize(float width, float height)
|
||||
{
|
||||
_screenLeftX = transform.position.x - width / 2;
|
||||
_screenRightX = transform.position.x + width / 2;
|
||||
_screenLeftX = - width / 2;
|
||||
_screenRightX = width / 2;
|
||||
|
||||
_topY = transform.position.y + height / 2;
|
||||
_bottomY = transform.position.y - height / 2;
|
||||
_topY = height / 2;
|
||||
_bottomY = - height / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public interface ISocket
|
||||
{
|
||||
public bool IsAvailable { get; }
|
||||
|
||||
public void PlugIn();
|
||||
public void PlugOut();
|
||||
}
|
||||
|
||||
public class Socket : MonoBehaviour, ISocket
|
||||
{
|
||||
private BodyModule _bodyModule;
|
||||
public bool IsAvailable { get; private set; }
|
||||
|
||||
public void PlugIn()
|
||||
{
|
||||
Debug.Log("Plug In");
|
||||
}
|
||||
|
||||
public void PlugOut()
|
||||
{
|
||||
Debug.Log("Plug Out");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public interface ISocketCommand
|
||||
{
|
||||
void Execute();
|
||||
void ShowWave();
|
||||
void HandleDeepIn();
|
||||
bool CanDeepIn();
|
||||
}
|
||||
|
||||
// public class CommandFactory
|
||||
// {
|
||||
// public ICommand CreateCommand(string commandType)
|
||||
// {
|
||||
// return new EyeCommand();
|
||||
// }
|
||||
// }
|
||||
|
||||
public abstract class AbsSocketCommand : ISocketCommand
|
||||
{
|
||||
public bool canDeepIn;
|
||||
public bool isFirstPlugIn;
|
||||
|
||||
public string moduleName;
|
||||
public string firstPlugYarnNode;
|
||||
public string repeatPlugYarnNode;
|
||||
|
||||
public WaveformType waveformType;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
ShowWave();
|
||||
DialogController.Instance.StartDialogNode(isFirstPlugIn ? firstPlugYarnNode : repeatPlugYarnNode);
|
||||
if (isFirstPlugIn) isFirstPlugIn = false;
|
||||
}
|
||||
|
||||
public void ShowWave()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void HandleDeepIn()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool CanDeepIn()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class EngineSocketCommand : ISocketCommand
|
||||
{
|
||||
public bool canDeepIn;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ShowWave()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void HandleDeepIn()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以进行深入
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CanDeepIn()
|
||||
{
|
||||
return canDeepIn;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 039e28e566264ed8b8b4e5acbae0376a
|
||||
timeCreated: 1732714359
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
@@ -23,8 +22,10 @@ namespace AibisDream.FixSystem
|
||||
|
||||
private Vector2 _startPos;
|
||||
private Vector2 _endPos;
|
||||
|
||||
private float _value;
|
||||
private bool _isDragging;
|
||||
|
||||
public float Value { get; private set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -39,6 +40,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
_startPos = new Vector2(startTrans.position.x, startTrans.position.y);
|
||||
_endPos = new Vector2(endTrans.position.x, endTrans.position.y);
|
||||
InitSlider();
|
||||
}
|
||||
|
||||
public void InitSlider()
|
||||
@@ -50,25 +52,57 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
if (OscilloscopeSystem.isScanning) return;
|
||||
|
||||
if (Input.GetMouseButton(0))
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
var clampedX = Mathf.Clamp(mousePos.x, _startPos.x, _endPos.x);
|
||||
_slider.position = new Vector3(clampedX, _slider.position.y, _slider.position.z);
|
||||
|
||||
// 计算滑块在轨道上的比例
|
||||
var curValue = (clampedX - _startPos.x) / (_endPos.x - _startPos.x);
|
||||
UpdateValue(curValue);
|
||||
OnMouseButtonDown();
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonUp(0))
|
||||
{
|
||||
OnMouseButtonUp();
|
||||
}
|
||||
|
||||
if (_isDragging)
|
||||
{
|
||||
OnDragging();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMouseButtonDown()
|
||||
{
|
||||
// 检测鼠标是否点击在滑块上
|
||||
Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
Collider2D hitCollider = Physics2D.OverlapPoint(mousePos);
|
||||
|
||||
if (hitCollider && hitCollider.transform == _slider)
|
||||
{
|
||||
_isDragging = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMouseButtonUp()
|
||||
{
|
||||
_isDragging = false;
|
||||
}
|
||||
|
||||
private void OnDragging()
|
||||
{
|
||||
Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
float clampedX = Mathf.Clamp(mousePos.x, _startPos.x, _endPos.x);
|
||||
_slider.position = new Vector3(clampedX, _slider.position.y, _slider.position.z);
|
||||
|
||||
// 计算滑块在轨道上的比例
|
||||
var curValue = (clampedX - _startPos.x) / (_endPos.x - _startPos.x);
|
||||
UpdateValue(curValue);
|
||||
}
|
||||
|
||||
private void UpdateValue(float curValue)
|
||||
{
|
||||
if (!Mathf.Approximately(curValue, Value))
|
||||
if (!Mathf.Approximately(curValue, _value))
|
||||
{
|
||||
// 如果相位有更新,就同步给波形
|
||||
OscilloscopeSystem.AdjustPhaseShift(curValue);
|
||||
Value = curValue;
|
||||
_value = curValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace AibisDream.FixSystem
|
||||
/// <param name="phaseShift">相位</param>
|
||||
public void AdjustPhaseShift(float phaseShift)
|
||||
{
|
||||
_waveParam.varPhaseShift = phaseShift;
|
||||
_waveParam.varPhaseShift = phaseShift * 2 * Mathf.PI;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using AibisDream.Utility;
|
||||
using UnityEngine;
|
||||
@@ -139,5 +140,27 @@ namespace AibisDream.Kit
|
||||
{
|
||||
JsonUtil.SaveBean(bean, key, path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询某个文件夹下的所有文件
|
||||
/// </summary>
|
||||
/// <param name="folderPath">
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public string[] GetFileNames(string folderPath)
|
||||
{
|
||||
if (!Directory.Exists(folderPath))
|
||||
{
|
||||
return Array.Empty<string>(); // 如果目录不存在,返回空数组
|
||||
}
|
||||
|
||||
// 获取所有 .json 文件的完整路径
|
||||
string[] filePaths = Directory.GetFiles(folderPath, "*.json");
|
||||
|
||||
// 提取文件名(不包括路径)
|
||||
string[] fileNames = filePaths.Select(Path.GetFileName).ToArray();
|
||||
|
||||
return fileNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public struct SerializableVector3
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
|
||||
public SerializableVector3(Vector3 vector)
|
||||
{
|
||||
x = vector.x;
|
||||
y = vector.y;
|
||||
z = vector.z;
|
||||
}
|
||||
|
||||
public Vector3 ToVector3()
|
||||
{
|
||||
return new Vector3(x, y, z);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab611734fd046fe41b0b72a904792339
|
||||
guid: 4ef3fd25c4fbf9b4f91ebba7bab3dffe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Framework.Core
|
||||
namespace AibisDream.Framework
|
||||
{
|
||||
public enum RunType
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.Framework
|
||||
@@ -9,8 +8,7 @@ namespace AibisDream.Framework
|
||||
public interface IModule
|
||||
{
|
||||
void Init();
|
||||
void Enable();
|
||||
void Disable();
|
||||
void Init(string dataKey);
|
||||
void Deinit();
|
||||
}
|
||||
|
||||
@@ -22,22 +20,27 @@ namespace AibisDream.Framework
|
||||
void Deinit();
|
||||
}
|
||||
|
||||
public interface IData
|
||||
public interface ISystemHasData
|
||||
{
|
||||
string CurDataKey { get; set; }
|
||||
string[] GetDataKeyOptions();
|
||||
void Load();
|
||||
void Save();
|
||||
}
|
||||
|
||||
public static class DataExtension
|
||||
public abstract class SystemHasData : MonoBehaviour, ISystemHasData
|
||||
{
|
||||
public static void Save(this IData data)
|
||||
{
|
||||
string json = JsonConvert.SerializeObject(data, Formatting.Indented);
|
||||
}
|
||||
public abstract string CurDataKey { get; set; }
|
||||
public abstract string[] GetDataKeyOptions();
|
||||
public abstract void Load();
|
||||
public abstract void Save();
|
||||
}
|
||||
|
||||
public static void Load(this IData data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
public interface IHasData
|
||||
{
|
||||
void Save(string dataKey);
|
||||
void Load(string dataKey);
|
||||
}
|
||||
|
||||
#region IOC容器
|
||||
|
||||
@@ -48,8 +51,6 @@ namespace AibisDream.Framework
|
||||
public void Register<T>(T instance)
|
||||
{
|
||||
var key = typeof(T);
|
||||
Debug.Log(key.Name);
|
||||
|
||||
_instances[key] = instance;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9759eab92c6f415cbecbb0bba88d30f8
|
||||
timeCreated: 1732915904
|
||||
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.Framework
|
||||
{
|
||||
public static class ResourceKit
|
||||
{
|
||||
public static string SavePsdSprite(Sprite sprite)
|
||||
{
|
||||
if (!sprite) return "";
|
||||
|
||||
// 先读Psd的路径
|
||||
string psdPath = AssetDatabase.GetAssetPath(sprite);
|
||||
var psdResPath = GetResourcePath(psdPath);
|
||||
// 去后缀
|
||||
// 找到最后一个点的位置
|
||||
int lastDotIndex = psdResPath.LastIndexOf('.');
|
||||
// 如果没有点,说明没有扩展名
|
||||
if (lastDotIndex == -1)
|
||||
{
|
||||
return psdResPath;
|
||||
}
|
||||
|
||||
// 提取文件名(不包括扩展名)
|
||||
var purePath = psdResPath.Substring(0, lastDotIndex);
|
||||
|
||||
// 添加后缀
|
||||
return purePath + "/" + sprite.name;
|
||||
}
|
||||
|
||||
private static string GetResourcePath(string absolutePath)
|
||||
{
|
||||
const string resourcesFolderName = "Resources/";
|
||||
int index = absolutePath.IndexOf(resourcesFolderName, StringComparison.Ordinal);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
// 获取 "Resources/" 之后的部分
|
||||
return absolutePath.Substring(index + resourcesFolderName.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
return absolutePath;
|
||||
}
|
||||
}
|
||||
|
||||
public static Sprite LoadSpriteFromPsd(string path)
|
||||
{
|
||||
int lastIndex = path.LastIndexOf('/');
|
||||
string spriteName = path.Substring(lastIndex + 1);
|
||||
string resPath = path.Substring(0, lastIndex);
|
||||
|
||||
// 加载
|
||||
var sprites = Resources.LoadAll<Sprite>(resPath);
|
||||
|
||||
foreach (var sprite in sprites)
|
||||
{
|
||||
if (sprite.name == spriteName)
|
||||
{
|
||||
return sprite;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d84ca862eec4bbbbc0216f76b5e715a
|
||||
timeCreated: 1732915915
|
||||
@@ -7,25 +7,25 @@ namespace AibisDream
|
||||
{
|
||||
private GameObject _self;
|
||||
private bool _isHold;
|
||||
private bool _isButtonActive;
|
||||
|
||||
public bool isButtonActive;
|
||||
|
||||
public event Action OnButtonDown;
|
||||
public event Action OnButtonUp;
|
||||
public event Action OnButtonHold;
|
||||
|
||||
public SpriteButton(GameObject gameObject)
|
||||
public SpriteButton(GameObject gameObject, bool initActive = true)
|
||||
{
|
||||
_self = gameObject;
|
||||
_isButtonActive = true;
|
||||
isButtonActive = initActive;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查按钮
|
||||
/// </summary>
|
||||
/// <param name="self"></param>
|
||||
public void CheckButtonClick()
|
||||
{
|
||||
if (!_isButtonActive)
|
||||
if (!isButtonActive)
|
||||
{
|
||||
_isHold = false;
|
||||
return;
|
||||
@@ -56,5 +56,10 @@ namespace AibisDream
|
||||
_isHold = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetActive(bool isActive)
|
||||
{
|
||||
isButtonActive = isActive;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using Framework.Core;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
@@ -10,15 +9,13 @@ namespace AibisDream
|
||||
{
|
||||
#region 索引
|
||||
|
||||
[SerializeField] private GameObject _gearPrefab;
|
||||
[SerializeField] private GameObject gearPrefab;
|
||||
private Shaft[] _shafts;
|
||||
|
||||
#endregion
|
||||
|
||||
private ShaftGraph _shaftGraph;
|
||||
private GearSysTemLevelData _levelData;
|
||||
|
||||
public RunType runType;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -43,16 +40,11 @@ namespace AibisDream
|
||||
this.FindComponents();
|
||||
_shafts = GetComponentsInChildren<Shaft>();
|
||||
|
||||
_gearPrefab = Resources.Load<GameObject>("Prefabs/Gear System/Gear");
|
||||
gearPrefab = Resources.Load<GameObject>("Prefabs/Gear System/Gear");
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
if (runType == RunType.Editor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
_shaftGraph = new ShaftGraph(_shafts);
|
||||
}
|
||||
|
||||
@@ -100,7 +92,7 @@ namespace AibisDream
|
||||
/// <returns>齿轮Obj</returns>
|
||||
public GameObject InitGear(Vector3 pos, float radius, Sprite sprite, float speed)
|
||||
{
|
||||
GameObject gearObj = Instantiate(_gearPrefab, pos, Quaternion.identity);
|
||||
GameObject gearObj = Instantiate(gearPrefab, pos, Quaternion.identity);
|
||||
gearObj.transform.parent = transform.GetChild(0).transform;
|
||||
Gear gear = gearObj.GetComponent<Gear>();
|
||||
gear.radius = radius;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
using AibisDream.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
@@ -105,6 +105,28 @@ namespace AibisDream.Utility
|
||||
File.WriteAllText(path, tempJson);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自动把文件名转为Json
|
||||
/// </summary>
|
||||
/// <param name="fileName">文件名</param>
|
||||
/// <returns>已改为json的文件名</returns>
|
||||
public static string FormatAsJsonPath(string fileName)
|
||||
{
|
||||
// 找到最后一个点的位置
|
||||
int lastDotIndex = fileName.LastIndexOf('.');
|
||||
|
||||
// 如果没有点,说明没有扩展名
|
||||
if (lastDotIndex == -1)
|
||||
{
|
||||
return fileName + JsonSuffix;
|
||||
}
|
||||
|
||||
// 提取文件名(不包括扩展名)
|
||||
string fileNameWithoutExtension = fileName.Substring(0, lastDotIndex);
|
||||
// 返回新的文件名,使用 .json 作为扩展名
|
||||
return fileNameWithoutExtension + JsonSuffix;
|
||||
}
|
||||
}
|
||||
|
||||
public enum SaveMode
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fab37192145c6247b5772d06d3a2069
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2931a43d35660b848b0f74f2bf964f2e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1 @@
|
||||
{"moduleDataArray":[{"moduleName":"Lung","modulePicPath":"","modulePos":{"x":0.91,"y":1.84,"z":0.0},"socketPos":{"x":0.005,"y":-0.011,"z":0.0},"waveformType":1,"waveHasError":true},{"moduleName":"Heart","modulePicPath":"","modulePos":{"x":-3.89,"y":1.44,"z":0.0},"socketPos":{"x":0.005,"y":-0.011,"z":0.0},"waveformType":0,"waveHasError":false},{"moduleName":"GearBox","modulePicPath":"","modulePos":{"x":-3.11,"y":0.08,"z":0.0},"socketPos":{"x":0.005,"y":-0.011,"z":0.0},"waveformType":0,"waveHasError":false},{"moduleName":"Liver","modulePicPath":"","modulePos":{"x":1.02,"y":-3.3,"z":0.0},"socketPos":{"x":0.005,"y":-0.011,"z":0.0},"waveformType":0,"waveHasError":false},{"moduleName":"Stomach","modulePicPath":"","modulePos":{"x":-3.77,"y":-3.81,"z":0.0},"socketPos":{"x":0.005,"y":-0.011,"z":0.0},"waveformType":0,"waveHasError":false}]}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af23137040825664ea7af48a6fce0507
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user