V0.7.3e2
This commit is contained in:
parent
402946e5de
commit
3cf3882298
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -203,6 +203,24 @@ namespace RuntimeData
|
||||
return oldPlayerCount != PlayerCount || oldSlotCount != (MultiCivs?.Count ?? 0);
|
||||
}
|
||||
|
||||
public bool ClearHostControlledSlotsForMultiplayerLobby()
|
||||
{
|
||||
EnsurePlayerSlots(NetMode.Multi);
|
||||
var changed = false;
|
||||
foreach (var slot in MultiCivs)
|
||||
{
|
||||
if (slot == null || slot.MemberId != 0 || !slot.IsHostControlled) continue;
|
||||
slot.IsHostControlled = false;
|
||||
slot.IsAI = true;
|
||||
slot.IsReady = false;
|
||||
slot.PlayerId = 0;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed) RefreshMultiCivsDict();
|
||||
return changed;
|
||||
}
|
||||
|
||||
private int GetRequiredPlayerSlotCount(int targetCount, NetMode netMode)
|
||||
{
|
||||
targetCount = Math.Max(0, targetCount);
|
||||
|
||||
@ -528,6 +528,7 @@ namespace TH1_Logic.Action
|
||||
|
||||
protected override bool Execute(CommonActionParams actionParams)
|
||||
{
|
||||
if (!CheckCan(actionParams)) return false;
|
||||
var player = actionParams.PlayerData;
|
||||
var heroD = player.PlayerHeroData;
|
||||
return heroD?.AddHero(actionParams.MapData,actionParams.PlayerData,_actionId.GiantType)??false;
|
||||
|
||||
@ -457,6 +457,14 @@ namespace Logic.Action
|
||||
&& actionParam.PlayerData.PlayerCultureInfo.PlayerCulture >= cultureCost;
|
||||
}
|
||||
|
||||
private bool CheckHeroBelongPlayer(CommonActionParams actionParam)
|
||||
{
|
||||
if (actionParam?.PlayerData == null) return false;
|
||||
if (!Table.Instance.UnitTypeDataAssets.GetUnitTypeInfo(UnitType.Giant, _actionId.GiantType, 1,
|
||||
out var info)) return false;
|
||||
return info.GiantEmpire == actionParam.PlayerData.Empire;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断场上的英雄数量是否已经达到 SameUnitCountLimit 上限
|
||||
/// </summary>
|
||||
@ -552,6 +560,7 @@ namespace Logic.Action
|
||||
if(_actionId.UnitType != UnitType.Giant) return false;
|
||||
|
||||
if (!TrainUnitActionCheckBaseData(actionParam)) return false;
|
||||
if (!CheckHeroBelongPlayer(actionParam)) return false;
|
||||
|
||||
GridData gridData;
|
||||
PlayerData playerData;
|
||||
@ -616,6 +625,7 @@ namespace Logic.Action
|
||||
//step #0 基础鲁棒性 (playerData不能为空 不是英雄则直接排除
|
||||
if(_actionId.UnitType != UnitType.Giant) return false;
|
||||
if (!TrainUnitActionCheckBaseData(actionParam)) return false;
|
||||
if (!CheckHeroBelongPlayer(actionParam)) return false;
|
||||
|
||||
GridData gridData;
|
||||
PlayerData playerData;
|
||||
|
||||
@ -663,6 +663,8 @@ namespace TH1_Logic.Steam
|
||||
return;
|
||||
}
|
||||
|
||||
Main.Instance?.MapConfig?.ClearHostControlledSlotsForMultiplayerLobby();
|
||||
|
||||
_pendingLobbyPassword = password ?? "";
|
||||
_pendingLobbyRoomName = FilterRoomName(string.IsNullOrWhiteSpace(roomName) ? GetDefaultRoomName(SelfName) : roomName.Trim());
|
||||
if (_pendingLobbyRoomName.Length < 2)
|
||||
|
||||
@ -255,7 +255,7 @@ namespace TH1_UI.View.Info
|
||||
public void UpdatePool()
|
||||
{
|
||||
var heroData = Main.MapData.PlayerMap.SelfPlayerData.PlayerHeroData;
|
||||
//_choiceGiantType = GiantType.None;
|
||||
_choiceGiantType = GiantType.None;
|
||||
|
||||
//确认是否要pick,是否显示相关的模块
|
||||
bool needPick = heroData.HeroCount != heroData.MaxHeroCount;
|
||||
@ -263,6 +263,7 @@ namespace TH1_UI.View.Info
|
||||
if (!needPick) return;
|
||||
|
||||
var player = Main.MapData.PlayerMap.SelfPlayerData;
|
||||
if (Pool == null || Pool.Count < 5) return;
|
||||
bool firstSelect = true;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
@ -270,7 +271,7 @@ namespace TH1_UI.View.Info
|
||||
var giantType = Table.Instance.UnitTypeDataAssets.GetGiantType(player.CivEnum, player.ForceEnum, ch);
|
||||
bool picked = player.PlayerHeroData.HasHero(giantType);
|
||||
bool selected = !picked && firstSelect;
|
||||
Pool[i].UpdateContent(picked,selected);
|
||||
Pool[i].SetupContent(player.CivEnum,player.ForceEnum,ch,OnPoolSelect,picked,selected);
|
||||
if (selected)
|
||||
{
|
||||
firstSelect = false;
|
||||
@ -290,7 +291,7 @@ namespace TH1_UI.View.Info
|
||||
var action = ActionLogicFactory.GetActionLogic(actionId);
|
||||
if (action == null) return;
|
||||
var actionParams = new CommonActionParams(mapData:Main.MapData,playerData:Main.MapData.PlayerMap.SelfPlayerData);
|
||||
if (action.CompleteExecute(actionParams))
|
||||
if (action.CheckCan(actionParams) && action.CompleteExecute(actionParams))
|
||||
{
|
||||
SetContent();
|
||||
EventManager.Publish(new UpdateUIBottomBottomBarHeroButtonAvatar());
|
||||
|
||||
@ -314,6 +314,8 @@ namespace TH1_UI.View.Outside
|
||||
public void SetContent(ShowUIOutsideMultiplay evt)
|
||||
{
|
||||
InitNetErrorArea();
|
||||
if (!_lobby.IsInLobby())
|
||||
Main.Instance?.MapConfig?.ClearHostControlledSlotsForMultiplayerLobby();
|
||||
|
||||
//Step #1 设置朋友列表
|
||||
RefreshFriendList();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user