提交line和messagebox的示例,并修复optionbug

This commit is contained in:
2024-08-28 21:24:50 +08:00
parent 9f9bb10081
commit 33bd173ae1
13 changed files with 155 additions and 50 deletions
@@ -20450,6 +20450,6 @@ SceneRoots:
- {fileID: 1141076862}
- {fileID: 1278583898}
- {fileID: 1182811777}
- {fileID: 863689910}
- {fileID: 223296691}
- {fileID: 863689910}
- {fileID: 1761949062}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0fc37b2ff0b6f16429dfa0e3914ac9fc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,12 @@
{
"projectFileVersion": 2,
"sourceFiles": [
"*.yarn"
],
"excludeFiles": [
"**/*~/*"
],
"localisation": {},
"baseLanguage": "zh-CHS",
"compilerOptions": {}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: e330debc3f1940f48a26e56843c74def
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 053561912b1654d80a424bb0696a74ae, type: 3}
useAddressableAssets: 0
UseUnityLocalisationSystem: 0
unityLocalisationStringTableCollection: {instanceID: 0}
@@ -0,0 +1,16 @@
title: Start
tags:
---
<<indoor>>
<<load_scene 佩佩视觉模块>>
<<set_scissors_mode LineManager true>>
<<set_line_cuttable LineManager MemoryEye true>>
[command name=activate_socket_choice /]
[options /]
-> MemoryEyeScissor
我:剪断哦了
<<set_scissors_mode LineManager false>>
-> MemoryUFScissor
我:这个剪不断噢
===
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2dd37687f6dec2e499e7cd50b3c8bda4
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 94073015eacc34c1d8fc6786e43d60ca, type: 3}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ca6cfd3dc1f658c4f81b4fc556445d52
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,12 @@
{
"projectFileVersion": 2,
"sourceFiles": [
"*.yarn"
],
"excludeFiles": [
"**/*~/*"
],
"localisation": {},
"baseLanguage": "zh-CHS",
"compilerOptions": {}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 9eca6f1b5a4584647beffd48f104950b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 053561912b1654d80a424bb0696a74ae, type: 3}
useAddressableAssets: 0
UseUnityLocalisationSystem: 0
unityLocalisationStringTableCollection: {instanceID: 0}
@@ -0,0 +1,26 @@
title: Start
tags:
---
<<indoor>>
<<load_scene 佩佩视觉模块>>
<<jump Test2>>
===
title: Test
position: 537,-1196
---
[command name=activate_socket_choice /]
[options /]
-> UFView
<<messagebox MessageBox "warning" "UFModule has error">>
我::插入UFview
<<jump Test2>>
-> EyeView
<<messagebox MessageBox "warning" "EyeModule has error">>
我::插入Eyeview
<<jump Test2>>
-> MemoryView
<<messagebox MessageBox "normal" "MemoryModule is normal">>
我::插入Memoryview
<<jump Test2>>
===
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7b342c35155a3ee45b13bcb985ceb0ff
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 94073015eacc34c1d8fc6786e43d60ca, type: 3}
@@ -20,51 +20,13 @@ position: 63,-958
// <<switch_tv 销售冠军>>
// 电视: 新闻3内容
// 我: 销售大赛…给机器人销售罐头?为什么呢……
<<declare $EyeMemory = false>>
///表示UF模块在当前维修阶段是否已经进入过了
<<declare $EyeUF = false>>
<<indoor>>
//<<load_scene 佩佩视觉模块>>
<<jump Test>>
<<jump OutDoorTalk>>
===
title: Test
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: Test2
position: 537,-1196
---
// [command name=activate_socket_choice /]
// [options /]
// -> UFView
// <<messagebox MessageBox "warning" "UFModule has error">>
// 我::插入UFview
// <<jump Test2>>
// -> EyeView
// <<messagebox MessageBox "warning" "EyeModule has error">>
// 我::插入Eyeview
// <<jump Test2>>
// -> MemoryView
// <<messagebox MessageBox "normal" "MemoryModule is normal">>
// 我::插入Memoryview
// <<jump Test2>>
===
title: OutDoorTalk
position: 72,-688
+25 -10
View File
@@ -65,6 +65,7 @@ public void CutLine(InteractiveLineSegment originalLineSegment, Vector3 splitPoi
GameObject secondLineSegmentObject = Instantiate(physicLineSegmentPrefab, transform);
PhysicLineSegment secondLineSegment = secondLineSegmentObject.GetComponent<PhysicLineSegment>();
secondLineSegment.Initialize(originalLineSegment.EndTransform.position,splitPoint);
originalLineSegment.Option.SelectOption();
// Immediately destroy the original line segment
Destroy(originalLineSegment.gameObject);
@@ -81,12 +82,20 @@ private void AddPhysicsComponents(GameObject lineSegmentObject)
HingeJoint2D hinge = lineSegmentObject.AddComponent<HingeJoint2D>();
hinge.anchor = Vector2.zero; // Set the anchor at one end of the line segment
}
public void BindOptionToLineSegment(string lineSegmentName, YarnOption option)
public void BindOptionToLineSegment(string lineSegmentName, YarnOption option)
{
InteractiveLineSegment lineSegment = GetLineSegmentByName(lineSegmentName);
if (lineSegment != null)
{
lineSegment.Option = option;
if (option != null)
{
lineSegment.Option = option;
Debug.Log("Binded option to " + lineSegmentName);
}
else
{
Debug.LogError("Option is null for " + lineSegmentName);
}
}
}
private void EnterLineSegment(InteractiveLineSegment lineSegment)
@@ -100,6 +109,11 @@ private void EnterLineSegment(InteractiveLineSegment lineSegment)
}
private void LongPressLineSegment(InteractiveLineSegment lineSegment)
{
if(!lineSegment.IsCuttable)
{
lineSegment.Option.SelectOption();
return;
}
longPressTime += Time.deltaTime;
Vector3 midpoint = (lineSegment.StartPoint + lineSegment.EndPoint) / 2;
@@ -182,16 +196,17 @@ private void ExitLineSegment()
private void Start()
private void Start()
{
// 查找场景中的所有 InteractiveLineSegment 并添加到字典中
InteractiveLineSegment[] lineSegments = FindObjectsOfType<InteractiveLineSegment>();
foreach (InteractiveLineSegment lineSegment in lineSegments)
{
// 查找场景中的所有 InteractiveLineSegment 并添加到字典中
InteractiveLineSegment[] lineSegments = FindObjectsOfType<InteractiveLineSegment>();
foreach (InteractiveLineSegment lineSegment in lineSegments)
{
lineSegmentDictionary.Add(lineSegment.name, lineSegment);
}
lineSegmentDictionary.Add(lineSegment.name, lineSegment);
Debug.Log("Added " + lineSegment.name + " to lineSegmentDictionary");
}
}
public InteractiveLineSegment GetLineSegmentByName(string lineSegmentName)
{
if (lineSegmentDictionary.TryGetValue(lineSegmentName, out InteractiveLineSegment lineSegment))