联机功能开发

This commit is contained in:
daixiawu 2026-05-28 13:11:26 +08:00
parent 32316024b8
commit efe217d4b6
6 changed files with 2213 additions and 2046 deletions

View File

@ -29,8 +29,8 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1315002688828714703}
- {fileID: 86432792637060186}
- {fileID: 1315002688828714703}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
@ -162,12 +162,13 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 9123125548031705264}
- {fileID: 15850864895657744}
m_Father: {fileID: 86432792637060186}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 272.58, y: 133.64}
m_SizeDelta: {x: 545.11, y: 267.28}
m_AnchoredPosition: {x: 219, y: -23}
m_SizeDelta: {x: 545.11, y: 558.0208}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4862056917982880964
CanvasRenderer:
@ -363,7 +364,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1436687245126327781}
m_HandleRect: {fileID: 5312906796478825185}
m_Direction: 2
m_Value: 0
m_Value: 1
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
@ -882,6 +883,140 @@ MonoBehaviour:
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &5682446644685623298
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 15850864895657744}
- component: {fileID: 5946708489791873858}
- component: {fileID: 4168598620314003523}
m_Layer: 5
m_Name: Title
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &15850864895657744
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5682446644685623298}
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: 2840714203641749202}
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: 21.0091, y: 256.8701}
m_SizeDelta: {x: 470.647, y: 38.2595}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5946708489791873858
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5682446644685623298}
m_CullTransparentMesh: 1
--- !u!114 &4168598620314003523
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5682446644685623298}
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: "\u7F51\u7EDC\u9519\u8BEF\u8BE6\u60C5"
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: 1
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: 0, y: 0, z: 0, 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!1 &6753549745623617326
GameObject:
m_ObjectHideFlags: 0
@ -1006,7 +1141,7 @@ RectTransform:
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: 32, y: -93}
m_AnchoredPosition: {x: 27, y: -105}
m_SizeDelta: {x: 545.16, y: 267.2933}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4288559544856766642
@ -1145,7 +1280,7 @@ MonoBehaviour:
m_Padding:
m_Left: 10
m_Right: 0
m_Top: 10
m_Top: 30
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0

View File

@ -118,11 +118,10 @@ namespace TH1_UI.View.Bottom
var mapConfig = Main.MapData?.MapConfig ?? Main.Instance?.MapConfig;
if (lobbyInfo == null || mapConfig == null) return;
mapConfig.EnsurePlayerSlots(NetMode.Multi);
var slots = mapConfig.MultiCivs;
var seats = BuildNetSeats(mapConfig);
var memberInfos = lobbyInfo.GetAllMemberInfo();
var ownerId = lobbyInfo.GetLobbyOwnerId();
var activeCount = slots?.Count ?? 0;
var activeCount = seats.Count;
EnsureNetRowCount(activeCount);
for (int i = 0; i < _netInfoRowList.Count; i++)
@ -132,14 +131,29 @@ namespace TH1_UI.View.Bottom
row.gameObject.SetActive(active);
if (!active) continue;
var slot = slots[i];
memberInfos.TryGetValue(slot.MemberId, out var memberInfo);
row.InitContent(slot, memberInfo, lobbyInfo.IsLobbyOwner(), ownerId);
var seat = seats[i];
memberInfos.TryGetValue(seat.MemberId, out var memberInfo);
row.InitContent(seat, memberInfo, lobbyInfo.IsLobbyOwner(), ownerId);
}
ResizeScrollView(activeCount);
}
private List<MemberCiv> BuildNetSeats(MapConfig mapConfig)
{
var seats = new List<MemberCiv>();
var slots = mapConfig.MultiCivs;
if (slots == null) return seats;
foreach (var slot in slots)
{
if (slot == null || slot.MemberId == 0) continue;
seats.Add(slot);
}
return seats;
}
private void EnsureNetRowCount(int count)
{
while (_netInfoRowList.Count < count)

View File

@ -777,6 +777,22 @@ namespace TH1_UI.View.Outside
}
}
private bool AreCurrentLobbyMembersReady()
{
if (!_lobby.IsInLobby()) return false;
var memberInfos = _lobby.GetAllMemberInfo();
if (memberInfos == null || memberInfos.Count == 0) return false;
var ownerId = _lobby.GetLobbyOwnerId();
foreach (var memberId in memberInfos.Keys)
{
if (memberId == ownerId) continue;
if (!Main.Instance.MapConfig.IsMemberReady(memberId)) return false;
}
return true;
}
private void ReconcileRoomMembers()
{
Main.Instance.MapConfig.SetPlayerCount(Main.Instance.MapConfig.PlayerCount, NetMode.Multi);
@ -1477,6 +1493,19 @@ namespace TH1_UI.View.Outside
SetMapConfig();
ReconcileRoomMembers();
if(Main.Instance.HasMultiArchive() && Main.Instance.MapConfig.IsResumeArchiveSelected){
if (!AreCurrentLobbyMembersReady())
{
Debug.Log("Cannot resume multiplayer game: not all current lobby members are ready");
NetworkPlayerTipManager.Instance.Request(NetworkPlayerTipType.LobbyMembersNotReady);
ShowLobbyNotify(UINotifyCommonType.OutsideMultiplayRoomNotReady);
return;
}
ShowLoadingAndStartGame(true);
return;
}
BuildRoomMemberRows(_lobby.GetAllMemberInfo(), Main.Instance.MapConfig.MultiCivs);
if (_openMemberRowCount > 0)
@ -1493,12 +1522,6 @@ namespace TH1_UI.View.Outside
return;
}
//Step #2 如果是继续存档,直接开始
if(Main.Instance.HasMultiArchive() && Main.Instance.MapConfig.IsResumeArchiveSelected){
ShowLoadingAndStartGame(true);
return;
}
// Step #3 已放开"相同 Empire (Civ+Force) 阻止",允许多人选择相同阵营开局。
// 旧逻辑(仅比较 CivId、未比 ForceId已移除提示文本 OutsideMultiplayCantStartForce 暂保留未删。
var members = _lobby.GetAllMemberIds();

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,7 +1,7 @@
# Graph Report - C:\TH1\TH1 (2026-05-28)
## Corpus Check
- 9287 files · ~94,358,422 words
- 9287 files · ~94,358,628 words
- Verdict: corpus is large enough that graph structure adds value.
## Summary
@ -11949,11 +11949,11 @@ Nodes (1): Kill any existing processes listening on the target port.
_Questions this graph is uniquely positioned to answer:_
- **Why does `NullCheck` connect `Community 3` to `Community 0`, `Community 1`, `Community 2`, `Community 5`, `Community 6`, `Community 7`, `Community 8`, `Community 9`, `Community 10`, `Community 11`, `Community 12`, `Community 13`, `Community 14`, `Community 15`, `Community 16`, `Community 17`, `Community 18`, `Community 19`, `Community 20`, `Community 21`, `Community 22`, `Community 23`, `Community 24`, `Community 26`, `Community 27`, `Community 28`, `Community 29`, `Community 30`, `Community 32`, `Community 33`, `Community 34`, `Community 35`, `Community 36`, `Community 37`, `Community 38`, `Community 40`, `Community 41`, `Community 42`, `Community 43`, `Community 44`, `Community 45`, `Community 46`, `Community 47`, `Community 48`, `Community 49`, `Community 50`, `Community 51`, `Community 52`, `Community 54`, `Community 55`, `Community 56`, `Community 57`, `Community 58`, `Community 59`, `Community 61`, `Community 62`, `Community 63`, `Community 64`, `Community 65`, `Community 66`, `Community 67`, `Community 68`, `Community 69`, `Community 70`, `Community 71`, `Community 72`, `Community 73`, `Community 74`, `Community 75`, `Community 76`, `Community 77`, `Community 79`, `Community 80`, `Community 81`, `Community 82`, `Community 83`, `Community 84`, `Community 86`, `Community 87`, `Community 89`, `Community 90`, `Community 91`, `Community 92`, `Community 99`, `Community 127`, `Community 148`, `Community 205`, `Community 318`?**
_High betweenness centrality (0.514) - this node is a cross-community bridge._
- **Why does `NotSupportedException__ctor_mE174750CF0247BBB47544FFD71D66BB89630945B()` connect `Community 6` to `Community 1`, `Community 2`, `Community 3`, `Community 5`, `Community 7`, `Community 8`, `Community 10`, `Community 13`, `Community 14`, `Community 17`, `Community 18`, `Community 22`, `Community 23`, `Community 26`, `Community 27`, `Community 29`, `Community 30`, `Community 34`, `Community 35`, `Community 36`, `Community 38`, `Community 42`, `Community 49`, `Community 55`, `Community 59`, `Community 68`, `Community 71`, `Community 75`, `Community 77`, `Community 81`?**
_High betweenness centrality (0.021) - this node is a cross-community bridge._
_High betweenness centrality (0.468) - this node is a cross-community bridge._
- **Why does `Object__ctor_mE837C6B9FA8C6D5D109F4B2EC885D79919AC0EA2()` connect `Community 8` to `Community 1`, `Community 2`, `Community 3`, `Community 5`, `Community 6`, `Community 7`, `Community 9`, `Community 10`, `Community 11`, `Community 12`, `Community 13`, `Community 14`, `Community 15`, `Community 16`, `Community 17`, `Community 18`, `Community 19`, `Community 20`, `Community 21`, `Community 22`, `Community 23`, `Community 24`, `Community 26`, `Community 27`, `Community 28`, `Community 29`, `Community 32`, `Community 33`, `Community 34`, `Community 35`, `Community 36`, `Community 37`, `Community 38`, `Community 40`, `Community 41`, `Community 42`, `Community 43`, `Community 44`, `Community 49`, `Community 54`, `Community 55`, `Community 56`, `Community 57`, `Community 58`, `Community 59`, `Community 61`, `Community 62`, `Community 63`, `Community 64`, `Community 65`, `Community 66`, `Community 67`, `Community 68`, `Community 69`, `Community 70`, `Community 71`, `Community 72`, `Community 73`, `Community 75`, `Community 76`, `Community 77`, `Community 79`, `Community 80`, `Community 81`, `Community 82`, `Community 84`, `Community 86`, `Community 87`, `Community 90`, `Community 91`, `Community 92`, `Community 99`, `Community 127`?**
_High betweenness centrality (0.016) - this node is a cross-community bridge._
_High betweenness centrality (0.029) - this node is a cross-community bridge._
- **Why does `NotSupportedException__ctor_mE174750CF0247BBB47544FFD71D66BB89630945B()` connect `Community 6` to `Community 1`, `Community 2`, `Community 3`, `Community 5`, `Community 7`, `Community 8`, `Community 10`, `Community 13`, `Community 14`, `Community 17`, `Community 18`, `Community 22`, `Community 23`, `Community 26`, `Community 27`, `Community 29`, `Community 30`, `Community 34`, `Community 35`, `Community 36`, `Community 38`, `Community 42`, `Community 49`, `Community 55`, `Community 59`, `Community 68`, `Community 71`, `Community 75`, `Community 77`, `Community 81`?**
_High betweenness centrality (0.022) - this node is a cross-community bridge._
- **Are the 86144 inferred relationships involving `NullCheck` (e.g. with `AnimancerComponent_set_Animator_m6D48D5AFEC5608F1982DDAF26C3512CFE72F2A8D()` and `AnimancerComponent_get_IsPlayableInitialized_mB5A207CBB483E0F77C65DB4AB7615F282E91CD30()`) actually correct?**
_`NullCheck` has 86144 INFERRED edges - model-reasoned connections that need verification._
- **Are the 9047 inferred relationships involving `Object__ctor_mE837C6B9FA8C6D5D109F4B2EC885D79919AC0EA2()` (e.g. with `UnitySourceGeneratedAssemblyMonoScriptTypes_v1__ctor_mE65AE524188091311A3CFBD98187D9F5EC00D8E3()` and `FastComparer__ctor_m651D576617C3EE91A72F9B695130EFBECE6F5DD0()`) actually correct?**