集市多等级 AI移动和攻击无间隔 山上长树 20x20画面移动问题 角色的圆形阴影 等若干问题修复
This commit is contained in:
parent
d23c04e75f
commit
85df70ef32
@ -728,7 +728,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 3
|
||||
Cost: 5
|
||||
Skills: 0b0000000d000000
|
||||
Skills: 0b0000000d00000002000000
|
||||
Sprite: {fileID: 0}
|
||||
SpriteGlow: {fileID: 0}
|
||||
IsSpriteVarient: 1
|
||||
@ -986,7 +986,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 0200000027000000030000000f00000006000000210000001d0000000d000000
|
||||
Skills: 0200000027000000030000000f000000060000001d0000000d000000
|
||||
Sprite: {fileID: 21300000, guid: f4a89946e6d83f5498b8da8784d65ac4, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: c7229ac6b9cbb3c48a0bf40d37f8d3b6, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1022,7 +1022,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 25000000260000002c000000200000000d000000
|
||||
Skills: 250000002600000004000000200000000d000000
|
||||
Sprite: {fileID: 21300000, guid: 869a247f7a81bff4c872f47d8e8e9cfe, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: a03eb25b8ec6903448d09ffef670f2bd, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1058,7 +1058,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 1c0000001b000000290000002a000000010000000d00000020000000
|
||||
Skills: 290000002a000000010000000d00000020000000
|
||||
Sprite: {fileID: 21300000, guid: bd7e07fc549ba8a46a4eb79a62f9090b, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: 5724de750e51c6a49a6b57d60106275e, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30502e696a0cc1d4281abfd9f17f183f
|
||||
guid: a8d61ad0be50b8b469541eb48895272c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ffc3a1071fa2f045ba0190e40f652c7
|
||||
guid: 90d8fb3a303ba004b8d8339ee1e93ba7
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07c499379d86fec458a05b913e398ccb
|
||||
guid: 2fae7fe999ce6a04b921334ac7b1e7e7
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -12,10 +12,10 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 166f55de27df0d64e9e1565037a54aaa, type: 3}
|
||||
m_Name: AnimDataAssets
|
||||
m_EditorClassIdentifier:
|
||||
AttackAnimTime: 0.15
|
||||
AttackReturnAnimTime: 0.15
|
||||
CounterAnimTime: 0.15
|
||||
CounterReturnAnimTime: 0.15
|
||||
AttackAnimTime: 0.1
|
||||
AttackReturnAnimTime: 0.1
|
||||
CounterAnimTime: 0.1
|
||||
CounterReturnAnimTime: 0.1
|
||||
BetweenAttackCounterAnimTime: 0.1
|
||||
MoveAnimTime: 0.15
|
||||
ExplorerMoveDelay: 0.15
|
||||
MoveAnimTime: 0.1
|
||||
ExplorerMoveDelay: 0.1
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93ca691205a2d2544941e35b4b7cd55c
|
||||
guid: 3a02fc78f9cd60d498d19b2af06a2f37
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b66476b9210d6440a3e325b43a3fc5a
|
||||
guid: de67e93f652ba67419231ebe8d2825bc
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acf213827f808f44bbf725d843f3eb2e
|
||||
guid: ff685314a1ddbcb409a28e4e39cf5bb6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14ab3026dec78db4c807d67be676eaa9
|
||||
guid: 984a32b25ebb0814baba629ae7714f5d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5566563c92fef064cae7f35dd6c09744
|
||||
guid: 2a6e137456d781949807bffba2c2d8a6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a53014d635e84194aa40981f6a679fbe
|
||||
guid: 2b01e22f0124c364d847855ae7132f08
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@ -728,7 +728,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 3
|
||||
Cost: 5
|
||||
Skills: 0b0000000d000000
|
||||
Skills: 0b0000000d00000002000000
|
||||
Sprite: {fileID: 0}
|
||||
SpriteGlow: {fileID: 0}
|
||||
IsSpriteVarient: 1
|
||||
@ -986,7 +986,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 0200000027000000030000000f00000006000000210000001d0000000d000000
|
||||
Skills: 0200000027000000030000000f000000060000001d0000000d000000
|
||||
Sprite: {fileID: 21300000, guid: f4a89946e6d83f5498b8da8784d65ac4, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: c7229ac6b9cbb3c48a0bf40d37f8d3b6, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1022,7 +1022,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 25000000260000002c000000200000000d000000
|
||||
Skills: 250000002600000004000000200000000d000000
|
||||
Sprite: {fileID: 21300000, guid: 869a247f7a81bff4c872f47d8e8e9cfe, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: a03eb25b8ec6903448d09ffef670f2bd, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
@ -1058,7 +1058,7 @@ MonoBehaviour:
|
||||
AttackRange: 1
|
||||
MoveRange: 1
|
||||
Cost: 15
|
||||
Skills: 1c0000001b000000290000002a000000010000000d00000020000000
|
||||
Skills: 290000002a000000010000000d00000020000000
|
||||
Sprite: {fileID: 21300000, guid: bd7e07fc549ba8a46a4eb79a62f9090b, type: 3}
|
||||
SpriteGlow: {fileID: 21300000, guid: 5724de750e51c6a49a6b57d60106275e, type: 3}
|
||||
IsSpriteVarient: 0
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06549b5945f4b9b4e98ab0eba6508e7d
|
||||
guid: d16887070e445b34eb307304ad5c0f27
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,9 @@ namespace RuntimeData
|
||||
// 唯一 ID
|
||||
public uint Id;
|
||||
|
||||
|
||||
|
||||
|
||||
// 技能信息
|
||||
public List<SkillBase> Skills = new List<SkillBase>();
|
||||
private Dictionary<SkillType, SkillBase> _skillDict;
|
||||
|
||||
@ -400,8 +400,25 @@ namespace RuntimeData
|
||||
return criticalHitRate;
|
||||
}
|
||||
|
||||
|
||||
// 是否能移动到伟人身周
|
||||
public bool IsCanMoveGiantNearbyGrid(MapData map)
|
||||
{
|
||||
foreach (var skill in Skills)
|
||||
{
|
||||
if (skill.IsCanMoveGiantNearbyGrid(this, map)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 是否拥有特别伤害技能,例如ROYALFLAME
|
||||
public bool IsHasAttackSkill(MapData map)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 是否能移动无人城市
|
||||
public bool CanMoveNoUnitCity(MapData map)
|
||||
public bool IsCanMoveNoUnitSelfCity(MapData map)
|
||||
{
|
||||
foreach (var skill in Skills)
|
||||
{
|
||||
|
||||
@ -14,7 +14,7 @@ public class DebugCenter
|
||||
public float DebugLandThreshold = -1f;
|
||||
public float DebugAIActionTime = 0.3f;
|
||||
public float AnimationSpeed = 1f;
|
||||
public bool DebugShowAIID = false;
|
||||
public bool DebugMode = false;
|
||||
public DebugCenter()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
@ -18,7 +18,7 @@ public enum LandType { None,LandAndPort,WaterAndAshore,LandOnly,WaterOnly,LandAn
|
||||
|
||||
public enum MoveAttackType { None,Move,Attack,MoveToPort,MoveAshore}
|
||||
|
||||
public enum UnitActionType { None,Upgrade,Recover,Heal,Examine,Gather,Capture,Disband}
|
||||
public enum UnitActionType { None,Upgrade,Recover,Heal,Examine,Gather,Capture,Disband,ROYALFLAMES}
|
||||
|
||||
public enum CityLevelUpActionType{None,Explorer,Workshop,CityWall,CityWealth,Expand,Population,Park,BigGuy}
|
||||
|
||||
|
||||
@ -405,7 +405,7 @@ namespace Logic.AI
|
||||
foreach (var grid in mapData.GridMap.GridList)
|
||||
{
|
||||
if (playerData.Sight.CheckIsInSight(grid.Id)) continue;
|
||||
if (!Main.UnitLogic.CheckUnitCanMoveToGrid(mapData, playerData, grid)) continue;
|
||||
if (!Main.UnitLogic.CheckUnitCanStandOnGrid(mapData, playerData, unit, grid)) continue;
|
||||
var distance = Mathf.Abs(unitGrid.Pos.X - grid.Pos.X) + Mathf.Abs(unitGrid.Pos.Y - grid.Pos.Y);
|
||||
if (targetGrid == null)
|
||||
{
|
||||
@ -547,7 +547,7 @@ namespace Logic.AI
|
||||
foreach (var gridId in playerData.Sight.SightGidSet)
|
||||
{
|
||||
if (!mapData.GridMap.GetGridDataByGid(gridId, out var gridData)) continue;
|
||||
if (!Main.UnitLogic.CheckUnitCanMoveToGrid(mapData, playerData, gridData)) continue;
|
||||
if (!Main.UnitLogic.CheckUnitCanStandOnGrid(mapData, playerData, null,gridData)) continue;
|
||||
score += 1f;
|
||||
_canMoveGrid.Add(gridData);
|
||||
}
|
||||
|
||||
@ -574,6 +574,7 @@ namespace Logic.Action
|
||||
return false;
|
||||
var player = actionParams.PlayerData;
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData,city,wonderInfo.Exp);
|
||||
actionParams.GridData.ResourceUnderBuilding = actionParams.GridData.Resource;
|
||||
actionParams.GridData.Resource = ResourceType.Wonder;
|
||||
actionParams.GridData.Wonder = wonderInfo.Wonder;
|
||||
player.Wonder.SetWonderState(wonderInfo.WonderType,WonderState.FINISH_BUILD);
|
||||
@ -717,10 +718,21 @@ namespace Logic.Action
|
||||
needUpdate = ResourceType.Forge;
|
||||
if(_actionId.ResourceType == ResourceType.LumberHut)
|
||||
needUpdate = ResourceType.Sawmill;
|
||||
var gridDataList = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData, actionParams.PlayerData,
|
||||
//更新对应的milllike建筑的buildinglevel
|
||||
var gridDataList1 = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData, actionParams.PlayerData,
|
||||
actionParams.GridData, needUpdate);
|
||||
foreach(var gridData in gridDataList)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData,gridData);
|
||||
foreach (var gridData1 in gridDataList1)
|
||||
{
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData,gridData1);
|
||||
//找到该milllike建筑附近的market,更新该market
|
||||
var gridDataList2 = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData, actionParams.PlayerData,
|
||||
gridData1, ResourceType.Market);
|
||||
foreach(var gridData2 in gridDataList2)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData,gridData2);
|
||||
}
|
||||
|
||||
//更新所有market建筑的buildinglevel
|
||||
|
||||
|
||||
}
|
||||
//处理windmill sawmill forge market
|
||||
@ -731,8 +743,19 @@ namespace Logic.Action
|
||||
actionParams.GridData.RenderMark = true;
|
||||
Main.CityLogic.CalcGridBuildingLevel(actionParams.MapData,actionParams.GridData, _actionId.ResourceType,out var buildingLevel);
|
||||
actionParams.GridData.buildingLevel = buildingLevel;
|
||||
if(_actionId.ResourceType != ResourceType.Market )
|
||||
|
||||
//如果建设的不是market,而是sawmill forge windmill
|
||||
if (_actionId.ResourceType != ResourceType.Market)
|
||||
{
|
||||
//提供城市经验
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData,cityData,buildingLevel * (_actionId.ResourceType == ResourceType.Forge? 2 : 1));
|
||||
//更新附近的market
|
||||
var gridDataList = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData, actionParams.PlayerData,
|
||||
actionParams.GridData, ResourceType.Market);
|
||||
foreach(var gridData in gridDataList)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData,gridData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1102,6 +1125,7 @@ namespace Logic.Action
|
||||
return false;
|
||||
if (_actionId.UnitType == UnitType.None)
|
||||
return false;
|
||||
actionParams.PlayerData.PlayerWealth -= GetCost();
|
||||
actionParams.MapData.AddUnitData(gridData.Id,actionParams.CityData.Id,_actionId.UnitType,_actionId.GiantType);
|
||||
actionParams.CityData.CityInfoRenderMark = true;
|
||||
return true;
|
||||
@ -1520,6 +1544,12 @@ namespace Logic.Action
|
||||
if (_actionId.UnitActionType == UnitActionType.Examine)
|
||||
return gridData.Resource == ResourceType.Treasure;
|
||||
|
||||
//处理战技ROYALFLAMES TODO 未实现
|
||||
if (_actionId.UnitActionType == UnitActionType.ROYALFLAMES)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public override bool CheckShow(CommonActionParams actionParams)
|
||||
@ -1771,13 +1801,14 @@ namespace Logic.Action
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool Execute(CommonActionParams actionParams)
|
||||
{
|
||||
if (actionParams.PlayerData == null || actionParams.GridData == null)
|
||||
return false;
|
||||
if (!Table.Instance.ActionDataAssets.GetActionInfo(_actionId, out var actionInfo))
|
||||
return false;
|
||||
|
||||
|
||||
//处理grow forest
|
||||
if (_actionId.GridMiscActionType == GridMiscActionType.GrowForest)
|
||||
{
|
||||
@ -1790,6 +1821,7 @@ namespace Logic.Action
|
||||
unit.RenderMark = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//处理clear forest
|
||||
if (_actionId.GridMiscActionType == GridMiscActionType.ClearForest)
|
||||
{
|
||||
@ -1802,8 +1834,9 @@ namespace Logic.Action
|
||||
unit.RenderMark = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//处理 burn forest
|
||||
if(_actionId.GridMiscActionType == GridMiscActionType.BurnForest )
|
||||
if (_actionId.GridMiscActionType == GridMiscActionType.BurnForest)
|
||||
{
|
||||
actionParams.PlayerData.PlayerWealth -= actionInfo.Cost;
|
||||
actionParams.GridData.Vegetation = Vegetation.None;
|
||||
@ -1811,52 +1844,79 @@ namespace Logic.Action
|
||||
actionParams.GridData.RenderMark = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//处理Destroy
|
||||
if (_actionId.GridMiscActionType == GridMiscActionType.Destroy)
|
||||
{
|
||||
if(!Table.Instance.GridAndResourceDataAssets.GetResourceInfo(actionParams.GridData.Resource,out var resourceInfo))
|
||||
Debug.Log($"执行拆除!目标是{actionParams.GridData.Resource}");
|
||||
if (!Table.Instance.GridAndResourceDataAssets.GetResourceInfo(actionParams.GridData.Resource,
|
||||
out var resourceInfo))
|
||||
return false;
|
||||
//如果destroy的位置是无主地块
|
||||
if (!actionParams.MapData.GetCityDataByTerritoryGid(actionParams.GridData.Id, out var cityData))
|
||||
return false;
|
||||
if (_actionId.ResourceType == ResourceType.Farm || _actionId.ResourceType == ResourceType.Mine ||
|
||||
_actionId.ResourceType == ResourceType.LumberHut)
|
||||
if (actionParams.GridData.Resource == ResourceType.Farm ||
|
||||
actionParams.GridData.Resource == ResourceType.Mine ||
|
||||
actionParams.GridData.Resource == ResourceType.LumberHut)
|
||||
{
|
||||
//在已经拆除前,记录下来周围的什么样的milllike建筑要被同时更新
|
||||
ResourceType needUpdate =
|
||||
Table.Instance.GridAndResourceDataAssets.GetMillLikeRelative(actionParams.GridData.Resource);
|
||||
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData, cityData, -resourceInfo.Exp);
|
||||
actionParams.GridData.Resource = actionParams.GridData.ResourceUnderBuilding;
|
||||
actionParams.GridData.ResourceUnderBuilding = ResourceType.None;
|
||||
|
||||
//更新周围的milllike建筑
|
||||
ResourceType needUpdate = Table.Instance.GridAndResourceDataAssets.GetMillLikeRelative(_actionId.ResourceType);
|
||||
var gridDataList = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData,
|
||||
var gridDataList1 = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData,
|
||||
actionParams.PlayerData,
|
||||
actionParams.GridData, needUpdate);
|
||||
|
||||
Debug.Log($"执行拆除!目标影响到了周围的{needUpdate},数量有是{gridDataList1.Count}");
|
||||
foreach (var gridData1 in gridDataList1)
|
||||
{
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData, gridData1);
|
||||
//还要额外连带影响附近的market
|
||||
var gridDataList2 = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData,
|
||||
actionParams.PlayerData, gridData1, ResourceType.Market);
|
||||
foreach (var gridData2 in gridDataList2)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData, gridData2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//处理windmill sawmill forge
|
||||
else if (actionParams.GridData.Resource == ResourceType.Windmill ||
|
||||
actionParams.GridData.Resource == ResourceType.Forge ||
|
||||
actionParams.GridData.Resource == ResourceType.Sawmill)
|
||||
{
|
||||
//对应城市先丢失exp
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData, cityData,
|
||||
-actionParams.GridData.buildingLevel * (actionParams.GridData.Resource == ResourceType.Forge ? 2 : 1));
|
||||
|
||||
//删除格子的内容
|
||||
actionParams.GridData.Resource = actionParams.GridData.ResourceUnderBuilding;
|
||||
actionParams.GridData.ResourceUnderBuilding = ResourceType.None;
|
||||
actionParams.GridData.buildingLevel = 0;
|
||||
//更新周围的market情况
|
||||
var gridDataList = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData,
|
||||
actionParams.PlayerData,
|
||||
actionParams.GridData, ResourceType.Market);
|
||||
Debug.Log($"这次拆除后,周围的market找到了{gridDataList.Count()}个");
|
||||
foreach (var gridData in gridDataList)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData, gridData);
|
||||
}
|
||||
//处理windmill sawmill forge market
|
||||
else if (_actionId.ResourceType == ResourceType.Windmill ||
|
||||
_actionId.ResourceType == ResourceType.Forge ||
|
||||
_actionId.ResourceType == ResourceType.Sawmill ||
|
||||
_actionId.ResourceType == ResourceType.Market)
|
||||
//处理market
|
||||
else if (actionParams.GridData.Resource == ResourceType.Market)
|
||||
{
|
||||
if (_actionId.ResourceType != ResourceType.Market)
|
||||
{
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData, cityData, -actionParams.GridData.buildingLevel);
|
||||
//更新周围的market情况
|
||||
var gridDataList = Main.PlayerLogic.GetPlayerResourceNearbyList(actionParams.MapData,
|
||||
actionParams.PlayerData,
|
||||
actionParams.GridData, ResourceType.Market);
|
||||
foreach (var gridData in gridDataList)
|
||||
Main.CityLogic.UpdateGridBuildingData(actionParams.MapData, gridData);
|
||||
}
|
||||
actionParams.GridData.Resource = actionParams.GridData.ResourceUnderBuilding;
|
||||
actionParams.GridData.ResourceUnderBuilding = ResourceType.None;
|
||||
actionParams.GridData.buildingLevel = 0;
|
||||
}
|
||||
//处理港口和桥梁
|
||||
else if(_actionId.ResourceType == ResourceType.Port ||
|
||||
_actionId.ResourceType == ResourceType.Bridge)
|
||||
else if(actionParams.GridData.Resource == ResourceType.Port ||
|
||||
actionParams.GridData.Resource == ResourceType.Bridge)
|
||||
{
|
||||
Main.CityLogic.CityUpdateExp(actionParams.MapData, cityData, -resourceInfo.Exp);
|
||||
Main.PlayerLogic.UpdateCityConnect(actionParams.MapData,actionParams.PlayerData);
|
||||
@ -1912,6 +1972,8 @@ namespace Logic.Action
|
||||
&& actionParams.GridData.Resource != ResourceType.Crop
|
||||
&& actionParams.GridData.Resource != ResourceType.Fruit))
|
||||
return false;
|
||||
if (actionParams.GridData.Feature == TerrainFeature.Mountain)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
//处理clear forest 和 burn forest
|
||||
@ -1940,7 +2002,9 @@ namespace Logic.Action
|
||||
|| actionParams.GridData.Resource == ResourceType.Farm
|
||||
|| actionParams.GridData.Resource == ResourceType.Mine
|
||||
|| actionParams.GridData.Resource == ResourceType.Port
|
||||
|| actionParams.GridData.Resource == ResourceType.Bridge)
|
||||
|| actionParams.GridData.Resource == ResourceType.Bridge
|
||||
|| actionParams.GridData.Resource == ResourceType.Market
|
||||
|| actionParams.GridData.Resource == ResourceType.Wonder)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -115,14 +115,19 @@ namespace Logic
|
||||
return null;
|
||||
}
|
||||
|
||||
//更新grid的buildinglevel,并且顺带会更新城市的exp
|
||||
public void UpdateGridBuildingData(MapData mapData, GridData gridData)
|
||||
{
|
||||
CalcGridBuildingLevel(mapData, gridData, gridData.Resource, out var level);
|
||||
int delta = level - gridData.buildingLevel;
|
||||
if (gridData.Resource == ResourceType.Forge)
|
||||
delta *= 2;
|
||||
if (gridData.Resource == ResourceType.Market)
|
||||
delta = 0;
|
||||
gridData.buildingLevel = level;
|
||||
gridData.RenderMark = true;
|
||||
mapData.GetCityDataByTerritoryGid(gridData.Id,out var cityData);
|
||||
CityUpdateExp(mapData,cityData,delta);
|
||||
if(mapData.GetCityDataByTerritoryGid(gridData.Id,out var cityData))
|
||||
CityUpdateExp(mapData,cityData,delta);
|
||||
}
|
||||
|
||||
//获得一个city当前的回合钱
|
||||
@ -214,8 +219,10 @@ namespace Logic
|
||||
level += grid.buildingLevel;
|
||||
ret = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (level > 8)
|
||||
level = 8;
|
||||
|
||||
}
|
||||
//处理windmill forge话sawmill的情况
|
||||
if ((grid.Resource == ResourceType.Farm && buildingType == ResourceType.Windmill)
|
||||
|
||||
@ -94,6 +94,19 @@ namespace Logic
|
||||
mouseLastDownPosition = Input.mousePosition;
|
||||
}
|
||||
|
||||
// 检测数字键1-5的按下,执行对应的操作
|
||||
if (_main.UIManager.BottomInfoUI.ROBottomInfoUI.activeSelf)
|
||||
{
|
||||
for (int i = 1; i <= 9; i++)
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1 + i - 1))
|
||||
{
|
||||
_main.UIManager.BottomInfoUI.ExecuteActionButtonByIndex(i - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonUp(0)) // 检测鼠标点击
|
||||
{
|
||||
if (EventSystem.current.IsPointerOverGameObject())
|
||||
@ -144,7 +157,7 @@ namespace Logic
|
||||
_main.MapData.PlayerMap.SelfPlayerData.PlayerWealth += 1000;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha3))
|
||||
if (Input.GetKeyDown(KeyCode.T))
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
|
||||
{
|
||||
@ -168,8 +181,14 @@ namespace Logic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Alpha3)
|
||||
|| Input.GetKeyDown(KeyCode.Alpha4) || Input.GetKeyDown(KeyCode.Alpha5))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha5))
|
||||
if (Input.GetKeyDown(KeyCode.W))
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
|
||||
{
|
||||
|
||||
@ -27,7 +27,7 @@ namespace Logic
|
||||
public bool AIMoreMoney = true;
|
||||
public float LandThreshold = -1f;
|
||||
public float AnimationSpeed = 1f;
|
||||
public bool DebugShowAIID = false;
|
||||
public bool DebugMode = false;
|
||||
|
||||
[Header("Play Settings")]
|
||||
public int cityCount;
|
||||
@ -76,7 +76,7 @@ namespace Logic
|
||||
DebugCenter.Instance.DebugAIMoreMoney = AIMoreMoney;
|
||||
DebugCenter.Instance.DebugAIActionTime = AIActionTime;
|
||||
DebugCenter.Instance.AnimationSpeed = AnimationSpeed;
|
||||
DebugCenter.Instance.DebugShowAIID = DebugShowAIID;
|
||||
DebugCenter.Instance.DebugMode = DebugMode;
|
||||
if(LandThreshold > 0)
|
||||
DebugCenter.Instance.DebugLandThreshold = LandThreshold;
|
||||
|
||||
|
||||
@ -297,15 +297,20 @@ namespace Logic
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 获取玩家在某个格子周围 1 单位的拥有某个资源的的全列表,
|
||||
// 获取玩家在某个格子周围 1 单位的拥有某个资源且属于该玩家领土的grid的全列表
|
||||
public List<GridData> GetPlayerResourceNearbyList(MapData mapData, PlayerData playerData, GridData gridData, ResourceType resourceType)
|
||||
{
|
||||
var aroundGridList = new List<GridData>();
|
||||
var aroundGrid = mapData.GridMap.GetAroundGridDataSet(1, 1, gridData);
|
||||
var territoryGidSet = mapData.GetPlayerTerritoryGridIdSet(playerData.Id);
|
||||
|
||||
//var territoryGidSet = mapData.GetPlayerTerritoryGridIdSet(playerData.Id);
|
||||
foreach (var grid in aroundGrid)
|
||||
{
|
||||
if (!territoryGidSet.Contains(grid.Id)) continue;
|
||||
//如果不是玩家的领土
|
||||
if(mapData.GetPlayerDataByTerritoryGridId(grid.Id, out var player)
|
||||
&& player.Id != playerData.Id)
|
||||
continue;
|
||||
|
||||
if (grid.Resource != resourceType) continue;
|
||||
aroundGridList.Add(grid);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
using System;
|
||||
using RuntimeData;
|
||||
|
||||
|
||||
namespace Logic.Skill
|
||||
@ -24,7 +25,11 @@ namespace Logic.Skill
|
||||
{
|
||||
return SkillType.ALLYTRANSPORT;
|
||||
}
|
||||
|
||||
|
||||
public override bool IsCanMoveGiantNearbyGrid(UnitData unit,MapData map)
|
||||
{
|
||||
return unit.Skills.Contains(SkillFactory.GetSkillBySkillType(SkillType.ALLYTRANSPORT));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -27,9 +27,9 @@ namespace Logic.Skill
|
||||
return SkillType.CITYTRANSPORT;
|
||||
}
|
||||
|
||||
public override void OnMove(UnitData self, GridData grid, MapData mapData,MoveType moveType)
|
||||
public override bool IsCanMoveToNoUnitSelfCity(UnitData self, MapData mapData)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,6 +90,8 @@ namespace Logic.Skill
|
||||
// 是否能移动到我方的无人城市
|
||||
public bool IsCanMoveToNoUnitSelfCity(UnitData self, MapData mapData);
|
||||
|
||||
public bool IsCanMoveGiantNearbyGrid(UnitData self, MapData mapData);
|
||||
|
||||
// 能否被杀死
|
||||
public bool IsCanBeKill(UnitData self, MapData mapData);
|
||||
|
||||
@ -323,6 +325,11 @@ namespace Logic.Skill
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool IsCanMoveGiantNearbyGrid(UnitData self, MapData mapData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool IsCanBeKill(UnitData self, MapData mapData)
|
||||
{
|
||||
return true;
|
||||
|
||||
@ -270,17 +270,27 @@ namespace Logic
|
||||
Debug.Log(t);
|
||||
}
|
||||
|
||||
// 判断我方单位是否可以移动到某个格子上, 不考虑视野信息
|
||||
public bool CheckUnitCanMoveToGrid(MapData map, PlayerData self, GridData grid)
|
||||
// 判断我方单位是否可以站在某个格子上, 不考虑视野信息,不考虑可达
|
||||
public bool CheckUnitCanStandOnGrid(MapData map, PlayerData self,UnitData unit ,GridData grid)
|
||||
{
|
||||
if (grid.Feature == TerrainFeature.Mountain && !self.TechTree.CheckIfHasTech(TechType.Climbing)) return false;
|
||||
if (grid.Terrain == TerrainType.ShallowSea && !self.TechTree.CheckIfHasTech(TechType.Fishing)) return false;
|
||||
if (grid.Terrain == TerrainType.DeepSea && !self.TechTree.CheckIfHasTech(TechType.Sailing)) return false;
|
||||
|
||||
|
||||
//如果unit不是null,那么就是判断具体的某个unit能否站在grid上
|
||||
if (unit != null)
|
||||
{
|
||||
if(!unit.IsCanMoveOnTerrain(map,grid.Terrain))return false;
|
||||
if (unit.IsCanMoveOnFeature(map, grid.Feature))return false;
|
||||
}
|
||||
//否则可能是判断一个玩家的任意unit能否站在上面
|
||||
else
|
||||
{
|
||||
if (grid.Feature == TerrainFeature.Mountain && !self.TechTree.CheckIfHasTech(TechType.Climbing)) return false;
|
||||
if (grid.Terrain == TerrainType.ShallowSea && !self.TechTree.CheckIfHasTech(TechType.Fishing)) return false;
|
||||
if (grid.Terrain == TerrainType.DeepSea && !self.TechTree.CheckIfHasTech(TechType.Sailing)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 判断我方单位是否可以移动到某个格子上, 不考虑视野信息
|
||||
// 仅从feature和terrain角度判断我方单位是否可以移动到某个格子上, 不考虑视野信息
|
||||
public bool CheckUnitCanMoveToGrid(MapData map, PlayerData self, Vector2Int start, Vector2Int end)
|
||||
{
|
||||
if (!map.GridMap.GetGridDataByPos(start.x, start.y, out var startGrid)) return false;
|
||||
@ -409,8 +419,29 @@ namespace Logic
|
||||
for (int i = 0; i < width; i++)
|
||||
for (int j = 0; j < height; j++)
|
||||
if(MoveInfoMap[i, j] >= 0 && Table.Instance.CalcDistance(new Vector2Int(gridData.Pos.X,gridData.Pos.Y),new Vector2Int(i,j)) > 5)
|
||||
Debug.Log("OWATAA!@!!!!!");
|
||||
//DebugOutputMoveInfo();
|
||||
Debug.Log("moveinfo计算时出现了超过5格的移动距离");
|
||||
|
||||
//处理ALLTRANSPORT技能,可以移动到己方伟人的身周
|
||||
if (unitData.IsCanMoveGiantNearbyGrid(mapData))
|
||||
{
|
||||
//遍历所有单位,找到己方的伟人
|
||||
foreach (var unitA in mapData.UnitMap.UnitList)
|
||||
if(unitA.UnitType == UnitType.Giant
|
||||
&& mapData.GetPlayerIdByUnitId(unitA.Id,out var pid)
|
||||
&& pid == playerData.Id)
|
||||
{
|
||||
mapData.GetGridDataByUnitId(unitA.Id, out var gridA);
|
||||
var nearby = mapData.GridMap.GetAroundGridDataSet(1,1,gridA);
|
||||
foreach (var gridDataA in nearby)
|
||||
//如果能够站在gridA上,并且格子上没人
|
||||
if(CheckUnitCanStandOnGrid(mapData,playerData,unitData,gridDataA)
|
||||
&& !mapData.GetUnitDataByGid(gridA.Id,out var tt))
|
||||
{
|
||||
int x = gridDataA.Pos.X, y = gridDataA.Pos.Y;
|
||||
MoveInfoMap[x, y] = 999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检查单位是否能攻击目标点
|
||||
@ -520,7 +551,9 @@ namespace Logic
|
||||
public void LandToBoat(MapData mapData, UnitData unitData)
|
||||
{
|
||||
unitData.CarryUnitType = unitData.UnitType;
|
||||
unitData.CarryGiantType = unitData.GiantType;
|
||||
unitData.UnitType = UnitType.Boat;
|
||||
unitData.GiantType = GiantType.None;
|
||||
unitData.CarryExp = unitData.Exp;
|
||||
unitData.Exp = 0;
|
||||
unitData.CarryVeteran = unitData.Veteran;
|
||||
|
||||
@ -371,7 +371,7 @@ namespace Logic
|
||||
ResourceType.Sawmill => Resources.Load<Sprite>(
|
||||
$"ArtResources/TH1Buildings/TH1BuildingsCommon/TH1Building_Sawmill_{Mathf.Min(_gridData.buildingLevel, 8)}"),
|
||||
ResourceType.Market => Resources.Load<Sprite>(
|
||||
$"ArtResources/TH1Buildings/TH1BuildingsCommon/TH1Building_Market"),
|
||||
$"ArtResources/TH1Buildings/TH1BuildingsCommon/TH1Building_Market_{Mathf.Min(_gridData.buildingLevel, 8)}"),
|
||||
ResourceType.Wonder => Table.Instance.GridAndResourceDataAssets.GetWonderSprite(_gridData.Wonder,_playerData),
|
||||
ResourceType.Tower => Resources.Load<Sprite>(
|
||||
$"ArtResources/TH1Buildings/TH1BuildingsCommon/TH1Building_Tower"),
|
||||
|
||||
@ -314,7 +314,7 @@ namespace Logic
|
||||
//初拉单位和selfplayer的视野关系
|
||||
RenderUpdateSelfPlayerSight();
|
||||
//DebugRender
|
||||
if (DebugCenter.Instance.DebugShowAIID)
|
||||
if (DebugCenter.Instance.DebugMode)
|
||||
RenderUpdateDebug();
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,10 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
_closeButton, // 收起按钮
|
||||
_previewArea, //grid/unit预览框
|
||||
_actionArea,
|
||||
_actionAreaScrollView;
|
||||
_actionAreaScrollView,
|
||||
_debugGrid,
|
||||
_debugUnit,
|
||||
_debugCity;
|
||||
public GameObject _hintWindow;//提示窗口
|
||||
|
||||
//public Tilemap borderTilemap;
|
||||
@ -66,9 +69,12 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
_description = ROBottomInfoUI.transform.Find("Description").gameObject; // 描述
|
||||
_closeButton = ROBottomInfoUI.transform.Find("CloseButton").gameObject; // 收起按钮
|
||||
_actionAreaScrollView = ROBottomInfoUI.transform.Find("ActionAreaScrollView").gameObject;
|
||||
_actionArea = _actionAreaScrollView.transform.Find("Viewport").transform.Find("ActionArea").gameObject;
|
||||
_previewArea = ROBottomInfoUI.transform.Find("PreviewArea").transform.Find("Grid").gameObject;
|
||||
_actionArea = _actionAreaScrollView.transform.Find("Viewport/ActionArea").gameObject;
|
||||
_previewArea = ROBottomInfoUI.transform.Find("PreviewArea/Grid").gameObject;
|
||||
_hintWindow = ROBottomInfoUI.transform.Find("HintWindow").gameObject;
|
||||
_debugGrid = ROBottomInfoUI.transform.Find("DebugGrid").gameObject;
|
||||
_debugUnit = ROBottomInfoUI.transform.Find("DebugUnit").gameObject;
|
||||
_debugCity = ROBottomInfoUI.transform.Find("DebugCity").gameObject;
|
||||
ActionBGAvailable = Resources.Load<Sprite>("ArtResources/TH1UI/Common/bgAvailable");
|
||||
ActionBGExpensive = Resources.Load<Sprite>("ArtResources/TH1UI/Common/bgExpensive");
|
||||
ActionBGUnavailable = Resources.Load<Sprite>("ArtResources/TH1UI/Common/bgUnavailable");
|
||||
@ -110,6 +116,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
//如果需要先下滑再上滑
|
||||
if (UIBottomInfoHideFirst)
|
||||
{
|
||||
//设定播放下滑动画的初始参数
|
||||
if (ROBottomInfoUI.activeSelf)
|
||||
{
|
||||
_isAnimating = true;
|
||||
@ -120,6 +127,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
//设定播放上滑动画的初始参数
|
||||
_isAnimating = true;
|
||||
_isShow = true;
|
||||
_slideTime = 0f;
|
||||
@ -184,7 +192,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
_closeButton.GetComponent<Button>().onClick.AddListener(SetBottomInfoHide);
|
||||
}
|
||||
|
||||
//RuntimeData.GridData gridData,UnitData unitData)//更新预览框的内容
|
||||
//更新预览框的内容
|
||||
public void UpdateInfo()
|
||||
{
|
||||
foreach (Transform child in _previewArea.transform)
|
||||
@ -253,9 +261,14 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
_description.GetComponent<TextMeshProUGUI>().text = showText[1];
|
||||
}
|
||||
|
||||
//如果是DebugMode,更新Debug模块的显示
|
||||
if (DebugCenter.Instance.DebugMode)
|
||||
UpdateDebugInfo();
|
||||
|
||||
}
|
||||
|
||||
public void ActionAreaClickHandler()//让每个action挂一个点击监听事件
|
||||
//让每个action挂一个点击监听事件
|
||||
public void ActionAreaClickHandler()
|
||||
{
|
||||
ActionClickedEvent[] items = _actionArea.GetComponentsInChildren<ActionClickedEvent>(true);//这里设为true,会遍历所有inactive的对象
|
||||
|
||||
@ -265,6 +278,8 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//处理一个action被点击后的情况
|
||||
public void ActionAreaClicked(GameObject clickedItem)
|
||||
{
|
||||
CommonActionId fakeActionId = clickedItem.GetComponent<ActionIdMono>().ActionId;
|
||||
@ -360,6 +375,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
//如果是单位
|
||||
else
|
||||
{
|
||||
foreach (Transform child in _actionArea.transform)
|
||||
@ -379,7 +395,7 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
textUIComponent.color = Color.white;
|
||||
backImage.sprite = ActionBGAvailable;
|
||||
|
||||
//如果是升级单位
|
||||
//如果是变形为其他type的单位
|
||||
if (tActionId.ResourceType !=ResourceType.None)
|
||||
{
|
||||
starImage.gameObject.SetActive(true);
|
||||
@ -419,4 +435,138 @@ public class BottomInfoUI// : MonoBehaviour
|
||||
UIBottomInfoIsGrid = false;
|
||||
UIBottomInfoStatusObjectId = unitId;
|
||||
}
|
||||
}
|
||||
|
||||
//更新Debug模块的信息
|
||||
public void UpdateDebugInfo()
|
||||
{
|
||||
//如果是城市格子
|
||||
if (UIBottomInfoIsGrid && _mapData.GetCityDataByGid(UIBottomInfoStatusObjectId,out var city))
|
||||
{
|
||||
_debugGrid.SetActive(false);
|
||||
_debugUnit.SetActive(false);
|
||||
_debugCity.SetActive(true);
|
||||
|
||||
}
|
||||
//如果是非城市格子
|
||||
else if (UIBottomInfoIsGrid)
|
||||
{
|
||||
_debugGrid.SetActive(true);
|
||||
_debugUnit.SetActive(false);
|
||||
_debugCity.SetActive(false);
|
||||
_main.MapData.GridMap.GetGridDataByGid(UIBottomInfoStatusObjectId,out var gridData);
|
||||
_debugGrid.transform.Find("BuildingLevelValue").GetComponent<TextMeshProUGUI>().text = gridData.buildingLevel.ToString();
|
||||
|
||||
}
|
||||
//如果是unit
|
||||
else
|
||||
{
|
||||
_debugGrid.SetActive(false);
|
||||
_debugUnit.SetActive(true);
|
||||
_debugCity.SetActive(false);
|
||||
|
||||
// 获取单位数据
|
||||
_main.MapData.UnitMap.GetUnitDataByUnitId(UIBottomInfoStatusObjectId, out var unitData);
|
||||
|
||||
// 填充单位类型信息
|
||||
_debugUnit.transform.Find("UnitTypeValue").GetComponent<TextMeshProUGUI>().text = unitData.UnitType.ToString();
|
||||
|
||||
// 填充巨人类型信息
|
||||
_debugUnit.transform.Find("GiantTypeValue").GetComponent<TextMeshProUGUI>().text = unitData.GiantType.ToString();
|
||||
|
||||
// 填充单位ID
|
||||
_debugUnit.transform.Find("UnitIdValue").GetComponent<TextMeshProUGUI>().text = unitData.Id.ToString();
|
||||
|
||||
// 填充AP值
|
||||
_debugUnit.transform.Find("APValue").GetComponent<TextMeshProUGUI>().text = unitData.AP.ToString();
|
||||
|
||||
// 填充MP值
|
||||
_debugUnit.transform.Find("MPValue").GetComponent<TextMeshProUGUI>().text = unitData.MP.ToString();
|
||||
|
||||
// 填充携带单位类型信息
|
||||
if (_debugUnit.transform.Find("CarryUnitTypeValue") != null)
|
||||
{
|
||||
_debugUnit.transform.Find("CarryUnitTypeValue").GetComponent<TextMeshProUGUI>().text =
|
||||
unitData.CarryUnitType != UnitType.None ? unitData.CarryUnitType.ToString() : "None";
|
||||
}
|
||||
|
||||
// 填充携带巨人类型信息
|
||||
if (_debugUnit.transform.Find("CarryGiantTypeValue") != null)
|
||||
{
|
||||
_debugUnit.transform.Find("CarryGiantTypeValue").GetComponent<TextMeshProUGUI>().text =
|
||||
unitData.CarryGiantType != GiantType.None ? unitData.CarryGiantType.ToString() : "None";
|
||||
}
|
||||
|
||||
// 填充携带单位经验值
|
||||
if (_debugUnit.transform.Find("CarryExpValue") != null)
|
||||
{
|
||||
_debugUnit.transform.Find("CarryExpValue").GetComponent<TextMeshProUGUI>().text =
|
||||
unitData.CarryUnitType != UnitType.None ? unitData.CarryExp.ToString() : "0";
|
||||
}
|
||||
|
||||
// 填充携带单位老兵状态
|
||||
if (_debugUnit.transform.Find("CarryVeteranValue") != null)
|
||||
{
|
||||
_debugUnit.transform.Find("CarryVeteranValue").GetComponent<TextMeshProUGUI>().text =
|
||||
unitData.CarryUnitType != UnitType.None ? unitData.CarryVeteran.ToString() : "False";
|
||||
}
|
||||
|
||||
// 获取技能组
|
||||
Transform skillGroup = _debugUnit.transform.Find("SkillGroup");
|
||||
|
||||
// 初始化所有技能文本为空
|
||||
for (int i = 0; i < 21; i++)
|
||||
{
|
||||
Transform skillTransform = skillGroup.Find($"Skill ({i})");
|
||||
if (skillTransform != null)
|
||||
{
|
||||
skillTransform.GetComponent<TextMeshProUGUI>().text = "";
|
||||
}
|
||||
}
|
||||
|
||||
// 填充技能信息
|
||||
int skillIndex = 0;
|
||||
foreach (var skill in unitData.Skills)
|
||||
{
|
||||
if (skillIndex >= 9) break; // 最多显示9个技能
|
||||
|
||||
Transform skillTransform = skillGroup.Find($"Skill ({skillIndex})");
|
||||
if (skillTransform != null)
|
||||
{
|
||||
// 获取技能名称
|
||||
string skillName = skill.GetSkillType().ToString();
|
||||
|
||||
skillTransform.GetComponent<TextMeshProUGUI>().text = skillName;
|
||||
}
|
||||
|
||||
skillIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 根据索引执行对应的操作按钮点击
|
||||
public void ExecuteActionButtonByIndex(int index)
|
||||
{
|
||||
if (!ROBottomInfoUI.activeSelf || !HasAction)
|
||||
return;
|
||||
|
||||
// 获取所有激活的操作按钮
|
||||
List<GameObject> activeButtons = new List<GameObject>();
|
||||
|
||||
foreach (Transform child in _actionArea.transform)
|
||||
{
|
||||
if (child.gameObject.activeSelf)
|
||||
{
|
||||
activeButtons.Add(child.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
// 检查索引是否有效
|
||||
if (index >= 0 && index < activeButtons.Count)
|
||||
{
|
||||
GameObject targetButton = activeButtons[index];
|
||||
|
||||
// 直接调用ActionAreaClicked方法,传入目标按钮
|
||||
ActionAreaClicked(targetButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,10 +13,10 @@ public class CameraController : MonoBehaviour
|
||||
|
||||
private Vector3 dragOrigin; // 记录拖动起点
|
||||
|
||||
public float minX = -100f;
|
||||
public float maxX = 100f;
|
||||
public float minY = -10f;
|
||||
public float maxY = 120f;
|
||||
public float minX = -200f;
|
||||
public float maxX = 200f;
|
||||
public float minY = -60f;
|
||||
public float maxY = 230f;
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user