_xiaofang/xiaofang/Assets/Script/UI/SceneItem.cs

63 lines
1.7 KiB
C#
Raw Normal View History

using Newtonsoft.Json;
2024-11-29 09:44:45 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SceneItem : MonoBehaviour
{
public int sceneId;
2024-12-01 17:51:09 +08:00
public int sceneType;
2024-11-29 09:44:45 +08:00
public Text sceneName;
public Image sceneImage;
public Image maskImage;
public string roleLimit;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public int limitNum;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-12-02 00:35:53 +08:00
public int dutyId;
public JSONReader jsonReader;
2024-11-29 09:44:45 +08:00
public bool IsOpen { get; set; } = true;
// Start is called before the first frame update
void Start()
{
jsonReader = GameObject.Find("JsonObj").GetComponent<JSONReader>();
2024-11-29 09:44:45 +08:00
}
// Update is called once per frame
void Update()
{
}
//<2F>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>
public void SetData()
{
foreach (var npc in jsonReader.locationDictionary)
{
Debug.Log("111111111111" + npc.Value.RoleLimit);
// ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>ŷָ<C5B7> RoleLimit <20>ֶ<EFBFBD>
string roleLimit = npc.Value.RoleLimit;
// <20><><EFBFBD><EFBFBD> RoleLimit <20><><EFBFBD>ǿ<EFBFBD><C7BF>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ն<EFBFBD><D5B6>ŷָ<C5B7>
if (!string.IsNullOrEmpty(roleLimit))
{
string[] roleLimits = roleLimit.Split(',');
// <20><><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>Ľ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
foreach (string role in roleLimits)
{
Debug.Log("RoleLimit Item: " + role);
// <20>жϽ<D0B6>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ -1
if (role == "-1")
{
Debug.Log("<22><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ-1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ޣ<EFBFBD>");
}
}
}
else
{
Debug.Log("RoleLimit is empty for NPC ID: " + npc.Key);
}
}
}
2024-11-29 09:44:45 +08:00
}