UI层逻辑代码以及配置表的接入

This commit is contained in:
huyulong 2024-12-02 02:47:29 +08:00
parent 5af6fe0d54
commit 92840d4957
3 changed files with 70 additions and 22 deletions

View File

@ -10612,7 +10612,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2102021660636739381, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_SizeDelta.x
value: 0
value: -361.72
objectReference: {fileID: 0}
- target: {fileID: 2102021660636739381, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_SizeDelta.y
@ -10686,6 +10686,10 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2102021661377337229, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: js
value:
objectReference: {fileID: 1417128757}
- target: {fileID: 2102021661377337229, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: panel
value:
@ -10712,19 +10716,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 190.05
objectReference: {fileID: 0}
- target: {fileID: 4764228630658219266, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -23.991
objectReference: {fileID: 0}
- target: {fileID: 4764228630805767484, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_Name
@ -10732,7 +10736,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4764228630805767484, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_IsActive
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4764228630805767485, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_Pivot.x
@ -10820,59 +10824,59 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4764228631245731675, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_SizeDelta.x
value: 0
value: 249.00002
objectReference: {fileID: 0}
- target: {fileID: 4764228631278755135, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_SizeDelta.x
value: 0
value: 629.702
objectReference: {fileID: 0}
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 133.7755
objectReference: {fileID: 0}
- target: {fileID: 4764228631451568083, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -39.08695
objectReference: {fileID: 0}
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 58.95
objectReference: {fileID: 0}
- target: {fileID: 4764228632225803364, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -23.991
objectReference: {fileID: 0}
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 495.9265
objectReference: {fileID: 0}
- target: {fileID: 4764228632238488446, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -39.08695
objectReference: {fileID: 0}
- target: {fileID: 9196293257107006892, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_IsActive

View File

@ -1,8 +1,10 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Xml.Serialization;
using UnityEngine;
using UnityEngine.UI;
using static System.Collections.Specialized.BitVector32;
public class EvacuationPanel : MonoBehaviour
{
@ -27,6 +29,7 @@ public class EvacuationPanel : MonoBehaviour
public GameObject JuesechoicePop;
public JueseChoicePop jc = new JueseChoicePop();
public JSONReader js;
[Header("×Ü°´Å¥")]
public Button redistributeBtn;
@ -35,9 +38,14 @@ public class EvacuationPanel : MonoBehaviour
[Header("NpcÊýÁ¿")]
public int npcNum;
[Header("Npc类型")]
public string npcType;
public string roleid;
// Start is called before the first frame update
void Start()
{
SetNpcType();
jc = JuesechoicePop.GetComponent<JueseChoicePop>();
redistributeBtn.onClick.AddListener(ClearData);
@ -53,11 +61,48 @@ public class EvacuationPanel : MonoBehaviour
{
foreach(var item in createTemplateInfo.Instance.auth_CreateTemplate.npcList)
{
item.userId = npcType;
item.roleId = roleid;
}
foreach(var item in createTemplateInfo.Instance.auth_CreateTemplate.playerList)
{
}
}
public void SetNpcType()
{
foreach (var scene in panel.sceneDataDictionary)
{
Debug.Log("+++++++++++");
foreach (var npcData in js.locationDictionary)
{
// 解析角色限制字段
string roleLimit = npcData.Value.NpcRatio;
if(npcData.Value.NpcRatio=="-1")
{
continue;
}
else
{
// 先按“,”分隔
string[] roleLimitSections = roleLimit.Split(',');
if (scene.Key == npcData.Value.Note)
{
// 只有当 scene.Key 和 npcData.Value.Note 匹配时才执行
this.npcType = roleLimitSections[1];
roleid = roleLimitSections[0];
}
}
}
}
}

View File

@ -6,7 +6,6 @@ public class createTemplateInfo : Singleton<createTemplateInfo>
{
public auth_createTemplate auth_CreateTemplate=new auth_createTemplate();
public List<PlayerList> playerList;//鯤소죗깊
public List<NpcList> npcList;//NpcÁĐąí
// Start is called before the first frame update
void Start()
{