bug修改
This commit is contained in:
parent
e80d187860
commit
e03032830a
@ -37,7 +37,7 @@ public class SelectScenePanel : MonoBehaviour
|
||||
public List<Toggle> difficultyList = new List<Toggle>();//游戏难度
|
||||
public Button continueBtn;
|
||||
public List<Toggle> scenetoggleList = new List<Toggle>();
|
||||
public List<Toggle> schooltoggleList=new List<Toggle>();
|
||||
public List<Toggle> schooltoggleList = new List<Toggle>();
|
||||
public List<Toggle> eventToggleList = new List<Toggle>();
|
||||
public List<Toggle> evnetsceneList = new List<Toggle>();
|
||||
|
||||
@ -174,29 +174,29 @@ public class SelectScenePanel : MonoBehaviour
|
||||
//动态加载事件选择预制体
|
||||
public void InstantiateIncidentPrefab(int eventId)
|
||||
{
|
||||
//foreach (var eventData in jsonReader.incidentSiteDictionary)
|
||||
//{
|
||||
// if(eventData.Key==eventId)
|
||||
// {
|
||||
// GameObject slot = GameObject.Instantiate<GameObject>(eventPrefab, eventList);
|
||||
// IncidentInfo item = slot.GetComponent<IncidentInfo>();
|
||||
// item.incidentText.text = eventData.Value.Note;
|
||||
// item.incidentID = eventData.Value.ID;
|
||||
// Toggle toggle = slot.GetComponent<Toggle>();
|
||||
foreach (var eventData in jsonReader.incidentSiteDictionary)
|
||||
{
|
||||
if (eventData.Key == eventId)
|
||||
{
|
||||
GameObject slot = GameObject.Instantiate<GameObject>(incidentPrefab, incidentList);
|
||||
IncidentInfo item = slot.GetComponent<IncidentInfo>();
|
||||
item.incidentText.text = eventData.Value.Note;
|
||||
item.incidentID = eventData.Value.ID;
|
||||
Toggle toggle = slot.GetComponent<Toggle>();
|
||||
|
||||
// if (toggle != null)
|
||||
// {
|
||||
// // ½« Toggle Ìí¼Óµ½ ToggleGroup ÖÐ
|
||||
// toggle.group = eventGroup;
|
||||
// toggle.isOn = false;
|
||||
// incidentInfos.Add(item);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
if (toggle != null)
|
||||
{
|
||||
// 将 Toggle 添加到 ToggleGroup 中
|
||||
toggle.group = eventGroup;
|
||||
toggle.isOn = false;
|
||||
incidentInfos.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//点击继续按钮后更换场景图片及名称
|
||||
@ -260,7 +260,7 @@ public class SelectScenePanel : MonoBehaviour
|
||||
//学校选择
|
||||
public void SelectSchoolBtn()
|
||||
{
|
||||
if(isSure)
|
||||
if (isSure)
|
||||
{
|
||||
SchoolInfo gameObject = GetComponentInChildren<SchoolInfo>();
|
||||
foreach (SchoolInfo item in schoolInfoList)
|
||||
@ -289,6 +289,7 @@ public class SelectScenePanel : MonoBehaviour
|
||||
// 设置场景名称
|
||||
this.sceneName = item.sceneName.text; // 获取 Text 组件的文本
|
||||
this.scnenId = item.sceneId;
|
||||
Debug.Log("------------this.scnenId:" + this.scnenId);
|
||||
|
||||
createTemplateInfo.Instance.auth_CreateTemplate.sceneId = item.sceneId.ToString();
|
||||
sceneSelected = true;
|
||||
@ -420,23 +421,32 @@ public class SelectScenePanel : MonoBehaviour
|
||||
//关闭按钮
|
||||
public void OnClickCloseBtn()
|
||||
{
|
||||
// 清空事件列表
|
||||
eventInfoList.Clear();
|
||||
|
||||
// 销毁所有已实例化的事件预制体
|
||||
foreach (Transform child in eventList)
|
||||
{
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
|
||||
// 如果需要,也可以清空其他相关信息
|
||||
eventToggleList.Clear();
|
||||
eventId = -1;
|
||||
eventName = string.Empty;
|
||||
|
||||
Debug.Log("事件列表已清空,UI已重置");
|
||||
if (schoolChoiceLable.gameObject.active == false)
|
||||
{
|
||||
foreach (Transform child in sceneList)
|
||||
{
|
||||
child.gameObject.SetActive(false);
|
||||
}
|
||||
sceneLable.gameObject.SetActive(true);
|
||||
schoolChoiceLable.gameObject.SetActive(true);
|
||||
eventChoiceLable.gameObject.SetActive(false);
|
||||
incidentLable.gameObject.SetActive(false);
|
||||
InstantiateScenePrefab();
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//通过判断Toggle的IsOn是否被打开来判断继续按钮是否置灰
|
||||
@ -447,7 +457,6 @@ public class SelectScenePanel : MonoBehaviour
|
||||
// 检查场景选择
|
||||
foreach (Toggle toggle in scenetoggleList)
|
||||
{
|
||||
//Debug.Log("++++++++++++++++++++++++=" + scenetoggleList.Count());
|
||||
if (toggle.isOn)
|
||||
{
|
||||
anyToggleSelected = true;
|
||||
|
Loading…
Reference in New Issue
Block a user