diff --git a/README.md b/README.md
index 202921e..8352b75 100644
--- a/README.md
+++ b/README.md
@@ -75,34 +75,6 @@ Enter the following command in the directory where the game is located:
./Traveler.sh
```
-## Configuring Openobserve
-
-> This is optional, and the game will work even if you do not configure Openobserve.
-
-openobserve is used to continuously collect logs and alarm information after a game has been released.
-
-#### Set up the openobserve server
-
-see:[openobserve](https://github.com/openobserve/openobserve)
-
-#### Write configuration
-
-After you have set up an openobserve server, follow the following steps to configure the file:
-
-1. Create a configuration file named **AppConfig.yaml** in the root directory of your project.
-
-2. Fill in the information for the remote server.
-
- ```yaml
- open_observe:
- address: [address]
- access_token: [token]
- org_id: [org_id]
- stream_name: [stream_name]
- ```
-
- address Indicates the address of the server in the format of http(s)://www.example.com. (Support http and https)
-
## Participate in translation
The project is prepared for localization at the beginning of writing. You can edit the csv file in the locals directory.
diff --git a/README_JA.md b/README_JA.md
index 63b3a81..d70b2a3 100644
--- a/README_JA.md
+++ b/README_JA.md
@@ -69,35 +69,6 @@ data/*
```
./Traveler.sh
```
-
-## はいちOpenobserve
-
-> これはオプションなので、Openobserveを設定しなくてもゲームは正常に動作します。
-
-openobserveは、リリース後にログやアラームを継続的に収集するために使用されます。
-
-#### 搭建openobserve衣服务器
-
-読み過ごす:[openobserve](https://github.com/openobserve/openobserve)
-
-#### 構成を書きます
-
-openobserveのサーバーを構築したら、次のようにファイルを設定します。
-
-1. プロジェクトのルートディレクトリに**AppConfig.yaml **というプロファイルを作成します。
-
-2. リモートサーバーの情報を入力します。
-
- ```yaml
- open_observe:
- address: [address]
- access_token: [token]
- org_id: [org_id]
- stream_name: [stream_name]
- ```
-
- address サーバーのアドレス、フォーマットはこうなります http(s)://www.example.com。(支持http和https)
-
## 翻訳に携わります
このプロジェクトは、当初からローカライズの準備ができていました。localsディレクトリのcsvファイルを編集することができます。新しい翻訳を加えたり修正したりしています
diff --git a/README_ZH.md b/README_ZH.md
index 955e17d..54e5cb1 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -72,34 +72,6 @@ data/*
./Traveler.sh
```
-## 配置Openobserve
-
-> 这是可选的操作,即使您不配置Openobserve,游戏也能正常运行。
-
-openobserve用于在游戏发布后,持续收集日志和报警信息。
-
-#### 搭建openobserve服务器
-
-请见:[openobserve](https://github.com/openobserve/openobserve)
-
-#### 编写配置
-
-在您搭建完毕openobserve的服务器后,按如下步骤配置文件:
-
-1. 在项目的根目录创建名为**AppConfig.yaml**的配置文件。
-
-2. 填入远程服务器的信息。
-
- ```yaml
- open_observe:
- address: [address]
- access_token: [token]
- org_id: [org_id]
- stream_name: [stream_name]
- ```
-
- address 服务器的地址,格式为 http(s)://www.example.com。(支持http和https)
-
## 参与翻译
此项目在编写之初就为本地化做好了准备。您可以编辑locals目录下的csv文件。来修改和添加新的翻译。
diff --git a/locals/Log.csv b/locals/Log.csv
index dd06ab6..f208247 100644
--- a/locals/Log.csv
+++ b/locals/Log.csv
@@ -62,10 +62,6 @@ log_owner_is_not_AiCharacter,所有者不是AiCharacter。,Owner is not AiCharac
log_find_nearest_item,查找最近的物品。,Find the nearest item.,最も近いアイテムを見つけます。
log_float_label_instantiate_failed,浮动标签实例化失败。,Float label instantiation failed.,フロートラベルのインスタンス化に失敗しました。
log_pickable_picked_up,可拾捡物被捡起了,那么不显示标签。,"If the pickable item is picked up, the label is not displayed.",でも、拾得物が拾い上げられたら、ラベルは表示されません。
-log_start_uploading,开始上传{0}条日志。,Start uploading {0} logs.,{0}個のログをアップロードを開始します。
-log_upload_successful,上传成功,已上传{0}条日志,剩余{1}条日志待上传。,"Upload successful, {0} logs uploaded, {1} logs remaining.",アップロードが成功しました、{0}個のログがアップロードされ、{1}個のログが残っています。
-log_upload_failed,上传失败,错误代码:{0},剩余{1}条日志待上传。,"Upload failed, error code: {0}, {1} logs remaining.",アップロードに失敗しました、エラーコード:{0}、{1}個のログが残っています。
-log_upload_status,已记录{0}条日志,上传阈值为{1}。,"{0} logs recorded, upload threshold is {1}.",{0}個のログが記録され、アップロード閾値は{1}です。
log_weapon_detected,检测到武器。,Weapon detected.,武器が検出されました。
log_no_weapon_detected,没有检测到武器。,No weapon detected.,武器が検出されません。
log_weapon_lost,武器丢失。,Weapon lost.,武器が失われました。
diff --git a/scripts/AppConfig.cs b/scripts/AppConfig.cs
deleted file mode 100644
index b40863f..0000000
--- a/scripts/AppConfig.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-using ColdMint.scripts.debug;
-using ColdMint.scripts.openObserve;
-using ColdMint.scripts.serialization;
-using Godot;
-
-namespace ColdMint.scripts;
-
-public class AppConfig
-{
- ///
- /// Load configuration from file
- /// 从文件加载配置
- ///
- public static AppConfigData? LoadFromFile()
- {
- var appConfigExists = FileAccess.FileExists(Config.AppConfigPath);
- if (!appConfigExists)
- {
- LogCat.LogWarning("appConfig_not_exist");
- return null;
- }
-
- var appConfigFileAccess = FileAccess.Open(Config.AppConfigPath, FileAccess.ModeFlags.Read);
- var yamlData = appConfigFileAccess.GetAsText();
- appConfigFileAccess.Close();
- return YamlSerialization.Deserialize(yamlData);
- }
-
-
- ///
- /// ApplyAppConfig
- /// 应用配置
- ///
- ///
- public static void ApplyAppConfig(AppConfigData appConfigData)
- {
- if (appConfigData.OpenObserve != null)
- {
- LogCollector.UpdateHttpClient(appConfigData.OpenObserve);
- }
- }
-}
-
-public class AppConfigData
-{
- ///
- /// OpenObserve configuration information
- /// OpenObserve的配置信息
- ///
- // ReSharper disable UnusedAutoPropertyAccessor.Global
- public OpenObserve? OpenObserve { get; set; }
- // ReSharper restore UnusedAutoPropertyAccessor.Global
-}
-
-///
-/// OpenObserve Configuration information
-/// OpenObserve配置信息
-///
-public class OpenObserve
-{
- ///
- /// server address
- /// 服务器地址
- ///
- // ReSharper disable UnusedAutoPropertyAccessor.Global
- public string? Address { get; set; }
- // ReSharper restore UnusedAutoPropertyAccessor.Global
-
- ///
- /// Access Token
- /// 访问密匙
- ///
- // ReSharper disable UnusedAutoPropertyAccessor.Global
- public string? AccessToken { get; set; }
- // ReSharper restore UnusedAutoPropertyAccessor.Global
-
- ///
- /// Organization ID
- /// 组织ID
- ///
- // ReSharper disable UnusedAutoPropertyAccessor.Global
- public string? OrgId { get; set; }
- // ReSharper restore UnusedAutoPropertyAccessor.Global
-
- ///
- /// Stream Name
- /// 流名称
- ///
- // ReSharper disable UnusedAutoPropertyAccessor.Global
- public string? StreamName { get; set; }
- // ReSharper restore UnusedAutoPropertyAccessor.Global
-}
\ No newline at end of file
diff --git a/scripts/bubble/BubbleMarker.cs b/scripts/bubble/BubbleMarker.cs
index 959e2c6..05fc4ef 100644
--- a/scripts/bubble/BubbleMarker.cs
+++ b/scripts/bubble/BubbleMarker.cs
@@ -45,7 +45,7 @@ public partial class BubbleMarker : Marker2D
{
if (!_bubbleDictionary.TryGetValue(id, out var value))
{
- LogCat.LogErrorWithFormat("bubble_not_found", LogCat.LogLabel.BubbleMarker, LogCat.UploadFormat,id);
+ LogCat.LogErrorWithFormat("bubble_not_found", LogCat.LogLabel.BubbleMarker,id);
return;
}
@@ -60,7 +60,7 @@ public partial class BubbleMarker : Marker2D
{
if (!_bubbleDictionary.TryGetValue(id, out var value))
{
- LogCat.LogErrorWithFormat("bubble_not_found", LogCat.LogLabel.BubbleMarker, LogCat.UploadFormat,id);
+ LogCat.LogErrorWithFormat("bubble_not_found", LogCat.LogLabel.BubbleMarker,id);
return;
}
diff --git a/scripts/camp/CampManager.cs b/scripts/camp/CampManager.cs
index 6d5bbe8..f6c0a82 100644
--- a/scripts/camp/CampManager.cs
+++ b/scripts/camp/CampManager.cs
@@ -40,7 +40,7 @@ public static class CampManager
if (camp.Id != Config.CampId.Default) return false;
_defaultCamp = camp;
AddCamp(camp);
- LogCat.LogWithFormat("set_default_camp", label: LogCat.LogLabel.CampManager, LogCat.UploadFormat, camp.Id);
+ LogCat.LogWithFormat("set_default_camp", label: LogCat.LogLabel.CampManager, camp.Id);
return true;
}
diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs
index be12d1e..69714c8 100644
--- a/scripts/character/CharacterTemplate.cs
+++ b/scripts/character/CharacterTemplate.cs
@@ -640,12 +640,12 @@ public partial class CharacterTemplate : CharacterBody2D
if (damageTemplate.Attacker is CharacterTemplate characterTemplate &&
!string.IsNullOrEmpty(characterTemplate.CharacterName))
{
- LogCat.LogWithFormat("death_info", LogCat.LogLabel.Default, LogCat.UploadFormat, CharacterName,
+ LogCat.LogWithFormat("death_info", LogCat.LogLabel.Default, CharacterName,
characterTemplate.CharacterName);
}
else
{
- LogCat.LogWithFormat("death_info", LogCat.LogLabel.Default, LogCat.UploadFormat, CharacterName,
+ LogCat.LogWithFormat("death_info", LogCat.LogLabel.Default, CharacterName,
damageTemplate.Attacker.Name);
}
}
diff --git a/scripts/character/Player.cs b/scripts/character/Player.cs
index 9185922..37008d9 100644
--- a/scripts/character/Player.cs
+++ b/scripts/character/Player.cs
@@ -47,7 +47,7 @@ public partial class Player : CharacterTemplate
return;
}
CharacterName = TranslationServerUtils.Translate("default_player_name");
- LogCat.LogWithFormat("player_spawn_debug", LogCat.LogLabel.Default, LogCat.UploadFormat, ReadOnlyCharacterName,
+ LogCat.LogWithFormat("player_spawn_debug", LogCat.LogLabel.Default, ReadOnlyCharacterName,
GlobalPosition);
_parabola = GetNode("Parabola");
var healthBarUi = GameSceneDepend.HealthBarUi;
diff --git a/scripts/debug/LogCat.cs b/scripts/debug/LogCat.cs
index 21a0361..dcb6cef 100644
--- a/scripts/debug/LogCat.cs
+++ b/scripts/debug/LogCat.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using ColdMint.scripts.openObserve;
using ColdMint.scripts.utils;
using Godot;
@@ -142,12 +141,7 @@ public static class LogCat
get => _minLogLevel;
set => _minLogLevel = value;
}
-
- ///
- /// Whether to upload logs that need to be formatted by default
- /// 是否默认上传需要格式化的日志
- ///
- public static bool UploadFormat { get; set; } = true;
+
private static readonly StringBuilder StringBuilder = new StringBuilder();
@@ -249,14 +243,12 @@ public static class LogCat
///
///
///
- ///
- ///
- public static void Log(string message, string label = LogLabel.Default, bool upload = true)
+ public static void Log(string message, string label = LogLabel.Default)
{
- PrintLog(InfoLogLevel, HandleMessage(InfoLogLevel, message, label).ToString(), label, upload);
+ PrintLog(InfoLogLevel, HandleMessage(InfoLogLevel, message, label).ToString(), label);
}
- private static void PrintLog(int level, string concreteLog, string label, bool upload)
+ private static void PrintLog(int level, string concreteLog, string label)
{
if (!IsEnabledLogLabel(label))
{
@@ -268,20 +260,6 @@ public static class LogCat
return;
}
- //If you need to upload logs, you can upload logs.
- //如果需要上传日志,并且能够上传日志。
- if (LogCollector.CanUploadLog && upload)
- {
- var logData = new LogData
- {
- Level = level,
- Message = concreteLog
- };
-#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
- LogCollector.Push(logData);
-#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
- }
-
switch (level)
{
case WarningLogLevel:
@@ -307,34 +285,30 @@ public static class LogCat
/// 这个消息支持本地化输出,假设已存在翻译key,Hello = 你好,传入Hello则会输出你好。
///
///
- ///
- public static void LogError(string message, string label = LogLabel.Default, bool upload = true)
+ public static void LogError(string message, string label = LogLabel.Default)
{
- PrintLog(ErrorLogLevel, HandleMessage(ErrorLogLevel, message, label).ToString(), label, upload);
+ PrintLog(ErrorLogLevel, HandleMessage(ErrorLogLevel, message, label).ToString(), label);
}
- public static void LogWarning(string message, string label = LogLabel.Default, bool upload = true)
+ public static void LogWarning(string message, string label = LogLabel.Default)
{
- PrintLog(WarningLogLevel, HandleMessage(WarningLogLevel, message, label).ToString(), label, upload);
+ PrintLog(WarningLogLevel, HandleMessage(WarningLogLevel, message, label).ToString(), label);
}
- public static void LogErrorWithFormat(string message, string label, bool upload, params object?[] args)
+ public static void LogErrorWithFormat(string message, string label, params object?[] args)
{
- PrintLog(ErrorLogLevel, string.Format(HandleMessage(ErrorLogLevel, message, label).ToString(), args), label,
- upload);
+ PrintLog(ErrorLogLevel, string.Format(HandleMessage(ErrorLogLevel, message, label).ToString(), args), label);
}
- public static void LogWithFormat(string message, string label, bool upload, params object?[] args)
+ public static void LogWithFormat(string message, string label, params object?[] args)
{
- PrintLog(InfoLogLevel, string.Format(HandleMessage(InfoLogLevel, message, label).ToString(), args), label,
- upload);
+ PrintLog(InfoLogLevel, string.Format(HandleMessage(InfoLogLevel, message, label).ToString(), args), label);
}
- public static void LogWarningWithFormat(string message, string label, bool upload, params object?[] args)
+ public static void LogWarningWithFormat(string message, string label, params object?[] args)
{
- PrintLog(WarningLogLevel, string.Format(HandleMessage(WarningLogLevel, message, label).ToString(), args), label,
- upload);
+ PrintLog(WarningLogLevel, string.Format(HandleMessage(WarningLogLevel, message, label).ToString(), args), label);
}
///
@@ -353,6 +327,6 @@ public static class LogCat
//Log an exception here or send it to the server.
//请在这里记录异常或将异常发送至服务器。
PrintLog(ErrorLogLevel,
- HandleMessage(ErrorLogLevel, e.Message, label).Append('\n').Append(e.StackTrace).ToString(), label, true);
+ HandleMessage(ErrorLogLevel, e.Message, label).Append('\n').Append(e.StackTrace).ToString(), label);
}
}
\ No newline at end of file
diff --git a/scripts/inventory/ItemTypeRegister.cs b/scripts/inventory/ItemTypeRegister.cs
index 8ff408f..8f2ac07 100644
--- a/scripts/inventory/ItemTypeRegister.cs
+++ b/scripts/inventory/ItemTypeRegister.cs
@@ -34,7 +34,7 @@ public static class ItemTypeRegister
var error = DirAccess.GetOpenError();
if (error is not Error.Ok)
{
- LogCat.LogErrorWithFormat("error_when_open_item_regs_dir", LogCat.LogLabel.Default, true, itemRegsDirPath,
+ LogCat.LogErrorWithFormat("error_when_open_item_regs_dir", LogCat.LogLabel.Default, itemRegsDirPath,
error.ToString());
return;
}
@@ -44,11 +44,11 @@ public static class ItemTypeRegister
var files = itemRegsDir.GetFiles();
if (files == null)
{
- LogCat.LogWithFormat("found_files", LogCat.LogLabel.Default, LogCat.UploadFormat, 0);
+ LogCat.LogWithFormat("found_files", LogCat.LogLabel.Default, 0);
return;
}
- LogCat.LogWithFormat("found_files", LogCat.LogLabel.Default, LogCat.UploadFormat, files.Length);
+ LogCat.LogWithFormat("found_files", LogCat.LogLabel.Default, files.Length);
//将文件解析为项目类型信息
//parse files to item type infos
var count = 0;
@@ -68,7 +68,7 @@ public static class ItemTypeRegister
count++;
}
- LogCat.LogWithFormat("found_item_types", LogCat.LogLabel.Default, LogCat.UploadFormat, count);
+ LogCat.LogWithFormat("found_item_types", LogCat.LogLabel.Default, count);
}
///
@@ -120,7 +120,7 @@ public static class ItemTypeRegister
return newItem;
});
var succeed = ItemTypeManager.Register(itemType);
- LogCat.LogWithFormat("register_item", label: LogCat.LogLabel.Default, LogCat.UploadFormat, itemType.Id,
+ LogCat.LogWithFormat("register_item", label: LogCat.LogLabel.Default, itemType.Id,
succeed);
}
diff --git a/scripts/loader/uiLoader/SplashScreenLoader.cs b/scripts/loader/uiLoader/SplashScreenLoader.cs
index 05f73d8..083d3d3 100644
--- a/scripts/loader/uiLoader/SplashScreenLoader.cs
+++ b/scripts/loader/uiLoader/SplashScreenLoader.cs
@@ -69,14 +69,6 @@ public partial class SplashScreenLoader : UiLoaderTemplate
///
private async Task LoadingGlobalData()
{
- //Loading App configuration
- //加载App配置
- var appConfigData = AppConfig.LoadFromFile();
- if (appConfigData != null)
- {
- AppConfig.ApplyAppConfig(appConfigData);
- }
-
//Set the minimum log level to Info in debug mode.(Print all logs)
//在调试模式下将最小日志等级设置为Info。(打印全部日志)
//Disable all logs in the release version.
diff --git a/scripts/loot/LootList.cs b/scripts/loot/LootList.cs
index 99ff3f3..d70d089 100644
--- a/scripts/loot/LootList.cs
+++ b/scripts/loot/LootList.cs
@@ -25,7 +25,7 @@ public readonly struct LootList(string id, IList groups)
{
if (Groups is [])
{
- LogCat.LogWithFormat("loot_list_has_no_entries", LogCat.LogLabel.Default, LogCat.UploadFormat, Id);
+ LogCat.LogWithFormat("loot_list_has_no_entries", LogCat.LogLabel.Default, Id);
return [];
}
@@ -41,10 +41,10 @@ public readonly struct LootList(string id, IList groups)
//我们为每个战利品条目生成一个战利品数据。
var datum = group.GenerateLootData();
lootDataList.Add(datum);
- LogCat.LogWithFormat("loot_data_add", LogCat.LogLabel.Default, LogCat.UploadFormat,datum);
+ LogCat.LogWithFormat("loot_data_add", LogCat.LogLabel.Default, datum);
}
- LogCat.LogWithFormat("loot_data_quantity", LogCat.LogLabel.Default, LogCat.UploadFormat,lootDataList.Count);
+ LogCat.LogWithFormat("loot_data_quantity", LogCat.LogLabel.Default, lootDataList.Count);
return lootDataList.ToArray();
}
}
\ No newline at end of file
diff --git a/scripts/map/ItemSpawn.cs b/scripts/map/ItemSpawn.cs
index db485fa..d2f36aa 100644
--- a/scripts/map/ItemSpawn.cs
+++ b/scripts/map/ItemSpawn.cs
@@ -30,7 +30,7 @@ public partial class ItemSpawn : Marker2D, ISpawnMarker
return null;
}
var item = ItemTypeManager.CreateItem(itemId, this);
- LogCat.LogWithFormat("generated_item_is_empty", LogCat.LogLabel.ItemSpawn, true, itemId, item == null);
+ LogCat.LogWithFormat("generated_item_is_empty", LogCat.LogLabel.ItemSpawn, itemId, item == null);
if (item is not Node2D node2D)
{
return null;
diff --git a/scripts/map/MapGenerator.cs b/scripts/map/MapGenerator.cs
index 89247e9..65e3dfd 100644
--- a/scripts/map/MapGenerator.cs
+++ b/scripts/map/MapGenerator.cs
@@ -245,7 +245,7 @@ public static class MapGenerator
//If the room injection processor cannot be found, a print error occurs.
//如果找不到房间注入处理器,那么打印错误。
LogCat.LogErrorWithFormat("room_injection_processor_does_not_exist",
- LogCat.LogLabel.Default, LogCat.UploadFormat, injectionProcessorData.Id);
+ LogCat.LogLabel.Default, injectionProcessorData.Id);
continue;
}
@@ -282,7 +282,7 @@ public static class MapGenerator
if (roomPlacementData == null)
{
LogCat.LogWithFormat("failed_to_calculate_the_room_location", LogCat.LogLabel.Default,
- LogCat.UploadFormat, roomNodeData.Id);
+ roomNodeData.Id);
continue;
}
@@ -368,19 +368,19 @@ public static class MapGenerator
if (dictionary.ContainsKey(roomNodeDataId))
{
- LogCat.LogWithFormat("place_existing_rooms", LogCat.LogLabel.Default, LogCat.UploadFormat, roomNodeDataId);
+ LogCat.LogWithFormat("place_existing_rooms", LogCat.LogLabel.Default, roomNodeDataId);
return false;
}
if (!await _roomPlacementStrategy.PlaceRoom(_mapRoot, roomPlacementData))
{
- LogCat.LogWarningWithFormat("room_placement_failed", LogCat.LogLabel.Default, LogCat.UploadFormat,
+ LogCat.LogWarningWithFormat("room_placement_failed", LogCat.LogLabel.Default,
roomNodeDataId);
return false;
}
dictionary.Add(roomNodeDataId, roomPlacementData.NewRoom);
- LogCat.LogWithFormat("room_placement_information", LogCat.LogLabel.Default, LogCat.UploadFormat, roomNodeDataId,
+ LogCat.LogWithFormat("room_placement_information", LogCat.LogLabel.Default, roomNodeDataId,
roomPlacementData.Position.ToString());
return true;
}
diff --git a/scripts/map/miniMap/MiniMap.cs b/scripts/map/miniMap/MiniMap.cs
index 3d37191..9a7bec1 100644
--- a/scripts/map/miniMap/MiniMap.cs
+++ b/scripts/map/miniMap/MiniMap.cs
@@ -93,7 +93,7 @@ public partial class MiniMap : NinePatchRect
CalculateRelativePositionOnTheMinimap(roomDictionaryValue));
if (textureRect == null)
{
- LogCat.LogErrorWithFormat("failed_to_create_room_preview", LogCat.LogLabel.Default, LogCat.UploadFormat,
+ LogCat.LogErrorWithFormat("failed_to_create_room_preview", LogCat.LogLabel.Default,
dictionaryKey);
}
else
diff --git a/scripts/map/room/Room.cs b/scripts/map/room/Room.cs
index 8aec9e5..c6c2032 100644
--- a/scripts/map/room/Room.cs
+++ b/scripts/map/room/Room.cs
@@ -170,8 +170,7 @@ public class Room
///
private void ShowAllCharacterTemplate()
{
- LogCat.LogWithFormat("show_all_node", LogCat.LogLabel.Room, LogCat.UploadFormat,
- _allCharacter.Count);
+ LogCat.LogWithFormat("show_all_node", LogCat.LogLabel.Room, _allCharacter.Count);
foreach (var characterTemplate in _allCharacter)
{
characterTemplate.Show();
@@ -184,8 +183,7 @@ public class Room
///
private void HideAllCharacterTemplate()
{
- LogCat.LogWithFormat("hide_all_node", LogCat.LogLabel.Room, LogCat.UploadFormat,
- _allCharacter.Count);
+ LogCat.LogWithFormat("hide_all_node", LogCat.LogLabel.Room, _allCharacter.Count);
foreach (var characterTemplate in _allCharacter)
{
characterTemplate.Hide();
@@ -272,7 +270,7 @@ public class Room
{
if (_rootNode != null)
{
- LogCat.LogWithFormat("enter_the_room_debug", LogCat.LogLabel.Default, LogCat.UploadFormat, node.Name,
+ LogCat.LogWithFormat("enter_the_room_debug", LogCat.LogLabel.Default, node.Name,
_rootNode.Name);
}
@@ -325,7 +323,7 @@ public class Room
{
if (_rootNode != null)
{
- LogCat.LogWithFormat("exit_the_room_debug", LogCat.LogLabel.Default, LogCat.UploadFormat, node.Name,
+ LogCat.LogWithFormat("exit_the_room_debug", LogCat.LogLabel.Default, node.Name,
_rootNode.Name);
}
diff --git a/scripts/mod/ModLoader.cs b/scripts/mod/ModLoader.cs
index 9955fe5..adbe05b 100644
--- a/scripts/mod/ModLoader.cs
+++ b/scripts/mod/ModLoader.cs
@@ -59,7 +59,7 @@ public class ModLoader
{
//When the dll that must be loaded does not exist, an error is reported immediately.
//当必须加载的dll不存在时,立即报错。
- LogCat.LogErrorWithFormat("dll_not_exist", LogCat.LogLabel.ModLoader, true, dllPath);
+ LogCat.LogErrorWithFormat("dll_not_exist", LogCat.LogLabel.ModLoader, dllPath);
throw new FileNotFoundException("dll not exist:" + dllPath);
}
@@ -88,7 +88,7 @@ public class ModLoader
//Load the dll.
//加载dll。
- LogCat.LogWithFormat("load_dll", LogCat.LogLabel.ModLoader, true, dllPath);
+ LogCat.LogWithFormat("load_dll", LogCat.LogLabel.ModLoader, dllPath);
try
{
var assembly = _assemblyLoadContext.LoadFromAssemblyPath(dllPath);
@@ -98,7 +98,7 @@ public class ModLoader
return;
}
- LogCat.LogWithFormat("dll_name", LogCat.LogLabel.ModLoader, true, assemblyName);
+ LogCat.LogWithFormat("dll_name", LogCat.LogLabel.ModLoader, assemblyName);
//If the load is not its own Dll file.
//如果加载的不是自身的Dll文件.
if (assemblyName == Config.SolutionName)
@@ -109,7 +109,7 @@ public class ModLoader
//Call the method of the entry class.
//调用入口类的方法
var exportedTypes = assembly.GetExportedTypes();
- LogCat.LogWarningWithFormat("dll_type_length", LogCat.LogLabel.ModLoader, LogCat.UploadFormat, dllPath,
+ LogCat.LogWarningWithFormat("dll_type_length", LogCat.LogLabel.ModLoader, dllPath,
exportedTypes.Length);
var modLifecycleHandlerType =
FindTypeInTypeArray(exportedTypes, Config.ModLifecycleHandlerName);
@@ -118,7 +118,6 @@ public class ModLoader
//The module does not register a lifecycle processor.
//模组没有注册生命周期处理器。
LogCat.LogWarningWithFormat("dll_does_not_register_lifecycle_processor", LogCat.LogLabel.ModLoader,
- LogCat.UploadFormat,
dllPath, Config.ModLifecycleHandlerName);
return;
}
@@ -129,7 +128,6 @@ public class ModLoader
//No parameterless constructor found.
//未找到无参构造方法。
LogCat.LogWarningWithFormat("dll_no_parameterless_constructor", LogCat.LogLabel.ModLoader,
- LogCat.UploadFormat,
dllPath);
return;
}
@@ -141,7 +139,7 @@ public class ModLoader
{
LogCat.LogWarningWithFormat("mod_lifecycle_handler_not_implement_interface",
LogCat.LogLabel.ModLoader,
- LogCat.UploadFormat, dllPath);
+ dllPath);
return;
}
@@ -151,7 +149,7 @@ public class ModLoader
{
//The assemblyPath parameter is null.
//assemblyPath参数为空。
- LogCat.LogErrorWithFormat("load_dll_argument_null_exception", LogCat.LogLabel.ModLoader, true, dllPath);
+ LogCat.LogErrorWithFormat("load_dll_argument_null_exception", LogCat.LogLabel.ModLoader, dllPath);
LogCat.WhenCaughtException(argumentNullException, LogCat.LogLabel.ModLoader);
return;
}
@@ -159,7 +157,7 @@ public class ModLoader
{
//Not an absolute path.
//不是绝对路径
- LogCat.LogErrorWithFormat("load_dll_argument_exception", LogCat.LogLabel.ModLoader, true, dllPath);
+ LogCat.LogErrorWithFormat("load_dll_argument_exception", LogCat.LogLabel.ModLoader, dllPath);
LogCat.WhenCaughtException(argumentException, LogCat.LogLabel.ModLoader);
return;
}
@@ -167,7 +165,7 @@ public class ModLoader
{
//A file that was found could not be loaded.
//无法加载找到的文件。
- LogCat.LogErrorWithFormat("load_dll_file_load_exception", LogCat.LogLabel.ModLoader, true, dllPath);
+ LogCat.LogErrorWithFormat("load_dll_file_load_exception", LogCat.LogLabel.ModLoader, dllPath);
LogCat.WhenCaughtException(fileLoadException, LogCat.LogLabel.ModLoader);
return;
}
@@ -175,7 +173,7 @@ public class ModLoader
{
//assemblyPath is not a valid assembly.
//assemblyPath不是有效的程序集。
- LogCat.LogErrorWithFormat("load_dll_bad_image_format_exception", LogCat.LogLabel.ModLoader, true,
+ LogCat.LogErrorWithFormat("load_dll_bad_image_format_exception", LogCat.LogLabel.ModLoader,
dllPath);
LogCat.WhenCaughtException(badImageFormatException, LogCat.LogLabel.ModLoader);
return;
@@ -183,7 +181,7 @@ public class ModLoader
//Loading the dll succeeded.
//加载dll成功。
- LogCat.LogWithFormat("load_dll_success", LogCat.LogLabel.ModLoader, true, dllPath);
+ LogCat.LogWithFormat("load_dll_success", LogCat.LogLabel.ModLoader, dllPath);
}
@@ -275,7 +273,7 @@ public class ModLoader
{
//The module does not contain a pck file.
//模组不包含pck文件。
- LogCat.LogWarningWithFormat("mod_not_contain_pck", LogCat.LogLabel.ModLoader, LogCat.UploadFormat,
+ LogCat.LogWarningWithFormat("mod_not_contain_pck", LogCat.LogLabel.ModLoader,
modFolderPath);
}
else
@@ -294,7 +292,7 @@ public class ModLoader
{
//The module does not contain a dll file.
//模组不包含dll文件。
- LogCat.LogWarningWithFormat("mod_not_contain_dll", LogCat.LogLabel.ModLoader, LogCat.UploadFormat,
+ LogCat.LogWarningWithFormat("mod_not_contain_dll", LogCat.LogLabel.ModLoader,
modFolderPath);
}
else
@@ -335,11 +333,11 @@ public class ModLoader
var success = ProjectSettings.LoadResourcePack(pckPath);
if (success)
{
- LogCat.LogWithFormat("load_pck_success", LogCat.LogLabel.ModLoader, true, pckPath);
+ LogCat.LogWithFormat("load_pck_success", LogCat.LogLabel.ModLoader, pckPath);
}
else
{
- LogCat.LogErrorWithFormat("load_pck_failed", LogCat.LogLabel.ModLoader, true, pckPath);
+ LogCat.LogErrorWithFormat("load_pck_failed", LogCat.LogLabel.ModLoader, pckPath);
//Throw a suitable exception here for handling at the caller.
//为这里抛出合适的异常,以便在调用方处理。
throw new DataException("load pck failed:" + pckPath);
diff --git a/scripts/openObserve/LogCollector.cs b/scripts/openObserve/LogCollector.cs
deleted file mode 100644
index 400a278..0000000
--- a/scripts/openObserve/LogCollector.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Net;
-using System.Net.Http.Json;
-using System.Threading.Tasks;
-using ColdMint.scripts.debug;
-using HttpClient = System.Net.Http.HttpClient;
-
-namespace ColdMint.scripts.openObserve;
-
-///
-/// LogCollector
-/// 日志收集器
-///
-public static class LogCollector
-{
- private static readonly List LogDataList = [];
-
- ///
- /// Automatic upload threshold
- /// 自动上传的阈值
- ///
- ///
- ///An attempt is made to upload logs when messages reach this number.
- ///当消息到达此数量后将尝试上传日志。
- ///
- public static int UploadThreshold { get; set; } = 300;
-
- private static bool _lockList;
-
- ///
- /// httpClient
- /// Http客户
- ///
- private static HttpClient? _httpClient;
-
- private static string? _orgId;
- private static string? _streamName;
-
- ///
- /// CanUploadLog
- /// 是否能上传日志
- ///
- public static bool CanUploadLog => _httpClient != null;
-
- ///
- /// UpdateHttpClient
- /// 更新Http客户端
- ///
- ///
- public static void UpdateHttpClient(OpenObserve openObserve)
- {
- if (openObserve.Address == null || openObserve.AccessToken == null || openObserve.OrgId == null ||
- openObserve.StreamName == null)
- {
- return;
- }
-
- var httpClient = new HttpClient();
- httpClient.BaseAddress = new Uri(openObserve.Address);
- //Add a Cookie to the request header
- //添加Cookie到请求头
- var cookie = new Cookie("auth_tokens",
- "{\"access_token\":\"Basic " + openObserve.AccessToken + "\",\"refresh_token\":\"\"}");
- httpClient.DefaultRequestHeaders.Add("Cookie", cookie.ToString());
- _httpClient = httpClient;
- _orgId = openObserve.OrgId;
- _streamName = openObserve.StreamName;
- }
-
-
- ///
- /// Push log
- /// 推送日志
- ///
- ///
- private static async Task PostLog(List logRequestBean)
- {
- if (_httpClient == null)
- {
- return;
- }
-
- _lockList = true;
- LogCat.LogWithFormat("start_uploading", label: LogCat.LogLabel.LogCollector, false, logRequestBean.Count);
- var httpResponseMessage =
- await _httpClient.PostAsJsonAsync("/api/" + _orgId + "/" + _streamName + "/_json", logRequestBean);
- _lockList = false;
- if (httpResponseMessage.IsSuccessStatusCode)
- {
- LogDataList.RemoveRange(0, logRequestBean.Count);
- LogCat.LogWithFormat("upload_successful", label: LogCat.LogLabel.LogCollector, false,
- logRequestBean.Count, LogDataList.Count);
- if (LogDataList.Count > UploadThreshold)
- {
- //After the upload succeeds, if the threshold is still met, continue uploading.
- //上传成功后,如果依然满足阈值,那么继续上传。
- await PostLog(LogDataList.GetRange(0, UploadThreshold));
- }
- }
- else
- {
- LogCat.LogWithFormat("upload_failed", label: LogCat.LogLabel.LogCollector, false,
- httpResponseMessage.StatusCode.ToString(), LogDataList.Count);
- }
- }
-
- ///
- /// Push log information to the cache
- /// 推送日志信息到缓存
- ///
- ///
- ///Log data
- ///日志信息
- ///
- ///
- ///When logs reach the upload threshold, logs are automatically uploaded.
- ///当日志信息到达上传阈值后会自动上传。
- ///
- public static async Task Push(LogData logData)
- {
- LogDataList.Add(logData);
- LogCat.LogWithFormat("upload_status", LogCat.LogLabel.LogCollector, false, LogDataList.Count, UploadThreshold);
- if (!_lockList && LogDataList.Count > UploadThreshold)
- {
- //执行上传
- await PostLog(LogDataList.GetRange(0, UploadThreshold));
- }
- }
-}
-
-public class LogData
-{
- ///
- /// The AppId of this application
- /// 此应用的AppId
- ///
- public string? AppId { get; set; }
-
- ///
- /// message
- /// 消息
- ///
- // ReSharper disable UnusedAutoPropertyAccessor.Global
- public string? Message { get; set; }
- // ReSharper restore UnusedAutoPropertyAccessor.Global
-
- ///
- /// level
- /// 错误等级
- ///
- // ReSharper disable UnusedAutoPropertyAccessor.Global
- public int Level { get; set; }
- // ReSharper restore UnusedAutoPropertyAccessor.Global
-}
\ No newline at end of file
diff --git a/scripts/stateMachine/IStateContext.cs b/scripts/stateMachine/IStateContext.cs
index cdb81a5..2e5effc 100644
--- a/scripts/stateMachine/IStateContext.cs
+++ b/scripts/stateMachine/IStateContext.cs
@@ -33,7 +33,7 @@ public class StateContext
return;
}
- LogCat.LogWithFormat("state_change", label: LogCat.LogLabel.StateContext, LogCat.UploadFormat,_currentState, value);
+ LogCat.LogWithFormat("state_change", label: LogCat.LogLabel.StateContext, _currentState, value);
OnStateChange?.Invoke(_currentState, value);
_previousState = _currentState;
_currentState = value;
diff --git a/scripts/stateMachine/StateMachineTemplate.cs b/scripts/stateMachine/StateMachineTemplate.cs
index 2eb06e6..a0ced8a 100644
--- a/scripts/stateMachine/StateMachineTemplate.cs
+++ b/scripts/stateMachine/StateMachineTemplate.cs
@@ -68,8 +68,7 @@ public abstract class StateMachineTemplate : IStateMachine
}
else
{
- LogCat.LogErrorWithFormat("state_processor_not_found", label: LogCat.LogLabel.StateMachineTemplate,
- LogCat.UploadFormat,newState);
+ LogCat.LogErrorWithFormat("state_processor_not_found", label: LogCat.LogLabel.StateMachineTemplate, newState);
}
}
diff --git a/scripts/stateMachine/StateProcessor/PatrolStateProcessor.cs b/scripts/stateMachine/StateProcessor/PatrolStateProcessor.cs
index c96167a..5c34751 100644
--- a/scripts/stateMachine/StateProcessor/PatrolStateProcessor.cs
+++ b/scripts/stateMachine/StateProcessor/PatrolStateProcessor.cs
@@ -74,7 +74,7 @@ public class PatrolStateProcessor : StateProcessorTemplate
_originPosition = aiCharacter.GlobalPosition;
LogCat.LogWithFormat("patrol_origin_position", LogCat.LogLabel.PatrolStateProcessor,
- LogCat.UploadFormat, _originPosition);
+ _originPosition);
}
var point = _originPosition + Points[_index];
@@ -83,7 +83,7 @@ public class PatrolStateProcessor : StateProcessorTemplate
{
//No need to actually come to the patrol point, we just need a distance to get close.
//无需真正的来到巡逻点,我们只需要一个距离接近了就可以了。
- LogCat.LogWithFormat("patrol_arrival_point", LogCat.LogLabel.PatrolStateProcessor, LogCat.UploadFormat,
+ LogCat.LogWithFormat("patrol_arrival_point", LogCat.LogLabel.PatrolStateProcessor,
point);
_index++;
if (_index >= Points.Length)
@@ -94,7 +94,7 @@ public class PatrolStateProcessor : StateProcessorTemplate
else
{
LogCat.LogWithFormat("patrol_to_next_point", label: LogCat.LogLabel.PatrolStateProcessor,
- LogCat.UploadFormat, point,
+ point,
aiCharacter.GlobalPosition, Points[_index],
distance);
aiCharacter.SetTargetPosition(point.Value);
diff --git a/scripts/utils/NodeUtils.cs b/scripts/utils/NodeUtils.cs
index 43b6200..cdec9cc 100644
--- a/scripts/utils/NodeUtils.cs
+++ b/scripts/utils/NodeUtils.cs
@@ -141,7 +141,7 @@ public static class NodeUtils
{
return;
}
-
+
for (var i = 0; i < count; i++)
{
var node = parent.GetChild(i);
@@ -289,8 +289,7 @@ public static class NodeUtils
if (node is T result) return result;
// If the transformation fails, release the created node
//如果转型失败,释放所创建的节点
- LogCat.LogWarningWithFormat("warning_node_cannot_cast_to", LogCat.LogLabel.Default, LogCat.UploadFormat, node,
- nameof(T));
+ LogCat.LogWarningWithFormat("warning_node_cannot_cast_to", LogCat.LogLabel.Default, node, nameof(T));
node.QueueFree();
return null;
}
diff --git a/scripts/utils/TimeUtils.cs b/scripts/utils/TimeUtils.cs
index 3efce58..c47048c 100644
--- a/scripts/utils/TimeUtils.cs
+++ b/scripts/utils/TimeUtils.cs
@@ -33,7 +33,7 @@ public static class TimeUtils
var compNum1 = DateTime.Compare(dateTime, dtStartTime);
var compNum2 = DateTime.Compare(dateTime, dtEndTime);
var result = compNum1 >= 0 && compNum2 <= 0;
- LogCat.LogWithFormat("time_range_debug", LogCat.LogLabel.Default, LogCat.UploadFormat,dateTime, dtStartTime, dtEndTime,
+ LogCat.LogWithFormat("time_range_debug", LogCat.LogLabel.Default, dateTime, dtStartTime, dtEndTime,
result);
return result;
}