修复场景报错问题

This commit is contained in:
lujiajian 2026-02-07 15:54:17 +08:00
parent 4577fe6940
commit ab8e0acd05
3 changed files with 34 additions and 24 deletions

View File

@ -5587,6 +5587,17 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 96343c47fe8d35a44a5244521831890f, type: 3}
m_Name:
m_EditorClassIdentifier:
SubjectTog:
- {fileID: 8259052942713030222}
- {fileID: 5678060293557198011}
- {fileID: 8089084432970626067}
- {fileID: 8811260483391861293}
- {fileID: 6655939487465875950}
- {fileID: 657600881843389557}
- {fileID: 7027064101671987027}
- {fileID: 6672875250636715790}
- {fileID: 9149981731159942754}
- {fileID: 6296556775557808310}
--- !u!1 &6325379169560023408
GameObject:
m_ObjectHideFlags: 0

View File

@ -8,7 +8,7 @@ using UnityEngine.UI;
public class SubjectToggle : BaseItem, IPointerEnterHandler, IPointerExitHandler
{
public Toggle Toggle_Subject;
public UI_ChooesPanel ChooesPanel;
//public UI_ChooesPanel ChooesPanel;
public UI_TopTitlePanel TopTitlePanel;
public Sprite[] subjectSprites; //科目选择图片
public TextMeshProUGUI SubjectNameText; //科目
@ -29,7 +29,9 @@ public class SubjectToggle : BaseItem, IPointerEnterHandler, IPointerExitHandler
{
case "Subject1":
//Bootstrap.Instance.uiManager.HidePanel<UI_TopTitlePanel>();
Bootstrap.Instance.uiManager.ShowPanel<UI_LoadingPanel>(this, E_UI_Layer.System, (panel) =>
Bootstrap.Instance.uiManager.ShowPanel<UI_RoamingPanel>(this, E_UI_Layer.System, (panel) =>
{
Bootstrap.Instance.uiManager.ShowPanel<UI_LoadingPanel>(this, E_UI_Layer.System, (panel) =>
{
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 0.5f);
Bootstrap.Instance.scenesManager.LoadSceneAsyn(this, "xianchang", () =>
@ -38,17 +40,14 @@ public class SubjectToggle : BaseItem, IPointerEnterHandler, IPointerExitHandler
{
Bootstrap.Instance.uiManager.ShowPanel<UI_ExperimentChooesPanel>(this, E_UI_Layer.Top, (panel) =>
{
Bootstrap.Instance.uiManager.ShowPanel<UI_RoamingPanel>(this, E_UI_Layer.System, (panel) =>
{
Bootstrap.Instance.uiManager.HidePanel<UI_ChooesPanel>();
Debug.Log("加载场景成功");
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 2f);
});
Debug.Log("加载场景成功");
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 2f);
Bootstrap.Instance.uiManager.HidePanel<UI_ChooesPanel>();
});
});
});
});
});
break;
case "Subject2":
@ -134,19 +133,19 @@ public class SubjectToggle : BaseItem, IPointerEnterHandler, IPointerExitHandler
/// 加载文件夹中图片
/// </summary>
/// <param name="path"></param>
public void LoadImage(string path)
{
Sprite sprite = Resources.Load<Sprite>(path);
if (sprite != null)
{
ChooesPanel.targetimage.sprite = sprite;
Debug.Log("sprite加载成功");
}
else
{
Debug.Log("sprite加载失败当前文件夹未找到");
}
}
//public void LoadImage(string path)
//{
// Sprite sprite = Resources.Load<Sprite>(path);
// if (sprite != null)
// {
// ChooesPanel.targetimage.sprite = sprite;
// Debug.Log("sprite加载成功");
// }
// else
// {
// Debug.Log("sprite加载失败当前文件夹未找到");
// }
//}
/// <summary>
/// toggle变大

View File

@ -123,8 +123,8 @@ public class UI_TopTitlePanel : BasePanel
Bootstrap.Instance.uiManager.ShowPanel<UI_TopTitlePanel>(this, E_UI_Layer.Top, (panel) =>
{
Bootstrap.Instance.uiManager.HidePanel<UI_LoginPanel>();
Bootstrap.Instance.uiManager.HidePanel< UI_TopTipPanel>();
Bootstrap.Instance.uiManager.HidePanel< UI_ExperimentChooesPanel>();
Bootstrap.Instance.uiManager.HidePanel<UI_TopTipPanel>();
Bootstrap.Instance.uiManager.HidePanel<UI_ExperimentChooesPanel>();
Debug.Log("场景加载成功");
});
});