人员配置点击修改

This commit is contained in:
lq 2024-12-02 19:40:49 +08:00
parent c63a323117
commit 53f6f2eea6
6 changed files with 142 additions and 137 deletions

View File

@ -112,9 +112,15 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 888f2cd11d6d3ea4c9383ac4808687dc, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneId: 0
sceneType: 0
sceneName: {fileID: 5207661254087907526}
sceneImage: {fileID: 0}
maskImage: {fileID: 0}
roleLimit:
limitNum: 0
dutyId: 0
jsonReader: {fileID: 0}
--- !u!1 &5207661254004645194
GameObject:
m_ObjectHideFlags: 0
@ -204,7 +210,7 @@ GameObject:
- component: {fileID: 5207661254087907526}
- component: {fileID: 5207661254087907527}
m_Layer: 5
m_Name: Text (Legacy)
m_Name: TextBtn
m_TagString: Scene
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

View File

@ -89,7 +89,7 @@ GameObject:
- component: {fileID: 3344224971532102837}
- component: {fileID: 3344224971532102794}
m_Layer: 5
m_Name: Text (Legacy)
m_Name: TextBtn
m_TagString: Duty
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -202,12 +202,12 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName:
m_MethodName:
m_Mode: 1
m_TargetAssemblyTypeName: Panel, Assembly-CSharp
m_MethodName: OnPeopleItemClicked
m_Mode: 2
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_ObjectArgumentAssemblyTypeName: UnityEngine.GameObject, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:

View File

@ -33,9 +33,9 @@ RectTransform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 194.0772, y: -29.2995}
m_SizeDelta: {x: 388.1544, y: 58.599}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3854006045193366972
@ -68,7 +68,7 @@ GameObject:
- component: {fileID: 4204671801752310761}
- component: {fileID: 4204671801752310760}
m_Layer: 5
m_Name: Text (Legacy)
m_Name: TextBtn
m_TagString: People
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

View File

@ -2240,7 +2240,7 @@ MonoBehaviour:
eventSystem: {fileID: 1579865912}
ManagerPanel: {fileID: 617308871}
peopleCountent: {fileID: 667280287}
peoplePrefab: {fileID: 1921476198}
peoplePrefab: {fileID: 4204671800070690484, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
panelContent: {fileID: 1145997501}
dutyPrefab: {fileID: 3344224972021141760, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
dutyCount: {fileID: 1034927193}
@ -2516,8 +2516,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1921476199}
m_Children: []
m_Father: {fileID: 1432888497}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -6520,7 +6519,8 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 3900195428984076543}
m_Father: {fileID: 1324221058}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -11405,16 +11405,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1910307861}
m_CullTransparentMesh: 1
--- !u!1 &1921476198 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4204671800070690484, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
m_PrefabInstance: {fileID: 4204671801455259858}
m_PrefabAsset: {fileID: 0}
--- !u!224 &1921476199 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
m_PrefabInstance: {fileID: 4204671801455259858}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1933500136
GameObject:
m_ObjectHideFlags: 0
@ -12829,107 +12819,112 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!1001 &4204671801455259858
--- !u!1001 &3900195428984076542
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 667280287}
m_TransformParent: {fileID: 1034927193}
m_Modifications:
- target: {fileID: 4204671800070690484, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_Name
value: btnPlayerChoose
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_SizeDelta.x
value: 388.1544
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_SizeDelta.y
value: 58.599
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_AnchoredPosition.x
value: 194.0772
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_AnchoredPosition.y
value: -29.2995
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4204671801752310760, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
- target: {fileID: 3344224971532102794, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 618256462}
- target: {fileID: 3344224972021141760, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_Name
value: btnDutyChoose
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_SizeDelta.x
value: 388.1544
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_SizeDelta.y
value: 53.678
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
--- !u!224 &3900195428984076543 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3}
m_PrefabInstance: {fileID: 3900195428984076542}
m_PrefabAsset: {fileID: 0}
--- !u!1 &5745561351200648224
GameObject:
m_ObjectHideFlags: 0

View File

@ -55,6 +55,8 @@ public class Panel : MonoBehaviour
public List<GameObject> peopleList = new List<GameObject>(); // 存储所有已加载的人员预制体
private List<GameObject> filteredPeopleList = new List<GameObject>(); // 存储筛选后的人员列表
private GameObject selectedPerson = null; // 当前选中的角色
private GameObject selectedDuty = null;//当前选中职责
private GameObject selectedScene = null;//当前选中场景
public SelectedInfo selectedInfo;
public Dictionary<string, List<SelectedInfo>> sceneDataDictionary = new Dictionary<string, List<SelectedInfo>>();//不同的场景存取不同的人员数据
public ManagerPanel managerPanel1;
@ -81,6 +83,8 @@ public class Panel : MonoBehaviour
SetText();
//SetInputFile();
}
//==================================================================动态加载=======================================================
//动态加载人员
public void DynamicLoadingPeople()
{
@ -88,7 +92,8 @@ public class Panel : MonoBehaviour
{
GameObject item = GameObject.Instantiate<GameObject>(peoplePrefab, peopleCountent);
PeopleItem peopleItem = item.GetComponent<PeopleItem>();
Button peoplebutton = item.transform.Find("TextBtn").GetComponent<Button>();
peoplebutton.onClick.AddListener(() => OnPeopleItemClicked(item,Color.yellow, selectedPerson));
peopleList.Add(item);// 将每个实例化的角色添加到列表中
}
@ -116,6 +121,8 @@ public class Panel : MonoBehaviour
// 创建DutyItem实例
GameObject item = GameObject.Instantiate(dutyPrefab, dutyCount);
DutyItem dutyItem = item.GetComponent<DutyItem>();
Button dutuybutton = item.transform.Find("TextBtn").GetComponent<Button>();
dutuybutton.onClick.AddListener(() => OnPeopleItemClicked(item,Color.red,selectedDuty));
dutyItem.dutyNameText.text = npcData.Value.Note;
dutyItem.leader = npcData.Value.GroupLeader;
peopleList.Add(item);
@ -143,13 +150,11 @@ public class Panel : MonoBehaviour
{
// 先按“|”分隔
string[] roleLimitSections = roleLimit.Split('|');
// 遍历每个部分(按“|”分隔后得到的数组)
bool shouldInstantiate = true; // 用于判断是否需要实例化
foreach (string section in roleLimitSections)
{
string[] roleLimits = section.Split(',');
// 判断当前部分是否包含 "-1" 来决定是否跳过实例化
if (section.Contains("-1"))
{
@ -161,17 +166,19 @@ public class Panel : MonoBehaviour
}
else
{
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
SceneItem sceneItem = item.GetComponent<SceneItem>();
// 设置limitNum
sceneItem.dutyId = int.Parse(roleLimits[1]);
sceneItem.limitNum = int.Parse(roleLimits[2]);
sceneItem.sceneName.text = npcData.Value.Note;
// 将每个实例化的角色添加到列表中
peopleList.Add(item);
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
SceneItem sceneItem = item.GetComponent<SceneItem>();
Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
scenebutton.onClick.AddListener(() => OnPeopleItemClicked(item, Color.green, selectedScene));
// 设置limitNum
sceneItem.dutyId = int.Parse(roleLimits[1]);
sceneItem.limitNum = int.Parse(roleLimits[2]);
sceneItem.sceneName.text = npcData.Value.Note;
// 将每个实例化的角色添加到列表中
peopleList.Add(item);
}
}
// 如果不满足实例化条件跳过当前NPC的实例化
if (!shouldInstantiate)
{
@ -180,8 +187,6 @@ public class Panel : MonoBehaviour
}
}
}
//=============================================================按钮和点击事件==================================================
//处理人员管理按钮
public void ClickPersonnelManagement()
@ -270,7 +275,6 @@ public class Panel : MonoBehaviour
// 可以在这里根据需求继续处理选中的数据
}
//处理界面关闭按钮
public void ClickCloseBtn()
{
@ -385,12 +389,12 @@ public class Panel : MonoBehaviour
}
// 点击选中角色,改变视觉效果(可复用)
public void OnPeopleItemClicked(GameObject clickedItem)
public void OnPeopleItemClicked(GameObject clickedItem,Color color,GameObject select)
{
// 如果有之前选中的角色,重置其视觉效果
if (selectedPerson != null)
if (select != null)
{
Text prevText = selectedPerson.GetComponentInChildren<Text>();
Text prevText = select.GetComponentInChildren<Text>();
if (prevText != null)
{
prevText.fontSize = 32; // 恢复原始字号
@ -399,13 +403,13 @@ public class Panel : MonoBehaviour
}
// 设置当前选中的角色为选中状态
selectedPerson = clickedItem;
select = clickedItem;
Text personText = clickedItem.GetComponentInChildren<Text>();
if (personText != null)
{
// 字号变大和颜色变更(选中状态)
personText.fontSize = 36;
personText.color = Color.yellow; // 选中颜色
personText.color = color; // 选中颜色
}
}

View File

@ -380,6 +380,7 @@ public class SelectScenePanel : MonoBehaviour
Debug.Log("没有选择场景或学校,继续按钮不可用!");
}
}
//提交按钮,点击上传数据和隐藏界面
public void SubmitBtn()
{
@ -436,7 +437,6 @@ public class SelectScenePanel : MonoBehaviour
}
}
//默认选择第一个Toggle
public void SetFirstChoise(List<Toggle> toggles)
{