缺少职业显示
This commit is contained in:
parent
18d3348bc3
commit
8fd9d76b66
@ -117,7 +117,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 815.6322, y: 0}
|
||||
m_SizeDelta: {x: 417.5337, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5900002970044281004
|
||||
CanvasRenderer:
|
||||
@ -188,6 +188,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5900002970044280994}
|
||||
- {fileID: 1360635075956290897}
|
||||
- {fileID: 5900002970821547561}
|
||||
m_Father: {fileID: 5900002971020626570}
|
||||
m_RootOrder: 1
|
||||
@ -372,7 +373,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 5900002969924403204}
|
||||
m_Father: {fileID: 5900002970331946163}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@ -702,3 +703,83 @@ MonoBehaviour:
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!1 &7094230277195147198
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1360635075956290897}
|
||||
- component: {fileID: 9216331784868106488}
|
||||
- component: {fileID: 313883530667027343}
|
||||
m_Layer: 5
|
||||
m_Name: lackText
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1360635075956290897
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7094230277195147198}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5900002970331946163}
|
||||
m_RootOrder: 1
|
||||
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_SizeDelta: {x: 411.5259, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &9216331784868106488
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7094230277195147198}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &313883530667027343
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7094230277195147198}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
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
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 30
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 3
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u8FD8\u7F3A\u81F3\u5C111\u540D\u4EC0\u4E48\u4EC0\u4E48\u804C\u4E1A"
|
||||
|
@ -1,5 +1,85 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &4498060909466071809
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8838300892937481870}
|
||||
- component: {fileID: 7577960020006578146}
|
||||
- component: {fileID: 5757504950814517587}
|
||||
m_Layer: 5
|
||||
m_Name: lackText
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8838300892937481870
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4498060909466071809}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5900002970331946163}
|
||||
m_RootOrder: 1
|
||||
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_SizeDelta: {x: 513.89, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7577960020006578146
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4498060909466071809}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &5757504950814517587
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4498060909466071809}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
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
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 30
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 3
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u8FD8\u7F3A\u81F3\u5C111\u540D\u4EC0\u4E48\u4EC0\u4E48\u804C\u4E1A"
|
||||
--- !u!1 &5900002969924403205
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -117,7 +197,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 815.6322, y: 0}
|
||||
m_SizeDelta: {x: 275.6023, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5900002970044281004
|
||||
CanvasRenderer:
|
||||
@ -188,6 +268,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5900002970044280994}
|
||||
- {fileID: 8838300892937481870}
|
||||
- {fileID: 5900002970821547561}
|
||||
m_Father: {fileID: 5900002971020626570}
|
||||
m_RootOrder: 1
|
||||
@ -372,7 +453,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 5900002969924403204}
|
||||
m_Father: {fileID: 5900002970331946163}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@ -522,6 +603,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
personelPanelText: {fileID: 5900002971283911308}
|
||||
personelNumText: {fileID: 5900002969924403207}
|
||||
lockText: {fileID: 5757504950814517587}
|
||||
personelContent: {fileID: 5900002971599260874}
|
||||
personelItem: {fileID: 6026028542083999128, guid: 93710d87e1c578748b4ef94ce0d38198, type: 3}
|
||||
firstLablePrefab: {fileID: 0}
|
||||
@ -641,7 +723,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 560.5, y: -44}
|
||||
m_AnchoredPosition: {x: 560.5, y: -109}
|
||||
m_SizeDelta: {x: 1121, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &5900002971599260725
|
||||
|
@ -2313,6 +2313,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 05b11d619e5d88a439384d80484d6952, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
retbutton: {fileID: 0}
|
||||
ClosureObj: {fileID: 0}
|
||||
setName: {fileID: 0}
|
||||
setDuty: {fileID: 0}
|
||||
setScene: {fileID: 0}
|
||||
@ -13690,6 +13692,8 @@ MonoBehaviour:
|
||||
personnelLable: {fileID: 5900002971020626571, guid: 297444ab6ae692b4dbcb38d34e0c5716, type: 3}
|
||||
personnelContent: {fileID: 1591253355}
|
||||
panel: {fileID: 618256462}
|
||||
selectScenePanel: {fileID: 7468736064579811982}
|
||||
jsonReader: {fileID: 1417128757}
|
||||
--- !u!222 &7318934474898386389
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -15947,6 +15951,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 724875a8a183ee14799d1c8e1c4ac8ae, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
retbutton: {fileID: 0}
|
||||
ClosureObj: {fileID: 0}
|
||||
scenePrefab: {fileID: 4948242154612453635, guid: 78fe1dd7452b1b641ba0043d518aa5e6, type: 3}
|
||||
sceneList: {fileID: 7468736063766177856}
|
||||
schoolPrefab: {fileID: 8240735974630159406, guid: e758e32b63aaadf4b88160fe6bf5d8dd, type: 3}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -40,7 +40,6 @@ public class DistributionPanel : MonoBehaviour
|
||||
//CreateFirstLable();
|
||||
foreach (var sceneEntry in panel.sceneDataDictionary)
|
||||
{
|
||||
Debug.Log("sceneEntry" +sceneEntry.Key);
|
||||
GameObject managerPanelInstance = Instantiate(personnelLable, personnelContent);
|
||||
PersonnelPanel scenetext = managerPanelInstance.GetComponent<PersonnelPanel>();
|
||||
scenetext.personelPanelText.text = sceneEntry.Key;
|
||||
@ -48,9 +47,10 @@ public class DistributionPanel : MonoBehaviour
|
||||
scenetext.CreatePeopleItem(sceneEntry.Value);
|
||||
foreach(var scene in sceneEntry.Value)
|
||||
{
|
||||
IsMeet(scene.sceneId);
|
||||
string a=CheckMissingRoles(scene.sceneId);
|
||||
scenetext.lockText.text = a;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,40 +58,94 @@ public class DistributionPanel : MonoBehaviour
|
||||
{
|
||||
GameObject fistLable = Instantiate<GameObject>(personnelLable, personnelContent);
|
||||
PersonnelInfo personnelItem = fistLable.GetComponent<PersonnelInfo>();
|
||||
|
||||
}
|
||||
//判断人员是否满足
|
||||
public void IsMeet(string sceneID)
|
||||
public string CheckMissingRoles(string sceneID)
|
||||
{
|
||||
List<SelectedInfo> info = null;
|
||||
panel.sceneDataDictionary.TryGetValue(sceneID, out info);
|
||||
// 尝试从字典中获取sceneID对应的列表
|
||||
if (panel.sceneDataDictionary.TryGetValue(sceneID, out info))
|
||||
{Debug.LogError(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
string roleLimit = jsonReader.GetAreaDateById(int.Parse(sceneID)).RoleLimit;
|
||||
string[] sceneLimit = roleLimit.Split('|');
|
||||
foreach (string limitStr in sceneLimit)
|
||||
|
||||
// 遍历字典中的每一个条目
|
||||
foreach (var entry in panel.sceneDataDictionary)
|
||||
{
|
||||
// 遍历每个 List<SelectedInfo>,查找是否包含 sceneID
|
||||
foreach (var selectedInfo in entry.Value)
|
||||
{
|
||||
string[] limit = limitStr.Split(",");
|
||||
if (selectedInfo.sceneId == sceneID) // 如果找到匹配的 sceneId
|
||||
{
|
||||
// 找到对应的 List<SelectedInfo>
|
||||
info = entry.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 如果找到了对应的 sceneId,跳出循环
|
||||
if (info != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
string roleLimit = jsonReader.GetAreaDateById(int.Parse(sceneID)).RoleLimit;
|
||||
string[] sceneLimits = roleLimit.Split('|');
|
||||
|
||||
// 存储已选择的职业ID集合
|
||||
HashSet<string> selectedDutyIds = new HashSet<string>();
|
||||
|
||||
// 遍历所有已选择的角色,提取职业ID
|
||||
foreach (var selectedInfo in info)
|
||||
{
|
||||
selectedDutyIds.Add(selectedInfo.dutyId);
|
||||
}
|
||||
|
||||
// 存储缺少的职业ID
|
||||
List<string> missingDutyIds = new List<string>();
|
||||
|
||||
// 获取选中的场景和难度ID
|
||||
string selectedSceneId = selectScenePanel.idcidentId.ToString();
|
||||
string selectedDifficultyId = selectScenePanel.difficultyId.ToString();
|
||||
|
||||
// 遍历每个限制条件,检查是否缺少职业
|
||||
foreach (var sceneLimit in sceneLimits)
|
||||
{
|
||||
string[] limit = sceneLimit.Split(',');
|
||||
|
||||
if (limit.Length == 4)
|
||||
{
|
||||
if (limit[0] == selectScenePanel.idcidentId.ToString() &&limit[1] == selectScenePanel.difficultyId.ToString())
|
||||
string sceneLimitId = limit[0];
|
||||
string difficultyLimitId = limit[1];
|
||||
string dutyId = limit[2];
|
||||
|
||||
// 检查是否符合场景ID和难度ID的条件
|
||||
if (sceneLimitId == selectedSceneId && difficultyLimitId == selectedDifficultyId)
|
||||
{
|
||||
foreach (var selectedInfo in info)
|
||||
// 检查是否缺少职业
|
||||
if (!selectedDutyIds.Contains(dutyId))
|
||||
{
|
||||
if (limit[2] == selectedInfo.dutyId.ToString())
|
||||
{
|
||||
return;
|
||||
}
|
||||
missingDutyIds.Add(dutyId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 输出缺少的职业ID并返回
|
||||
if (missingDutyIds.Count > 0)
|
||||
{
|
||||
string missingCountMessage = "缺少至少" + missingDutyIds.Count + "名";
|
||||
foreach (var missingDutyId in missingDutyIds)
|
||||
{
|
||||
// 获取职业名称(假设 SetUIText 方法用于获取职业名称)
|
||||
missingCountMessage += jsonReader.SetUIText(int.Parse(missingDutyId)) + " ";
|
||||
}
|
||||
return missingCountMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null; // 所有职业都已选择,无需返回任何信息
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("没有找到对应的场景数据!");
|
||||
return "没有找到该 sceneID 的信息!"; // 没有找到该 sceneID 信息
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ public class PersonnelPanel : MonoBehaviour
|
||||
{
|
||||
public Text personelPanelText;
|
||||
public Text personelNumText;
|
||||
public Text lockText;
|
||||
public Transform personelContent;
|
||||
public GameObject personelItem;
|
||||
public GameObject firstLablePrefab;
|
||||
|
Loading…
Reference in New Issue
Block a user