Browse Source

修复升级建筑的一些问题

master
DESKTOP-3LEE30U\star 3 years ago
parent
commit
fde0f0c6d4
  1. 6
      Server/Hotfix/Demo/Building/Handler/M2C_BuildingDurableHandler.cs
  2. 9
      Unity/Animancer.FSM.csproj
  3. 9
      Unity/Animancer.csproj
  4. 9
      Unity/Assets/Scenes/Game.unity
  5. 6
      Unity/Codes/Hotfix/Demo/Helper/BuildingHelper.cs
  6. 4
      Unity/Codes/Hotfix/Demo/Operate/ConstructOperate.cs
  7. 4
      Unity/Codes/HotfixView/Demo/Building/BuildingViewComponentSystem.cs
  8. 2
      Unity/Codes/HotfixView/Demo/Building/CameraPosChange_UpdateBuildingNamePos.cs
  9. 6
      Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FUIBuildingUpgradeWindowComponentSystem.cs
  10. 4
      Unity/Codes/Model/Module/Message/OpcodeHelper.cs

6
Server/Hotfix/Demo/Building/Handler/M2C_BuildingDurableHandler.cs

@ -10,6 +10,12 @@ namespace ET
try
{
var bc = unit.GetComponent<BuildingComponent>();
if (bc == null || bc.Children == null)
{
reply();
return;
}
if (request.BuildingId > 0)
{
Building building = bc.GetChild<Building>(request.BuildingId);

9
Unity/Animancer.FSM.csproj

@ -310,9 +310,6 @@
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Android.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\UnityEditor.Android.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.WindowsStandalone.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\UnityEditor.WindowsStandalone.Extensions.dll</HintPath>
</Reference>
@ -349,12 +346,6 @@
<Reference Include="NCalc">
<HintPath>Assets\ThirdParty\NCalc\NCalc.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Types">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Types.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Gradle">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Gradle.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\mscorlib.dll</HintPath>
</Reference>

9
Unity/Animancer.csproj

@ -447,9 +447,6 @@
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Android.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\UnityEditor.Android.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.WindowsStandalone.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\UnityEditor.WindowsStandalone.Extensions.dll</HintPath>
</Reference>
@ -486,12 +483,6 @@
<Reference Include="NCalc">
<HintPath>Assets\ThirdParty\NCalc\NCalc.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Types">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Types.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Gradle">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Gradle.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\mscorlib.dll</HintPath>
</Reference>

9
Unity/Assets/Scenes/Game.unity

@ -546,7 +546,7 @@ NavMeshAgent:
m_GameObject: {fileID: 804818787}
m_Enabled: 1
m_AgentTypeID: 0
m_Radius: 0.5
m_Radius: 0.1
m_Speed: 5
m_Acceleration: 100
avoidancePriority: 50
@ -1518,7 +1518,7 @@ MonoBehaviour:
m_OverrideTileSize: 0
m_TileSize: 256
m_OverrideVoxelSize: 0
m_VoxelSize: 0.033333335
m_VoxelSize: 0.16666667
m_BuildHeightMesh: 0
m_HideEditorLogs: 0
m_NavMeshData: {fileID: 23800000, guid: d5619753999409f4b86af078c3f3050a, type: 2}
@ -1589,6 +1589,11 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1504570233403092943, guid: 1bfa233c465a65d4591c50583242e7f2,
type: 3}
propertyPath: m_Radius
value: 0.1
objectReference: {fileID: 0}
- target: {fileID: 3678915325285043676, guid: 1bfa233c465a65d4591c50583242e7f2,
type: 3}
propertyPath: m_LocalRotation.w

6
Unity/Codes/Hotfix/Demo/Helper/BuildingHelper.cs

@ -72,6 +72,12 @@ namespace ET
return resp.Error;
}
var bc = unit.GetComponent<BuildingComponent>();
if (bc == null)
{
return ErrorCode.ERR_Success;
}
for (int i=0; i< resp.IdList.Count;i++)
{
var building = bc.GetChild<Building>(resp.IdList[i]);

4
Unity/Codes/Hotfix/Demo/Operate/ConstructOperate.cs

@ -150,6 +150,10 @@ namespace ET
if (construct.IsUpgrade)
{
build = unit.GetOrAddComponent<BuildingComponent>().GetChild<Building>(construct.BuildingId);
if (build == null)
{
Log.Error($"Can't find building:{construct.BuildingId} for construct:{construct.Id}");
}
}
else
{

4
Unity/Codes/HotfixView/Demo/Building/BuildingViewComponentSystem.cs

@ -152,6 +152,10 @@ namespace ET
return;
}
FUIUnitNamePanelComponent unitNamePanelComponent = FUIComponent.Instance.GetUI(FUI_UnitNamePanel.UIResName) as FUIUnitNamePanelComponent;
unitNamePanelComponent.FUIUnitNamePanel.FGComp.RemoveChild(self.UnitName.FGComp);
self.UnitName.Dispose();
var sprRender = self.BuildingRoot.GetComponentInChildren<SpriteRenderer>();
mapComp.MarkPlaceOnGrid(self.BuildingRoot.transform.position, mapComp.GetSizeBySpriteCollider(sprRender), false);
self.BuildingRoot.SetActive(false);

2
Unity/Codes/HotfixView/Demo/Building/CameraPosChange_UpdateBuildingNamePos.cs

@ -13,7 +13,7 @@ namespace ET
foreach (var v in buildingComp.Children)
{
var buildingViewComp = v.Value.GetComponent<BuildingViewComponent>();
buildingViewComp.UpdateNamePos();
buildingViewComp?.UpdateNamePos();
}
}
}

6
Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FUIBuildingUpgradeWindowComponentSystem.cs

@ -146,12 +146,14 @@ namespace ET
return;
}
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
Log.Error($"CurUpgradeSynthesisConfigId:{self.CurUpgradeSynthesisConfigId}");
int result = await ConstructHelper.CreateConstruct(unit, self.CurUpgradeSynthesisConfigId, self.Building.Position.x, self.Building.Position.y,
self.Building.Id);
if (result != ErrorCode.ERR_Success)
if (result == ErrorCode.ERR_Success)
{
// 删除原来建筑的表现,等待新房子建成换成新的
self.Building.RemoveComponent<BuildingViewComponent>();
self.Window.Hide();
}
}

4
Unity/Codes/Model/Module/Message/OpcodeHelper.cs

@ -9,7 +9,9 @@ namespace ET
OuterOpcode.C2G_Ping,
OuterOpcode.G2C_Ping,
OuterOpcode.M2C_GameTime,
OuterOpcode.C2M_GameTime
OuterOpcode.C2M_GameTime,
OuterOpcode.C2M_PeopleMove,
OuterOpcode.M2C_PeopleMove
};
private static bool IsNeedLogMessage(ushort opcode)

Loading…
Cancel
Save