Compare commits
No commits in common. "f1b696ad5e0637a0d80fa86e72db137c1f7966b9" and "0b5e2c3217997bd76f5ba578593fc0dbb8cb0244" have entirely different histories.
f1b696ad5e
...
0b5e2c3217
|
@ -10,8 +10,6 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0-preview.6.24327.7" />
|
||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
|
||||
<PackageReference Include="YamlDotNet" Version="15.1.6" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -4,9 +4,6 @@ using System.Text;
|
|||
using ColdMint.scripts.openObserve;
|
||||
using ColdMint.scripts.utils;
|
||||
using Godot;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenTelemetry.Exporter;
|
||||
using OpenTelemetry.Logs;
|
||||
|
||||
namespace ColdMint.scripts.debug;
|
||||
|
||||
|
@ -119,25 +116,6 @@ public static class LogCat
|
|||
private static HashSet<string> DisabledLogLabels { get; } = [];
|
||||
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
var loggerFactory = LoggerFactory.Create(builder =>
|
||||
{
|
||||
builder.AddOpenTelemetry(options => { options.AddOtlpExporter(OtlpExporterOptions); });
|
||||
});
|
||||
var logger = loggerFactory.CreateLogger("323");
|
||||
logger.Log(LogLevel.Debug, "你好");
|
||||
}
|
||||
|
||||
public static void OtlpExporterOptions(OtlpExporterOptions options)
|
||||
{
|
||||
options.Protocol = OtlpExportProtocol.HttpProtobuf;
|
||||
options.Endpoint = new Uri("http://test.coldmint.top/api/default/traces");
|
||||
options.Headers =
|
||||
"Authorization=Basic cm9vdEBleGFtcGxlLmNvbTp5V0kwVzZYcWhteTBzQml3,organization=default,stream-name=default";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>Disable log Label</para>
|
||||
/// <para>禁用某个日志标签</para>
|
||||
|
|
|
@ -20,154 +20,154 @@ namespace ColdMint.scripts.loader.uiLoader;
|
|||
/// </summary>
|
||||
public partial class MainMenuLoader : UiLoaderTemplate
|
||||
{
|
||||
private Button? _startGameButton;
|
||||
private Label? _copyrightLabel;
|
||||
private StringBuilder? _copyrightBuilder;
|
||||
private PackedScene? _gameScene;
|
||||
private PackedScene? _contributor;
|
||||
private PackedScene? _levelGraphEditor;
|
||||
private Label? _sloganLabel;
|
||||
private Label? _versionLabel;
|
||||
private Button? _levelGraphEditorButton;
|
||||
private LinkButton? _contributorButton;
|
||||
private Button? _startGameButton;
|
||||
private Label? _copyrightLabel;
|
||||
private StringBuilder? _copyrightBuilder;
|
||||
private PackedScene? _gameScene;
|
||||
private PackedScene? _contributor;
|
||||
private PackedScene? _levelGraphEditor;
|
||||
private Label? _sloganLabel;
|
||||
private Label? _versionLabel;
|
||||
private Button? _levelGraphEditorButton;
|
||||
private LinkButton? _contributorButton;
|
||||
|
||||
public override void InitializeData()
|
||||
{
|
||||
AppConfigData? appConfigData = AppConfig.LoadFromFile();
|
||||
if (appConfigData != null)
|
||||
{
|
||||
AppConfig.ApplyAppConfig(appConfigData);
|
||||
}
|
||||
public override void InitializeData()
|
||||
{
|
||||
AppConfigData? appConfigData = AppConfig.LoadFromFile();
|
||||
if (appConfigData != null)
|
||||
{
|
||||
AppConfig.ApplyAppConfig(appConfigData);
|
||||
}
|
||||
|
||||
if (Config.IsDebug())
|
||||
{
|
||||
//Set the minimum log level to Info in debug mode.(Print all logs)
|
||||
//在调试模式下将最小日志等级设置为Info。(打印全部日志)
|
||||
LogCat.MinLogLevel = LogCat.InfoLogLevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Disable all logs in the release version.
|
||||
//在发行版禁用所有日志。
|
||||
LogCat.MinLogLevel = LogCat.DisableAllLogLevel;
|
||||
}
|
||||
if (Config.IsDebug())
|
||||
{
|
||||
//Set the minimum log level to Info in debug mode.(Print all logs)
|
||||
//在调试模式下将最小日志等级设置为Info。(打印全部日志)
|
||||
LogCat.MinLogLevel = LogCat.InfoLogLevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Disable all logs in the release version.
|
||||
//在发行版禁用所有日志。
|
||||
LogCat.MinLogLevel = LogCat.DisableAllLogLevel;
|
||||
}
|
||||
|
||||
ContributorDataManager.RegisterAllContributorData();
|
||||
DeathInfoGenerator.RegisterDeathInfoHandler(new SelfDeathInfoHandler());
|
||||
MapGenerator.RegisterRoomInjectionProcessor(new ChanceRoomInjectionProcessor());
|
||||
MapGenerator.RegisterRoomInjectionProcessor(new TimeIntervalRoomInjectorProcessor());
|
||||
//Register the corresponding encoding provider to solve the problem of garbled Chinese path of the compressed package
|
||||
//注册对应的编码提供程序,解决压缩包中文路径乱码问题
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
//创建游戏数据文件夹
|
||||
var dataPath = Config.GetGameDataDirectory();
|
||||
if (!Directory.Exists(dataPath))
|
||||
{
|
||||
Directory.CreateDirectory(dataPath);
|
||||
}
|
||||
ContributorDataManager.RegisterAllContributorData();
|
||||
DeathInfoGenerator.RegisterDeathInfoHandler(new SelfDeathInfoHandler());
|
||||
MapGenerator.RegisterRoomInjectionProcessor(new ChanceRoomInjectionProcessor());
|
||||
MapGenerator.RegisterRoomInjectionProcessor(new TimeIntervalRoomInjectorProcessor());
|
||||
//Register the corresponding encoding provider to solve the problem of garbled Chinese path of the compressed package
|
||||
//注册对应的编码提供程序,解决压缩包中文路径乱码问题
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
//创建游戏数据文件夹
|
||||
var dataPath = Config.GetGameDataDirectory();
|
||||
if (!Directory.Exists(dataPath))
|
||||
{
|
||||
Directory.CreateDirectory(dataPath);
|
||||
}
|
||||
|
||||
|
||||
//Registered camp
|
||||
//注册阵营
|
||||
var defaultCamp = new Camp(Config.CampId.Default)
|
||||
{
|
||||
FriendInjury = true
|
||||
};
|
||||
CampManager.SetDefaultCamp(defaultCamp);
|
||||
var mazoku = new Camp(Config.CampId.Mazoku);
|
||||
CampManager.AddCamp(mazoku);
|
||||
var aborigines = new Camp(Config.CampId.Aborigines);
|
||||
CampManager.AddCamp(aborigines);
|
||||
_gameScene = GD.Load<PackedScene>("res://scenes/game.tscn");
|
||||
_contributor = GD.Load<PackedScene>("res://scenes/contributor.tscn");
|
||||
_levelGraphEditor = GD.Load<PackedScene>("res://scenes/levelGraphEditor.tscn");
|
||||
//Registered camp
|
||||
//注册阵营
|
||||
var defaultCamp = new Camp(Config.CampId.Default)
|
||||
{
|
||||
FriendInjury = true
|
||||
};
|
||||
CampManager.SetDefaultCamp(defaultCamp);
|
||||
var mazoku = new Camp(Config.CampId.Mazoku);
|
||||
CampManager.AddCamp(mazoku);
|
||||
var aborigines = new Camp(Config.CampId.Aborigines);
|
||||
CampManager.AddCamp(aborigines);
|
||||
_gameScene = GD.Load<PackedScene>("res://scenes/game.tscn");
|
||||
_contributor = GD.Load<PackedScene>("res://scenes/contributor.tscn");
|
||||
_levelGraphEditor = GD.Load<PackedScene>("res://scenes/levelGraphEditor.tscn");
|
||||
|
||||
//Register ItemTypes from file
|
||||
//从文件注册物品类型
|
||||
ItemTypeRegister.RegisterFromFile();
|
||||
//Hardcoded ItemTypes Register
|
||||
//硬编码注册物品类型
|
||||
ItemTypeRegister.StaticRegister();
|
||||
//Register ItemTypes from file
|
||||
//从文件注册物品类型
|
||||
ItemTypeRegister.RegisterFromFile();
|
||||
//Hardcoded ItemTypes Register
|
||||
//硬编码注册物品类型
|
||||
ItemTypeRegister.StaticRegister();
|
||||
|
||||
//静态注册掉落表
|
||||
LootRegister.StaticRegister();
|
||||
}
|
||||
//静态注册掉落表
|
||||
LootRegister.StaticRegister();
|
||||
}
|
||||
|
||||
public override void InitializeUi()
|
||||
{
|
||||
_contributorButton = GetNode<LinkButton>("VBoxContainer2/ContributorButton");
|
||||
_startGameButton = GetNode<Button>("StartGameButton");
|
||||
_levelGraphEditorButton = GetNode<Button>("levelGraphEditorButton");
|
||||
//The level map editor is only available in debug mode.
|
||||
//关卡图编辑器仅在调试模式可用。
|
||||
_levelGraphEditorButton.Visible = Config.IsDebug();
|
||||
_startGameButton.GrabFocus();
|
||||
_versionLabel = GetNode<Label>("VBoxContainer2/VersionLabel");
|
||||
//Generative copyright
|
||||
//生成版权
|
||||
_copyrightLabel = GetNode<Label>("VBoxContainer/CopyrightLabel");
|
||||
_sloganLabel = GetNode<Label>("CenterContainer2/SloganLabel");
|
||||
_copyrightBuilder = new StringBuilder();
|
||||
_copyrightBuilder.Append('\u00a9');
|
||||
var currentYear = DateTime.Now.Year;
|
||||
_copyrightBuilder.Append(Config.CreationYear);
|
||||
if (currentYear != Config.CreationYear)
|
||||
{
|
||||
_copyrightBuilder.Append('-');
|
||||
_copyrightBuilder.Append(currentYear);
|
||||
}
|
||||
public override void InitializeUi()
|
||||
{
|
||||
_contributorButton = GetNode<LinkButton>("VBoxContainer2/ContributorButton");
|
||||
_startGameButton = GetNode<Button>("StartGameButton");
|
||||
_levelGraphEditorButton = GetNode<Button>("levelGraphEditorButton");
|
||||
//The level map editor is only available in debug mode.
|
||||
//关卡图编辑器仅在调试模式可用。
|
||||
_levelGraphEditorButton.Visible = Config.IsDebug();
|
||||
_startGameButton.GrabFocus();
|
||||
_versionLabel = GetNode<Label>("VBoxContainer2/VersionLabel");
|
||||
//Generative copyright
|
||||
//生成版权
|
||||
_copyrightLabel = GetNode<Label>("VBoxContainer/CopyrightLabel");
|
||||
_sloganLabel = GetNode<Label>("CenterContainer2/SloganLabel");
|
||||
_copyrightBuilder = new StringBuilder();
|
||||
_copyrightBuilder.Append('\u00a9');
|
||||
var currentYear = DateTime.Now.Year;
|
||||
_copyrightBuilder.Append(Config.CreationYear);
|
||||
if (currentYear != Config.CreationYear)
|
||||
{
|
||||
_copyrightBuilder.Append('-');
|
||||
_copyrightBuilder.Append(currentYear);
|
||||
}
|
||||
|
||||
_copyrightBuilder.Append(' ');
|
||||
_copyrightBuilder.Append(Config.CompanyName);
|
||||
_copyrightBuilder.Append(" all rights reserved.");
|
||||
_copyrightLabel.Text = _copyrightBuilder.ToString();
|
||||
_versionLabel.Text = "ver." + Config.GetVersion();
|
||||
_sloganLabel.Text = SloganProvider.GetSlogan();
|
||||
_contributorButton.Text =
|
||||
TranslationServerUtils.TranslateWithFormat("ui_contributor_tips",
|
||||
ContributorDataManager.GetContributorTotals());
|
||||
}
|
||||
_copyrightBuilder.Append(' ');
|
||||
_copyrightBuilder.Append(Config.CompanyName);
|
||||
_copyrightBuilder.Append(" all rights reserved.");
|
||||
_copyrightLabel.Text = _copyrightBuilder.ToString();
|
||||
_versionLabel.Text = "ver." + Config.GetVersion();
|
||||
_sloganLabel.Text = SloganProvider.GetSlogan();
|
||||
_contributorButton.Text =
|
||||
TranslationServerUtils.TranslateWithFormat("ui_contributor_tips",
|
||||
ContributorDataManager.GetContributorTotals());
|
||||
}
|
||||
|
||||
public override void LoadUiActions()
|
||||
{
|
||||
if (_startGameButton != null)
|
||||
{
|
||||
_startGameButton.Pressed += () =>
|
||||
{
|
||||
if (_gameScene == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
public override void LoadUiActions()
|
||||
{
|
||||
if (_startGameButton != null)
|
||||
{
|
||||
_startGameButton.Pressed += () =>
|
||||
{
|
||||
if (_gameScene == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GetTree().ChangeSceneToPacked(_gameScene);
|
||||
};
|
||||
}
|
||||
GetTree().ChangeSceneToPacked(_gameScene);
|
||||
};
|
||||
}
|
||||
|
||||
if (_contributorButton != null)
|
||||
{
|
||||
_contributorButton.Pressed += () =>
|
||||
{
|
||||
if (_contributor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_contributorButton != null)
|
||||
{
|
||||
_contributorButton.Pressed += () =>
|
||||
{
|
||||
if (_contributor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GetTree().ChangeSceneToPacked(_contributor);
|
||||
};
|
||||
}
|
||||
GetTree().ChangeSceneToPacked(_contributor);
|
||||
};
|
||||
}
|
||||
|
||||
if (_levelGraphEditorButton != null)
|
||||
{
|
||||
_levelGraphEditorButton.Pressed += () =>
|
||||
{
|
||||
LogCat.Log("level_graph_editor");
|
||||
if (_levelGraphEditor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_levelGraphEditorButton != null)
|
||||
{
|
||||
_levelGraphEditorButton.Pressed += () =>
|
||||
{
|
||||
LogCat.Log("level_graph_editor");
|
||||
if (_levelGraphEditor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GetTree().ChangeSceneToPacked(_levelGraphEditor);
|
||||
};
|
||||
}
|
||||
}
|
||||
GetTree().ChangeSceneToPacked(_levelGraphEditor);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user