Browse Source

(WIP) Completely removed Bolt from Scripts

master
laurids 1 year ago
parent
commit
f6081ef965
23 changed files with 88 additions and 590 deletions
  1. +7
    -4
      Assets/GWConquest/Scripts/Battle.cs
  2. +1
    -1
      Assets/GWConquest/Scripts/BattleFlank.cs
  3. +0
    -58
      Assets/GWConquest/Scripts/BoltEntityCache.cs
  4. +0
    -11
      Assets/GWConquest/Scripts/BoltEntityCache.cs.meta
  5. +0
    -240
      Assets/GWConquest/Scripts/BoltList.cs
  6. +0
    -11
      Assets/GWConquest/Scripts/BoltList.cs.meta
  7. +1
    -1
      Assets/GWConquest/Scripts/District.cs
  8. +0
    -119
      Assets/GWConquest/Scripts/EntityList.cs
  9. +0
    -11
      Assets/GWConquest/Scripts/EntityList.cs.meta
  10. +2
    -3
      Assets/GWConquest/Scripts/Formation.cs
  11. +0
    -35
      Assets/GWConquest/Scripts/GWBoltBehaviour.cs
  12. +0
    -11
      Assets/GWConquest/Scripts/GWBoltBehaviour.cs.meta
  13. +0
    -5
      Assets/GWConquest/Scripts/GWNetworkArray.cs
  14. +0
    -11
      Assets/GWConquest/Scripts/GWNetworkArray.cs.meta
  15. +25
    -1
      Assets/GWConquest/Scripts/GWNetworkManager.cs
  16. +13
    -26
      Assets/GWConquest/Scripts/GameManager.cs
  17. +1
    -1
      Assets/GWConquest/Scripts/Planet.cs
  18. +13
    -8
      Assets/GWConquest/Scripts/PlanetPlacement.cs
  19. +5
    -0
      Assets/GWConquest/Scripts/Player.cs
  20. +12
    -16
      Assets/GWConquest/Scripts/UI/MainMenu.cs
  21. +3
    -2
      Assets/GWConquest/Scripts/UI/PauseMenu.cs
  22. +1
    -1
      Assets/GWConquest/Scripts/Unit.cs
  23. +4
    -14
      Assets/GWConquest/Scripts/Zone.cs

+ 7
- 4
Assets/GWConquest/Scripts/Battle.cs View File

@ -19,6 +19,8 @@ namespace GWConquest
private NetworkVariable<int> victorID;
private NetworkVariable<float> preparingCooldown;
public GameObject BattleFlankPrefab;
public IEnumerable<Formation> Formations
{
get => formations.Select(r => r.GetBehaviour<Formation>());
@ -149,7 +151,9 @@ namespace GWConquest
private BattleFlank InstantiateNewFlank(int maxUnitCount)
{
var go = BoltNetwork.Instantiate(BoltPrefabs.BattleFlank);
GameObject go = Instantiate(BattleFlankPrefab);
go.GetComponent<NetworkObject>().Spawn();
var flank = go.GetComponent<BattleFlank>();
flank.Battle = this;
flank.MaxUnitCount = maxUnitCount;
@ -227,7 +231,7 @@ namespace GWConquest
{
if(IsInPreparing)
{
PreparingCooldown -= BoltNetwork.FrameDeltaTime;
PreparingCooldown -= Time.fixedDeltaTime;
if(PreparingCooldown <= 0)
{
PreparingCooldown = 0;
@ -287,8 +291,7 @@ namespace GWConquest
foreach(var flank in AllFlanks.ToList())
{
BoltNetwork.Destroy(flank.gameObject);
Destroy(flank.gameObject);
flank.NetworkObject.Despawn();
}
}


+ 1
- 1
Assets/GWConquest/Scripts/BattleFlank.cs View File

@ -130,7 +130,7 @@ namespace GWConquest {
{
if(GetDeathCooldown(i) > 0)
{
deathCooldowns[i] -= BoltNetwork.FrameDeltaTime;
deathCooldowns[i] -= Time.fixedDeltaTime;
if(GetDeathCooldown(i) <= 0)
{
var unit = GetUnit(i);


+ 0
- 58
Assets/GWConquest/Scripts/BoltEntityCache.cs View File

@ -1,58 +0,0 @@
using UnityEngine;
using System.Collections.Generic;
namespace GWConquest
{
public static class BoltEntityCache
{
private static Dictionary<NetworkId, IEntityBehaviour> dictionary = new Dictionary<NetworkId, IEntityBehaviour>();
public static T Get<T>(NetworkId id) where T : class, IEntityBehaviour
{
if(id == default(NetworkId))
{
return null;
}
if(dictionary.ContainsKey(id))
{
var behaviour = dictionary[id];
if(behaviour.entity.NetworkId == id)
{
return behaviour as T;
}
}
var entity = BoltNetwork.FindEntity(id);
if(entity == null)
{
return null;
}
else {
var newBeh = entity.GetComponent<T>();
dictionary[id] = newBeh;
return newBeh;
}
}
public static NetworkId Set<T>(T behaviour) where T : class, IEntityBehaviour
{
if(behaviour == null)
{
return default(NetworkId);
}
else {
return behaviour.entity.NetworkId;
}
}
public static void ClearCache()
{
dictionary.Clear();
}
}
}

+ 0
- 11
Assets/GWConquest/Scripts/BoltEntityCache.cs.meta View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c2f033f40a5a03e4ba66c6f9240d2043
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 240
Assets/GWConquest/Scripts/BoltList.cs View File

@ -1,240 +0,0 @@

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UdpKit;
namespace GWConquest
{
public abstract class BoltList<T, TokenClass> : IList<T> where TokenClass : BoltListToken<T>, new()
{
private IState state;
private string propertyName;
public BoltList(IState _state, string _propertyName)
{
state = _state;
propertyName = _propertyName;
}
private TokenClass Token
{
get
{
TokenClass token = state.GetDynamic(propertyName) as TokenClass;
if (token == null)
{
return new TokenClass();
}
else
{
return token;
}
}
set => state.SetDynamic(propertyName, value);
}
public void FromToken(TokenClass token)
{
Token = token;
}
public T this[int index]
{
get => Token.entries[index];
set
{
Token.entries[index] = value;
Token = new TokenClass().SetEntries(Token.entries) as TokenClass;
}
}
public int Count => Token.entries.Length;
public bool IsReadOnly => false;
public void Add(T item)
{
if (!Contains(item))
{
Token = new TokenClass().SetEntries(Token.entries.Append(item)) as TokenClass;
}
}
public void Clear()
{
Token = new TokenClass();
}
public bool Contains(T item)
{
return Token.entries.Contains(item);
}
public void CopyTo(T[] array, int arrayIndex)
{
Token.entries.CopyTo(array, arrayIndex);
}
public IEnumerator<T> GetEnumerator()
{
return new GenericListEnumerator<T>(this);
}
public int IndexOf(T item)
{
return Array.IndexOf(Token.entries, item);
}
public void Insert(int index, T item)
{
List<T> list = Token.entries.ToList();
list.Insert(index, item);
Token = new TokenClass().SetEntries(list) as TokenClass;
}
public bool Remove(T item)
{
List<T> list = Token.entries.ToList();
if (list.Remove(item))
{
Token = new TokenClass().SetEntries(list) as TokenClass;
return true;
}
else return false;
}
public void RemoveAt(int index)
{
List<T> list = Token.entries.ToList();
list.RemoveAt(index);
Token = new TokenClass().SetEntries(list) as TokenClass;
}
IEnumerator IEnumerable.GetEnumerator()
{
return new GenericListEnumerator<T>(this);
}
public override string ToString()
{
return "BoltList " + Util.PrintEnumerable(this);
}
public void SetEntries(IEnumerable<T> entries)
{
Token = new TokenClass().SetEntries(entries) as TokenClass;
}
}
public abstract class BoltListToken<T> : IProtocolToken
{
public BoltListToken()
{
entries = new T[0];
}
public BoltListToken<T> SetEntries(IEnumerable<T> _entities)
{
entries = _entities.ToArray();
return this;
}
public T[] entries { get; private set; }
public void Read(UdpPacket packet)
{
//Debug.LogFormat("Reading Bolt list...");
int count = packet.ReadInt();
entries = new T[count];
for (int i = 0; i < count; i++)
{
entries[i] = ReadEntry(packet);
}
//Debug.LogFormat("Finished reading Bolt list {0}", this);
}
public void Write(UdpPacket packet)
{
//Debug.LogFormat("Writing Bolt list...");
packet.WriteInt(entries.Length);
foreach (T e in entries)
{
WriteEntry(packet, e);
}
//Debug.LogFormat("Finished writing Bolt list {0}", this);
}
public override string ToString()
{
return "BoltList " + Util.PrintEnumerable(entries);
}
public override bool Equals(object obj)
{
if(obj == null || !(obj is BoltListToken<T>))
return false;
var other = obj as BoltListToken<T>;
if(entries.Length != other.entries.Length)
return false;
for(int i = 0; i < entries.Length; i++)
{
if(entries[i] == null)
{
if(other.entries[i] != null)
return false;
}
else {
if(!entries[i].Equals(other.entries[i]))
return false;
}
}
return true;
}
public abstract T ReadEntry(UdpPacket packet);
public abstract void WriteEntry(UdpPacket packet, T entry);
}
public class ZoneListToken : BoltListToken<Zone> {
public override Zone ReadEntry(UdpPacket packet)
{
return Zone.GetFromId(packet.ReadInt());
}
public override void WriteEntry(UdpPacket packet, Zone entry)
{
packet.WriteInt(Zone.GetZoneId(entry));
}
}
public class ZoneList : BoltList<Zone, ZoneListToken>
{
public ZoneList(IState _state, string _propertyName) : base(_state, _propertyName) {}
}
public class StringListToken : BoltListToken<string> {
public override string ReadEntry(UdpPacket packet)
{
return packet.ReadString();
}
public override void WriteEntry(UdpPacket packet, string entry)
{
packet.WriteString(entry);
}
}
public class StringList : BoltList<string, StringListToken>
{
public StringList(IState _state, string _propertyName) : base(_state, _propertyName) {}
}
}

+ 0
- 11
Assets/GWConquest/Scripts/BoltList.cs.meta View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: fda8796fd8800ef46a1ae47fa4de74a7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 1
- 1
Assets/GWConquest/Scripts/District.cs View File

@ -285,7 +285,7 @@ namespace GWConquest
{
Debug.LogFormat("Player {0} is the only player in district {1}, starting allegiance change...", player, this);
}
captureCooldown.Value += BoltNetwork.FrameDeltaTime;
captureCooldown.Value += Time.fixedDeltaTime;
}
return;
}


+ 0
- 119
Assets/GWConquest/Scripts/EntityList.cs View File

@ -1,119 +0,0 @@
using UdpKit;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
using System;
namespace GWConquest
{
public class GenericListEnumerator<T> : IEnumerator<T>
{
private int position = -1;
private IList<T> list;
public GenericListEnumerator(IList<T> _list)
{
list = _list;
}
public T Current => list[position];
object IEnumerator.Current => list[position];
public void Dispose() { }
public bool MoveNext()
{
position++;
return position < list.Count;
}
public void Reset()
{
position = -1;
}
}
public class CachedBoltEntity
{
public NetworkId NetworkId { get; private set; }
private BoltEntity cachedEntity;
public CachedBoltEntity(NetworkId id)
{
NetworkId = id;
}
public CachedBoltEntity(BoltEntity e)
{
NetworkId = e.NetworkId;
cachedEntity = e;
}
public BoltEntity Entity
{
get
{
if (cachedEntity == null)
{
cachedEntity = BoltNetwork.FindEntity(NetworkId);
}
return cachedEntity;
}
}
public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType())
{
return false;
}
var other = obj as CachedBoltEntity;
return NetworkId == other.NetworkId;
}
public override int GetHashCode()
{
return NetworkId.PackedValue.GetHashCode();
}
public override string ToString()
{
return Entity?.ToString();
}
}
public class EntityListToken : BoltListToken<CachedBoltEntity>
{
public override CachedBoltEntity ReadEntry(UdpPacket packet)
{
var id = new NetworkId(packet.ReadULong());
return new CachedBoltEntity(id);
}
public override void WriteEntry(UdpPacket packet, CachedBoltEntity entry)
{
packet.WriteULong(entry.NetworkId.PackedValue);
}
}
public class EntityList : BoltList<CachedBoltEntity, EntityListToken>
{
public EntityList(IState _state, string _propertyName) : base(_state, _propertyName) { }
public void Add(BoltEntity e)
{
Add(new CachedBoltEntity(e));
}
public bool Remove(BoltEntity e)
{
return Remove(new CachedBoltEntity(e));
}
}
}

+ 0
- 11
Assets/GWConquest/Scripts/EntityList.cs.meta View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 38983f1af3b8f9446a9a71fc1d5ebfc7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 2
- 3
Assets/GWConquest/Scripts/Formation.cs View File

@ -507,7 +507,7 @@ namespace GWConquest
}
if (MovementState == FormationMovementState.Moving)
{
CoveredDistance += movementSpeed * BoltNetwork.FrameDeltaTime;
CoveredDistance += movementSpeed * Time.fixedDeltaTime;
if (CoveredDistance >= CurrentTransition.TransitionLength)
{
@ -1076,8 +1076,7 @@ namespace GWConquest
units.RemoveAt(i);
OnUnitRemoved(unit);
BoltNetwork.Destroy(unit.gameObject);
Destroy(unit.gameObject);
unit.NetworkObject.Despawn();
}
}
}


+ 0
- 35
Assets/GWConquest/Scripts/GWBoltBehaviour.cs View File

@ -1,35 +0,0 @@
namespace GWConquest {
public abstract class GWBoltBehaviour<T> : EntityBehaviour<T> where T : class, IState
{
private T _state = null;
public T State {
get {
/*if(_state == null)
{
_state = state;
}
return _state;*/
return state;
}
}
}
public abstract class GWBoltEntityListener<T> : EntityEventListener<T> where T : class, IState
{
private T _state = null;
public T State {
get {
/*if(_state == null)
{
_state = state;
}
return _state;*/
return state;
}
}
}
}

+ 0
- 11
Assets/GWConquest/Scripts/GWBoltBehaviour.cs.meta View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f48b9c6bc6be7154e809c78208e38787
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 5
Assets/GWConquest/Scripts/GWNetworkArray.cs View File

@ -1,5 +0,0 @@
using Unity.Netcode;
namespace GWConquest {
}

+ 0
- 11
Assets/GWConquest/Scripts/GWNetworkArray.cs.meta View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 5893ec9dc0d5802479ca61e4b13ac64f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 25
- 1
Assets/GWConquest/Scripts/GWNetworkManager.cs View File

@ -19,6 +19,7 @@ namespace GWConquest {
public GameObject UnitPrefab;
public GameObject FormationPrefab;
public GameObject BattlePrefab;
public override void OnNetworkSpawn()
{
@ -39,6 +40,8 @@ namespace GWConquest {
else {
ServerSceneLoadCompleteRemote(sceneEvent.ClientId);
}
GameManager.Instance.SceneLoadLocalDone(false);
}
}
@ -46,6 +49,7 @@ namespace GWConquest {
if(sceneEvent.SceneEventType == SceneEventType.LoadComplete)
{
ClientSceneLoadComplete();
GameManager.Instance.SceneLoadLocalDone(true);
}
}
}
@ -66,7 +70,7 @@ namespace GWConquest {
serverPlayer.SetFaction((ushort) GameManager.HostFactionIndex);
serverPlayer.AssignStartingPlanets();
GameManager.Instance.SceneLoadLocalDone();
GameManager.Instance.ServerSceneLoadLocalDone();
//foreach(GameObject go in FindObjectsOfType<GameObject>()) {
// go.SendMessage("OnSceneLoadLocalDone", SendMessageOptions.DontRequireReceiver);
@ -154,10 +158,30 @@ namespace GWConquest {
public Formation SpawnFormation(Zone zone, Player player)
{
GameObject go = Instantiate(FormationPrefab);
go.GetComponent<NetworkObject>().Spawn();
Formation playerFormation = go.GetComponent<Formation>();
playerFormation.Initialize(zone, player);
return playerFormation;
}
public Battle SpawnBattle(Zone zone)
{
var go = Instantiate(BattlePrefab);
go.GetComponent<NetworkObject>().Spawn();
Battle battle = go.GetComponent<Battle>();
battle.Zone = zone;
foreach (Formation f in zone.Formations)
{
battle.AddFormation(f);
}
battle.Init();
Debug.LogFormat("Starting battle at zone {0}", this);
return battle;
}
}
}

+ 13
- 26
Assets/GWConquest/Scripts/GameManager.cs View File

@ -1,7 +1,6 @@
using UnityEngine;
using System.Collections;
using Unity.Netcode;
namespace GWConquest
{
@ -85,6 +84,8 @@ namespace GWConquest
public bool SpawnAIPlayer;
public GameObject PlayerPrefab;
public bool IsLoaded { get; private set; } = false;
public float TimeScale = 1f;
@ -118,7 +119,7 @@ namespace GWConquest
BattleLog.Instance = new BattleLog();
}
public void SceneLoadLocalDone()
public void ServerSceneLoadLocalDone()
{
if(SpawnAIPlayer)
{
@ -128,11 +129,12 @@ namespace GWConquest
var faction = Factions[i];
if(faction.IsAI)
{
BoltEntity playerEntity = BoltNetwork.Instantiate(BoltPrefabs.Player);
IPlayerState playerState = playerEntity.GetState<IPlayerState>(); ;
playerState.IsAI = true;
playerState.FactionIndex = i;
playerEntity.GetComponent<Player>().AssignStartingPlanets();
GameObject go = Instantiate(PlayerPrefab);
go.GetComponent<NetworkObject>().Spawn();
Player player = go.GetComponent<Player>();
player.SetAI();
player.SetFaction((ushort) i);
player.AssignStartingPlanets();
}
}
@ -141,26 +143,11 @@ namespace GWConquest
IsLoaded = true;
}
public void FixedUpdate() {
if(Input.GetKeyDown(KeyCode.F1))
{
var ui = IngameUI.Instance.gameObject;
ui.SetActive(!ui.activeSelf);
}
}
public void SetEntitiesLoaded()
public void SceneLoadLocalDone(bool isClient)
{
StartCoroutine(EntitiesLoadedAsync());
}
private IEnumerator EntitiesLoadedAsync()
{
yield return new WaitForSecondsRealtime(1f);
yield return new WaitForFixedUpdate();
EntitiesLoaded = true;
if(BoltNetwork.IsClient)
if(isClient)
{
Debug.LogFormat("Loading non-static planets on client...");
InitPlanetsClient();
@ -176,6 +163,7 @@ namespace GWConquest
LoadingScreen.Dismiss();
}
private void InitPlanetsClient()
{
var allPlanets = FindObjectsOfType<Planet>();
@ -212,7 +200,6 @@ namespace GWConquest
BattleLog.Instance = null;
BoltEntityCache.ClearCache();
District.AllDistricts.Clear();
Formation.AllFormations.Clear();


+ 1
- 1
Assets/GWConquest/Scripts/Planet.cs View File

@ -338,7 +338,7 @@ namespace GWConquest
{
formationsChangedSinceLastFrame = true;
if(BoltNetwork.IsServer)
if(IsServer)
{
var currentPlayers = GetAllFormations(ZoneType.Space).Select(f => f.Player).Distinct();
foreach(Player player in currentPlayers)


+ 13
- 8
Assets/GWConquest/Scripts/PlanetPlacement.cs View File

@ -2,8 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Unity.Netcode;
namespace GWConquest
@ -26,6 +25,10 @@ namespace GWConquest
public Transform PlanetConnectionParent;
public GameObject[] PlanetPrefabs;
public GameObject PlanetPrefab;
public GameObject DistrictPrefab;
public GameObject FactoryPrefab;
private string[] PlanetNames;
public float MinPlanetDistance;
@ -120,7 +123,8 @@ namespace GWConquest
public Planet PlacePlanet(Vector3 position, ref int nextZoneId)
{
var planetGO = BoltNetwork.Instantiate(BoltPrefabs.Planet, position, Quaternion.identity);
var planetGO = Instantiate(PlanetPrefab, position, Quaternion.identity);
planetGO.GetComponent<NetworkObject>().Spawn();
var planet = planetGO.GetComponent<Planet>();
var planetName = DrawName();
@ -166,11 +170,11 @@ namespace GWConquest
public void SpawnDistrict(Planet planet, ref int nextZoneId)
{
PrefabId prefabID;
GameObject prefab;
DistrictType type;
if(Random.value <= districtSettings.FactoryChance)
{
prefabID = BoltPrefabs.Factory;
prefab = FactoryPrefab;
int factoryType = Random.Range(0, 3);
switch(factoryType)
{
@ -190,11 +194,11 @@ namespace GWConquest
}
else if(Random.value <= districtSettings.FoodChance / (1f - districtSettings.FactoryChance))
{
prefabID = BoltPrefabs.District;
prefab = DistrictPrefab;
type = DistrictType.Food;
}
else {
prefabID = BoltPrefabs.Factory;
prefab = FactoryPrefab;
type = DistrictType.Civil;
}
@ -212,7 +216,8 @@ namespace GWConquest
districtPos += planet.transform.position;
var go = BoltNetwork.Instantiate(prefabID, districtPos, Quaternion.identity);
var go = Instantiate(prefab, districtPos, Quaternion.identity);
go.GetComponent<NetworkObject>().Spawn();
go.transform.SetParent(planet.transform);
var district = go.GetComponent<District>();


+ 5
- 0
Assets/GWConquest/Scripts/Player.cs View File

@ -91,6 +91,11 @@ namespace GWConquest
factionIndex.Value = ind;
}
public void SetAI()
{
isAI.Value = true;
}
public NetworkClient Client
{
get


+ 12
- 16
Assets/GWConquest/Scripts/UI/MainMenu.cs View File

@ -1,17 +1,19 @@

using Photon.Bolt.Matchmaking;
using System;
using UdpKit;
using UnityEngine;
using Unity.Netcode;
namespace GWConquest
{
public class MainMenu : GlobalEventListener
public class MainMenu : MonoBehaviour
{
private void Start() {
GameOptions.ApplyOptions();
NetworkManager.Singleton.OnServerStarted += ServerStartDone;
}
public void StartServer(int hostFactionIndex)
@ -22,39 +24,33 @@ namespace GWConquest
LoadingScreen.Show();
BoltLauncher.StartServer();
NetworkManager.Singleton.StartHost();
}
public void StartClient()
{
GameManager.ClearAllCaches();
BoltLauncher.StartClient();
NetworkManager.Singleton.StartClient();
}
public void CancelClient()
{
BoltLauncher.Shutdown();
NetworkManager.Singleton.Shutdown();
}
public void Quit() {
Application.Quit();
}
public override void BoltStartDone()
public void ServerStartDone()
{
if(BoltNetwork.IsServer)
{
string matchName = Guid.NewGuid().ToString();
Debug.Log("Server start done");
BoltMatchmaking.CreateSession(
sessionID: matchName,
sceneToLoad: "GalaxyMap"
);
}
NetworkManager.Singleton.SceneManager.LoadScene("GalaxyMap", UnityEngine.SceneManagement.LoadSceneMode.Single);
}
public override void SessionListUpdated(Map<Guid, UdpSession> sessionList)
/*public override void SessionListUpdated(Map<Guid, UdpSession> sessionList)
{
Debug.LogFormat("Session list updated: {0} total sessions", sessionList.Count);
@ -69,6 +65,6 @@ namespace GWConquest
BoltMatchmaking.JoinSession(photonSession);
}
}
}
}*/
}
}

+ 3
- 2
Assets/GWConquest/Scripts/UI/PauseMenu.cs View File

@ -1,6 +1,7 @@

using UnityEngine;
using UnityEngine.SceneManagement;
using Unity.Netcode;
namespace GWConquest
{
@ -8,13 +9,13 @@ namespace GWConquest
{
public void QuitToMainMenu()
{
BoltLauncher.Shutdown();
NetworkManager.Singleton.Shutdown();
SceneManager.LoadScene("MainMenu");
}
public void QuitToDesktop()
{
BoltLauncher.Shutdown();
NetworkManager.Singleton.Shutdown();
Application.Quit();
}
}


+ 1
- 1
Assets/GWConquest/Scripts/Unit.cs View File

@ -498,7 +498,7 @@ namespace GWConquest
if (ShieldsCooldown == 0 && Shields < Class.Shields)
{
float regRate = Class.ShieldRegeneration / GameManager.Instance.BattleTurnLength;
Shields += regRate * BoltNetwork.FrameDeltaTime;
Shields += regRate * Time.fixedDeltaTime;
if (Shields > Class.Shields)
{
Shields = Class.Shields;


+ 4
- 14
Assets/GWConquest/Scripts/Zone.cs View File

@ -1,8 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using Unity.Netcode;
namespace GWConquest
{
@ -111,7 +110,7 @@ namespace GWConquest
OnFormationChanged(formation);
if (BoltNetwork.IsServer)
if (NetworkManager.Singleton.IsServer)
{
if (CurrentBattle != null)
{
@ -132,16 +131,7 @@ namespace GWConquest
{
if (ShouldStartBattle())
{
var battleEntity = BoltNetwork.Instantiate(BoltPrefabs.Battle);
CurrentBattle = battleEntity.GetComponent<Battle>();
CurrentBattle.Zone = this;
foreach (Formation f in Formations)
{
CurrentBattle.AddFormation(f);
}
CurrentBattle.Init();
Debug.LogFormat("Starting battle at zone {0}", this);
GWNetworkManager.Instance.SpawnBattle(this);
}
}
@ -154,7 +144,7 @@ namespace GWConquest
{
OnFormationChanged(formation);
if (BoltNetwork.IsServer)
if (NetworkManager.Singleton.IsServer)
{
if (CurrentBattle != null)
{


Loading…
Cancel
Save