This commit is contained in:
wuwenbo 2026-04-03 11:34:18 +08:00
commit 1ee666978f
6 changed files with 63 additions and 23 deletions

View File

@ -196,7 +196,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &5844346892814870363
RectTransform:
m_ObjectHideFlags: 0
@ -1699,7 +1699,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -25.1}
m_SizeDelta: {x: 0, y: 45}
m_SizeDelta: {x: 345.01, y: 45}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4124539299936669926
CanvasRenderer:
@ -2038,7 +2038,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 578.98334, y: -649.6361}
m_AnchoredPosition: {x: 499.9831, y: -449.6361}
m_SizeDelta: {x: 836.2855, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5880887939028001257
@ -3236,7 +3236,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &6137653071972115895
RectTransform:
m_ObjectHideFlags: 0
@ -3496,7 +3496,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 239, y: -189}
m_SizeDelta: {x: 0, y: 77.2471}
m_SizeDelta: {x: 161.3776, y: 77.2471}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &410956719829077056
MonoBehaviour:
@ -4256,7 +4256,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 1378.1428, y: -500.1789}
m_AnchoredPosition: {x: 1299.1426, y: -300.1789}
m_SizeDelta: {x: 762.0334, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3448114547893685357
@ -6476,7 +6476,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6783109922304953915}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
@ -6667,6 +6667,7 @@ GameObject:
- component: {fileID: 1241485650656532452}
- component: {fileID: 7288334602915375921}
- component: {fileID: 564035902137378431}
- component: {fileID: 2665910223034029775}
m_Layer: 5
m_Name: BGRow
m_TagString: Untagged
@ -6693,10 +6694,10 @@ RectTransform:
- {fileID: 2751538148082621367}
m_Father: {fileID: 6961690653480397463}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -46}
m_SizeDelta: {x: 1761.9995, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1241485650656532452
CanvasRenderer:
@ -6751,7 +6752,7 @@ MonoBehaviour:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 200
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 1
m_Spacing: 0
@ -6762,6 +6763,20 @@ MonoBehaviour:
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &2665910223034029775
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7012897301952734023}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!1 &7174736790847714504
GameObject:
m_ObjectHideFlags: 0
@ -6874,7 +6889,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 59, y: -40.07083}
m_AnchoredPosition: {x: 52, y: -56}
m_SizeDelta: {x: 49.3881, y: 47.5514}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3907029063914451139
@ -6898,7 +6913,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Color: {r: 0.23137257, g: 0.21176472, b: 0.47450984, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@ -7351,6 +7366,7 @@ MonoBehaviour:
CheckButton: {fileID: 7141692321587899133}
ReturnButton: {fileID: 4630657448471480515}
BlockButton: {fileID: 5282322453820411557}
TwoPanelTransform: {fileID: 1331613566982700540}
--- !u!114 &4424146884624691702
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -536,6 +536,7 @@ namespace RuntimeData
public void AddCulturePoint(int culture)
{
PlayerCultureInfo.PlayerCulture += culture;
EventManager.Publish(new UpdateUITopTopBar() { UpdateType = UpdateTopBarType.UpdateCulture });
}
//增加金币(目前处理了逻辑和动画 TODO 现在还是逻辑和动画没有分开,后续还是要分开

View File

@ -1173,6 +1173,7 @@ namespace Logic.Action
{
EventManager.Publish(new UpdateUITopTopBar() { UpdateType = UpdateTopBarType.UpdateCoinPerTurn });
EventManager.Publish(new UpdateUITopTopBar() { UpdateType = UpdateTopBarType.UpdateTechPerTurn });
EventManager.Publish(new UpdateUITopTopBar() { UpdateType = UpdateTopBarType.UpdateCulturePerTurn });
EventManager.Publish(new UpdateUITopTopBar() { UpdateType = UpdateTopBarType.UpdateFaith });
}
Main.PlayerLogic.Update(actionParams.MapData);

View File

@ -36,15 +36,15 @@ namespace Logic.Skill
public override void OnBeInteractTarget(UnitData origin, UnitData self, GridData grid, MapData mapData)
{
bool removed = origin.GetSkill(SkillType.HideState, out _);
origin.RemoveSkill(SkillType.HideState, mapData);
bool removed = self.GetSkill(SkillType.HideState, out _);
self.RemoveSkill(SkillType.HideState, mapData);
//处理视觉
if (removed && origin.InMainSight())
if (removed && self.InMainSight())
{
//播放雾气特效
origin.Grid(mapData)?.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Fog));
//刷新origin的显示
origin.Renderer(mapData)?.InstantUpdateUnit(true);
self.Grid(mapData)?.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Fog));
//刷新self的显示
self.Renderer(mapData)?.InstantUpdateUnit(true);
}
}
@ -54,6 +54,10 @@ namespace Logic.Skill
// 触发渲染更新使HideState立即生效
if (mapData.GetIdentifierBase(originId) is UnitData unitData)
{
if (unitData.InMainSight())
{
unitData.Grid(mapData)?.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Fog));
}
unitData.Renderer(mapData)?.InstantUpdateUnit(true);
}
}

View File

@ -1,3 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using Logic.Action;
using Logic.Audio;
@ -33,6 +34,7 @@ namespace TH1_UI.View.Info
public Button CheckButton;
public Button ReturnButton;
public Button BlockButton;
public RectTransform TwoPanelTransform;
private GiantType _choiceGiantType;
private bool _alreadyMatchStart;
@ -135,21 +137,31 @@ namespace TH1_UI.View.Info
public void SetContent(bool firstOpen = true)
{
if (!_alreadyMatchStart) OnMatchStart();
//Step #1 设置选择英雄框
UpdatePool();
//Step #2 设置出战框
UpdatePickedList();
//Step #3 通知bottombar 刷新英雄头像
EventManager.Publish(new UpdateUIBottomBottomBarHeroButtonAvatar());
//Step #4 处理音乐
if (firstOpen && Table.Instance.PlayerDataAssets.GetPlayerInfo(Main.MapData.PlayerMap.SelfPlayerData, out var info))
{
AudioManager.Instance.PlayMusic(info.MusicName, 1f, 2f, true);
}
//Step #5 强制重建布局修复首次打开时Layout错乱需延迟到帧末Canvas完成首次计算后
LayoutRebuilder.ForceRebuildLayoutImmediate(TwoPanelTransform);
/*StartCoroutine(DelayedLayoutRebuild());
}
private IEnumerator DelayedLayoutRebuild()
{
yield return new WaitForEndOfFrame();
Canvas.ForceUpdateCanvases();*/
}
public void UpdatePickedList()

View File

@ -53,10 +53,15 @@ namespace TH1_UI.View.Top
public void SetContent()
{
UpdateAllInstant();
// 首次SetContent时强制重建布局确保所有Panel的位置和大小正确
if (FatherPanel != null)
LayoutRebuilder.ForceRebuildLayoutImmediate(FatherPanel);
}
public void UpdateAllInstant()
{
//注意 开局首次调用本函数所有city都是空percoin和pertech perculture都是0需要controller里的每个update函数来刷新的
if (Main.MapData?.PlayerMap?.SelfPlayerData == null) return;
Turn.text = (Main.MapData.PlayerMap.SelfPlayerData.Turn + 1).ToString();
Faith.text = Main.MapData.PlayerMap.SelfPlayerData.PlayerScore.ToString();
@ -93,6 +98,7 @@ namespace TH1_UI.View.Top
// 强制根据数据显示/隐藏Culture模块
bool cultureNeedShow = (culturePerTurn > 0 || Main.MapData.PlayerMap.SelfPlayerData.PlayerCultureInfo.PlayerCulture > 0);
//cultureNeedShow = true;
if (CultureTransform != null)
{