带插线和剪线的完整跑通版本

This commit is contained in:
2024-08-24 00:38:49 +08:00
parent 7c1d325db6
commit 4f4f0401b0
12 changed files with 723 additions and 79 deletions
+101
View File
@@ -0,0 +1,101 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2485500826200128654
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4991240399770923164}
- component: {fileID: 4101671748916885094}
- component: {fileID: 4414950781642350908}
m_Layer: 0
m_Name: Scissor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4991240399770923164
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2485500826200128654}
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: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &4101671748916885094
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2485500826200128654}
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: 0
m_Sprite: {fileID: 21300000, guid: a381c88104077474e99fc58857a227bc, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 25, y: 25}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &4414950781642350908
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2485500826200128654}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4fd53c3c93f6e48428e57a5b0d7c8a66, type: 3}
m_Name:
m_EditorClassIdentifier:
cursorTexture: {fileID: 2800000, guid: a381c88104077474e99fc58857a227bc, type: 3}
rotationCorrection: {x: 0, y: 0, z: 0}
@@ -1,7 +1,6 @@
fileFormatVersion: 2
guid: 66396da4416c4704b8de9d1e3073c484
folderAsset: yes
DefaultImporter:
guid: 1afc7e4d2be0126438b5fe65aaccc901
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
@@ -21,6 +21,8 @@ public class EyeTransitionManager : MonoBehaviour
// MemoryProcess 组件的引用
public MemoryProcess memoryProcess;
public LineManager lineManager; // LineManager的引用
// 视图配置类
[System.Serializable]
public class ViewConfig
@@ -29,6 +31,7 @@ public class EyeTransitionManager : MonoBehaviour
public Button activateButton; // 视图的激活按钮(MainView除外)
public Button returnToMainViewButton; // 视图的返回MainView按钮
public Socket socket;
public InteractiveLineSegment lineSegment; // 线段
public ViewState viewState;
private bool _isAvailable = false; // 视图是否可用的私有字段
@@ -188,6 +191,18 @@ public class EyeTransitionManager : MonoBehaviour
optionDic[viewConfig.viewState+ "Activate"].SelectOption();
});
}
foreach (var lineSegmentName in lineManager.GetLineSegmentNames())
{
var recognizedName = lineManager.GetLineSegmentName(lineSegmentName);
if (recognizedName != null && optionDic.ContainsKey(recognizedName + "Scissor"))
{
// 为线段的option赋值
lineManager.BindOptionToLineSegment(lineSegmentName, optionDic[recognizedName + "Scissor"]);
}
}
}
}
@@ -256,6 +271,8 @@ public void SetViewAvailability(string viewStateName, bool isAvailable)
SaveState();
}
// Yarn 命令,设置线段的可剪断性
// 开始视图过渡
@@ -2502,6 +2502,203 @@ RectTransform:
m_AnchoredPosition: {x: -5, y: 0}
m_SizeDelta: {x: -20, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &223296687
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 223296691}
- component: {fileID: 223296690}
- component: {fileID: 223296689}
- component: {fileID: 223296688}
m_Layer: 0
m_Name: MemoryUF
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &223296688
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 223296687}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 067e5e9e7bcd7a2429feff639d0ef630, type: 3}
m_Name:
m_EditorClassIdentifier:
startTransform: {fileID: 19183080}
endTransform: {fileID: 590852442}
--- !u!61 &223296689
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 223296687}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 6.61, y: -0.60116494}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!120 &223296690
LineRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 223296687}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 51099a9679b002c46b76c25f9ac139e3, 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: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 959782197
m_SortingLayer: 5
m_SortingOrder: 0
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 1
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.02299881
value: 0.20912552
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 6
numCapVertices: 6
alignment: 0
textureMode: 0
textureScale: {x: 1, y: 1}
shadowBias: 0.5
generateLightingData: 0
m_MaskInteraction: 0
m_UseWorldSpace: 1
m_Loop: 0
m_ApplyActiveColorSpace: 1
--- !u!4 &223296691
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 223296687}
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: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!21 &241218475
Material:
serializedVersion: 8
@@ -7654,12 +7851,12 @@ GameObject:
- component: {fileID: 863689911}
- component: {fileID: 863689912}
m_Layer: 0
m_Name: MemoryToEyeLine
m_Name: MemoryEye
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!120 &863689908
LineRenderer:
serializedVersion: 2
@@ -9020,24 +9217,25 @@ MonoBehaviour:
zoomDuration: 1
blackScreenImage: {fileID: 783911289}
memoryProcess: {fileID: 1617403347}
lineManager: {fileID: 1182811776}
viewConfigs:
- viewPanel: {fileID: 1229487019}
activateButton: {fileID: 1887941707}
returnToMainViewButton: {fileID: 1700390218}
isAvailable: 1
socket: {fileID: 2031366194}
lineSegment: {fileID: 863689912}
viewState: 1
- viewPanel: {fileID: 1294333830}
activateButton: {fileID: 19183081}
returnToMainViewButton: {fileID: 2126911511}
isAvailable: 1
socket: {fileID: 7986262}
lineSegment: {fileID: 223296688}
viewState: 2
- viewPanel: {fileID: 1882925196}
activateButton: {fileID: 590852443}
returnToMainViewButton: {fileID: 254003903}
isAvailable: 1
socket: {fileID: 1451543708}
lineSegment: {fileID: 0}
viewState: 3
--- !u!4 &1102365682
Transform:
@@ -9740,7 +9938,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &1182811776
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -9754,6 +9952,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
visualLineSegmentPrefab: {fileID: 3614166255594274803, guid: 094e209d31320554891f54b63c125b31, type: 3}
customCursor: {fileID: 1761949063}
--- !u!4 &1182811777
Transform:
m_ObjectHideFlags: 0
@@ -10867,6 +11066,10 @@ PrefabInstance:
propertyPath: m_SortingLayerID
value: 1607245853
objectReference: {fileID: 0}
- target: {fileID: -3288671892723703735, guid: d8489dc41f8c4c9479ba48d5bf39e02e, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: -2586898055405681282, guid: d8489dc41f8c4c9479ba48d5bf39e02e, type: 3}
propertyPath: m_IsActive
value: 0
@@ -15971,6 +16174,106 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1758221730}
m_CullTransparentMesh: 1
--- !u!1001 &1761949062
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2485500826200128654, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_Name
value: Scissor
objectReference: {fileID: 0}
- target: {fileID: 2485500826200128654, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4101671748916885094, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_SortingLayer
value: 5
objectReference: {fileID: 0}
- target: {fileID: 4101671748916885094, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_SortingOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 4101671748916885094, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_SortingLayerID
value: 959782197
objectReference: {fileID: 0}
- target: {fileID: 4414950781642350908, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: rotationCorrection.z
value: -180
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalScale.x
value: 0.093240894
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalScale.y
value: 0.093240894
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalScale.z
value: 0.093240894
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalPosition.x
value: -4.59
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalPosition.y
value: -2.93
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4991240399770923164, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
--- !u!114 &1761949063 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 4414950781642350908, guid: 1afc7e4d2be0126438b5fe65aaccc901, type: 3}
m_PrefabInstance: {fileID: 1761949062}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4fd53c3c93f6e48428e57a5b0d7c8a66, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1769484987
GameObject:
m_ObjectHideFlags: 0
@@ -19719,3 +20022,5 @@ SceneRoots:
- {fileID: 1278583898}
- {fileID: 1182811777}
- {fileID: 863689910}
- {fileID: 223296691}
- {fileID: 1761949062}

Before

Width:  |  Height:  |  Size: 542 KiB

After

Width:  |  Height:  |  Size: 542 KiB

@@ -4,9 +4,8 @@
// ---
title: Start
tags:
position: 58,-1202
position: 58,-1212
---
//<<indoor>>
//<<CharacterInit>>
<<jump TV>>
@@ -14,16 +13,37 @@ position: 58,-1202
title: TV
position: 63,-958
---
// <<switch_tv 黑屏>>
// 电视: 新闻1内容
// <<switch_tv 新闻>>
// 电视: 新闻2内容
// <<switch_tv 销售冠军>>
// 电视: 新闻3内容
// 我: 销售大赛…给机器人销售罐头?为什么呢……
<<switch_tv 黑屏>>
电视: 新闻1内容
<<switch_tv 新闻>>
电视: 新闻2内容
<<switch_tv 销售冠军>>
电视: 新闻3内容
我: 销售大赛…给机器人销售罐头?为什么呢……
<<declare $EyeMemory = false>>
///表示UF模块在当前维修阶段是否已经进入过了
<<declare $EyeUF = false>>
//<<jump LineTest>>
<<jump OutDoorTalk>>
===
title: LineTest
position: 537,-1196
---
<<indoor>>
<<load_scene 佩佩视觉模块>>
<<set_scissors_mode LineManager true>>
<<set_line_cuttable LineManager MemoryEye true>>
[command name=activate_socket_choice /]
[options /]
-> MemoryEyeScissor<<if $EyeMemory==false >>
我::剪断哦了
<<set $EyeMemory=true >>
<<jump LineTest>>
-> MemoryUFScissor
我::这个剪不断噢
<<jump LineTest>>
===
title: OutDoorTalk
position: 72,-688
@@ -105,10 +125,12 @@ position: 71,-262
<<jump Choice>>
===
title: Choice
position: 77,22
position: 78,21
---
<<start_transition ViewManager "MainView">>
<<if $surgery==true>>
<<set_scissors_mode LineManager true>>
<<set_line_cuttable LineManager MemoryEye true>>
<<jump Surgery>>
<<elseif $treatment==true>>
->开启视觉检查权限
@@ -392,7 +414,7 @@ position: -266,367
===
title: Treatment
position: 136,479
position: 153,473
---
<<set_EyeState EyeManager "CannotImagineColor">>
<<start_transition ViewManager "EyeView">>
@@ -457,19 +479,34 @@ title: Surgery
position: 85,821
---
/////头部视角-视觉-记忆桥截断术
//<<start_transition ViewManager "MainView">>
->执行视觉-记忆桥阻断术
佩佩: 啊…眼睛……我的……
佩佩: 好痛!
我: 怎么了?怪了,这不应该引起任何痛觉的
佩佩: ……
佩佩: 呼…
佩佩: 好像……好多了。
我: 进视觉和UF模块检查一下吧。
<<set $EyeVisited to false>>
<<set $UFVisited to false>>
<<jump review>>
[options /]
-> MemoryEyeScissor
<<set_scissors_mode LineManager false>>
佩佩: 啊…眼睛……我的…
佩佩: 好痛!
我: 怎么了?怪了,这不应该引起任何痛觉的
佩佩: ……
佩佩: 呼……
佩佩: 好像……好多了。
我: 进视觉和UF模块检查一下吧。
<<set $EyeVisited to false>>
<<set $UFVisited to false>>
<<jump review>>
-> MemoryUFScissor
我: 我们要剪的不是这个吧
<<jump Surgery>>
// ->执行视觉-记忆桥阻断术
// 佩佩: 啊…眼睛……我的……
// 佩佩: 好痛!
// 我: 怎么了?怪了,这不应该引起任何痛觉的…
// 佩佩: ……
// 佩佩: 呼……
// 佩佩: 好像……好多了。
// 我: 进视觉和UF模块检查一下吧。
// <<set $EyeVisited to false>>
// <<set $UFVisited to false>>
// <<jump review>>
===
title: review
@@ -483,13 +520,13 @@ position: 85,1052
<<elseif $UFVisited&&$EyeVisited>>
我: 好,都没问题了。
<<endif>>
->复查视觉系统<<if $EyeVisited==false>>
->开启视觉检查权限<<if $EyeVisited==false>>
<<set_view_availability ViewManager "EyeView" true>>
[options /]
-> EyeViewActivate
<<jump EyeViewFollowUp>>
<<jump EyeViewFollowUp>>
->复查UF模块<<if $UFVisited==false>>
->进行绘图测试<<if $UFVisited==false>>
<<jump UFViewFollowUp>>
->结束治疗<<if $EyeVisited&&$UFVisited>>
<<jump EndTreatment>>
@@ -522,7 +559,7 @@ position: -171,1128
<<start_transition ViewManager "MainView">>
///<<任务提示更新:进行UF绘图测试>>
我: 我们用UF画一张图吧
我: 佩佩,我们用UF画一张图吧
<<show_photo UFManager "normal">>
我: 总算是好了。你恢复正确的绘制能力了
<<set $UFVisited to true>>
@@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CustomCursor : MonoBehaviour
{
public Texture2D cursorTexture;
public Vector3 rotationCorrection; // 旋转修正,你可以在 Inspector 中设置
private void Start()
{
// 设置旋转修正
transform.rotation = Quaternion.Euler(rotationCorrection);
}
private void Update()
{
// 设置自定义光标的位置为鼠标的位置
Vector2 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
transform.position = cursorPos;
}
private void OnEnable()
{
// 当启用自定义光标时,隐藏默认的鼠标光标
Cursor.visible = false;
}
private void OnDisable()
{
// 当禁用自定义光标时,显示默认的鼠标光标
Cursor.visible = true;
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7e3a15ec4d5079e45b4a663a654825ca
guid: 4fd53c3c93f6e48428e57a5b0d7c8a66
MonoImporter:
externalObjects: {}
serializedVersion: 2
@@ -1,5 +1,6 @@
using Unity.VisualScripting;
using UnityEngine;
using AibisDream;
public class InteractiveLineSegment : VisualLineSegment
{
@@ -21,6 +22,26 @@ public class InteractiveLineSegment : VisualLineSegment
private BoxCollider2D boxCollider;
private YarnOption _option;
public YarnOption Option
{
get => _option;
set => _option = value;
}
public bool IsCuttable
{
get { return _isCuttable; }
set
{
_isCuttable = value;
// Change the color of the line segment based on its cuttability
GetComponent<LineRenderer>().material.color = value ? Color.white : Color.black;
}
}
private bool _isCuttable=false;
protected override void Awake()
{
base.Awake();
@@ -31,6 +52,7 @@ public class InteractiveLineSegment : VisualLineSegment
Initialize();
}
public void Initialize()
@@ -40,6 +62,7 @@ public class InteractiveLineSegment : VisualLineSegment
Debug.LogError("StartTransform or EndTransform is not set.");
return;
}
IsCuttable=false;
base.Initialize(StartTransform.position, EndTransform.position);
+169 -25
View File
@@ -1,13 +1,169 @@
using UnityEngine;
using Yarn.Unity;
using System;
using System.Collections.Generic;
using System.Collections;
using AibisDream;
using System.Linq;
public class LineManager : MonoBehaviour
{
//public GameObject interactiveLineSegmentPrefab;
public GameObject visualLineSegmentPrefab;
public CustomCursor customCursor; // 自定义光标,你可以在 Inspector 中设置
private bool isScissorsMode;
public bool IsScissorsMode
{
get
{
return isScissorsMode;
}
set
{
isScissorsMode = value;
if (isScissorsMode)
{
SetScissorsCursor();
}
else
{
ResetCursor();
}
}
}
private Dictionary<string, InteractiveLineSegment> lineSegmentDictionary = new Dictionary<string, InteractiveLineSegment>();
public IEnumerable<string> GetLineSegmentNames()
{
return lineSegmentDictionary.Keys;
}
private void SetScissorsCursor()
{
// 启用自定义光标
customCursor.gameObject.SetActive(true);
}
private void ResetCursor()
{
// 禁用自定义光标
customCursor.gameObject.SetActive(false);
}
private void Start()
{
// 查找场景中的所有 InteractiveLineSegment 并添加到字典中
InteractiveLineSegment[] lineSegments = FindObjectsOfType<InteractiveLineSegment>();
foreach (InteractiveLineSegment lineSegment in lineSegments)
{
lineSegmentDictionary.Add(lineSegment.name, lineSegment);
}
}
public InteractiveLineSegment GetLineSegmentByName(string lineSegmentName)
{
if (lineSegmentDictionary.TryGetValue(lineSegmentName, out InteractiveLineSegment lineSegment))
{
return lineSegment;
}
else
{
Debug.LogError("Invalid line segment name: " + lineSegmentName);
return null;
}
}
public string GetLineSegmentName(string input)
{
// 转换为小写并移除所有的下划线
string[] inputWords = input.ToLower().Split('_');
foreach (var lineSegmentName in lineSegmentDictionary.Keys)
{
// 转换为小写并移除所有的下划线
string[] lineSegmentWords = lineSegmentName.ToLower().Split('_');
// 检查是否包含相同的单词
if (inputWords.All(word => lineSegmentWords.Contains(word)) && lineSegmentWords.All(word => inputWords.Contains(word)))
{
return lineSegmentName;
}
}
return null;
}
// Yarn 命令,设置线段的可剪断性
[YarnCommand("set_line_cuttable")]
public void SetLineCuttable(string lineSegmentName, bool isCuttable)
{
string recognizedName = GetLineSegmentName(lineSegmentName);
if (recognizedName != null)
{
InteractiveLineSegment lineSegment = GetLineSegmentByName(recognizedName);
if (lineSegment != null)
{
lineSegment.IsCuttable = isCuttable;
}
}
else
{
Debug.LogError("Invalid line segment name: " + lineSegmentName);
}
}
// Yarn 命令,设置剪刀模式
[YarnCommand("set_scissors_mode")]
public void SetScissorsMode(bool isEnabled)
{
IsScissorsMode = isEnabled;
}
public void CutLine(InteractiveLineSegment originalLineSegment, Vector3 splitPoint)
{
// 如果线段不可剪断,就直接返回,不进行剪断操作
if (!originalLineSegment.IsCuttable)
{
return;
}
// Create the first new line segment
GameObject firstLineSegmentObject = Instantiate(visualLineSegmentPrefab, transform);
VisualLineSegment firstLineSegment = firstLineSegmentObject.GetComponent<VisualLineSegment>();
firstLineSegment.Initialize(originalLineSegment.StartPoint, splitPoint);
// Create the second new line segment
GameObject secondLineSegmentObject = Instantiate(visualLineSegmentPrefab, transform);
VisualLineSegment secondLineSegment = secondLineSegmentObject.GetComponent<VisualLineSegment>();
secondLineSegment.Initialize(originalLineSegment.EndPoint, splitPoint);
// Immediately destroy the original line segment
Destroy(originalLineSegment.gameObject);
// Shrink and disappear the new line segments
firstLineSegment.ShrinkAndDisappear();
secondLineSegment.ShrinkAndDisappear();
}
public void BindOptionToLineSegment(string lineSegmentName, YarnOption option)
{
InteractiveLineSegment lineSegment = GetLineSegmentByName(lineSegmentName);
if (lineSegment != null)
{
lineSegment.Option = option;
}
}
private void Update()
{
if (Input.GetMouseButtonDown(0))
if (Input.GetMouseButtonDown(0) && isScissorsMode)
{
// Convert the mouse position to a 2D ray
Vector2 ray = Camera.main.ScreenToWorldPoint(Input.mousePosition);
@@ -23,35 +179,23 @@ public class LineManager : MonoBehaviour
{
Debug.Log("Line segment hit: " + originalLineSegment.name);
// Calculate the split point
Vector3 splitPoint = hit.point;
// Create the first new line segment
GameObject firstLineSegmentObject = Instantiate(visualLineSegmentPrefab, transform);
VisualLineSegment firstLineSegment = firstLineSegmentObject.GetComponent<VisualLineSegment>();
firstLineSegment.Initialize(originalLineSegment.StartPoint, splitPoint);
// Create the second new line segment
GameObject secondLineSegmentObject = Instantiate(visualLineSegmentPrefab, transform);
VisualLineSegment secondLineSegment = secondLineSegmentObject.GetComponent<VisualLineSegment>();
secondLineSegment.Initialize(originalLineSegment.EndPoint,splitPoint);
// Immediately destroy the original line segment
Destroy(originalLineSegment.gameObject);
// Shrink and disappear the new line segments
firstLineSegment.ShrinkAndDisappear();
secondLineSegment.ShrinkAndDisappear();
CutLine(originalLineSegment,hit.point);
// Check if Option is not null before selecting it
if (originalLineSegment.Option != null)
{
originalLineSegment.Option.SelectOption();
}
}
else
{
Debug.Log("Hit object is not a line segment");
//Debug.Log("Hit object is not a line segment");
}
}
else
{
Debug.Log("No raycast hit");
}
}
}
}
-18
View File
@@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Module : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}