Compare commits
2 Commits
44a81c31a7
...
8bb12d1eb3
Author | SHA1 | Date | |
---|---|---|---|
8bb12d1eb3 | |||
3d8b063137 |
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"ID": "2001",
|
||||
"ID": 2001,
|
||||
"Note": "厨房起火",
|
||||
"Name": "2001",
|
||||
"Name": 2001,
|
||||
"Scene": "9003",
|
||||
"Position": "36,1,2",
|
||||
"Volume": "-1",
|
||||
@ -12,9 +12,9 @@
|
||||
"GeneralRole": "8000,8001,8002,8003,8004,8005,8006,8008,8009,8010"
|
||||
},
|
||||
{
|
||||
"ID": "2002",
|
||||
"ID": 2002,
|
||||
"Note": "学生宿舍起火",
|
||||
"Name": "2002",
|
||||
"Name": 2002,
|
||||
"Scene": "9002",
|
||||
"Position": "0,0,0",
|
||||
"Volume": "-1",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,7 @@ public class SelectScenePanel : MonoBehaviour
|
||||
public List<SceneItem> sceneItemList = new List<SceneItem>();//场景信息
|
||||
public List<Toggle> difficultyList = new List<Toggle>();//游戏难度
|
||||
public Button continueBtn;
|
||||
public Button submitBtn;
|
||||
public List<Toggle> scenetoggleList = new List<Toggle>();
|
||||
public List<Toggle> schooltoggleList = new List<Toggle>();
|
||||
public List<Toggle> eventToggleList = new List<Toggle>();
|
||||
@ -75,6 +76,7 @@ public class SelectScenePanel : MonoBehaviour
|
||||
void Update()
|
||||
{
|
||||
IsClick();
|
||||
IsSubmit();
|
||||
}
|
||||
|
||||
//动态加载场景选择预制体
|
||||
@ -160,14 +162,14 @@ public class SelectScenePanel : MonoBehaviour
|
||||
if (toggle != null)
|
||||
{
|
||||
// 将 Toggle 添加到 ToggleGroup 中
|
||||
toggle.group = eventGroup;
|
||||
toggle.group = incidentGroup;
|
||||
toggle.isOn = false;
|
||||
incidentInfos.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -194,7 +196,6 @@ public class SelectScenePanel : MonoBehaviour
|
||||
Debug.Log("eventData.ID:" + eventData.ID);
|
||||
Debug.Log("eventData.DisasterLocation:" + eventData.DisasterLocation);
|
||||
string[] incidentIds2 = eventData.DisasterLocation.Split('|');
|
||||
|
||||
GameObject slot = GameObject.Instantiate<GameObject>(eventPrefab, eventList);
|
||||
EventInfo item = slot.GetComponent<EventInfo>();
|
||||
item.eventId = eventData.ID;
|
||||
@ -210,8 +211,9 @@ public class SelectScenePanel : MonoBehaviour
|
||||
Toggle toggle = slot.GetComponent<Toggle>();
|
||||
if (toggle != null)
|
||||
{
|
||||
toggle.group = sceneGroup;
|
||||
toggle.group = eventGroup;
|
||||
eventInfoList.Add(item);
|
||||
evnetsceneList.Add(toggle);
|
||||
}
|
||||
toggle.onValueChanged.AddListener((isSelected) =>
|
||||
{
|
||||
@ -230,6 +232,7 @@ public class SelectScenePanel : MonoBehaviour
|
||||
{
|
||||
Debug.Log("disasterLocation>>>>>>>"+ disasterLocation);
|
||||
InstantiateIncidentPrefab(int.Parse(disasterLocation));
|
||||
OnRandomEventClick();
|
||||
}
|
||||
|
||||
createTemplateInfo.Instance.auth_CreateTemplate.sceneId = item.eventId.ToString();
|
||||
@ -307,11 +310,12 @@ public class SelectScenePanel : MonoBehaviour
|
||||
//随机事件
|
||||
public void OnRandomEventClick()
|
||||
{
|
||||
|
||||
// 随机选择一个事件
|
||||
if (eventInfoList.Count > 1)
|
||||
{
|
||||
int randomIndex = Random.Range(0, eventInfoList.Count);
|
||||
|
||||
int randomIndex = Random.Range(0, eventInfoList.Count);
|
||||
// 取消所有Toggle的选中状态
|
||||
foreach (Toggle toggle in eventToggleList)
|
||||
{
|
||||
@ -336,8 +340,8 @@ public class SelectScenePanel : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("只有一个事件!!!");
|
||||
randomEventBtn.gameObject.SetActive(false);
|
||||
Debug.LogWarning("事件列表为空!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -353,7 +357,6 @@ public class SelectScenePanel : MonoBehaviour
|
||||
auth_CreateTemplate.mode = this.difficulty;//给结构体“难度”赋值
|
||||
}
|
||||
}
|
||||
//Debug.Log("%%%%%%%%%%%%%3:" + this.difficulty);
|
||||
}
|
||||
|
||||
//继续按钮,点击后上传数据
|
||||
@ -362,7 +365,7 @@ public class SelectScenePanel : MonoBehaviour
|
||||
SelectSchoolBtn();
|
||||
SelectSceneBtn();
|
||||
InstantiateEventPrefab(this.scnenId);
|
||||
SetFirstChoise(scenetoggleList);
|
||||
SetFirstChoise(evnetsceneList);
|
||||
if (continueBtn.interactable)
|
||||
{
|
||||
sceneLable.gameObject.SetActive(false);
|
||||
@ -441,6 +444,40 @@ public class SelectScenePanel : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
//通过判断EventSceneList里面的IsOn是否打开判断提交按钮是否置灰
|
||||
public void IsSubmit()
|
||||
{
|
||||
bool anyToggleSelected = false;
|
||||
bool anyeventSelected = false;
|
||||
Debug.Log("evnetsceneList>>>>"+ evnetsceneList.Count());
|
||||
// 检查场景选择
|
||||
foreach (Toggle toggle in evnetsceneList)
|
||||
{
|
||||
if (toggle.isOn)
|
||||
{
|
||||
anyToggleSelected = true;
|
||||
break; // 如果有一个场景 Toggle 被选中,停止检查
|
||||
}
|
||||
}
|
||||
foreach (Toggle toggle in eventToggleList)
|
||||
{
|
||||
if (toggle.isOn)
|
||||
{
|
||||
anyeventSelected = true;
|
||||
break; // 如果有一个场景 Toggle 被选中,停止检查
|
||||
}
|
||||
}
|
||||
// 根据是否有 Toggle 被选中,设置 ContinueBtn 是否可交互
|
||||
if (submitBtn != null && anyToggleSelected == true&& anyeventSelected==true)
|
||||
{
|
||||
submitBtn.interactable = anyToggleSelected; // 如果有选中的 Toggle,继续按钮可交互,否则不可交互
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("提交按钮组件未找到!");
|
||||
}
|
||||
}
|
||||
|
||||
//默认选择第一个Toggle
|
||||
public void SetFirstChoise(List<Toggle> toggles)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user