【debug】增加强制进入关卡
parent
8c7a4cba9a
commit
bc53bc0a5a
|
|
@ -0,0 +1,32 @@
|
|||
namespace FightDebug
|
||||
{
|
||||
public abstract class BaseSubDebugPanel : ISubDebugPanel
|
||||
{
|
||||
|
||||
public bool isFold
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string title
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public BaseSubDebugPanel(string setTitle)
|
||||
{
|
||||
title = setTitle;
|
||||
}
|
||||
|
||||
public void DrawUI()
|
||||
{
|
||||
_OnDrawUI();
|
||||
}
|
||||
|
||||
protected virtual void _OnDrawUI()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 96918301128746309c668b27cf5092d5
|
||||
timeCreated: 1746596478
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FightDebug.Impl;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace FightDebug
|
||||
{
|
||||
public class FightDebugWindowV3 : EditorWindow
|
||||
{
|
||||
[MenuItem("Tools/*战斗信息Debug/FightDebugWindowV3 _F10")]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
var window = GetWindow<FightDebugWindowV3>();
|
||||
window._AddSubPanel(new Debug_ForceEnterLevel());
|
||||
window.titleContent = new GUIContent("战斗信息修改");
|
||||
window.Show();
|
||||
}
|
||||
|
||||
private List<ISubDebugPanel> _subDebugWindows = new List<ISubDebugPanel>();
|
||||
|
||||
private void _AddSubPanel(ISubDebugPanel subPanel)
|
||||
{
|
||||
_subDebugWindows.Add(subPanel);
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
for (int i = 0; i < _subDebugWindows.Count; i++)
|
||||
{
|
||||
var subDebugWindow = _subDebugWindows[i];
|
||||
subDebugWindow.isFold = EditorGUILayout.Foldout(subDebugWindow.isFold, subDebugWindow.title);
|
||||
if (subDebugWindow.isFold)
|
||||
{
|
||||
subDebugWindow.DrawUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e9f464fc51e8405f900dc5c186beedc1
|
||||
timeCreated: 1746596158
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
namespace FightDebug
|
||||
{
|
||||
public interface ISubDebugPanel
|
||||
{
|
||||
bool isFold { get; set; }
|
||||
string title { get; }
|
||||
void DrawUI();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 469e8c3a2418447db868c20a9a6ec37c
|
||||
timeCreated: 1746596415
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f181937cf49a4eda8d04e83ea5e94c40
|
||||
timeCreated: 1746596333
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
using cfg.LevelCfg;
|
||||
using Framework;
|
||||
using Gameplay.Level;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
namespace FightDebug.Impl
|
||||
{
|
||||
public class Debug_ForceEnterLevel : BaseSubDebugPanel
|
||||
{
|
||||
|
||||
private int _levelId;
|
||||
private DataLevel _levelConfig;
|
||||
|
||||
public Debug_ForceEnterLevel() : base("强制进入关卡")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void _OnDrawUI()
|
||||
{
|
||||
base._OnDrawUI();
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("关卡ID", GUILayout.Width(60));
|
||||
var newLevelId = EditorGUILayout.IntField(_levelId, GUILayout.Width(200));
|
||||
if (newLevelId != _levelId)
|
||||
{
|
||||
_levelId = newLevelId;
|
||||
_levelConfig = EditorTableManager.instance.tables.Level.GetOrDefault(newLevelId);
|
||||
if (_levelConfig == null)
|
||||
{
|
||||
EditorGUILayout.HelpBox("无效的关卡ID", MessageType.Error);
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
if (GUILayout.Button("进入关卡", GUILayout.Height(40)))
|
||||
{
|
||||
if (_levelConfig == null)
|
||||
{
|
||||
_levelConfig = EditorTableManager.instance.tables.Level.GetOrDefault(newLevelId);
|
||||
}
|
||||
if (_levelConfig == null)
|
||||
{
|
||||
// 弹出对话框提示
|
||||
EditorUtility.DisplayDialog("错误", "无效的关卡ID", "确定");
|
||||
return;
|
||||
}
|
||||
LevelManager.Instance.EnterLevelDirectly(_levelId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 32f5457b169e462ca08b977d0e67ba32
|
||||
timeCreated: 1746596384
|
||||
Loading…
Reference in New Issue