PanelToggle更改

This commit is contained in:
lq 2024-12-09 11:09:39 +08:00
parent 4a1837a740
commit 0462282d61
3 changed files with 49 additions and 17 deletions

View File

@ -2211,12 +2211,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 05b11d619e5d88a439384d80484d6952, type: 3}
m_Name:
m_EditorClassIdentifier:
choseJuBenSettingBtn: {fileID: 0}
emergencySettingBtn: {fileID: 0}
peoplePublishBtn: {fileID: 0}
materialReserveBtn: {fileID: 0}
dateSelectionBtn: {fileID: 0}
personnelmanagementBtn: {fileID: 287151820}
setName: {fileID: 0}
setDuty: {fileID: 0}
setScene: {fileID: 0}
@ -2226,6 +2220,13 @@ MonoBehaviour:
shaixuaninputField: {fileID: 466570545}
raycaster: {fileID: 1592869150}
eventSystem: {fileID: 1579865912}
chooseGroup: {fileID: 1695373862}
panelToggle:
- {fileID: 1194981513}
- {fileID: 361203553}
- {fileID: 1783365054}
- {fileID: 1247260776}
- {fileID: 452024858}
ManagerPanel: {fileID: 617308871}
peopleCountent: {fileID: 667280287}
peoplePrefab: {fileID: 4204671800070690484, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}

View File

@ -23,30 +23,46 @@ public class SelectedInfo
public class Panel : MonoBehaviour
{
[Header("组件")]
public Button choseJuBenSettingBtn;
public Button emergencySettingBtn;
public Button peoplePublishBtn;
public Button materialReserveBtn;
public Button dateSelectionBtn;
public Button personnelmanagementBtn;
[Header("设置人员")]
public Button setName;//设置人员
[Header("设置职责")]
public Button setDuty;//设置职责
[Header("设置场景")]
public Button setScene;//设置场景
[Header("整体安排")]
public Text arrangeText;//整体安排
[Header("确认信息按钮")]
public Button sureBtn;//确认信息按钮
[Header("场景的ToggleGroup")]
public ToggleGroup scenetoggleGroup;//场景的ToggleGroup
[Header("筛选输入框")]
public InputField shaixuaninputField;//筛选输入框
[Header("画布上的射线投射器")]
public GraphicRaycaster raycaster; // 画布上的射线投射器
[Header("事件系统")]
public EventSystem eventSystem; // 事件系统
public ToggleGroup chooseGroup;
public Toggle[] panelToggle;//面板选择Toggle
[Header("物体")]
[Header("人员管理界面")]
public GameObject ManagerPanel;//人员管理界面
[Header("人员的窗口")]
public Transform peopleCountent;//人员的窗口
[Header("人员的预制体")]
public GameObject peoplePrefab;//人员的预制体
[Header("物体")]
public Transform panelContent;
[Header("职责预制体")]
public GameObject dutyPrefab;//职责预制体
[Header("职责的窗口")]
public Transform dutyCount;//职责的窗口
public GameObject scenePrefab;
public Transform sceneCount;
[Header("场景预制体")]
public GameObject scenePrefab;//场景预制体
[Header("存放场景预制体")]
public Transform sceneCount;//存放场景预制体的地方
[Header("人员管理面板")]
public GameObject ManagerPanelPrefab; // 预制体,包含人员管理面板
@ -75,6 +91,10 @@ public class Panel : MonoBehaviour
DynamicLoadingPeople();
DynamicLoadingDuty();
DynamicLoadingScene();
for (int i = 1; i < panelToggle.Length; i++)
{
panelToggle[i].interactable = false;
}
}
// Update is called once per frame
@ -82,9 +102,9 @@ public class Panel : MonoBehaviour
{
GetData();
SetText();
PanelToggelSet();
//SetInputFile();
}
//==================================================================动态加载=======================================================
//动态加载人员
public void DynamicLoadingPeople()
@ -339,6 +359,16 @@ public class Panel : MonoBehaviour
//==========================================================功能===========================================
//判断是否能够点击按钮
public void PanelToggelSet()
{
Debug.Log("isSure<<<<<<<<<<<<<<<<<"+ selectScenePanel.isSure);
if(selectScenePanel.isSure)
{
panelToggle[1].interactable = selectScenePanel.isSure; // 启用第二个Toggle
panelToggle[2].interactable = selectScenePanel.isSure; // 启用第三个Toggle
}
}
private void UpdateConfirmButtonState()
{
// 如果人员、职责和场景都已选择,则启用确认按钮,否则禁用

View File

@ -56,7 +56,7 @@ public class SelectScenePanel : MonoBehaviour
public string idcidentName{ get; set; }
public string difficulty { get; set; }
public string isBuy { get; set; }
public bool isSure { get; set; }//判断是否点击了提交按钮
public bool isSure { get; set; } = false;//判断是否点击了提交按钮
public JSONReader jsonReader;
// Start is called before the first frame update
void Start()
@ -420,6 +420,7 @@ public class SelectScenePanel : MonoBehaviour
this.gameObject.SetActive(false);
panel.gameObject.SetActive(true);
DisableUIInteraction();
isSure = true;
}
//关闭按钮
@ -492,6 +493,7 @@ public class SelectScenePanel : MonoBehaviour
break; // 如果有一个场景 Toggle 被选中,停止检查
}
}
//检查事件选择
foreach (Toggle toggle in eventToggleList)
{
Debug.LogError("事件选择:" + anyToggleSelected);
@ -604,7 +606,6 @@ public class SelectScenePanel : MonoBehaviour
{
toggle.interactable = false; // 设置Toggle为不可交互
}
Debug.Log("schooltoggleList>>>>>>>>>>"+ schooltoggleList.Count);
// 禁用学校选择中的所有Toggle按钮
foreach (Toggle toggle in schooltoggleList)
{