diff --git a/Assets/GWConquest/Scripts/District.cs b/Assets/GWConquest/Scripts/District.cs index 95c46fa..5e8529d 100644 --- a/Assets/GWConquest/Scripts/District.cs +++ b/Assets/GWConquest/Scripts/District.cs @@ -37,10 +37,7 @@ namespace GWConquest return type == DistrictType.Civil || type == DistrictType.SpaceStation || type == DistrictType.FactoryArmor || type == DistrictType.FactoryInfantry || type == DistrictType.FactorySupplies || type == DistrictType.FactoryFuel; } - public Planet Planet { - get => State.Planet?.GetComponent(); - set => State.Planet = value.entity; - } + public Planet Planet; public Player ControllingPlayer { get { @@ -105,13 +102,17 @@ namespace GWConquest State.DistrictType = (int) DistrictType; State.DistrictName = DistrictName; State.Level = DistrictLevel; - State.Planet = GetComponentInParent().entity; + } + Planet = GetComponentInParent(); } } public void InitNonStatic() { + + Planet = BoltEntityCache.Get(State.Planet); + if(DistrictType == DistrictType.SpaceStation) { Zone.zoneType = ZoneType.Space; @@ -212,10 +213,23 @@ namespace GWConquest public override void SimulateOwner() { - var allPlayers = Zone.Formations.Select(f => f.Player).Distinct(); - if(allPlayers.Count() == 1) + Player player = null; + bool moreThanOnePlayer = false; + foreach(var f in Zone.Formations) + { + var formationPlayer = f.Player; + if(player == null) + { + player = formationPlayer; + } + else if(player != formationPlayer) + { + moreThanOnePlayer = true; + break; + } + } + if(player != null && !moreThanOnePlayer) { - var player = allPlayers.First(); if(player != ControllingPlayer) { BoltLog.Info("Player {0} is the only player in district {1}, changing allegiance", player, this); diff --git a/Assets/GWConquest/Scripts/Formation.cs b/Assets/GWConquest/Scripts/Formation.cs index 09abe38..4415ee8 100644 --- a/Assets/GWConquest/Scripts/Formation.cs +++ b/Assets/GWConquest/Scripts/Formation.cs @@ -514,37 +514,39 @@ namespace GWConquest private void Update() { - if(GameManager.EntitiesLoaded) + if (entity.IsAttached) { - if(currentZone != null && currentZone.zoneType == ZoneType.Space && movingArmyIcon == null) + if (GameManager.EntitiesLoaded) { - MakeMovingIcon(IngameUI.Instance.MovingFleetsTransform); + if (currentZone != null && currentZone.zoneType == ZoneType.Space && movingArmyIcon == null) + { + MakeMovingIcon(IngameUI.Instance.MovingFleetsTransform); + } } - } - //Debug.LogFormat("Current state: IsInTransit {0}; CurrentZone {1}; CoveredDistance {2}", State.IsInTransit, State.CurrentZone, CoveredDistance); + //Debug.LogFormat("Current state: IsInTransit {0}; CurrentZone {1}; CoveredDistance {2}", State.IsInTransit, State.CurrentZone, CoveredDistance); - if (MovementState == FormationMovementState.Moving) - { - animDistanceCovered += movementSpeed * Time.deltaTime; - Zone originZone = Zone.GetFromId(State.CurrentTransition.OriginZone); - Zone targetZone = Zone.GetFromId(State.CurrentTransition.TargetZone); + if (MovementState == FormationMovementState.Moving) + { + animDistanceCovered += movementSpeed * Time.deltaTime; + Zone originZone = Zone.GetFromId(State.CurrentTransition.OriginZone); + Zone targetZone = Zone.GetFromId(State.CurrentTransition.TargetZone); - Vector3 originPos = originZone.transform.position; - Vector3 targetPos = targetZone.transform.position; + Vector3 originPos = originZone.transform.position; + Vector3 targetPos = targetZone.transform.position; - if(!State.CurrentTransition.IsCurved) - { - originPos += originZone.planet.GetFleetArrivalPosition(targetZone) * originZone.planet.GetCurrentCircleRadius(); - targetPos += targetZone.planet.GetFleetArrivalPosition(originZone) * targetZone.planet.GetCurrentCircleRadius(); + if (!State.CurrentTransition.IsCurved) + { + originPos += originZone.planet.GetFleetArrivalPosition(targetZone) * originZone.planet.GetCurrentCircleRadius(); + targetPos += targetZone.planet.GetFleetArrivalPosition(originZone) * targetZone.planet.GetCurrentCircleRadius(); - } + } + + Vector3 oldPos = transform.position; + Vector3 newPos; + Quaternion newRot; + //if(State.CurrentTransition.IsCurved) + //{ - Vector3 oldPos = transform.position; - Vector3 newPos; - Quaternion newRot; - //if(State.CurrentTransition.IsCurved) - //{ - /*Vector3 planetPos = targetZone.planet.transform.position; Vector3 originPos = originZone.transform.position - planetPos; Vector3 targetPos = targetZone.transform.position - planetPos; @@ -553,67 +555,70 @@ namespace GWConquest newPos += planetPos; newRot = Quaternion.LookRotation(newPos - oldPos, newPos - planetPos); */ - //} - //else - //{ + //} + //else + //{ newPos = Vector3.Lerp(originPos, targetPos, animDistanceCovered / State.CurrentTransition.TransitionLength); newRot = Quaternion.LookRotation(newPos - oldPos, Vector3.up); - //} - - transform.position = newPos; - transform.rotation = newRot; - - } - else if(MovementState == FormationMovementState.PreparingMovement) - { - if(ZoneType == ZoneType.Space) - { - var planet = currentZone.planet; - Vector3 origin = GetRestingPosition(); - var targetZone = PathQueue.First(); - Vector3 target = planet.transform.position + planet.GetFleetArrivalPosition(targetZone) * planet.GetCurrentCircleRadius(); + //} - Vector3 newPos = Vector3.Lerp(origin, target, 1f - ActionCooldownPercent); transform.position = newPos; + transform.rotation = newRot; + } - - } - else if(MovementState == FormationMovementState.FinishingMovement) - { - if(ZoneType == ZoneType.Space) + else if (MovementState == FormationMovementState.PreparingMovement) { - var planet = currentZone.planet; - Vector3 target = GetRestingPosition(); - Vector3 origin = planet.transform.position + arrivalPosition * planet.GetCurrentCircleRadius(); + if (ZoneType == ZoneType.Space) + { + var planet = currentZone.planet; + Vector3 origin = GetRestingPosition(); + var targetZone = PathQueue.First(); + Vector3 target = planet.transform.position + planet.GetFleetArrivalPosition(targetZone) * planet.GetCurrentCircleRadius(); + + Vector3 newPos = Vector3.Lerp(origin, target, 1f - ActionCooldownPercent); + transform.position = newPos; + } - Vector3 newPos = Vector3.Lerp(origin, target, 1f - ActionCooldownPercent); - transform.position = newPos; } - - } - else if(MovementState == FormationMovementState.Idle) - { - //transform.position = currentZone.transform.position; - if(ZoneType == ZoneType.Space) + else if (MovementState == FormationMovementState.FinishingMovement) { - transform.position = GetRestingPosition(); + if (ZoneType == ZoneType.Space) + { + var planet = currentZone.planet; + Vector3 target = GetRestingPosition(); + Vector3 origin = planet.transform.position + arrivalPosition * planet.GetCurrentCircleRadius(); + + Vector3 newPos = Vector3.Lerp(origin, target, 1f - ActionCooldownPercent); + transform.position = newPos; + } + } - else { - transform.position = currentZone.transform.position; + else if (MovementState == FormationMovementState.Idle) + { + //transform.position = currentZone.transform.position; + if (ZoneType == ZoneType.Space) + { + transform.position = GetRestingPosition(); + } + else + { + transform.position = currentZone.transform.position; + } } - } - if(movingArmyIcon != null && ZoneType == ZoneType.Space) - { - if(!IngameUI.PlanetViewEnabled && (GWCamera.Instance.ShowCircles || MovementState == FormationMovementState.Moving)) + if (movingArmyIcon != null && ZoneType == ZoneType.Space) { - movingArmyIcon.SetActive(true); - movingArmyIcon.GetComponent().Update(); - } - else { - movingArmyIcon.SetActive(false); + if (!IngameUI.PlanetViewEnabled && (GWCamera.Instance.ShowCircles || MovementState == FormationMovementState.Moving)) + { + movingArmyIcon.SetActive(true); + movingArmyIcon.GetComponent().Update(); + } + else + { + movingArmyIcon.SetActive(false); + } } } } diff --git a/Assets/GWConquest/Scripts/Planet.cs b/Assets/GWConquest/Scripts/Planet.cs index b8b6d0d..fc6178a 100644 --- a/Assets/GWConquest/Scripts/Planet.cs +++ b/Assets/GWConquest/Scripts/Planet.cs @@ -496,7 +496,7 @@ namespace GWConquest CircleTransform.localScale = Vector3.one * CircleSize; - if(IngameUI.PlanetViewEnabled || (!DebugUI.ShowAllPlanets && VisibilityStatus == PlanetVisibilityStatus.Hidden) || CircleSize == CircleSizeMin) + if(IngameUI.PlanetViewEnabled || (!DebugUI.ShowAllPlanets && VisibilityStatus == PlanetVisibilityStatus.Hidden) || CircleSize == CircleSizeMin || !Util.IsPointOnScreen(transform.position)) { CircleTransform.gameObject.SetActive(false); } diff --git a/Assets/GWConquest/Scripts/PlanetPlacement.cs b/Assets/GWConquest/Scripts/PlanetPlacement.cs index 9f94545..69a6b3f 100644 --- a/Assets/GWConquest/Scripts/PlanetPlacement.cs +++ b/Assets/GWConquest/Scripts/PlanetPlacement.cs @@ -252,7 +252,7 @@ namespace GWConquest zone.zoneType = ZoneType.Ground; nextZoneId++; - district.Planet = planet; + district.State.Planet = BoltEntityCache.Set(planet); var otherDistricts = planet.GetComponentsInChildren().ToList(); diff --git a/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll b/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll index 7948d93..d7ba0d6 100644 Binary files a/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll and b/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll differ diff --git a/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb b/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb index 5b53ba4..e0484f2 100644 Binary files a/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb and b/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb differ diff --git a/Assets/Photon/PhotonBolt/project.json b/Assets/Photon/PhotonBolt/project.json index 8fd370b..373a7dd 100644 --- a/Assets/Photon/PhotonBolt/project.json +++ b/Assets/Photon/PhotonBolt/project.json @@ -2320,7 +2320,7 @@ "ReplicationMode": 1, "Priority": 1, "PropertyType": { - "$type": "Photon.Bolt.Compiler.PropertyTypeEntity, bolt.compiler" + "$type": "Photon.Bolt.Compiler.PropertyTypeNetworkId, bolt.compiler" }, "AssetSettings": { "$type": "Photon.Bolt.Compiler.PropertyStateSettings, bolt.compiler", diff --git a/Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset b/Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset index 1fbbca9..b08a1fa 100644 --- a/Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset +++ b/Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset @@ -50,10 +50,10 @@ MonoBehaviour: debugStartPort: 54321 debugBuildMode: 1 debugStartMapName: GalaxyMap - debugPlayAsServer: 1 + debugPlayAsServer: 0 showDebugInfo: 0 overrideTimeScale: 1 - debugEditorMode: 1 + debugEditorMode: 2 consoleToggleKey: 9 consoleVisibleByDefault: 0 compilationWarnLevel: 4