联机bug修复

This commit is contained in:
daixiawu 2026-05-28 23:09:19 +08:00
parent e818cf87bf
commit acedf96656
13 changed files with 6701 additions and 5448 deletions

File diff suppressed because one or more lines are too long

View File

@ -820,7 +820,7 @@ MonoBehaviour:
- TaskType: 402016
IsActive: 1
Name: 20111
Description: 20112
Description: 20128
WonderType: 5
CultureValue: 5
LockByTech: 0

File diff suppressed because one or more lines are too long

View File

@ -61,6 +61,7 @@ MonoBehaviour:
BugReportUploadingHint:
BugReportUploadingSuccessHint:
BugReportUploadingFailedHint:
BugReportUploadingSuccessNotify:
HeroTaskFinishedDesc: 2360
GridInfoText_PerTurn: 2503
GridInfoText_Population: 2504

View File

@ -327,6 +327,81 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &1410574936525718859
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3801995801602567961}
- component: {fileID: 2442486295289587762}
- component: {fileID: 1200838203512695312}
m_Layer: 5
m_Name: Hint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3801995801602567961
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1410574936525718859}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5914682348923016253}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 188, y: 39}
m_SizeDelta: {x: 87.5724, y: 68.763}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2442486295289587762
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1410574936525718859}
m_CullTransparentMesh: 1
--- !u!114 &1200838203512695312
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1410574936525718859}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: c09f251071d94ad468d8b59ad5126ae5, type: 3}
m_Type: 0
m_PreserveAspect: 1
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &1462377175188131347
GameObject:
m_ObjectHideFlags: 0
@ -544,6 +619,7 @@ RectTransform:
- {fileID: 1474286997294041896}
- {fileID: 6639640428677976138}
- {fileID: 7463303194629128016}
- {fileID: 5914682348923016253}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
@ -1388,6 +1464,81 @@ MonoBehaviour:
ID: 19978
FontID: 0
TextCfg: []
--- !u!1 &3139423379558860914
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4544793768592753303}
- component: {fileID: 5374783636876524037}
- component: {fileID: 137987358015337877}
m_Layer: 5
m_Name: BG
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4544793768592753303
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3139423379558860914}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5914682348923016253}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.000947, y: -0.52307}
m_SizeDelta: {x: 406.77, y: 68.763}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5374783636876524037
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3139423379558860914}
m_CullTransparentMesh: 1
--- !u!114 &137987358015337877
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3139423379558860914}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.21176472, g: 0.19607845, b: 0.45098042, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 9d002fd0b91e49747b7a957c9e0df3d0, type: 3}
m_Type: 1
m_PreserveAspect: 1
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &3383405614125398143
GameObject:
m_ObjectHideFlags: 0
@ -1636,7 +1787,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "\u623F\u95F4\u540D\u79F0"
m_text: "\u63CF\u8FF0\u95EE\u9898"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: ce4904f8ddac15944907907115531ad5, type: 2}
m_sharedMaterial: {fileID: 1214840240034325189, guid: ce4904f8ddac15944907907115531ad5, type: 2}
@ -1721,7 +1872,7 @@ MonoBehaviour:
NoExport: 0
FontBan: 0
Preset: 0
ID: 19979
ID: 20127
FontID: 2
TextCfg:
- Type: 1
@ -3318,6 +3469,182 @@ MonoBehaviour:
LineSpacing: 0
ApplyParagraphSpacing: 0
ParagraphSpacing: 0
--- !u!1 &6006186574766481407
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6528401495572540667}
- component: {fileID: 4609176109548218278}
- component: {fileID: 6525005249998588714}
- component: {fileID: 3775077552116314037}
m_Layer: 5
m_Name: Message
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6528401495572540667
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6006186574766481407}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5914682348923016253}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 0.000015258789, y: -0.52309}
m_SizeDelta: {x: 406.77, y: 68.763}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &4609176109548218278
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6006186574766481407}
m_CullTransparentMesh: 1
--- !u!114 &6525005249998588714
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6006186574766481407}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "\u5B58\u5728\u76F8\u540C\u7684\u9635\u8425\uFF0C\u65E0\u6CD5\u5F00\u59CB"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8e119f168f1a6b745be02ef19f51610f, type: 2}
m_sharedMaterial: {fileID: -8081454072124122709, guid: 8e119f168f1a6b745be02ef19f51610f, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 24
m_fontSizeBase: 24
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 12
m_fontSizeMax: 24
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 25.665771, y: 0, z: 17.73378, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &3775077552116314037
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6006186574766481407}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6b27f832d22e4a8d916272b644937774, type: 3}
m_Name:
m_EditorClassIdentifier:
Ban: 0
NoExport: 0
FontBan: 0
Preset: 0
ID: 2502
FontID: 1
TextCfg:
- Type: 0
ApplyFontSize: 0
FontSize: 24
ApplyCharacterSpacing: 0
CharacterSpacing: 0
ApplyWordSpacing: 0
WordSpacing: 0
ApplyLineSpacing: 0
LineSpacing: 0
ApplyParagraphSpacing: 0
ParagraphSpacing: 0
- Type: 1
ApplyFontSize: 0
FontSize: 24
ApplyCharacterSpacing: 0
CharacterSpacing: 0
ApplyWordSpacing: 0
WordSpacing: 0
ApplyLineSpacing: 0
LineSpacing: 0
ApplyParagraphSpacing: 0
ParagraphSpacing: 0
--- !u!1 &6290379265712900593
GameObject:
m_ObjectHideFlags: 0
@ -3399,6 +3726,103 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!1 &6517830460796597447
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5914682348923016253}
- component: {fileID: 828689230318265229}
- component: {fileID: 1856526186480041475}
- component: {fileID: 9120505538115558562}
- component: {fileID: 7439456304264024725}
m_Layer: 5
m_Name: BugReportInsideNotify
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &5914682348923016253
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6517830460796597447}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.99992007, y: 0.99992007, z: 0.99992007}
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 4544793768592753303}
- {fileID: 3801995801602567961}
- {fileID: 6528401495572540667}
m_Father: {fileID: 1937094061063432054}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 344.97223, y: -270.97833}
m_SizeDelta: {x: 406.767, y: 67.717}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &828689230318265229
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6517830460796597447}
m_CullTransparentMesh: 1
--- !u!225 &1856526186480041475
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6517830460796597447}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!95 &9120505538115558562
Animator:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6517830460796597447}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 0}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!114 &7439456304264024725
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6517830460796597447}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ad50f81b1d25c441943c37a89ba23f6, type: 3}
m_Name:
m_EditorClassIdentifier:
_Animator: {fileID: 9120505538115558562}
_ActionOnDisable: 0
--- !u!1 &7286883806265505568
GameObject:
m_ObjectHideFlags: 0

View File

@ -439,6 +439,7 @@ namespace RuntimeData
CivId = copyData.CivId;
Wonder = copyData.Wonder;
buildingLevel = copyData.buildingLevel;
NavalBasePoint = copyData.NavalBasePoint;
GeoIdList = new List<uint>();
foreach (var id in copyData.GeoIdList) GeoIdList.Add(id);
WaterRoadForceId = new bool[copyData.WaterRoadForceId.Length];
@ -463,6 +464,7 @@ namespace RuntimeData
CivId = copyData.CivId;
Wonder = copyData.Wonder;
buildingLevel = copyData.buildingLevel;
NavalBasePoint = copyData.NavalBasePoint;
WaterRoadForceId = new bool[copyData.WaterRoadForceId.Length];
Array.Copy(copyData.WaterRoadForceId, WaterRoadForceId, copyData.WaterRoadForceId.Length);
GeoIdList ??= new List<uint>();
@ -995,4 +997,4 @@ namespace RuntimeData
}
}
}

View File

@ -67,6 +67,7 @@ public class TextDataAssets : ScriptableObject
[MultilingualField]public string BugReportUploadingHint;
[MultilingualField]public string BugReportUploadingSuccessHint;
[MultilingualField]public string BugReportUploadingFailedHint;
[MultilingualField]public string BugReportUploadingSuccessNotify;
//-------- UI --------

View File

@ -1,4 +1,8 @@
using TH1_Core.Events;
using Logic.CrashSight;
using TH1_Logic.Config;
using TH1_Logic.Oss;
using Steamworks;
using TH1_UI.Controller.Base;
using TH1_UI.View.Global;
@ -6,6 +10,8 @@ namespace TH1_UI.Controller.Global
{
public class UIGlobalBugReportController : ViewController<UIGlobalBugReportView>
{
private bool _isUploading;
public UIGlobalBugReportController() { }
protected override void RegisterEventCallback()
@ -14,6 +20,7 @@ namespace TH1_UI.Controller.Global
if (WindowScript != null)
{
WindowScript.OnBtnCloseClick += _OnBtnCloseClick;
WindowScript.OnBtnSubmitClick += _OnBtnSubmitClick;
}
}
@ -22,6 +29,7 @@ namespace TH1_UI.Controller.Global
if (WindowScript != null)
{
WindowScript.OnBtnCloseClick = null;
WindowScript.OnBtnSubmitClick = null;
}
base.UnregisterEventCallback();
}
@ -38,6 +46,7 @@ namespace TH1_UI.Controller.Global
public override bool Close()
{
WindowScript?.CloseView();
_isUploading = false;
return base.Close();
}
@ -45,5 +54,86 @@ namespace TH1_UI.Controller.Global
{
Close();
}
void _OnBtnSubmitClick()
{
if (_isUploading || WindowScript == null) return;
_ = SubmitBugReportAsync();
}
private async System.Threading.Tasks.Task SubmitBugReportAsync()
{
if (WindowScript == null) return;
_isUploading = true;
WindowScript.SetUploading(true);
WindowScript.SetStatusText(Table.Instance.TextDataAssets.BugReportUploadingHint);
try
{
if (!TryGetSteamId(out var steamId))
{
WindowScript.SetStatusText(Table.Instance.TextDataAssets.BugReportUploadingFailedHint);
return;
}
string version = PlayerBugReportService.GetCurrentVersion();
string description = WindowScript.GetDescription();
bool includeArchives = WindowScript.ShouldUploadRecord();
var package = PlayerBugReportService.BuildPackage(steamId, description, version,
includeArchives, includeArchives, includeArchives);
if (package.Data.Length > PlayerBugReportService.MaxBugReportUploadBytes)
{
LogSystem.LogError($"PlayerBugReport upload failed: package size {package.Data.Length} exceeds {PlayerBugReportService.MaxBugReportUploadBytes}");
WindowScript.SetStatusText(Table.Instance.TextDataAssets.BugReportUploadingFailedHint);
return;
}
var result = await OssManager.Instance.UploadPlayerBugReportAsync(steamId, package.Data,
package.Manifest.version);
if (result.success)
{
WindowScript.SetStatusText(Table.Instance.TextDataAssets.BugReportUploadingSuccessHint);
WindowScript.ShowInsideNotify(Table.Instance.TextDataAssets.BugReportUploadingSuccessNotify);
}
else
{
WindowScript.SetStatusText(Table.Instance.TextDataAssets.BugReportUploadingFailedHint);
}
}
catch (System.Exception ex)
{
LogSystem.LogError($"PlayerBugReport submit exception: {ex}");
WindowScript?.SetStatusText(Table.Instance.TextDataAssets.BugReportUploadingFailedHint);
}
finally
{
_isUploading = false;
WindowScript?.SetUploading(false);
}
}
private static bool TryGetSteamId(out string steamId)
{
steamId = "";
try
{
if (!SteamUser.BLoggedOn())
return false;
var id = SteamUser.GetSteamID().m_SteamID;
if (id == 0)
return false;
steamId = id.ToString();
return true;
}
catch (System.Exception ex)
{
LogSystem.LogWarning($"PlayerBugReport SteamID unavailable: {ex.Message}");
return false;
}
}
}
}

View File

@ -1,5 +1,8 @@
using TH1_Core.Events;
using Logic.Multilingual;
using TH1_UI.View.Base;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace TH1_UI.View.Global
@ -8,12 +11,21 @@ namespace TH1_UI.View.Global
{
public Button CloseButton;
public Button BlockerButton;
public Button SubmitButton;
public Toggle UploadRecordToggle;
public TMP_InputField DescriptionInput;
public TextMeshProUGUI StatusText;
public GameObject BugReportInsideNotify;
public TextMeshProUGUI BugReportInsideNotifyText;
public CanvasGroup BugReportInsideNotifyCanvasGroup;
public ViDelegateAssisstant.Dele OnBtnCloseClick;
public ViDelegateAssisstant.Dele OnBtnSubmitClick;
protected override void OnInit()
{
base.OnInit();
EnsureReferences();
if (CloseButton != null)
{
@ -26,14 +38,148 @@ namespace TH1_UI.View.Global
BlockerButton.onClick.RemoveAllListeners();
BlockerButton.onClick.AddListener(() => { OnBtnCloseClick?.Invoke(); });
}
if (SubmitButton != null)
{
SubmitButton.onClick.RemoveAllListeners();
SubmitButton.onClick.AddListener(() => { OnBtnSubmitClick?.Invoke(); });
}
}
public void SetContent(ShowUIGlobalBugReport evt)
{
EnsureReferences();
SetUploading(false);
SetStatusText(string.Empty);
HideInsideNotify();
}
public void CloseView()
{
HideInsideNotify();
if (Timer.Instance != null) Timer.Instance.CancelByTarget(this);
}
public string GetDescription()
{
EnsureReferences();
return DescriptionInput != null ? DescriptionInput.text : string.Empty;
}
public bool ShouldUploadRecord()
{
EnsureReferences();
return UploadRecordToggle == null || UploadRecordToggle.isOn;
}
public void SetUploading(bool uploading)
{
EnsureReferences();
if (SubmitButton != null) SubmitButton.interactable = !uploading;
if (DescriptionInput != null) DescriptionInput.interactable = !uploading;
if (UploadRecordToggle != null) UploadRecordToggle.interactable = !uploading;
}
public void SetStatusText(string textKey)
{
EnsureReferences();
SetTextDataAssetText(StatusText, textKey);
}
public void ShowInsideNotify(string textKey)
{
EnsureReferences();
if (BugReportInsideNotify == null) return;
if (BugReportInsideNotifyText != null)
SetTextDataAssetText(BugReportInsideNotifyText, textKey);
if (BugReportInsideNotifyCanvasGroup != null)
BugReportInsideNotifyCanvasGroup.alpha = 1f;
BugReportInsideNotify.SetActive(true);
if (Timer.Instance != null)
{
Timer.Instance.CancelByTarget(this);
Timer.Instance.TimerRegister(this, HideInsideNotify, 2f, "BugReportInsideNotify");
}
}
private void HideInsideNotify()
{
if (BugReportInsideNotify != null)
BugReportInsideNotify.SetActive(false);
}
private void EnsureReferences()
{
if (SubmitButton == null)
{
var report = FindChild("Report");
SubmitButton = report != null ? report.GetComponent<Button>() : null;
}
if (UploadRecordToggle == null)
{
var toggle = FindChild("UploadRecordToggle");
UploadRecordToggle = toggle != null ? toggle.GetComponent<Toggle>() : null;
}
if (DescriptionInput == null)
DescriptionInput = GetComponentInChildren<TMP_InputField>(true);
if (StatusText == null)
{
var message = FindChild("Message");
StatusText = message != null ? message.GetComponentInChildren<TextMeshProUGUI>(true) : null;
}
if (BugReportInsideNotify == null)
{
var notify = FindChild("BugReportInsideNotify");
BugReportInsideNotify = notify != null ? notify.gameObject : null;
}
if (BugReportInsideNotify == null)
return;
if (BugReportInsideNotifyText == null)
{
var text = BugReportInsideNotify.transform.Find("Text (TMP)");
BugReportInsideNotifyText = text != null
? text.GetComponent<TextMeshProUGUI>()
: BugReportInsideNotify.GetComponentInChildren<TextMeshProUGUI>(true);
}
if (BugReportInsideNotifyCanvasGroup == null)
BugReportInsideNotifyCanvasGroup = BugReportInsideNotify.GetComponent<CanvasGroup>();
}
private Transform FindChild(string childName)
{
var children = GetComponentsInChildren<Transform>(true);
for (int i = 0; i < children.Length; i++)
{
if (children[i].name == childName)
return children[i];
}
return null;
}
private void SetTextDataAssetText(TextMeshProUGUI text, string textKey)
{
if (text == null)
return;
if (uint.TryParse(textKey, out _))
{
MultilingualManager.Instance.SetUIText(text, textKey);
return;
}
text.text = textKey ?? string.Empty;
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff