fix event msg types being broken when disconnecting/reconnecting

This commit is contained in:
JohnCorby 2021-11-30 18:00:12 -08:00
parent 49996f50f9
commit cd48c916fc
4 changed files with 7 additions and 18 deletions

View File

@ -1,14 +1,8 @@
using System; namespace QSB.Events
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QSB.Events
{ {
public abstract class BaseQSBEvent : IQSBEvent public abstract class BaseQSBEvent : IQSBEvent
{ {
protected static int _msgType = 0; internal static int _msgType;
public abstract void SetupListener(); public abstract void SetupListener();
public abstract void CloseListener(); public abstract void CloseListener();

View File

@ -1,4 +1,5 @@
using OWML.Common; using System;
using OWML.Common;
using QSB.ClientServerStateSync; using QSB.ClientServerStateSync;
using QSB.Messaging; using QSB.Messaging;
using QSB.Player; using QSB.Player;
@ -6,8 +7,6 @@ using QSB.Player.Events;
using QSB.Player.TransformSync; using QSB.Player.TransformSync;
using QSB.Utility; using QSB.Utility;
using QuantumUNET.Components; using QuantumUNET.Components;
using System;
using UnityEngine;
namespace QSB.Events namespace QSB.Events
{ {
@ -29,11 +28,6 @@ namespace QSB.Events
_eventHandler.OnServerReceiveMessage += message => OnReceive(true, message); _eventHandler.OnServerReceiveMessage += message => OnReceive(true, message);
} }
~QSBEvent()
{
_msgType--;
}
public virtual void OnReceiveRemote(bool isHost, T message) { } public virtual void OnReceiveRemote(bool isHost, T message) { }
public virtual void OnReceiveLocal(bool isHost, T message) { } public virtual void OnReceiveLocal(bool isHost, T message) { }

View File

@ -45,6 +45,7 @@ namespace QSB.Events
public static void Init() public static void Init()
{ {
BaseQSBEvent._msgType = 0;
_eventList = new List<IQSBEvent> _eventList = new List<IQSBEvent>
{ {
// Player // Player