630 lines
22 KiB
C#
630 lines
22 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using GameCore;
|
|
using asap.core;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using cfg;
|
|
using IngameDebugConsole;
|
|
using UnityEngine.AddressableAssets;
|
|
using game;
|
|
using System.Linq;
|
|
|
|
public class DeBugPanel : MonoBehaviour
|
|
{
|
|
static public bool isShow = true;
|
|
private CanvasGroup _canvasGroup;
|
|
private Button btn_close;
|
|
private Button root_review_closs;
|
|
private Button btn_changjing;
|
|
private Button btn_yugan;
|
|
//private Button btn_sure;
|
|
private Button btn_sure1;
|
|
|
|
TMP_Text text_cur_time;
|
|
|
|
TMP_Text text_cur_viplv;
|
|
TMP_Text text_cur_pricelv;
|
|
public TMP_InputField inputField_vip;
|
|
public Button btn_vip;
|
|
TMP_InputField inputField_Seconds;
|
|
Button btn_Day;
|
|
Button btn_Seconds;
|
|
TMP_InputField inputField_Digging;
|
|
Button btn_Digging;
|
|
|
|
TMP_InputField inputField_duel;
|
|
Button btn_duel;
|
|
private TMP_InputField inputField_yu;
|
|
//private TMP_InputField inputField_grade;
|
|
|
|
TMP_InputField inputField_itemId;
|
|
TMP_InputField inputField_itemCount;
|
|
|
|
Button btn_addItem;
|
|
|
|
//账号等级
|
|
TMP_InputField inputField_level;
|
|
|
|
Button btn_level;
|
|
|
|
//账号等级
|
|
TMP_InputField inputField_supplyDrop;
|
|
|
|
Button btn_supplyDrop;
|
|
|
|
//活动ID
|
|
TMP_InputField inputField_activityId;
|
|
Button btn_activityId;
|
|
|
|
//鱼竿
|
|
public
|
|
TMP_InputField inputField_rod;
|
|
public
|
|
Button btn_rodFull;
|
|
public
|
|
Button btn_rod_full_star;
|
|
//鱼熟练度全升级
|
|
Button btn_fishFull;
|
|
//鱼熟练度全满
|
|
Button btn_fishFull1;
|
|
//鱼熟练度全升级
|
|
Button btn_fishFullAll;
|
|
Button btn_fishFullAll1;
|
|
//图鉴全满
|
|
Button btn_albumFull;
|
|
Button btn_show_panel;
|
|
|
|
TMP_InputField inputField_guide;
|
|
Button btn_guide;
|
|
|
|
TMP_InputField inputField_build;
|
|
Button btn_build;
|
|
|
|
Button btn_bomb;
|
|
TMP_InputField inputField_btn_bomb;
|
|
|
|
Button btn_aquarium;
|
|
Button btn_raid;
|
|
Button btn_bomb_game;
|
|
|
|
private GameObject root_review;
|
|
private GameObject root;
|
|
|
|
private TMP_Text text_title;
|
|
|
|
private Transform content;
|
|
|
|
GameObject item;
|
|
|
|
List<DeBugItem> deBugItems = new List<DeBugItem>();
|
|
|
|
int _index = 0;
|
|
Button btn_album_orientation;
|
|
Button btn_album_orientation1;
|
|
Button btn_console_toggle;
|
|
public TMP_InputField inputField_mmt;
|
|
public Button btn_mmt;
|
|
float inflate = 0f;
|
|
// Start is called before the first frame update
|
|
void Awake()
|
|
{
|
|
inputField_itemId = transform.Find("root/InputField_icon").GetComponent<TMP_InputField>();
|
|
inputField_itemCount = transform.Find("root/InputField_icon_num").GetComponent<TMP_InputField>();
|
|
btn_addItem = transform.Find("root/btn_sure2/btn_green").GetComponent<Button>();
|
|
inputField_level = transform.Find("root/InputField_account_grade").GetComponent<TMP_InputField>();
|
|
btn_level = transform.Find("root/btn_sure3/btn_green").GetComponent<Button>();
|
|
|
|
inputField_supplyDrop = transform.Find("root/InputField_supplyDropIndex").GetComponent<TMP_InputField>();
|
|
btn_supplyDrop = transform.Find("root/btn_suresupplyDrop/btn_green").GetComponent<Button>();
|
|
|
|
inputField_activityId = transform.Find("root/InputField_event").GetComponent<TMP_InputField>();
|
|
btn_activityId = transform.Find("root/btn_sure4/btn_green").GetComponent<Button>();
|
|
btn_fishFull = transform.Find("root/btn_fish_upgrade1/btn_green").GetComponent<Button>();
|
|
btn_fishFull1 = transform.Find("root/btn_fish_full1/btn_green").GetComponent<Button>();
|
|
btn_fishFullAll = transform.Find("root/btn_fish_upgrade2/btn_green").GetComponent<Button>();
|
|
btn_fishFullAll1 = transform.Find("root/btn_fish_full2/btn_green").GetComponent<Button>();
|
|
btn_albumFull = transform.Find("root/btn_album_full/btn_green").GetComponent<Button>();
|
|
btn_show_panel = transform.Find("root/btn_show_panel/btn_green").GetComponent<Button>();
|
|
inputField_guide = transform.Find("root/InputField_guide").GetComponent<TMP_InputField>();
|
|
btn_guide = transform.Find("root/btn_guide/btn_green").GetComponent<Button>();
|
|
inputField_build = transform.Find("root/InputField_build").GetComponent<TMP_InputField>();
|
|
btn_build = transform.Find("root/btn_build/btn_green").GetComponent<Button>();
|
|
btn_bomb = transform.Find("root/btn_bomb/btn_green").GetComponent<Button>();
|
|
inputField_btn_bomb = transform.Find("root/InputField_bomb").GetComponent<TMP_InputField>();
|
|
|
|
btn_aquarium = transform.Find("root/btn_aquarium/btn_green").GetComponent<Button>();
|
|
btn_raid = transform.Find("root/btn_raid/btn_green").GetComponent<Button>();
|
|
btn_bomb_game = transform.Find("root/btn_bomb_game/btn_green").GetComponent<Button>();
|
|
_canvasGroup = GetComponent<CanvasGroup>();
|
|
root = transform.Find("root").gameObject;
|
|
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
|
|
root_review_closs = transform.Find("root_review/btn_close").GetComponent<Button>();
|
|
btn_changjing = transform.Find("root/btn_changjing/btn_green").GetComponent<Button>();
|
|
btn_yugan = transform.Find("root/btn_yugan/btn_green").GetComponent<Button>();
|
|
//btn_sure = transform.Find("root/btn_sure/btn_green").GetComponent<Button>();
|
|
btn_sure1 = transform.Find("root/btn_sure1/btn_green").GetComponent<Button>();
|
|
inputField_yu = transform.Find("root/InputField_yu").GetComponent<TMP_InputField>();
|
|
//inputField_grade = transform.Find("root/InputField_grade").GetComponent<TMP_InputField>();
|
|
root_review = transform.Find("root_review").gameObject;
|
|
text_title = transform.Find("root_review/text_title").GetComponent<TMP_Text>();
|
|
content = transform.Find("root_review/Scroll View/Viewport/Content");
|
|
item = transform.Find("root_review/Scroll View/Viewport/Content/Item").gameObject;
|
|
btn_album_orientation = transform.Find("root/btn_album_orientation/btn_green").GetComponent<Button>();
|
|
btn_album_orientation1 = transform.Find("root/btn_album_orientation1/btn_green").GetComponent<Button>();
|
|
btn_console_toggle = transform.Find("root/Console/btn_green").GetComponent<Button>();
|
|
SetSecondsTime();
|
|
SetDigging();
|
|
SetDuelTier();
|
|
SetVIP();
|
|
// SetMMT();
|
|
|
|
inflate = GContext.container.Resolve<PlayerData>().InflationRate;
|
|
}
|
|
void SetVIP()
|
|
{
|
|
text_cur_viplv = transform.Find("root/text_cur_viplv").GetComponent<TMP_Text>();
|
|
text_cur_pricelv = transform.Find("root/text_cur_pricelv").GetComponent<TMP_Text>();
|
|
btn_vip.onClick.AddListener(SetPriceLv);
|
|
PlayerData playerData = GContext.container.Resolve<PlayerData>();
|
|
var _tables = GContext.container.Resolve<Tables>();
|
|
var dynamicVipParam = _tables.TbGlobalConfig.DynamicVipParam;
|
|
int allPackPoints = (int)(playerData.vipAllScore * dynamicVipParam[0] + playerData.vipLastScore * dynamicVipParam[1]);
|
|
text_cur_viplv.text = $"{playerData.vip}({playerData.vipAllScore})";
|
|
text_cur_pricelv.text = $"{playerData.PriceLv}({allPackPoints})";
|
|
}
|
|
|
|
void SetPriceLv()
|
|
{
|
|
string secStr = inputField_vip.text;
|
|
if (int.TryParse(secStr, out int sec))
|
|
{
|
|
PlayerData playerData = GContext.container.Resolve<PlayerData>();
|
|
playerData.SetPriceLevel(sec);
|
|
var _tables = GContext.container.Resolve<Tables>();
|
|
var dynamicVipParam = _tables.TbGlobalConfig.DynamicVipParam;
|
|
int allPackPoints = (int)(playerData.vipAllScore * dynamicVipParam[0] + playerData.vipLastScore * dynamicVipParam[1]);
|
|
text_cur_viplv.text = $"{playerData.vip}({playerData.vipAllScore})";
|
|
text_cur_pricelv.text = $"{playerData.PriceLv}({allPackPoints})";
|
|
}
|
|
}
|
|
|
|
void SetSecondsTime()
|
|
{
|
|
text_cur_time = transform.Find("root/text_cur_time").GetComponent<TMP_Text>();
|
|
inputField_Seconds = transform.Find("root/InputField_Seconds").GetComponent<TMP_InputField>();
|
|
inputField_Seconds.text = ZZTimeHelper.LocalTimeOffsetInSec.ToString();
|
|
btn_Day = transform.Find("root/btn_Day/btn_green").GetComponent<Button>();
|
|
btn_Seconds = transform.Find("root/btn_Seconds/btn_green").GetComponent<Button>();
|
|
|
|
text_cur_time.text = ZZTimeHelper.UtcNow().ToString("yyyy/MM/dd HH:mm:ss");
|
|
btn_Seconds.onClick.AddListener(OnClickSetTime);
|
|
btn_Day.onClick.AddListener(OnClickSetTimeDay);
|
|
}
|
|
|
|
void OnClickSetTime()
|
|
{
|
|
string secStr = inputField_Seconds.text;
|
|
if (!string.IsNullOrEmpty(secStr))
|
|
{
|
|
if (int.TryParse(secStr, out int sec))
|
|
{
|
|
ZZTimeHelper.LocalTimeOffsetInSec = sec;
|
|
text_cur_time.text = ZZTimeHelper.UtcNow().ToString("yyyy/MM/dd HH:mm:ss");
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("输入的秒数格式不正确");
|
|
}
|
|
}
|
|
}
|
|
void OnClickSetTimeDay()
|
|
{
|
|
string secStr = inputField_Seconds.text;
|
|
if (!string.IsNullOrEmpty(secStr))
|
|
{
|
|
if (int.TryParse(secStr, out int sec))
|
|
{
|
|
ZZTimeHelper.LocalTimeOffsetInSec = sec * 86400;
|
|
text_cur_time.text = ZZTimeHelper.UtcNow().ToString("yyyy/MM/dd HH:mm:ss");
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("输入的天数格式不正确");
|
|
}
|
|
}
|
|
}
|
|
|
|
void SetDigging()
|
|
{
|
|
inputField_Digging = transform.Find("root/InputField_Digging").GetComponent<TMP_InputField>();
|
|
btn_Digging = transform.Find("root/btn_Digging/btn_green").GetComponent<Button>();
|
|
btn_Digging.onClick.AddListener(OnClickDigging);
|
|
}
|
|
void OnClickDigging()
|
|
{
|
|
string indexStr = inputField_Digging.text;
|
|
if (!string.IsNullOrEmpty(indexStr))
|
|
{
|
|
int.TryParse(indexStr, out int index);
|
|
}
|
|
}
|
|
private void Start()
|
|
{
|
|
btn_close.onClick.AddListener(OnClosePanel);
|
|
btn_changjing.onClick.AddListener(OnChangjing);
|
|
btn_yugan.onClick.AddListener(OnYugan);
|
|
//btn_sure.onClick.AddListener(OnSure);
|
|
btn_sure1.onClick.AddListener(OnSure1);
|
|
btn_addItem.onClick.AddListener(AddItem);
|
|
btn_level.onClick.AddListener(SetLevel);
|
|
|
|
btn_supplyDrop.onClick.AddListener(SetSupplyDrop);
|
|
|
|
btn_activityId.onClick.AddListener(SetaCtivityId);
|
|
btn_rodFull.onClick.AddListener(() =>
|
|
{
|
|
if (!string.IsNullOrEmpty(inputField_rod.text))
|
|
{
|
|
int level = Convert.ToInt32(inputField_rod.text);
|
|
GContext.container.Resolve<PlayerFishData>().GMSetLvAll(level);
|
|
}
|
|
});
|
|
btn_rod_full_star.onClick.AddListener(() =>
|
|
{
|
|
if (!string.IsNullOrEmpty(inputField_rod.text))
|
|
{
|
|
int level = Convert.ToInt32(inputField_rod.text);
|
|
GContext.container.Resolve<PlayerFishData>().GMSetStarAll(level);
|
|
}
|
|
});
|
|
btn_fishFull.onClick.AddListener(() =>
|
|
{
|
|
GContext.container.Resolve<PlayerFishData>().GMAddAllFishMastery();
|
|
});
|
|
btn_fishFull1.onClick.AddListener(() =>
|
|
{
|
|
GContext.container.Resolve<PlayerFishData>().GMAddAllFishMastery1();
|
|
});
|
|
btn_fishFullAll.onClick.AddListener(() =>
|
|
{
|
|
GContext.container.Resolve<PlayerFishData>().GMAddAllFishMastery(true);
|
|
});
|
|
btn_fishFullAll1.onClick.AddListener(() =>
|
|
{
|
|
GContext.container.Resolve<PlayerFishData>().GMAddAllFishMastery1(true);
|
|
});
|
|
btn_albumFull.onClick.AddListener(() =>
|
|
{
|
|
//GContext.container.Resolve<AlbumData>().GMAddAll();
|
|
// 已移除 MMTService 模块
|
|
// MMTService mmService = GContext.container.Resolve<MMTService>();
|
|
// mmService.CanShowHand = !mmService.CanShowHand;
|
|
// GContext.Publish(new ShowHandEvent() { isShow = mmService.CanShowHand });
|
|
});
|
|
btn_guide.onClick.AddListener(() =>
|
|
{
|
|
if (!string.IsNullOrEmpty(inputField_guide.text))
|
|
{
|
|
GContext.container.Resolve<GuideDataCenter>().ClearGuide(inputField_guide.text);
|
|
OnClosePanel();
|
|
}
|
|
});
|
|
btn_build.onClick.AddListener(() =>
|
|
{
|
|
if (!string.IsNullOrEmpty(inputField_build.text))
|
|
{
|
|
if (inputField_build.text.Contains("-"))
|
|
{
|
|
string[] strings = inputField_build.text.Split('-');
|
|
GContext.container.Resolve<CampDataMM>().SetCampAreaIndex(strings[0]);
|
|
GContext.container.Resolve<CampDataMM>().SetCampAreaStep(strings[1]);
|
|
GContext.container.Resolve<CampDataMM>().UpdateCurrentData();
|
|
}
|
|
else
|
|
{
|
|
GContext.container.Resolve<CampDataMM>().ChangeCampId(int.Parse(inputField_build.text));
|
|
}
|
|
OnClosePanel();
|
|
}
|
|
});
|
|
btn_bomb.onClick.AddListener(() =>
|
|
{
|
|
if (!string.IsNullOrEmpty(inputField_btn_bomb.text))
|
|
{
|
|
GContext.container.Resolve<SmallGameData>().GMSetBomb(inputField_btn_bomb.text);
|
|
OnClosePanel();
|
|
}
|
|
});
|
|
|
|
root_review_closs.onClick.AddListener(() => SetRootReview(false));
|
|
btn_show_panel.onClick.AddListener(ChangeShow);
|
|
btn_album_orientation.onClick.AddListener(() =>
|
|
{
|
|
Screen.orientation = ScreenOrientation.LandscapeLeft;
|
|
});
|
|
btn_album_orientation1.onClick.AddListener(() =>
|
|
{
|
|
Screen.orientation = ScreenOrientation.Portrait;
|
|
});
|
|
|
|
btn_console_toggle.onClick.AddListener(() =>
|
|
{
|
|
if (null == DebugLogManager.Instance)
|
|
{
|
|
Addressables.InstantiateAsync("IngameDebugConsole");
|
|
}
|
|
else
|
|
{
|
|
Destroy(DebugLogManager.Instance.gameObject);
|
|
}
|
|
});
|
|
btn_aquarium.onClick.AddListener(GMShootFishRefresh);
|
|
btn_bomb_game.onClick.AddListener(async () =>
|
|
{
|
|
UIManager.Instance.DestroyUI(UITypes.DeBugPanel);
|
|
});
|
|
btn_raid.onClick.AddListener(async () =>
|
|
{
|
|
UIManager.Instance.DestroyUI(UITypes.DeBugPanel);
|
|
});
|
|
}
|
|
// Update is called once per frame
|
|
|
|
|
|
// public override void OnPause()
|
|
// {
|
|
// //当弹出新的面板的时候,让主菜单面板不再和鼠标交互
|
|
// _canvasGroup.alpha = 0;
|
|
// _canvasGroup.blocksRaycasts = false;
|
|
// }
|
|
|
|
public void OnEnable()
|
|
{
|
|
//当弹出新的面板的时候,让主菜单面板不再和鼠标交互
|
|
_canvasGroup.alpha = 1;
|
|
_canvasGroup.blocksRaycasts = true;
|
|
|
|
//UIManager.Instance.DestroyUI(UITypes.HomePanel);
|
|
GContext.Publish(new HideHomePanelEvent());
|
|
}
|
|
|
|
public void OnDisable()
|
|
{
|
|
// _canvasGroup.alpha = 0;
|
|
// _canvasGroup.blocksRaycasts = false;
|
|
|
|
RestartShowHomeUIEvent restartShowHomeUIEvent = new RestartShowHomeUIEvent();
|
|
GContext.Publish(restartShowHomeUIEvent);
|
|
}
|
|
|
|
public void OnClosePanel()
|
|
{
|
|
UIManager.Instance.DestroyUI(UITypes.DeBugPanel);
|
|
}
|
|
|
|
void SetRootReview(bool isShow, int index = 0)
|
|
{
|
|
_index = index;
|
|
root_review.SetActive(isShow);
|
|
root.SetActive(!isShow);
|
|
}
|
|
|
|
void OnChangjing()
|
|
{
|
|
if (_index == 2)
|
|
return;
|
|
var list = GContext.container.Resolve<Tables>().TbMapData.DataList;
|
|
int count = deBugItems.Count;
|
|
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
deBugItems[i].gameObject.SetActive(false);
|
|
}
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
if (i >= count)
|
|
{
|
|
deBugItems.Add(Instantiate(item, content).AddComponent<DeBugItem>());
|
|
}
|
|
|
|
var i1 = i;
|
|
var map_name = LocalizationMgr.GetText(list[i].Name_l10n_key);
|
|
deBugItems[i].deBugItemData = new DeBugItemData($"{map_name}\n{list[i].ID}",
|
|
async () =>
|
|
{
|
|
ChangeMapDataAsyncEvent changeMapDataAsyncEvent = new ChangeMapDataAsyncEvent(list[i1].ID);
|
|
GContext.Publish(changeMapDataAsyncEvent);
|
|
await changeMapDataAsyncEvent.source.Task;
|
|
});
|
|
deBugItems[i].gameObject.SetActive(true);
|
|
}
|
|
|
|
SetRootReview(true, 2);
|
|
}
|
|
|
|
void OnYugan()
|
|
{
|
|
if (_index == 1)
|
|
return;
|
|
var list = GContext.container.Resolve<Tables>().TbRodData.DataList;
|
|
int count = deBugItems.Count;
|
|
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
deBugItems[i].gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void OnSure1()
|
|
{
|
|
if (!string.IsNullOrEmpty(inputField_yu.text))
|
|
{
|
|
int yu = Convert.ToInt32(inputField_yu.text);
|
|
var fishItem = GContext.container.Resolve<Tables>().GetItemData(yu);
|
|
if (fishItem != null && fishItem.RedirectID > 0 && fishItem.Type == 4)
|
|
{
|
|
GContext.container.Resolve<FishingData>().fishItem = fishItem;
|
|
GContext.Publish(new ChangeFishDataEvent(fishItem.RedirectID));
|
|
}
|
|
else
|
|
{
|
|
ToastPanel.Show("输入的ID不是鱼");
|
|
}
|
|
}
|
|
}
|
|
|
|
void AddItem()
|
|
{
|
|
int.TryParse(inputField_itemCount.text, out int count);
|
|
if (count == 0)
|
|
{
|
|
count = 1;
|
|
}
|
|
GContext.container.Resolve<PlayerItemData>().AddItemCount(Convert.ToInt32(inputField_itemId.text), count, null);
|
|
}
|
|
|
|
|
|
|
|
void SetLevel()
|
|
{
|
|
if (!string.IsNullOrEmpty(inputField_level.text))
|
|
{
|
|
int level = Convert.ToInt32(inputField_level.text);
|
|
GContext.container.Resolve<PlayerData>().SetLv(level);
|
|
GContext.container.Resolve<CampDataMM>().Init();
|
|
}
|
|
}
|
|
|
|
void SetSupplyDrop()
|
|
{
|
|
if (!string.IsNullOrEmpty(inputField_supplyDrop.text))
|
|
{
|
|
int level = Convert.ToInt32(inputField_supplyDrop.text);
|
|
GContext.container.Resolve<PlayerData>().SupplyDropIndex = level;
|
|
}
|
|
}
|
|
|
|
void SetaCtivityId()
|
|
{
|
|
if (!string.IsNullOrEmpty(inputField_activityId.text))
|
|
{
|
|
int activityId = Convert.ToInt32(inputField_activityId.text);
|
|
GContext.container.Resolve<FishingEventData>().GMSetEvent(activityId);
|
|
var eventConfig=GContext.container.Resolve<Tables>()?.TbFishingEvent.GetOrDefault(activityId);
|
|
// TODO: restore when GMActivityOpenedEvent is available
|
|
// GContext.Publish(new GMActivityOpenedEvent(eventConfig));
|
|
}
|
|
}
|
|
|
|
void ChangeShow()
|
|
{
|
|
isShow = !isShow;
|
|
}
|
|
|
|
void SetDuelTier()
|
|
{
|
|
inputField_duel = transform.Find("root/InputField_duel").GetComponent<TMP_InputField>();
|
|
btn_duel = transform.Find("root/btn_sure_duel/btn_green").GetComponent<Button>();
|
|
btn_duel.onClick.AddListener(GMDuelSetTier);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// GM命令调段位
|
|
/// </summary>
|
|
/// <param name="initTier"></param>
|
|
public void GMDuelSetTier()
|
|
{
|
|
string indexStr = inputField_duel.text;
|
|
if (!string.IsNullOrEmpty(indexStr))
|
|
{
|
|
int.TryParse(indexStr, out int count);
|
|
// TODO: restore when GMAddSoloProgress is available
|
|
// GContext.container.Resolve<FishingEventData>().GMAddSoloProgress(count);
|
|
}
|
|
}
|
|
public void GMShootFishRefresh()
|
|
{
|
|
}
|
|
|
|
private string _cfg_ver;
|
|
private string CfgVer => _cfg_ver ??
|
|
#if UNITY_EDITOR
|
|
(_cfg_ver = $"Conf Ver [{System.IO.File.ReadAllText("../cfgData/conf_ver.txt").Trim()}]");
|
|
#else
|
|
(_cfg_ver = $"Conf Ver [{System.IO.File.ReadAllText(System.IO.Path.Combine(Application.persistentDataPath,"cfgData/conf_ver.txt")).Trim()}]");
|
|
#endif
|
|
|
|
void OnGUI()
|
|
{
|
|
//draw cfg ver
|
|
if (!_originFlag)
|
|
{
|
|
_originFlag = true;
|
|
GetOriginalGUIStyle();
|
|
}
|
|
GUIStyle style = GUI.skin.label;
|
|
style.fontSize = 80;
|
|
style.normal.textColor = Color.magenta;
|
|
GUI.Label(new Rect(50, 50, 2000, 100), CfgVer, style);
|
|
GUILayout.Space(200);
|
|
string inflateStr = $"inflate {inflate}";
|
|
GUILayout.Label(inflateStr, style, GUILayout.Width(2000), GUILayout.Height(100));
|
|
SetOriginalGUIStyle();
|
|
}
|
|
private GUIStyle _originalGUIStyle;
|
|
private bool _originFlag = false;
|
|
private void GetOriginalGUIStyle()
|
|
{
|
|
_originalGUIStyle = new GUIStyle(GUI.skin.label);
|
|
}
|
|
private void SetOriginalGUIStyle()
|
|
{
|
|
if (_originalGUIStyle == null)
|
|
return;
|
|
GUI.skin.GetStyle("Label").normal.textColor = _originalGUIStyle.normal.textColor;
|
|
GUI.skin.GetStyle("Label").fontSize = _originalGUIStyle.fontSize;
|
|
}
|
|
}
|
|
|
|
class DeBugItem : MonoBehaviour
|
|
{
|
|
public TMP_Text text;
|
|
public Button btn;
|
|
public DeBugItemData deBugItemData;
|
|
|
|
private void Awake()
|
|
{
|
|
text = transform.Find("text").GetComponent<TMP_Text>();
|
|
btn = transform.GetComponent<Button>();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
text.text = deBugItemData.str;
|
|
btn.onClick.AddListener(() => deBugItemData.action());
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
btn.onClick.RemoveAllListeners();
|
|
}
|
|
}
|
|
|
|
class DeBugItemData
|
|
{
|
|
public string str;
|
|
public Action action;
|
|
|
|
public DeBugItemData(string str, Action action)
|
|
{
|
|
this.str = str;
|
|
this.action = action;
|
|
}
|
|
}
|