疏散人群公布UI逻辑修改
This commit is contained in:
parent
a349a1ee86
commit
aaf0eb1408
@ -115,7 +115,7 @@ MonoBehaviour:
|
|||||||
sceneId: 0
|
sceneId: 0
|
||||||
sceneType: 0
|
sceneType: 0
|
||||||
sceneName: {fileID: 5207661254087907526}
|
sceneName: {fileID: 5207661254087907526}
|
||||||
sceneImage: {fileID: 0}
|
sceneImage: {fileID: 5207661254004645192}
|
||||||
maskImage: {fileID: 0}
|
maskImage: {fileID: 0}
|
||||||
roleLimit:
|
roleLimit:
|
||||||
limitNum: 0
|
limitNum: 0
|
||||||
|
@ -140,6 +140,8 @@ MonoBehaviour:
|
|||||||
sceneText: {fileID: 6013369223126947389}
|
sceneText: {fileID: 6013369223126947389}
|
||||||
personnelImage: {fileID: 6013369224158235502}
|
personnelImage: {fileID: 6013369224158235502}
|
||||||
personnelNum: {fileID: 6013369223785314021}
|
personnelNum: {fileID: 6013369223785314021}
|
||||||
|
sceneId: 0
|
||||||
|
Num: 0
|
||||||
--- !u!1 &6013369223126947387
|
--- !u!1 &6013369223126947387
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -151,8 +153,9 @@ GameObject:
|
|||||||
- component: {fileID: 6013369223126947388}
|
- component: {fileID: 6013369223126947388}
|
||||||
- component: {fileID: 6013369223126947390}
|
- component: {fileID: 6013369223126947390}
|
||||||
- component: {fileID: 6013369223126947389}
|
- component: {fileID: 6013369223126947389}
|
||||||
|
- component: {fileID: 6166932461062257870}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: Text (Legacy)
|
m_Name: sceneText
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
@ -220,6 +223,50 @@ MonoBehaviour:
|
|||||||
m_VerticalOverflow: 0
|
m_VerticalOverflow: 0
|
||||||
m_LineSpacing: 1
|
m_LineSpacing: 1
|
||||||
m_Text: "\u53A8\u623F"
|
m_Text: "\u53A8\u623F"
|
||||||
|
--- !u!114 &6166932461062257870
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6013369223126947387}
|
||||||
|
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: 6013369223126947389}
|
||||||
|
m_OnClick:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
--- !u!1 &6013369223785314019
|
--- !u!1 &6013369223785314019
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -299,7 +346,7 @@ MonoBehaviour:
|
|||||||
m_HorizontalOverflow: 0
|
m_HorizontalOverflow: 0
|
||||||
m_VerticalOverflow: 0
|
m_VerticalOverflow: 0
|
||||||
m_LineSpacing: 1
|
m_LineSpacing: 1
|
||||||
m_Text: 5
|
m_Text:
|
||||||
--- !u!1 &6013369224158235500
|
--- !u!1 &6013369224158235500
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -317,7 +364,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!224 &6013369224158235501
|
--- !u!224 &6013369224158235501
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1866,6 +1866,11 @@ RectTransform:
|
|||||||
m_AnchoredPosition: {x: -700, y: 111}
|
m_AnchoredPosition: {x: -700, y: 111}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!1 &569417021 stripped
|
||||||
|
GameObject:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 4764228632217023203, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 1799705458}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1 &580293850
|
--- !u!1 &580293850
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -2133,7 +2138,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &618256459
|
--- !u!224 &618256459
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -10041,7 +10046,7 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2102021660636739381, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 2102021660636739381, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_SizeDelta.x
|
propertyPath: m_SizeDelta.x
|
||||||
value: -361.72
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2102021660636739381, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 2102021660636739381, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_SizeDelta.y
|
propertyPath: m_SizeDelta.y
|
||||||
@ -10119,10 +10124,18 @@ PrefabInstance:
|
|||||||
propertyPath: panel
|
propertyPath: panel
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 618256462}
|
objectReference: {fileID: 618256462}
|
||||||
|
- target: {fileID: 2102021661377337229, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
|
propertyPath: classCount
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 569417021}
|
||||||
- target: {fileID: 2102021661377337229, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 2102021661377337229, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: jsonReader
|
propertyPath: jsonReader
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 1417128757}
|
objectReference: {fileID: 1417128757}
|
||||||
|
- target: {fileID: 2102021661377337229, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
|
propertyPath: selectScene
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 7468736064579811982}
|
||||||
- target: {fileID: 4764228630647718977, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228630647718977, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: m_AnchorMax.y
|
||||||
value: 0
|
value: 0
|
||||||
@ -10141,19 +10154,19 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: m_AnchorMax.y
|
||||||
value: 1
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchorMin.y
|
propertyPath: m_AnchorMin.y
|
||||||
value: 1
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 190.05
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchoredPosition.y
|
propertyPath: m_AnchoredPosition.y
|
||||||
value: -23.991
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228630805767484, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228630805767484, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
@ -10161,7 +10174,7 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228630805767484, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228630805767484, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_IsActive
|
propertyPath: m_IsActive
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228630805767485, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228630805767485, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_Pivot.x
|
propertyPath: m_Pivot.x
|
||||||
@ -10249,59 +10262,59 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228631245731675, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228631245731675, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_SizeDelta.x
|
propertyPath: m_SizeDelta.x
|
||||||
value: 249.00002
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228631278755135, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228631278755135, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_SizeDelta.x
|
propertyPath: m_SizeDelta.x
|
||||||
value: 629.702
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: m_AnchorMax.y
|
||||||
value: 1
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchorMin.y
|
propertyPath: m_AnchorMin.y
|
||||||
value: 1
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 133.7755
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchoredPosition.y
|
propertyPath: m_AnchoredPosition.y
|
||||||
value: -39.08695
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: m_AnchorMax.y
|
||||||
value: 1
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchorMin.y
|
propertyPath: m_AnchorMin.y
|
||||||
value: 1
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 58.95
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchoredPosition.y
|
propertyPath: m_AnchoredPosition.y
|
||||||
value: -23.991
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: m_AnchorMax.y
|
||||||
value: 1
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchorMin.y
|
propertyPath: m_AnchorMin.y
|
||||||
value: 1
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 495.9265
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_AnchoredPosition.y
|
propertyPath: m_AnchoredPosition.y
|
||||||
value: -39.08695
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 9196293257107006892, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
- target: {fileID: 9196293257107006892, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
|
||||||
propertyPath: m_IsActive
|
propertyPath: m_IsActive
|
||||||
@ -14631,9 +14644,9 @@ RectTransform:
|
|||||||
m_Father: {fileID: 7468736063934366934}
|
m_Father: {fileID: 7468736063934366934}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 334.1322, y: -55}
|
||||||
m_SizeDelta: {x: 187, y: 110}
|
m_SizeDelta: {x: 187, y: 110}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &7468736064122132329
|
--- !u!1 &7468736064122132329
|
||||||
@ -14914,9 +14927,9 @@ RectTransform:
|
|||||||
m_Father: {fileID: 7468736063934366934}
|
m_Father: {fileID: 7468736063934366934}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 3
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 753.3966, y: -55}
|
||||||
m_SizeDelta: {x: 187, y: 110}
|
m_SizeDelta: {x: 187, y: 110}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &7468736064198941274
|
--- !u!1 &7468736064198941274
|
||||||
@ -15674,7 +15687,7 @@ RectTransform:
|
|||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: 3.3229}
|
m_AnchoredPosition: {x: 0, y: 3.3229}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 1834, y: 1070}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &7468736064579811972
|
--- !u!1 &7468736064579811972
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -15696,7 +15709,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!114 &7468736064579811982
|
--- !u!114 &7468736064579811982
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -16154,9 +16167,9 @@ RectTransform:
|
|||||||
m_Father: {fileID: 7468736063934366934}
|
m_Father: {fileID: 7468736063934366934}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 543.7644, y: -55}
|
||||||
m_SizeDelta: {x: 187, y: 110}
|
m_SizeDelta: {x: 187, y: 110}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &7468736064659112359
|
--- !u!1 &7468736064659112359
|
||||||
@ -16360,9 +16373,9 @@ RectTransform:
|
|||||||
m_Father: {fileID: 7468736064579811971}
|
m_Father: {fileID: 7468736064579811971}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 917, y: -53.335}
|
||||||
m_SizeDelta: {x: 1834, y: 106.67}
|
m_SizeDelta: {x: 1834, y: 106.67}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &7468736064728012045
|
--- !u!1 &7468736064728012045
|
||||||
@ -16522,9 +16535,9 @@ RectTransform:
|
|||||||
m_Father: {fileID: 7468736063934366934}
|
m_Father: {fileID: 7468736063934366934}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 124.5, y: -55}
|
||||||
m_SizeDelta: {x: 187, y: 110}
|
m_SizeDelta: {x: 187, y: 110}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &7468736064820222392
|
--- !u!1 &7468736064820222392
|
||||||
@ -16935,9 +16948,9 @@ RectTransform:
|
|||||||
m_Father: {fileID: 7468736064579811971}
|
m_Father: {fileID: 7468736064579811971}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 917, y: -588.33496}
|
||||||
m_SizeDelta: {x: 1834, y: 498.685}
|
m_SizeDelta: {x: 1834, y: 498.685}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &7468736064937661071
|
--- !u!1 &7468736064937661071
|
||||||
|
@ -241,6 +241,17 @@ public class JSONReader : MonoBehaviour
|
|||||||
return null; // 如果没有找到符合条件的语言数据,返回 null
|
return null; // 如果没有找到符合条件的语言数据,返回 null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LocationData GetAreaDateById(int id)
|
||||||
|
{
|
||||||
|
LocationData info = null;
|
||||||
|
if (locationDictionary.TryGetValue(id, out info))
|
||||||
|
{
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public SceneData GetSceneById(int id)
|
public SceneData GetSceneById(int id)
|
||||||
{
|
{
|
||||||
SceneData info = null;
|
SceneData info = null;
|
||||||
|
@ -18,6 +18,7 @@ public class SelectedInfo
|
|||||||
public string duty;//职责
|
public string duty;//职责
|
||||||
public string scene;//场景名
|
public string scene;//场景名
|
||||||
public string leader;//是否组长
|
public string leader;//是否组长
|
||||||
|
public int sceneId;//场景Id
|
||||||
public int dutyId;//职责的Id
|
public int dutyId;//职责的Id
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +164,6 @@ public class Panel : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//动态加载场景
|
//动态加载场景
|
||||||
public void DynamicLoadingScene()
|
public void DynamicLoadingScene()
|
||||||
{
|
{
|
||||||
@ -199,6 +199,7 @@ public class Panel : MonoBehaviour
|
|||||||
Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
||||||
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
||||||
// 设置limitNum
|
// 设置limitNum
|
||||||
|
sceneItem.sceneId = npcData.Key;
|
||||||
sceneItem.dutyId = int.Parse(roleLimits[1]);
|
sceneItem.dutyId = int.Parse(roleLimits[1]);
|
||||||
sceneItem.limitNum = int.Parse(roleLimits[2]);
|
sceneItem.limitNum = int.Parse(roleLimits[2]);
|
||||||
sceneItem.sceneName.text = npcData.Value.Note;
|
sceneItem.sceneName.text = npcData.Value.Note;
|
||||||
@ -275,8 +276,21 @@ public class Panel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
||||||
SceneItem sceneItem = item.GetComponent<SceneItem>();
|
SceneItem sceneItem = item.GetComponent<SceneItem>();
|
||||||
|
// 获取当前该位置该职业的人数
|
||||||
|
int currentPeopleCount = GetCurrentPeopleCount(accidentLocationId, roleId);
|
||||||
|
|
||||||
|
// 设置推荐标记(如果人数不足)
|
||||||
|
if (minRequired > currentPeopleCount)
|
||||||
|
{
|
||||||
|
sceneItem.sceneImage.gameObject.SetActive(true); // 显示推荐标记
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sceneItem.sceneImage.gameObject.SetActive(false); // 隐藏推荐标记
|
||||||
|
}
|
||||||
Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
||||||
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
||||||
|
sceneItem.sceneId = npcData.Key;
|
||||||
sceneItem.dutyId = accidentLocationId;
|
sceneItem.dutyId = accidentLocationId;
|
||||||
sceneItem.limitNum = minRequired;
|
sceneItem.limitNum = minRequired;
|
||||||
sceneItem.sceneName.text = npcData.Value.Note;
|
sceneItem.sceneName.text = npcData.Value.Note;
|
||||||
@ -287,68 +301,84 @@ public class Panel : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取当前该位置该职业的已添加人数
|
||||||
|
private int GetCurrentPeopleCount(int accidentLocationId, int roleId)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
// 遍历场景数据字典,统计该事故位置和职业的人员数量
|
||||||
|
foreach (var sceneData in sceneDataDictionary)
|
||||||
|
{
|
||||||
|
foreach (var selectedInfo in sceneData.Value)
|
||||||
|
{
|
||||||
|
if (selectedInfo.sceneId == accidentLocationId && selectedInfo.dutyId == roleId)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
//处理点击确认按钮
|
//处理点击确认按钮
|
||||||
public void ClickSureBtn()
|
public void ClickSureBtn()
|
||||||
{
|
{
|
||||||
// 只有在选择了人员、职责和场景的情况下,才会执行后续操作
|
// 只有在选择了人员、职责和场景的情况下,才会执行后续操作
|
||||||
if (isPersonSelected && isDutySelected && isSceneSelected)
|
if (isPersonSelected && isDutySelected && isSceneSelected)
|
||||||
|
{
|
||||||
|
// 保存选中的人员信息到场景数据字典中
|
||||||
|
string sceneName = selectedInfo.scene;
|
||||||
|
|
||||||
|
// 如果场景字典中没有这个场景,先创建一个空列表
|
||||||
|
if (!sceneDataDictionary.ContainsKey(sceneName))
|
||||||
{
|
{
|
||||||
// 保存选中的人员信息到场景数据字典中
|
sceneDataDictionary[sceneName] = new List<SelectedInfo>();
|
||||||
string sceneName = selectedInfo.scene;
|
}
|
||||||
|
|
||||||
// 如果场景字典中没有这个场景,先创建一个空列表
|
// 需要判断是否达到了职责的人员上限
|
||||||
if (!sceneDataDictionary.ContainsKey(sceneName))
|
bool isLimitReached = false;
|
||||||
|
// 获取当前场景中的所有人员信息
|
||||||
|
List<SelectedInfo> currentSceneInfo = sceneDataDictionary[sceneName];
|
||||||
|
// 如果选中了“主持人”、“各组长”或“总指挥”,则限制数量为1
|
||||||
|
if (selectedInfo.duty == "主持人" || selectedInfo.duty == "组长" || selectedInfo.duty == "总指挥")
|
||||||
|
{
|
||||||
|
int count = currentSceneInfo.Count(info => info.duty == selectedInfo.duty); // 统计当前职责人数
|
||||||
|
|
||||||
|
if (count >= 1) // 如果已经有1个此职责的人选
|
||||||
{
|
{
|
||||||
sceneDataDictionary[sceneName] = new List<SelectedInfo>();
|
isLimitReached = true; // 标记限制已达
|
||||||
}
|
|
||||||
|
|
||||||
// 需要判断是否达到了职责的人员上限
|
|
||||||
bool isLimitReached = false;
|
|
||||||
|
|
||||||
// 获取当前场景中的所有人员信息
|
|
||||||
List<SelectedInfo> currentSceneInfo = sceneDataDictionary[sceneName];
|
|
||||||
// 如果选中了“主持人”、“各组长”或“总指挥”,则限制数量为1
|
|
||||||
if (selectedInfo.duty == "主持人" || selectedInfo.duty == "组长" || selectedInfo.duty == "总指挥")
|
|
||||||
{
|
|
||||||
int count = currentSceneInfo.Count(info => info.duty == selectedInfo.duty); // 统计当前职责人数
|
|
||||||
|
|
||||||
if (count >= 1) // 如果已经有1个此职责的人选
|
|
||||||
{
|
|
||||||
Debug.LogError($"{selectedInfo.duty} 已达最大人数限制");
|
|
||||||
isLimitReached = true; // 标记限制已达
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 如果没有达到上限,则可以添加人员信息
|
|
||||||
if (!isLimitReached)
|
|
||||||
{
|
|
||||||
// 通过创建一个新的 SelectedInfo 实例来避免引用同一个对象
|
|
||||||
SelectedInfo newSelectedInfo = new SelectedInfo
|
|
||||||
{
|
|
||||||
name = selectedInfo.name,
|
|
||||||
duty = selectedInfo.duty,
|
|
||||||
scene = selectedInfo.scene,
|
|
||||||
dutyId= selectedInfo.dutyId
|
|
||||||
};
|
|
||||||
|
|
||||||
// 将当前选中的人员信息添加到对应场景的人员列表中
|
|
||||||
currentSceneInfo.Add(newSelectedInfo);
|
|
||||||
|
|
||||||
// 禁用确认按钮并清空选择标志
|
|
||||||
sureBtn.interactable = false;
|
|
||||||
isPersonSelected = false;
|
|
||||||
isDutySelected = false;
|
|
||||||
isSceneSelected = false;
|
|
||||||
|
|
||||||
// 改变已添加人员的显示颜色
|
|
||||||
UpdatePeopleListVisual();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
// 如果没有达到上限,则可以添加人员信息
|
||||||
|
if (!isLimitReached)
|
||||||
{
|
{
|
||||||
Debug.LogError("请确保选择了人员、职责和场景!");
|
// 通过创建一个新的 SelectedInfo 实例来避免引用同一个对象
|
||||||
|
SelectedInfo newSelectedInfo = new SelectedInfo
|
||||||
|
{
|
||||||
|
name = selectedInfo.name,
|
||||||
|
duty = selectedInfo.duty,
|
||||||
|
scene = selectedInfo.scene,
|
||||||
|
dutyId = selectedInfo.dutyId,
|
||||||
|
sceneId = selectedInfo.sceneId
|
||||||
|
};
|
||||||
|
|
||||||
|
// 将当前选中的人员信息添加到对应场景的人员列表中
|
||||||
|
currentSceneInfo.Add(newSelectedInfo);
|
||||||
|
|
||||||
|
// 禁用确认按钮并清空选择标志
|
||||||
|
sureBtn.interactable = false;
|
||||||
|
isPersonSelected = false;
|
||||||
|
isDutySelected = false;
|
||||||
|
isSceneSelected = false;
|
||||||
|
// 改变已添加人员的显示颜色
|
||||||
|
UpdatePeopleListVisual();
|
||||||
}
|
}
|
||||||
datePanel.NumberText.text = "共" + (sceneDataDictionary.Keys.Count * sceneDataDictionary.Values.Count).ToString() + "人参与";
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("请确保选择了人员、职责和场景!");
|
||||||
|
}
|
||||||
|
datePanel.NumberText.text = "共" + (sceneDataDictionary.Keys.Count * sceneDataDictionary.Values.Count).ToString() + "人参与";
|
||||||
|
}
|
||||||
|
|
||||||
//处理界面关闭按钮
|
//处理界面关闭按钮
|
||||||
public void ClickCloseBtn()
|
public void ClickCloseBtn()
|
||||||
@ -358,67 +388,77 @@ public class Panel : MonoBehaviour
|
|||||||
|
|
||||||
//获取鼠标点击位置的信息
|
//获取鼠标点击位置的信息
|
||||||
public void GetData()
|
public void GetData()
|
||||||
{
|
{
|
||||||
ManagerPanel managerPanel = new ManagerPanel();
|
ManagerPanel managerPanel = new ManagerPanel();
|
||||||
|
|
||||||
// 当鼠标左键按下时进行检测
|
// 当鼠标左键按下时进行检测
|
||||||
if (Input.GetMouseButtonDown(0))
|
if (Input.GetMouseButtonDown(0))
|
||||||
|
{
|
||||||
|
// 确保 raycaster 和 eventSystem 不为空
|
||||||
|
if (raycaster == null || eventSystem == null)
|
||||||
{
|
{
|
||||||
// 确保 raycaster 和 eventSystem 不为空
|
Debug.LogError("Raycaster 或 EventSystem 未正确分配,请在 Inspector 中进行分配。");
|
||||||
if (raycaster == null || eventSystem == null)
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建 PointerEventData 来记录点击事件的数据
|
||||||
|
PointerEventData pointerData = new PointerEventData(eventSystem);
|
||||||
|
pointerData.position = Input.mousePosition; // 获取鼠标点击的位置
|
||||||
|
|
||||||
|
// 用于存储射线检测的结果
|
||||||
|
List<RaycastResult> results = new List<RaycastResult>();
|
||||||
|
|
||||||
|
// 射线检测 UI
|
||||||
|
raycaster.Raycast(pointerData, results);
|
||||||
|
|
||||||
|
// 遍历射线检测的结果
|
||||||
|
foreach (RaycastResult result in results)
|
||||||
|
{
|
||||||
|
// 检测到点击了按钮
|
||||||
|
Button clickedButton = result.gameObject.GetComponent<Button>();
|
||||||
|
|
||||||
|
if (clickedButton != null)
|
||||||
{
|
{
|
||||||
Debug.LogError("Raycaster 或 EventSystem 未正确分配,请在 Inspector 中进行分配。");
|
Text buttonText = clickedButton.GetComponentInChildren<Text>();
|
||||||
return;
|
if (buttonText != null && buttonText.tag == Tags.people) // 获取标签为人员的信息
|
||||||
}
|
{
|
||||||
|
name = buttonText.text;
|
||||||
// 创建 PointerEventData 来记录点击事件的数据
|
Debug.Log(name);
|
||||||
PointerEventData pointerData = new PointerEventData(eventSystem);
|
selectedInfo.name = name;
|
||||||
pointerData.position = Input.mousePosition; // 获取鼠标点击的位置
|
isPersonSelected = true; // 选择了人员
|
||||||
|
}
|
||||||
// 用于存储射线检测的结果
|
else if (buttonText != null && buttonText.tag == Tags.scene) // 获取标签为场景的信息
|
||||||
List<RaycastResult> results = new List<RaycastResult>();
|
{
|
||||||
|
scene = buttonText.text;
|
||||||
// 射线检测 UI
|
SceneItem sceneItem = buttonText.gameObject.GetComponentInParent<SceneItem>();
|
||||||
raycaster.Raycast(pointerData, results);
|
selectedInfo.scene = scene;
|
||||||
|
selectedInfo.sceneId= sceneItem.sceneId;
|
||||||
// 遍历射线检测的结果
|
isSceneSelected = true; // 选择了场景
|
||||||
foreach (RaycastResult result in results)
|
}
|
||||||
{
|
else if (buttonText != null && buttonText.tag == Tags.duty) // 获取标签为职责的信息
|
||||||
// 检测到点击了按钮
|
|
||||||
Button clickedButton = result.gameObject.GetComponent<Button>();
|
|
||||||
|
|
||||||
if (clickedButton != null)
|
|
||||||
{
|
{
|
||||||
Text buttonText = clickedButton.GetComponentInChildren<Text>();
|
|
||||||
if (buttonText != null && buttonText.tag == Tags.people) // 获取标签为人员的信息
|
|
||||||
{
|
|
||||||
name = buttonText.text;
|
|
||||||
Debug.Log(name);
|
|
||||||
selectedInfo.name = name;
|
|
||||||
isPersonSelected = true; // 选择了人员
|
|
||||||
}
|
|
||||||
else if (buttonText != null && buttonText.tag == Tags.scene) // 获取标签为场景的信息
|
|
||||||
{
|
|
||||||
scene = buttonText.text;
|
|
||||||
Debug.Log(scene);
|
|
||||||
selectedInfo.scene = scene;
|
|
||||||
isSceneSelected = true; // 选择了场景
|
|
||||||
}
|
|
||||||
else if (buttonText != null && buttonText.tag == Tags.duty) // 获取标签为职责的信息
|
|
||||||
{
|
|
||||||
DutyItem item = clickedButton.GetComponentInParent<DutyItem>();
|
DutyItem item = clickedButton.GetComponentInParent<DutyItem>();
|
||||||
duty = buttonText.text;
|
duty = buttonText.text;
|
||||||
dutyId = item.dutyId;
|
if(duty=="主持人")
|
||||||
selectedInfo.duty = duty;
|
{
|
||||||
isDutySelected = true; // 选择了职责
|
isDutySelected = true; // 选择了职责
|
||||||
|
isSceneSelected = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isDutySelected = true;
|
||||||
|
isSceneSelected = false;
|
||||||
|
}
|
||||||
|
dutyId = item.dutyId;
|
||||||
|
selectedInfo.duty = duty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据选择情况,启用或禁用确认按钮
|
|
||||||
UpdateConfirmButtonState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据选择情况,启用或禁用确认按钮
|
||||||
|
UpdateConfirmButtonState();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================功能===========================================
|
//==========================================================功能===========================================
|
||||||
|
|
||||||
@ -448,6 +488,7 @@ public class Panel : MonoBehaviour
|
|||||||
//判断确认按钮是否可以点击
|
//判断确认按钮是否可以点击
|
||||||
private void UpdateConfirmButtonState()
|
private void UpdateConfirmButtonState()
|
||||||
{
|
{
|
||||||
|
if(isDutySelected)
|
||||||
// 如果人员、职责和场景都已选择,则启用确认按钮,否则禁用
|
// 如果人员、职责和场景都已选择,则启用确认按钮,否则禁用
|
||||||
sureBtn.interactable = isPersonSelected && isDutySelected && isSceneSelected;
|
sureBtn.interactable = isPersonSelected && isDutySelected && isSceneSelected;
|
||||||
}
|
}
|
||||||
|
@ -2,22 +2,26 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Networking.Types;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using static System.Collections.Specialized.BitVector32;
|
using static System.Collections.Specialized.BitVector32;
|
||||||
using static UnityEditor.Progress;
|
using static UnityEditor.Progress;
|
||||||
|
|
||||||
public class EvacuationPanel : MonoBehaviour
|
public class EvacuationPanel : MonoBehaviour
|
||||||
{
|
{
|
||||||
public Dictionary<string, int> distributePeople = new Dictionary<string, int>();
|
public Dictionary<string, int> distributePeople = new Dictionary<string, int>();// 分配给各个场景的人数
|
||||||
public List<PersonnelItem> personnelItems;
|
public List<PersonnelItem> personnelItems;
|
||||||
|
|
||||||
public Transform personnelContent;
|
public Transform personnelContent;
|
||||||
public Panel panel;
|
public Panel panel;
|
||||||
public GameObject personnelPrefabs;
|
public GameObject personnelPrefabs;
|
||||||
public GameObject classPrefab;
|
public GameObject classPrefab;
|
||||||
|
public GameObject classCount;
|
||||||
public Transform content;
|
public Transform content;
|
||||||
public Text topText;
|
public Text topText;
|
||||||
|
private GameObject selectedScene = null;//当前选中场景
|
||||||
|
|
||||||
public List<ClassItem> classItemList = new List<ClassItem>();
|
public List<ClassItem> classItemList = new List<ClassItem>();
|
||||||
public List<ClassMate> classMateList = new List<ClassMate>();
|
public List<ClassMate> classMateList = new List<ClassMate>();
|
||||||
@ -43,21 +47,40 @@ public class EvacuationPanel : MonoBehaviour
|
|||||||
public string npcType;
|
public string npcType;
|
||||||
public string roleid;
|
public string roleid;
|
||||||
|
|
||||||
|
[Header("可分配列表")]
|
||||||
|
List<int> nonZeroAreas = new List<int>();
|
||||||
|
|
||||||
|
Dictionary<int, PersonnelItem> personnelItemsDict = new Dictionary<int, PersonnelItem>();
|
||||||
|
private HashSet<int> excludedAreas = new HashSet<int>(); // 被清空的区域 ID
|
||||||
|
public SelectScenePanel selectScene;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
SetNpcType();
|
SetNpcType();
|
||||||
|
nonZeroAreas= GetNonZeroNpcRatioAreas();
|
||||||
jc = JuesechoicePop.GetComponent<JueseChoicePop>();
|
jc = JuesechoicePop.GetComponent<JueseChoicePop>();
|
||||||
|
//redistributeBtn.onClick.AddListener(ClearData);
|
||||||
redistributeBtn.onClick.AddListener(ClearData);
|
redistributeBtn.onClick.AddListener(() =>
|
||||||
|
{
|
||||||
|
if (redistributeBtn.interactable)
|
||||||
|
{
|
||||||
|
Debug.Log("Redistribute button clicked!");
|
||||||
|
RedistributeLogic();
|
||||||
|
}
|
||||||
|
});
|
||||||
CountsubmitBtn.onClick.AddListener(Submit);
|
CountsubmitBtn.onClick.AddListener(Submit);
|
||||||
submitBtn.onClick.AddListener(totalSubmit);
|
submitBtn.onClick.AddListener(totalSubmit);
|
||||||
|
|
||||||
StuCountInputField.onEndEdit.AddListener(CheckInput);
|
StuCountInputField.onEndEdit.AddListener(CheckInput);
|
||||||
SetClass();
|
SetClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
CheckInput(StuCountInputField.text);
|
||||||
|
IsRedistribution();
|
||||||
|
IsOpen(selectScene.difficultyId);
|
||||||
|
}
|
||||||
|
//上传数据
|
||||||
public void totalSubmit()
|
public void totalSubmit()
|
||||||
{
|
{
|
||||||
Debug.Log(createTemplateInfo.Instance.auth_CreateTemplate + "===============");
|
Debug.Log(createTemplateInfo.Instance.auth_CreateTemplate + "===============");
|
||||||
@ -66,23 +89,16 @@ public class EvacuationPanel : MonoBehaviour
|
|||||||
nPC.roleId = roleid;
|
nPC.roleId = roleid;
|
||||||
createTemplateInfo.Instance.auth_CreateTemplate.npcList = new List<NpcList>();
|
createTemplateInfo.Instance.auth_CreateTemplate.npcList = new List<NpcList>();
|
||||||
createTemplateInfo.Instance.auth_CreateTemplate.npcList.Add(nPC);
|
createTemplateInfo.Instance.auth_CreateTemplate.npcList.Add(nPC);
|
||||||
//foreach(NpcList item in createTemplateInfo.Instance.auth_CreateTemplate.npcList)
|
|
||||||
//{
|
|
||||||
// Debug.Log("npcType>>>>>>>>>>>>>>>>>" + item.userId);
|
|
||||||
// Debug.Log("roleid>>>>>>>>>>>>>>>>>" + item.roleId);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNpcType()
|
public void SetNpcType()
|
||||||
{
|
{
|
||||||
foreach (var scene in panel.sceneDataDictionary)
|
foreach (var scene in panel.sceneDataDictionary)
|
||||||
{
|
{
|
||||||
Debug.Log("+++++++++++");
|
|
||||||
foreach (var npcData in js.locationDictionary)
|
foreach (var npcData in js.locationDictionary)
|
||||||
{
|
{
|
||||||
// 解析角色限制字段
|
// 解析角色限制字段
|
||||||
string roleLimit = npcData.Value.NpcRatio;
|
string roleLimit = npcData.Value.NpcRatio;
|
||||||
|
|
||||||
if(npcData.Value.NpcRatio=="-1")
|
if(npcData.Value.NpcRatio=="-1")
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -98,150 +114,101 @@ public class EvacuationPanel : MonoBehaviour
|
|||||||
roleid = roleLimitSections[0];
|
roleid = roleLimitSections[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void Submit()
|
|
||||||
//{
|
|
||||||
// //int count = int.Parse(StuCountInputField.text);//总人数
|
|
||||||
// //StuCountInputField.text = "";
|
|
||||||
// //int initialPeople = panel.sceneDataDictionary.Keys.Count* panel.sceneDataDictionary.Values.Count;//已经分了的人
|
|
||||||
// //string[] sceneNames = { };
|
|
||||||
// //for(int i = 0; i< panel.sceneDataDictionary.Keys.Count;i++)//拿场景名称
|
|
||||||
// //{
|
|
||||||
// // foreach(var item in panel.sceneDataDictionary.Keys)
|
|
||||||
// // {
|
|
||||||
// // sceneNames[i] = item;
|
|
||||||
// // }
|
|
||||||
// //}
|
|
||||||
|
|
||||||
// //distributePeople = DistributePeople(sceneNames, initialPeople, count);
|
|
||||||
|
|
||||||
// //foreach(var item in distributePeople)
|
|
||||||
// //{
|
|
||||||
// // Debug.Log(item.Value);
|
|
||||||
// //}
|
|
||||||
|
|
||||||
// int count = int.Parse(StuCountInputField.text); // 总人数
|
|
||||||
// StuCountInputField.text = "";
|
|
||||||
|
|
||||||
// // 已经分配的人员数量
|
|
||||||
// int initialPeople = panel.sceneDataDictionary.Keys.Count * panel.sceneDataDictionary.Values.Count;
|
|
||||||
|
|
||||||
// // 动态创建sceneNames数组,大小为场景数量
|
|
||||||
// string[] sceneNames = new string[panel.sceneDataDictionary.Keys.Count];
|
|
||||||
|
|
||||||
// // 遍历场景数据字典并填充sceneNames数组
|
|
||||||
// int i = 0;
|
|
||||||
// foreach (var item in panel.sceneDataDictionary.Keys)
|
|
||||||
// {
|
|
||||||
// sceneNames[i] = item;
|
|
||||||
// i++;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 调用分配人员函数
|
|
||||||
// distributePeople = DistributePeople(sceneNames, initialPeople, count);
|
|
||||||
|
|
||||||
// // 输出分配结果
|
|
||||||
// foreach (var item in distributePeople)
|
|
||||||
// {
|
|
||||||
// //Debug.Log(item.Value);
|
|
||||||
|
|
||||||
// foreach(var a in personnelItems)
|
|
||||||
// {
|
|
||||||
// a.SetInfo(item.Value.ToString());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
private void Submit()
|
private void Submit()
|
||||||
{
|
{
|
||||||
// 获取输入的总人数
|
// 获取输入的总人数
|
||||||
int count = int.Parse(StuCountInputField.text); // 总人数
|
int count = int.Parse(StuCountInputField.text); // 总人数
|
||||||
StuCountInputField.text = "";
|
StuCountInputField.text = "";
|
||||||
|
|
||||||
// 计算已分配的人员数量
|
foreach (var item in personnelItems)
|
||||||
int initialPeople = 0;
|
|
||||||
foreach (var item in panel.sceneDataDictionary.Values)
|
|
||||||
{
|
{
|
||||||
initialPeople += item.Count; // 假设每个场景的Value是一个List或类似的结构,其中包含该场景下的所有人员
|
personnelItemsDict[item.sceneId] = item; // 使用 sceneId 作为键
|
||||||
}
|
}
|
||||||
|
|
||||||
// 动态创建sceneNames数组,大小为场景数量
|
// 将 nonZeroAreas 转换为场景 ID 数组
|
||||||
string[] sceneNames = new string[panel.sceneDataDictionary.Keys.Count];
|
int[] sceneIds = nonZeroAreas.ToArray();
|
||||||
|
|
||||||
// 填充sceneNames数组
|
// 调用分配方法
|
||||||
int i = 0;
|
var result = DistributePeopleWithBalance(sceneIds, personnelItemsDict, count);
|
||||||
foreach (var item in panel.sceneDataDictionary.Keys)
|
|
||||||
|
// 更新 UI 显示
|
||||||
|
foreach (var kvp in result)
|
||||||
{
|
{
|
||||||
sceneNames[i] = item;
|
if (personnelItemsDict.ContainsKey(kvp.Key))
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调用分配人员函数(假设该函数处理人员分配的逻辑)
|
|
||||||
distributePeople = DistributePeople(sceneNames, initialPeople, count);
|
|
||||||
|
|
||||||
// 输出分配结果
|
|
||||||
foreach (var item in distributePeople)
|
|
||||||
{
|
|
||||||
// 假设 personnelItems 是存储UI元素的列表
|
|
||||||
foreach (var a in personnelItems)
|
|
||||||
{
|
{
|
||||||
a.SetInfo(item.Value.ToString());
|
personnelItemsDict[kvp.Key].SetInfo(kvp.Value.ToString()); // 更新UI
|
||||||
|
personnelItemsDict[kvp.Key].personnelImage.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public Dictionary<int, int> DistributePeopleWithBalance(int[] scenes, Dictionary<int, PersonnelItem> personnelItemsDict, int totalPeople)
|
||||||
public static Dictionary<string, int> DistributePeople(string[] scenes, int initialPeople, int totalPeople)
|
|
||||||
{
|
{
|
||||||
// 1. 计算已分配的人员数
|
// 1. 计算当前每个区域的总人数(初始人数 + 已分配人数)
|
||||||
int totalAssigned = initialPeople;
|
Dictionary<int, int> totalPeoplePerScene = new Dictionary<int, int>();
|
||||||
|
|
||||||
//foreach (var scene in scenes)
|
|
||||||
//{
|
|
||||||
// if (initialPeople.ContainsKey(scene))
|
|
||||||
// {
|
|
||||||
// totalAssigned += initialPeople[scene];
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
// 2. 计算剩余人员数
|
|
||||||
int remainingPeople = totalPeople - totalAssigned;
|
|
||||||
|
|
||||||
// 3. 将剩余人员平均分配到所有场景中
|
|
||||||
Dictionary<string, int> finalDistribution = new Dictionary<string, int>(initialPeople);
|
|
||||||
int peoplePerScene = remainingPeople / scenes.Length;
|
|
||||||
int extraPeople = remainingPeople % scenes.Length; // 计算余数
|
|
||||||
|
|
||||||
// 4. 每个场景分配均等的人员
|
|
||||||
foreach (var scene in scenes)
|
foreach (var scene in scenes)
|
||||||
{
|
{
|
||||||
if (finalDistribution.ContainsKey(scene))
|
// 如果 personnelItemsDict 中包含该场景,取其初始人数;否则设为 0
|
||||||
|
if (personnelItemsDict.ContainsKey(scene))
|
||||||
{
|
{
|
||||||
finalDistribution[scene] += peoplePerScene; // 均分的人员
|
totalPeoplePerScene[scene] = personnelItemsDict[scene].Num; // 初始人数
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
finalDistribution[scene] = peoplePerScene; // 新场景初始化
|
totalPeoplePerScene[scene] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Debug 输出每个场景的初始人数
|
||||||
|
Debug.Log($"Scene {scene}: Initial People = {totalPeoplePerScene[scene]}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存初始人数以便后续计算
|
||||||
|
Dictionary<int, int> initialPeoplePerScene = new Dictionary<int, int>(totalPeoplePerScene);
|
||||||
|
|
||||||
|
// 2. 分配剩余人数
|
||||||
|
int remainingPeople = totalPeople;
|
||||||
|
while (remainingPeople > 0)
|
||||||
|
{
|
||||||
|
// 找出当前人数最少的区域
|
||||||
|
int minScene = -1; // 用于记录人数最少的场景 ID
|
||||||
|
int minPeople = int.MaxValue;
|
||||||
|
|
||||||
|
foreach (var scene in totalPeoplePerScene)
|
||||||
|
{
|
||||||
|
if (scene.Value < minPeople)
|
||||||
|
{
|
||||||
|
minPeople = scene.Value;
|
||||||
|
minScene = scene.Key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分配一个 NPC 到人数最少的区域
|
||||||
|
if (minScene != -1) // 确保找到有效的场景
|
||||||
|
{
|
||||||
|
totalPeoplePerScene[minScene]++;
|
||||||
|
remainingPeople--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break; // 如果没有找到有效的场景,终止分配
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. 随机分配余数人员
|
// 3. 计算分配结果,减去初始人数
|
||||||
System.Random rand = new System.Random();
|
Dictionary<int, int> allocatedPeople = new Dictionary<int, int>();
|
||||||
for (int i = 0; i < extraPeople; i++)
|
foreach (var scene in totalPeoplePerScene)
|
||||||
{
|
{
|
||||||
string randomScene = scenes[rand.Next(scenes.Length)];
|
int initialPeople = initialPeoplePerScene.GetValueOrDefault(scene.Key, 0);
|
||||||
finalDistribution[randomScene]++;
|
allocatedPeople[scene.Key] = scene.Value - initialPeople; // 分配人数 = 总人数 - 初始人数
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalDistribution;
|
return allocatedPeople;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//清除
|
||||||
private void ClearData()
|
private void ClearData()
|
||||||
{
|
{
|
||||||
jc.classItem.isSet = false;
|
jc.classItem.isSet = false;
|
||||||
@ -250,38 +217,142 @@ public class EvacuationPanel : MonoBehaviour
|
|||||||
item.isSet = false;
|
item.isSet = false;
|
||||||
item.setClassItem("");
|
item.setClassItem("");
|
||||||
}
|
}
|
||||||
|
|
||||||
jc.classMate.isBeSet = false;
|
jc.classMate.isBeSet = false;
|
||||||
|
|
||||||
foreach(var item in jc.classMateList)
|
foreach(var item in jc.classMateList)
|
||||||
{
|
{
|
||||||
item.isBeSet = false;
|
item.isBeSet = false;
|
||||||
item.setName();
|
item.setName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
//判断NPC的比例字段,列出分配比例不为0的所有区域名称。
|
||||||
void Update()
|
public List<int> GetNonZeroNpcRatioAreas()
|
||||||
{
|
{
|
||||||
CheckInput(StuCountInputField.text);
|
List<int> nonZeroAreas = new List<int>();
|
||||||
|
|
||||||
|
foreach (var sceneEntry in panel.sceneDataDictionary)
|
||||||
|
{
|
||||||
|
foreach (var sceneInfo in sceneEntry.Value)
|
||||||
|
{
|
||||||
|
foreach (var npcData in js.locationDictionary)
|
||||||
|
{
|
||||||
|
LocationData locationData = npcData.Value;
|
||||||
|
|
||||||
|
// 如果场景的 ID 匹配当前 NPC 的 ID
|
||||||
|
if (locationData.ID == sceneInfo.sceneId)
|
||||||
|
{
|
||||||
|
// 获取每个区域的 NpcRatio 字段
|
||||||
|
string npcRatio = locationData.NpcRatio;
|
||||||
|
|
||||||
|
// 将 NpcRatio 字符串按 '|' 分割,获取每一项
|
||||||
|
string[] npcRatioEntries = npcRatio.Split('|');
|
||||||
|
|
||||||
|
// 遍历每一项
|
||||||
|
foreach (var entry in npcRatioEntries)
|
||||||
|
{
|
||||||
|
// 将每一项按 ',' 分割,获取事故位置、NPCID、归属和分配比例
|
||||||
|
string[] entryData = entry.Split(',');
|
||||||
|
|
||||||
|
if (entryData.Length == 4)
|
||||||
|
{
|
||||||
|
string allocationRatio = entryData[3]; // 获取分配比例
|
||||||
|
|
||||||
|
// 检查分配比例是否不为 "0" 和 "-1"
|
||||||
|
if (allocationRatio != "0" && allocationRatio != "-1")
|
||||||
|
{
|
||||||
|
// 如果比例不为0,将该区域 ID 添加到列表
|
||||||
|
nonZeroAreas.Add(locationData.ID);
|
||||||
|
Debug.Log("locationData.ID"+ locationData.ID);
|
||||||
|
break; // 一旦找到有效的分配比例,就不再检查当前区域的其他项
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 输出所有分配比例不为0的区域 ID
|
||||||
|
foreach (var area in nonZeroAreas)
|
||||||
|
{
|
||||||
|
Debug.Log("区域 ID:" + area);
|
||||||
|
}
|
||||||
|
// 返回符合条件的区域 ID 列表
|
||||||
|
return nonZeroAreas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置左侧场景显示
|
||||||
public void SetPersonnel()
|
public void SetPersonnel()
|
||||||
{
|
{
|
||||||
|
// 清空现有的UI项
|
||||||
foreach (Transform child in personnelContent)
|
foreach (Transform child in personnelContent)
|
||||||
{
|
{
|
||||||
Destroy(child.gameObject);
|
Destroy(child.gameObject);
|
||||||
}
|
}
|
||||||
|
// 清空人员列表
|
||||||
|
personnelItems.Clear();
|
||||||
|
|
||||||
foreach (var sceneEntry in panel.sceneDataDictionary)
|
foreach (var sceneEntry in panel.sceneDataDictionary)
|
||||||
{
|
{
|
||||||
GameObject item = GameObject.Instantiate<GameObject>(personnelPrefabs, personnelContent);
|
foreach (var sceneInfo in sceneEntry.Value)
|
||||||
PersonnelItem personnelItem=item.GetComponent<PersonnelItem>();
|
{
|
||||||
personnelItems.Add(personnelItem);
|
LocationData area = js.GetAreaDateById(sceneInfo.sceneId);
|
||||||
personnelItem.sceneText.text = sceneEntry.Key;
|
// 如果NpcRatio不为"-1"表示该场景有效
|
||||||
personnelItem.personnelNum.text = sceneEntry.Value.Count.ToString();
|
if (area.NpcRatio != "-1")
|
||||||
|
{
|
||||||
|
// 检查 personnelItems 是否已经包含该 sceneText.text
|
||||||
|
var existingItem = personnelItems.Find(item => item.sceneText.text == sceneEntry.Key);
|
||||||
|
if (existingItem != null)
|
||||||
|
{
|
||||||
|
// 如果已经存在,增加 Num
|
||||||
|
existingItem.Num++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果没有重复的 personnelItem,创建并添加
|
||||||
|
GameObject item = GameObject.Instantiate(personnelPrefabs, personnelContent);
|
||||||
|
PersonnelItem personnelItem = item.GetComponent<PersonnelItem>();
|
||||||
|
Button button = personnelItem.transform.Find("sceneText").GetComponent<Button>();
|
||||||
|
personnelItem.sceneText.text = sceneEntry.Key;
|
||||||
|
personnelItem.sceneId = area.ID;
|
||||||
|
personnelItem.Num = 1; // 设置初始值为 1
|
||||||
|
button.onClick.AddListener(() =>
|
||||||
|
{
|
||||||
|
OnSceneItemClicked(item, Color.yellow, selectedScene);
|
||||||
|
|
||||||
|
});
|
||||||
|
//Debug.Log("New PersonnelItem created. SceneId: " + personnelItem.sceneId + ", Num: " + personnelItem.Num);
|
||||||
|
personnelItems.Add(personnelItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break; // 如果遇到无效场景(NpcRatio为-1),跳出当前循环
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断重新分配按钮是否可以点击
|
||||||
|
public void IsRedistribution()
|
||||||
|
{
|
||||||
|
// 遍历 personnelItemsDict,检查是否有任何 PersonnelItem 的 gameObject 处于激活状态
|
||||||
|
bool canRedistribute = false;
|
||||||
|
|
||||||
|
foreach (var kvp in personnelItemsDict)
|
||||||
|
{
|
||||||
|
if (kvp.Value.personnelImage.gameObject.activeSelf) // 检查 gameObject 是否显示
|
||||||
|
{
|
||||||
|
canRedistribute = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 设置重新分配按钮的交互状态
|
||||||
|
redistributeBtn.interactable = canRedistribute;
|
||||||
|
|
||||||
|
// 调试输出
|
||||||
|
Debug.Log($"Redistribute button is {(canRedistribute ? "enabled" : "disabled")}");
|
||||||
|
}
|
||||||
//判断输入框的数字是否大于1
|
//判断输入框的数字是否大于1
|
||||||
void CheckInput(string input)
|
void CheckInput(string input)
|
||||||
{
|
{
|
||||||
@ -292,8 +363,7 @@ public class EvacuationPanel : MonoBehaviour
|
|||||||
if (result > 1)
|
if (result > 1)
|
||||||
{
|
{
|
||||||
CountsubmitBtn.GetComponent<Image>().sprite = rsprite;
|
CountsubmitBtn.GetComponent<Image>().sprite = rsprite;
|
||||||
CountsubmitBtn.onClick.AddListener(Countsubmit);
|
CountsubmitBtn.onClick.AddListener(Countsubmit);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,16 +373,17 @@ public class EvacuationPanel : MonoBehaviour
|
|||||||
CountsubmitBtn.GetComponent<Image>().sprite = fsprite;
|
CountsubmitBtn.GetComponent<Image>().sprite = fsprite;
|
||||||
StuCountInputField.text = string.Empty;
|
StuCountInputField.text = string.Empty;
|
||||||
//按配置对输入的Npc数量进行 分配
|
//按配置对输入的Npc数量进行 分配
|
||||||
|
|
||||||
//取消监听
|
//取消监听
|
||||||
CountsubmitBtn.onClick.RemoveAllListeners();
|
CountsubmitBtn.onClick.RemoveAllListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
//场景ID进行配置
|
//场景ID进行配置
|
||||||
public void SettopText()
|
public void SettopText()
|
||||||
{
|
{
|
||||||
topText.text = "以下班级需要设定班主任老师:";
|
topText.text = "以下班级需要设定班主任老师:";
|
||||||
topText.text = "以下楼层需要设定搜救老师:";
|
topText.text = "以下楼层需要设定搜救老师:";
|
||||||
}
|
}
|
||||||
|
|
||||||
//实例化ClassItem
|
//实例化ClassItem
|
||||||
public void SetClass()
|
public void SetClass()
|
||||||
{
|
{
|
||||||
@ -324,4 +395,102 @@ public class EvacuationPanel : MonoBehaviour
|
|||||||
classItemList.Add(classItem);
|
classItemList.Add(classItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//重新分配
|
||||||
|
public void RedistributeLogic()
|
||||||
|
{
|
||||||
|
// 计算需要重新分配的 NPC 总数
|
||||||
|
int totalRedistributePeople = 0;
|
||||||
|
|
||||||
|
foreach (var kvp in personnelItemsDict)
|
||||||
|
{
|
||||||
|
PersonnelItem item = kvp.Value;
|
||||||
|
|
||||||
|
// 如果 gameObject 是激活的,表示需要清空 NPC
|
||||||
|
if (item.personnelImage.gameObject.activeSelf)
|
||||||
|
{
|
||||||
|
totalRedistributePeople += item.Num; // 累加需要重新分配的 NPC 数量
|
||||||
|
item.Num = 0; // 清空该区域的 NPC 数量
|
||||||
|
item.SetInfo("0"); // 更新 UI 显示
|
||||||
|
item.personnelImage.gameObject.SetActive(false); // 隐藏图标
|
||||||
|
excludedAreas.Add(kvp.Key); // 记录清空的区域 ID
|
||||||
|
Debug.Log($"Cleared NPCs from Scene ID: {kvp.Key}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 准备有效分配区域列表(排除被清空的区域)
|
||||||
|
List<int> validAreas = new List<int>();
|
||||||
|
foreach (var kvp in personnelItemsDict)
|
||||||
|
{
|
||||||
|
if (!excludedAreas.Contains(kvp.Key)) // 排除清空的区域
|
||||||
|
{
|
||||||
|
validAreas.Add(kvp.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没有有效区域,则提示
|
||||||
|
if (validAreas.Count == 0)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("No valid areas available for redistribution.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将有效区域转换为数组
|
||||||
|
int[] validSceneIds = validAreas.ToArray();
|
||||||
|
|
||||||
|
// 调用分配方法,将清空区域的 NPC 分配到有效区域
|
||||||
|
var redistributionResult = DistributePeopleWithBalance(validSceneIds, personnelItemsDict, totalRedistributePeople);
|
||||||
|
|
||||||
|
// 更新分配结果到 UI
|
||||||
|
foreach (var kvp in redistributionResult)
|
||||||
|
{
|
||||||
|
if (personnelItemsDict.ContainsKey(kvp.Key))
|
||||||
|
{
|
||||||
|
personnelItemsDict[kvp.Key].Num += kvp.Value; // 更新人数
|
||||||
|
personnelItemsDict[kvp.Key].SetInfo(personnelItemsDict[kvp.Key].Num.ToString()); // 更新 UI 显示
|
||||||
|
personnelItemsDict[kvp.Key].personnelImage.gameObject.SetActive(true); // 确保图标显示
|
||||||
|
personnelItemsDict[kvp.Key].personnelNum.gameObject.SetActive(true); // 确保图标显示
|
||||||
|
Debug.Log($"Assigned {kvp.Value} NPCs to Scene ID: {kvp.Key}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置文字颜色
|
||||||
|
public void OnSceneItemClicked(GameObject clickedItem, Color color, GameObject select)
|
||||||
|
{
|
||||||
|
// 如果有之前选中的角色,重置其视觉效果
|
||||||
|
if (selectedScene != null && select != clickedItem)
|
||||||
|
{
|
||||||
|
Text prevText = selectedScene.GetComponentInChildren<Text>();
|
||||||
|
if (prevText != null)
|
||||||
|
{
|
||||||
|
prevText.fontSize = 32; // 恢复原始字号
|
||||||
|
prevText.color = Color.white; // 恢复原始颜色
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置当前选中的角色为选中状态
|
||||||
|
selectedScene = clickedItem; // 更新选中人物
|
||||||
|
Text personText = clickedItem.GetComponentInChildren<Text>();
|
||||||
|
if (personText != null)
|
||||||
|
{
|
||||||
|
// 字号变大和颜色变更(选中状态)
|
||||||
|
personText.fontSize = 36;
|
||||||
|
personText.color = color; // 选中颜色
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断分管区域是否打开
|
||||||
|
public void IsOpen(int id)
|
||||||
|
{
|
||||||
|
if (selectScene.difficultyId > 3)
|
||||||
|
{
|
||||||
|
classCount.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
classCount.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -126,15 +126,7 @@ public class ManagerPanel : MonoBehaviour
|
|||||||
foreach(var item in panelInfo.peopleList)
|
foreach(var item in panelInfo.peopleList)
|
||||||
scenetext.personelPanelText.text = sceneEntry.Key;
|
scenetext.personelPanelText.text = sceneEntry.Key;
|
||||||
scenetext.personelNumText.text = sceneEntry.Value.Count.ToString();
|
scenetext.personelNumText.text = sceneEntry.Value.Count.ToString();
|
||||||
//foreach (var item in panelInfo.peopleList)
|
scenetext.CreatePeopleItem(sceneEntry.Value);
|
||||||
//{
|
|
||||||
// SceneItem sceneItem = item.GetComponent<SceneItem>();
|
|
||||||
// if(sceneItem.sceneName.text== scenetext.personelPanelText.text)
|
|
||||||
// {
|
|
||||||
// if(sceneEntry.Value.duty==)
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
scenetext.CreatePeopleItem(sceneEntry.Value);
|
|
||||||
}
|
}
|
||||||
//CreatePeopleItem();
|
//CreatePeopleItem();
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,6 @@ public class SelectScenePanel : MonoBehaviour
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
continueBtn.interactable = isOk;
|
continueBtn.interactable = isOk;
|
||||||
Debug.LogError("ContinueBtn 按钮组件未找到!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ public class PersonnelItem : MonoBehaviour
|
|||||||
public Text sceneText;
|
public Text sceneText;
|
||||||
public Image personnelImage;
|
public Image personnelImage;
|
||||||
public Text personnelNum;
|
public Text personnelNum;
|
||||||
|
public int sceneId;
|
||||||
|
public int Num = 0;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ public class ClassMate : MonoBehaviour
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jueseChoicePop.ChangeClassMate();
|
//jueseChoicePop.ChangeClassMate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,19 +72,5 @@ public class JueseChoicePop : MonoBehaviour
|
|||||||
classItem.setClassItem(classMate.classmatename.text);
|
classItem.setClassItem(classMate.classmatename.text);
|
||||||
//s = classMate.classmatename.text;
|
//s = classMate.classmatename.text;
|
||||||
this.classMate.classmatename.text = classMate.classmatename.text + "(" + classItem.classname.text + ")";
|
this.classMate.classmatename.text = classMate.classmatename.text + "(" + classItem.classname.text + ")";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearClassMate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void ChangeClassMate()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user