This commit is contained in:
Mister_Nebula 2020-11-03 21:42:14 +00:00
parent a64a5fcf79
commit 45d459d389
45 changed files with 57 additions and 58 deletions

View File

@ -1,5 +1,5 @@
using OWML.ModHelper.Events;
using QSB.Events;
using QSB.EventsCore;
using QSB.Player;
using System;
using System.Linq;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Player;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Player;

View File

@ -1,6 +1,6 @@
using OWML.Common;
using OWML.ModHelper.Events;
using QSB.Events;
using QSB.EventsCore;
using QSB.Player;
using QSB.Utility;
using QSB.WorldSync;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Player;
using QSB.WorldSync;

View File

@ -1,6 +1,6 @@
using OWML.Common;
using OWML.ModHelper.Events;
using QSB.Events;
using QSB.EventsCore;
using QSB.Player;
using QSB.Utility;
using QSB.WorldSync;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using System.Linq;
namespace QSB.DeathSync

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Player;
using QSB.Utility;

View File

@ -1,6 +1,6 @@
using OWML.Common;
using OWML.ModHelper.Events;
using QSB.Events;
using QSB.EventsCore;
using QSB.Utility;
using System.Linq;
using UnityEngine;

View File

@ -1,5 +1,5 @@
using OWML.ModHelper.Events;
using QSB.Events;
using QSB.EventsCore;
namespace QSB.ElevatorSync
{

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.WorldSync;

View File

@ -1,4 +1,4 @@
namespace QSB.Events
namespace QSB.EventsCore
{
public static class EventNames
{

View File

@ -1,4 +1,4 @@
namespace QSB.Events
namespace QSB.EventsCore
{
public interface IQSBEvent
{

View File

@ -3,7 +3,7 @@ using QSB.Player;
using QSB.TransformSync;
using UnityEngine.Networking;
namespace QSB.Events
namespace QSB.EventsCore
{
/// <summary>
/// Abstract class that handles all event code.
@ -13,11 +13,11 @@ namespace QSB.Events
{
public abstract EventType Type { get; }
public uint LocalPlayerId => QSBPlayerManager.LocalPlayerId;
private readonly MessageHandler<T> _eventHandler;
private readonly QSBMessageHandler<T> _eventHandler;
protected QSBEvent()
{
_eventHandler = new MessageHandler<T>(Type);
_eventHandler = new QSBMessageHandler<T>(Type);
_eventHandler.OnClientReceiveMessage += OnClientReceive;
_eventHandler.OnServerReceiveMessage += OnServerReceive;
}

View File

@ -14,7 +14,7 @@ using QSB.TransformSync;
using QSB.Utility;
using System.Collections.Generic;
namespace QSB.Events
namespace QSB.EventsCore
{
public static class QSBEventManager
{

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.WorldSync;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.WorldSync;
using UnityEngine.Networking;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Player;
using QSB.Utility;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Instruments.QSBCamera;
using QSB.Player;
using UnityEngine;

View File

@ -7,14 +7,14 @@ using UnityEngine.Networking;
namespace QSB.Messaging
{
// Extend this to create new message handlers.
public class MessageHandler<T> where T : MessageBase, new()
public class QSBMessageHandler<T> where T : MessageBase, new()
{
public event Action<T> OnClientReceiveMessage;
public event Action<T> OnServerReceiveMessage;
private readonly EventType _eventType;
public MessageHandler(EventType eventType)
public QSBMessageHandler(EventType eventType)
{
_eventType = eventType + MsgType.Highest + 1;
if (QSBNetworkManager.Instance.IsReady)

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.WorldSync;

View File

@ -1,5 +1,5 @@
using OWML.Common;
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.TransformSync;
using QSB.Utility;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.WorldSync;
using UnityEngine;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.WorldSync;
namespace QSB.OrbSync

View File

@ -1,5 +1,5 @@
using OWML.Common;
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Utility;

View File

@ -1,5 +1,5 @@
using OWML.Common;
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Utility;
using System.Linq;

View File

@ -1,5 +1,5 @@
using OWML.Common;
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.TransformSync;
using QSB.Utility;

View File

@ -1,19 +1,17 @@
using QSB.Messaging;
using QSB.Player;
using QSB.Player.Events;
using UnityEngine.Networking;
namespace QSB.Events
namespace QSB.Player.Events
{
public class PlayerStateEvent : NetworkBehaviour
{
public static PlayerStateEvent LocalInstance { get; private set; }
private MessageHandler<PlayerStateMessage> _messageHandler;
private QSBMessageHandler<PlayerStateMessage> _messageHandler;
private void Awake()
{
_messageHandler = new MessageHandler<PlayerStateMessage>(EventType.FullState);
_messageHandler = new QSBMessageHandler<PlayerStateMessage>(EventType.FullState);
_messageHandler.OnClientReceiveMessage += OnClientReceiveMessage;
LocalInstance = this;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.TransformSync;
using QSB.Utility;

View File

@ -143,9 +143,9 @@
<Compile Include="ElevatorSync\Events\ElevatorEvent.cs" />
<Compile Include="ElevatorSync\ElevatorManager.cs" />
<Compile Include="ElevatorSync\ElevatorPatches.cs" />
<Compile Include="Events\EventNames.cs" />
<Compile Include="EventsCore\EventNames.cs" />
<Compile Include="DeathSync\Events\PlayerDeathEvent.cs" />
<Compile Include="Events\IQSBEvent.cs" />
<Compile Include="EventsCore\IQSBEvent.cs" />
<Compile Include="Instruments\Events\PlayInstrumentEvent.cs" />
<Compile Include="Instruments\Events\PlayInstrumentMessage.cs" />
<Compile Include="Instruments\InstrumentType.cs" />
@ -183,9 +183,9 @@
<Compile Include="Tools\Events\PlayerProbeLauncherEvent.cs" />
<Compile Include="Tools\Events\PlayerSignalscopeEvent.cs" />
<Compile Include="Tools\Events\PlayerTranslatorEvent.cs" />
<Compile Include="Events\QSBEvent.cs" />
<Compile Include="EventsCore\QSBEvent.cs" />
<Compile Include="Player\Events\PlayerJoinMessage.cs" />
<Compile Include="Messaging\ToggleMessage.cs" />
<Compile Include="MessagesCore\ToggleMessage.cs" />
<Compile Include="TransformSync\QSBSector.cs" />
<Compile Include="TransformSync\QSBSectorManager.cs" />
<Compile Include="TransformSync\TransformSync.cs" />
@ -199,14 +199,14 @@
<Compile Include="Tools\ToolType.cs" />
<Compile Include="TransformSync\PlayerProbeSync.cs" />
<Compile Include="Utility\DebugActions.cs" />
<Compile Include="Events\QSBEventManager.cs" />
<Compile Include="EventsCore\QSBEventManager.cs" />
<Compile Include="Player\Events\PlayerStateMessage.cs" />
<Compile Include="Events\PlayerStateEvent.cs" />
<Compile Include="Player\Events\PlayerStateEvent.cs" />
<Compile Include="DeathSync\Necronomicon.cs" />
<Compile Include="Utility\DebugLog.cs" />
<Compile Include="Messaging\PlayerMessage.cs" />
<Compile Include="Messaging\MessageHandler.cs" />
<Compile Include="Messaging\EventType.cs" />
<Compile Include="MessagesCore\PlayerMessage.cs" />
<Compile Include="MessagesCore\QSBMessageHandler.cs" />
<Compile Include="MessagesCore\EventType.cs" />
<Compile Include="Player\PlayerInfo.cs" />
<Compile Include="Player\State.cs" />
<Compile Include="DeathSync\PreventShipDestruction.cs" />

View File

@ -4,11 +4,12 @@ using QSB.Animation;
using QSB.ConversationSync;
using QSB.DeathSync;
using QSB.ElevatorSync;
using QSB.Events;
using QSB.EventsCore;
using QSB.GeyserSync;
using QSB.OrbSync;
using QSB.Patches;
using QSB.Player;
using QSB.Player.Events;
using QSB.TimeSync;
using QSB.TransformSync;
using QSB.Utility;
@ -102,7 +103,7 @@ namespace QSB
channels.Add(QosType.Reliable);
channels.Add(QosType.Unreliable);
gameObject.AddComponent<Events.PlayerStateEvent>();
gameObject.AddComponent<PlayerStateEvent>();
}
public override void OnStartServer()

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
namespace QSB.TimeSync.Events

View File

@ -1,6 +1,6 @@
using OWML.ModHelper.Events;
using QSB.DeathSync;
using QSB.Events;
using QSB.EventsCore;
using QSB.TimeSync.Events;
using QSB.Utility;
using UnityEngine;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Player;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Player;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Player;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Player;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Player;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
namespace QSB.Tools
{

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Player;
using QSB.Tools;
using QSB.Utility;

View File

@ -1,5 +1,5 @@
using OWML.Common;
using QSB.Events;
using QSB.EventsCore;
using QSB.Messaging;
using QSB.Player;
using QSB.Utility;

View File

@ -1,4 +1,4 @@
using QSB.Events;
using QSB.EventsCore;
using QSB.Player;
using System.Linq;
using UnityEngine;