修改摇杆的代码

This commit is contained in:
huyulong 2024-11-19 10:30:41 +08:00
parent ab62d3f646
commit 2866ead9c9
4 changed files with 525 additions and 364 deletions

View File

@ -846,7 +846,8 @@ GameObject:
- component: {fileID: 344253780}
- component: {fileID: 344253783}
- component: {fileID: 344253782}
- component: {fileID: 344253781}
- component: {fileID: 344253784}
- component: {fileID: 344253785}
m_Layer: 5
m_Name: mwRoom
m_TagString: Untagged
@ -875,50 +876,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 211.6828, y: 49.1634}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &344253781
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 344253779}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 344253782}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &344253782
MonoBehaviour:
m_ObjectHideFlags: 0
@ -957,6 +914,68 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 344253779}
m_CullTransparentMesh: 1
--- !u!114 &344253784
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 344253779}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 10fced1e0f8a54b43a7c3fe7277fbc42, type: 3}
m_Name:
m_EditorClassIdentifier:
buttonText: {fileID: 1612514132}
targetColor: {r: 0.9593377, g: 1, b: 0, a: 1}
--- !u!114 &344253785
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 344253779}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
m_SelectedColor: {r: 0.96470594, g: 1, b: 0, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1612514132}
toggleTransition: 1
graphic: {fileID: 0}
m_Group: {fileID: 1314167376}
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_IsOn: 0
--- !u!1 &420373026
GameObject:
m_ObjectHideFlags: 0
@ -1006,7 +1025,8 @@ GameObject:
- component: {fileID: 444962120}
- component: {fileID: 444962123}
- component: {fileID: 444962122}
- component: {fileID: 444962121}
- component: {fileID: 444962124}
- component: {fileID: 444962125}
m_Layer: 5
m_Name: class3_3
m_TagString: Untagged
@ -1035,50 +1055,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 211.6828, y: 49.1634}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &444962121
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 444962119}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 444962122}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &444962122
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1117,6 +1093,68 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 444962119}
m_CullTransparentMesh: 1
--- !u!114 &444962124
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 444962119}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 10fced1e0f8a54b43a7c3fe7277fbc42, type: 3}
m_Name:
m_EditorClassIdentifier:
buttonText: {fileID: 533563531}
targetColor: {r: 0.97647065, g: 0.9803922, b: 0.07450981, a: 1}
--- !u!114 &444962125
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 444962119}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
m_SelectedColor: {r: 0.96470594, g: 1, b: 0, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 533563531}
toggleTransition: 1
graphic: {fileID: 0}
m_Group: {fileID: 1314167376}
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_IsOn: 0
--- !u!1 &533563529
GameObject:
m_ObjectHideFlags: 0
@ -2881,7 +2919,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0.99911976, b: 0.054901958, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@ -3271,7 +3309,8 @@ GameObject:
- component: {fileID: 1182760134}
- component: {fileID: 1182760137}
- component: {fileID: 1182760136}
- component: {fileID: 1182760135}
- component: {fileID: 1182760138}
- component: {fileID: 1182760139}
m_Layer: 5
m_Name: class3_2
m_TagString: Untagged
@ -3301,50 +3340,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 211.6828, y: 49.1634}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1182760135
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1182760133}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1182760136}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &1182760136
MonoBehaviour:
m_ObjectHideFlags: 0
@ -3383,6 +3378,68 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1182760133}
m_CullTransparentMesh: 1
--- !u!114 &1182760138
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1182760133}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 10fced1e0f8a54b43a7c3fe7277fbc42, type: 3}
m_Name:
m_EditorClassIdentifier:
buttonText: {fileID: 1150900467}
targetColor: {r: 0.94117653, g: 0.95294124, b: 0.10588236, a: 1}
--- !u!114 &1182760139
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1182760133}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
m_SelectedColor: {r: 0.96470594, g: 1, b: 0, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1150900467}
toggleTransition: 1
graphic: {fileID: 0}
m_Group: {fileID: 1314167376}
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_IsOn: 0
--- !u!1 &1211225360
GameObject:
m_ObjectHideFlags: 0
@ -3859,6 +3916,7 @@ GameObject:
- component: {fileID: 1314167374}
- component: {fileID: 1314167373}
- component: {fileID: 1314167375}
- component: {fileID: 1314167376}
m_Layer: 5
m_Name: btns
m_TagString: Untagged
@ -3953,6 +4011,19 @@ MonoBehaviour:
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &1314167376
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1314167371}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2fafe2cfe61f6974895a912c3755e8f1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_AllowSwitchOff: 1
--- !u!1 &1322064191
GameObject:
m_ObjectHideFlags: 0
@ -4261,7 +4332,8 @@ GameObject:
- component: {fileID: 1405796538}
- component: {fileID: 1405796541}
- component: {fileID: 1405796540}
- component: {fileID: 1405796539}
- component: {fileID: 1405796542}
- component: {fileID: 1405796543}
m_Layer: 5
m_Name: artRoom
m_TagString: Untagged
@ -4291,50 +4363,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 211.6828, y: 49.1634}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1405796539
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1405796537}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1405796540}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &1405796540
MonoBehaviour:
m_ObjectHideFlags: 0
@ -4373,6 +4401,68 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1405796537}
m_CullTransparentMesh: 1
--- !u!114 &1405796542
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1405796537}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 10fced1e0f8a54b43a7c3fe7277fbc42, type: 3}
m_Name:
m_EditorClassIdentifier:
buttonText: {fileID: 953137149}
targetColor: {r: 0.9550984, g: 1, b: 0, a: 1}
--- !u!114 &1405796543
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1405796537}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
m_SelectedColor: {r: 0.96470594, g: 1, b: 0, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 953137149}
toggleTransition: 1
graphic: {fileID: 0}
m_Group: {fileID: 1314167376}
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_IsOn: 0
--- !u!1 &1447782714
GameObject:
m_ObjectHideFlags: 0
@ -4862,7 +4952,8 @@ GameObject:
- component: {fileID: 1655475311}
- component: {fileID: 1655475314}
- component: {fileID: 1655475313}
- component: {fileID: 1655475312}
- component: {fileID: 1655475315}
- component: {fileID: 1655475316}
m_Layer: 5
m_Name: kitchenBtn
m_TagString: Untagged
@ -4892,50 +4983,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 211.6828, y: 49.1634}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1655475312
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1655475310}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1655475313}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &1655475313
MonoBehaviour:
m_ObjectHideFlags: 0
@ -4950,7 +4997,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
@ -4974,6 +5021,68 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1655475310}
m_CullTransparentMesh: 1
--- !u!114 &1655475315
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1655475310}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 10fced1e0f8a54b43a7c3fe7277fbc42, type: 3}
m_Name:
m_EditorClassIdentifier:
buttonText: {fileID: 1736586789}
targetColor: {r: 0.9607844, g: 0.96470594, b: 0.09019608, a: 1}
--- !u!114 &1655475316
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1655475310}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
m_SelectedColor: {r: 0.96470594, g: 1, b: 0, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1736586789}
toggleTransition: 1
graphic: {fileID: 0}
m_Group: {fileID: 1314167376}
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_IsOn: 0
--- !u!1 &1659683792
GameObject:
m_ObjectHideFlags: 0
@ -6099,7 +6208,7 @@ GameObject:
- component: {fileID: 2032522159}
- component: {fileID: 2032522162}
- component: {fileID: 2032522161}
- component: {fileID: 2032522160}
- component: {fileID: 2032522163}
m_Layer: 5
m_Name: class6_1
m_TagString: Untagged
@ -6128,50 +6237,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 211.6828, y: 49.1634}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2032522160
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2032522158}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 2032522161}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &2032522161
MonoBehaviour:
m_ObjectHideFlags: 0
@ -6210,6 +6275,54 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2032522158}
m_CullTransparentMesh: 1
--- !u!114 &2032522163
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2032522158}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
m_SelectedColor: {r: 0.96470594, g: 1, b: 0, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 898151804}
toggleTransition: 0
graphic: {fileID: 0}
m_Group: {fileID: 1314167376}
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_IsOn: 0
--- !u!1 &2052536003
GameObject:
m_ObjectHideFlags: 0
@ -6221,7 +6334,8 @@ GameObject:
- component: {fileID: 2052536004}
- component: {fileID: 2052536007}
- component: {fileID: 2052536006}
- component: {fileID: 2052536005}
- component: {fileID: 2052536008}
- component: {fileID: 2052536009}
m_Layer: 5
m_Name: office3
m_TagString: Untagged
@ -6251,50 +6365,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 211.6828, y: 49.1634}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2052536005
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2052536003}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 2052536006}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &2052536006
MonoBehaviour:
m_ObjectHideFlags: 0
@ -6333,6 +6403,68 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2052536003}
m_CullTransparentMesh: 1
--- !u!114 &2052536008
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2052536003}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 10fced1e0f8a54b43a7c3fe7277fbc42, type: 3}
m_Name:
m_EditorClassIdentifier:
buttonText: {fileID: 1115666830}
targetColor: {r: 0.86274517, g: 0.882353, b: 0.16862746, a: 1}
--- !u!114 &2052536009
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2052536003}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
m_SelectedColor: {r: 0.96470594, g: 1, b: 0, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1115666830}
toggleTransition: 1
graphic: {fileID: 0}
m_Group: {fileID: 1314167376}
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_IsOn: 0
--- !u!1 &2053696908
GameObject:
m_ObjectHideFlags: 0

View File

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement_Jpystick : MonoBehaviour
public class PlayerMovement_Joystick : MonoBehaviour
{
public FixedJoystick joystick; // 引用 Fixed Joystick
public Transform cameraTransform; // 引用主摄像机的 Transform
@ -14,24 +14,24 @@ public class PlayerMovement_Jpystick : MonoBehaviour
public Camera mainCamera;
private Rigidbody rb;
// 定义相机 FOV 相关变量
public float normalFOV = 60f; // 正常行走时的FOV
public float sprintFOV = 120f; // 奔跑时的FOV
public float fovChangeSpeed = 2f; // FOV改变的速
public float fovChangeSpeed = 2f; // FOV改变的速
// 触摸ID变量用于区分左右区域触摸
private int leftFingerId = -1;
private int rightFingerId = -1;
// 触摸ID变量用于区分左右区域触摸
private int leftFingerId = -1; // 左侧区域触摸ID
private int rightFingerId = -1; // 右侧区域触摸ID
private Vector2 rightTouchStartPos; // 记录右手触摸开始位置
private bool IsMoving = false;
//跑步切换的时间
private float MoveTime = 0f;
//走路的时间
public float walkTime;
//跑的时间
public float runTime;
//跑步时平滑切换fov
private float targetFOV;
private float MoveTime = 0f; // 跑步切换的时间
public float walkTime; // 走路的时间
public float runTime; // 跑的时间
private float targetFOV; // 跑步时平滑切换FOV
private void Start()
{
characterControl = GetComponent<CharacterControl>();
@ -39,52 +39,43 @@ public class PlayerMovement_Jpystick : MonoBehaviour
rb = GetComponent<Rigidbody>();
}
void Update()
{
// 检测屏幕上所有触摸点
foreach (Touch touch in Input.touches)
{
// 触摸开始时分配触摸区域
// 触摸开始时分配触摸区域
if (touch.phase == TouchPhase.Began)
{
if (touch.position.x < Screen.width / 2 && leftFingerId == -1)
{
// 左侧区域绑定左手指ID用于控制虚拟摇杆
leftFingerId = touch.fingerId;
leftFingerId = touch.fingerId; // 左侧区域用于控制虚拟摇杆
}
else if (touch.position.x >= Screen.width / 2 && rightFingerId == -1)
{
// 右侧区域绑定右手指ID用于滑动视角
rightFingerId = touch.fingerId;
rightFingerId = touch.fingerId; // 右侧区域用于滑动视角
rightTouchStartPos = touch.position; // 记录右手触摸起点
}
}
else if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Stationary)
{
if (touch.fingerId == leftFingerId)
{
// 左侧触摸:处理角色移动
HandleJoystickControl();
HandleJoystickControl(); // 左手触摸:处理角色移动
}
else if (touch.fingerId == rightFingerId)
{
// 右侧触摸:滑动视角
HandleViewSwipe(touch);
HandleViewSwipe(touch); // 右手触摸:滑动视角
}
}
else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
{
// 触摸结束时重置ID
if (touch.fingerId == leftFingerId)
{
leftFingerId = -1;
leftFingerId = -1; // 触摸结束时重置左手ID
}
else if (touch.fingerId == rightFingerId)
{
rightFingerId = -1;
rightFingerId = -1; // 触摸结束时重置右手ID
}
}
}
@ -92,29 +83,27 @@ public class PlayerMovement_Jpystick : MonoBehaviour
void HandleJoystickControl()
{
// 1. 获取摇杆输入
// 获取摇杆输入
float horizontal = joystick.Horizontal;
float vertical = joystick.Vertical;
// 2. 转换为三维方向向量 (保持在水平面)
// 转换为三维方向向量 (保持在水平面)
Vector3 inputDirection = new Vector3(horizontal, 0f, vertical);
// 3. 获取移动方向相对于摄像机的世界方向
// 获取移动方向相对于摄像机的世界方向
Vector3 cameraForward = cameraTransform.forward; // 摄像机的前向方向
Vector3 cameraRight = cameraTransform.right; // 摄像机的右方向
Vector3 cameraRight = cameraTransform.right; // 摄像机的右方向
// 由于我们只需要水平的移动方向去掉摄像头的y轴分量
// 只需要水平的移动方向去掉摄像头的y轴分量
cameraForward.y = 0;
cameraRight.y = 0;
cameraForward.Normalize();
cameraRight.Normalize();
// 4. 计算最终的移动方向 (相对于摄像机的前后左右)
// 计算最终的移动方向 (相对于摄像机的前后左右)
Vector3 moveDirection = (cameraRight * horizontal + cameraForward * vertical).normalized;
if (Mathf.Abs(vertical) > 0.01f || Mathf.Abs(horizontal) > 0.01f)
{
if (MoveTime < (walkTime + runTime + 0.1f))
@ -122,30 +111,32 @@ public class PlayerMovement_Jpystick : MonoBehaviour
MoveTime += Time.deltaTime;
}
}
// 5. 应用移动
// 应用移动
if (moveDirection.magnitude > 0.1f)
{
// 使用速度移动角色
Vector3 newPosition = rb.position + moveDirection * moveSpeed * Time.fixedDeltaTime;
rb.MovePosition(newPosition);
MoveState();
// 使角色面朝移动方向
Quaternion toRotation = Quaternion.LookRotation(moveDirection, Vector3.up);
transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, 720 * Time.deltaTime);
}
}
void HandleViewSwipe(Touch touch)
{
// 滑动视角逻辑
float horizontalSwipe = touch.deltaPosition.x * 0.1f; // 可调整灵敏度
float verticalSwipe = -touch.deltaPosition.y * 0.1f;
Vector2 swipeDelta = touch.position - rightTouchStartPos;
float horizontalSwipe = swipeDelta.x * 0.1f; // 可调整灵敏度
float verticalSwipe = -swipeDelta.y * 0.1f;
cameraTransform.Rotate(0, horizontalSwipe, 0, Space.World);
cameraTransform.Rotate(verticalSwipe, 0, 0, Space.Self);
// 更新右手触摸起点
rightTouchStartPos = touch.position;
}
public void MoveState()
@ -169,6 +160,4 @@ public class PlayerMovement_Jpystick : MonoBehaviour
// 使用插值平滑调整相机的FOV
mainCamera.fieldOfView = Mathf.Lerp(mainCamera.fieldOfView, targetFOV, fovChangeSpeed * Time.deltaTime);
}
}

View File

@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ButtonTextColorChange : MonoBehaviour
{
public Text buttonText; // 按钮的文字
public Color targetColor = Color.red; // 点击后的颜色
private Color originalColor;
private void Start()
{
// 保存初始颜色
if (buttonText != null)
{
originalColor = buttonText.color;
}
}
public void ChangeTextColor()
{
// 改变文字颜色
if (buttonText != null)
{
buttonText.color = buttonText.color == originalColor ? targetColor : originalColor;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 10fced1e0f8a54b43a7c3fe7277fbc42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: