mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-03-29 19:20:40 +00:00
CodeMaid cleanup
This commit is contained in:
parent
7925b637a0
commit
78f1c6e811
@ -29,6 +29,7 @@ namespace QSB.Animation
|
||||
|
||||
public AnimatorMirror Mirror { get; private set; }
|
||||
public AnimationType CurrentType = AnimationType.PlayerUnsuited;
|
||||
|
||||
public Animator Animator
|
||||
{
|
||||
get { return _bodyAnim; }
|
||||
@ -141,7 +142,9 @@ namespace QSB.Animation
|
||||
}
|
||||
|
||||
private void OnJump() => _netAnim.SetTrigger("Jump");
|
||||
|
||||
private void OnBecomeGrounded() => _netAnim.SetTrigger("Grounded");
|
||||
|
||||
private void OnBecomeUngrounded() => _netAnim.SetTrigger("Ungrounded");
|
||||
|
||||
public void SendCrouch(float value = 0)
|
||||
@ -199,23 +202,29 @@ namespace QSB.Animation
|
||||
_unsuitedGraphics?.SetActive(false);
|
||||
_suitedGraphics?.SetActive(true);
|
||||
break;
|
||||
|
||||
case AnimationType.PlayerUnsuited:
|
||||
controller = _unsuitedAnimController;
|
||||
_unsuitedGraphics?.SetActive(true);
|
||||
_suitedGraphics?.SetActive(false);
|
||||
break;
|
||||
|
||||
case AnimationType.Chert:
|
||||
controller = _chertController;
|
||||
break;
|
||||
|
||||
case AnimationType.Esker:
|
||||
controller = _eskerController;
|
||||
break;
|
||||
|
||||
case AnimationType.Feldspar:
|
||||
controller = _feldsparController;
|
||||
break;
|
||||
|
||||
case AnimationType.Gabbro:
|
||||
controller = _gabbroController;
|
||||
break;
|
||||
|
||||
case AnimationType.Riebeck:
|
||||
controller = _riebeckController;
|
||||
break;
|
||||
|
@ -70,6 +70,7 @@ namespace QSB.Animation
|
||||
}
|
||||
_floatParams[fromParam.name].Target = _from.GetFloat(fromParam.name);
|
||||
break;
|
||||
|
||||
case AnimatorControllerParameterType.Bool:
|
||||
_to.SetBool(fromParam.name, _from.GetBool(fromParam.name));
|
||||
break;
|
||||
|
@ -21,6 +21,7 @@ namespace QSB.Animation
|
||||
}
|
||||
|
||||
private void HandleSuitUp() => SendEvent(CreateMessage(true));
|
||||
|
||||
private void HandleSuitDown() => SendEvent(CreateMessage(false));
|
||||
|
||||
private ToggleMessage CreateMessage(bool value) => new ToggleMessage
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace QSB.Animation.Events
|
||||
{
|
||||
class QSBAnimationMessage : MessageBase
|
||||
internal class QSBAnimationMessage : MessageBase
|
||||
{
|
||||
public NetworkInstanceId netId;
|
||||
public int stateHash;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace QSB.Animation.Events
|
||||
{
|
||||
class QSBAnimationParametersMessage : MessageBase
|
||||
internal class QSBAnimationParametersMessage : MessageBase
|
||||
{
|
||||
public NetworkInstanceId netId;
|
||||
public byte[] parameters;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace QSB.Animation.Events
|
||||
{
|
||||
class QSBAnimationTriggerMessage : MessageBase
|
||||
internal class QSBAnimationTriggerMessage : MessageBase
|
||||
{
|
||||
public NetworkInstanceId netId;
|
||||
public int hash;
|
||||
|
@ -13,7 +13,7 @@ namespace QSB.Animation
|
||||
_lookBase = lookBase;
|
||||
}
|
||||
|
||||
void LateUpdate()
|
||||
private void LateUpdate()
|
||||
{
|
||||
var bone = _attachedAnimator.GetBoneTransform(HumanBodyBones.Head);
|
||||
// Get the camera's local rotation with respect to the player body
|
||||
|
@ -7,7 +7,7 @@ namespace QSB.Animation
|
||||
{
|
||||
// Cleaned up unity code. UNET is so broken I gave up and fixed it myself.
|
||||
|
||||
class QSBNetworkAnimator : QSBNetworkBehaviour
|
||||
internal class QSBNetworkAnimator : QSBNetworkBehaviour
|
||||
{
|
||||
private static QSBAnimationMessage AnimationMessage = new QSBAnimationMessage();
|
||||
private static QSBAnimationParametersMessage ParametersMessage = new QSBAnimationParametersMessage();
|
||||
@ -182,9 +182,11 @@ namespace QSB.Animation
|
||||
case AnimatorControllerParameterType.Int:
|
||||
writer.WritePackedUInt32((uint)m_Animator.GetInteger(parameter.nameHash));
|
||||
break;
|
||||
|
||||
case AnimatorControllerParameterType.Float:
|
||||
writer.Write(m_Animator.GetFloat(parameter.nameHash));
|
||||
break;
|
||||
|
||||
case AnimatorControllerParameterType.Bool:
|
||||
writer.Write(m_Animator.GetBool(parameter.nameHash));
|
||||
break;
|
||||
@ -210,10 +212,12 @@ namespace QSB.Animation
|
||||
var num = (int)reader.ReadPackedUInt32();
|
||||
m_Animator.SetInteger(parameter.nameHash, num);
|
||||
break;
|
||||
|
||||
case AnimatorControllerParameterType.Float:
|
||||
var single = reader.ReadSingle();
|
||||
m_Animator.SetFloat(parameter.nameHash, single);
|
||||
break;
|
||||
|
||||
case AnimatorControllerParameterType.Bool:
|
||||
var flag = reader.ReadBoolean();
|
||||
m_Animator.SetBool(parameter.nameHash, flag);
|
||||
|
@ -142,4 +142,4 @@ namespace QSB.ConversationSync
|
||||
return newBox;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -111,4 +111,4 @@ namespace QSB.ConversationSync
|
||||
QSB.Helper.HarmonyHelper.AddPrefix<CharacterAnimController>("OnZoneExit", typeof(ConversationPatches), nameof(OnZoneExit));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,4 +7,4 @@
|
||||
CloseCharacter,
|
||||
ClosePlayer
|
||||
}
|
||||
}
|
||||
}
|
@ -30,9 +30,11 @@ namespace QSB.ConversationSync.Events
|
||||
var translated = TextTranslation.Translate(message.Message).Trim();
|
||||
ConversationManager.Instance.DisplayCharacterConversationBox(message.ObjectId, translated);
|
||||
break;
|
||||
|
||||
case ConversationType.Player:
|
||||
ConversationManager.Instance.DisplayPlayerConversationBox((uint)message.ObjectId, message.Message);
|
||||
break;
|
||||
|
||||
case ConversationType.CloseCharacter:
|
||||
if (message.ObjectId == -1)
|
||||
{
|
||||
@ -41,10 +43,11 @@ namespace QSB.ConversationSync.Events
|
||||
var tree = WorldRegistry.OldDialogueTrees[message.ObjectId];
|
||||
UnityEngine.Object.Destroy(ConversationManager.Instance.BoxMappings[tree]);
|
||||
break;
|
||||
|
||||
case ConversationType.ClosePlayer:
|
||||
UnityEngine.Object.Destroy(QSBPlayerManager.GetPlayer((uint)message.ObjectId).CurrentDialogueBox);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -25,4 +25,4 @@ namespace QSB.ConversationSync.Events
|
||||
writer.Write(Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -67,4 +67,4 @@ namespace QSB.ConversationSync.Events
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -25,4 +25,4 @@ namespace QSB.ConversationSync.Events
|
||||
writer.Write(State);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -30,4 +30,4 @@ namespace QSB.DeathSync.Events
|
||||
|
||||
public override void OnReceiveLocal(EnumMessage<DeathType> message) => OnReceiveRemote(message);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ namespace QSB.DeathSync
|
||||
{
|
||||
public static class Necronomicon
|
||||
{
|
||||
|
||||
private static readonly Dictionary<DeathType, string[]> DeathDictionary = new Dictionary<DeathType, string[]>
|
||||
{
|
||||
{ DeathType.Default, new[]
|
||||
@ -100,6 +99,5 @@ namespace QSB.DeathSync
|
||||
{
|
||||
return DeathDictionary[deathType].OrderBy(x => Guid.NewGuid()).First();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -40,4 +40,4 @@ namespace QSB.DeathSync
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -136,4 +136,4 @@ namespace QSB.DeathSync
|
||||
.FirstOrDefault(spawnPoint => spawnPoint.GetSpawnLocation() == SpawnLocation.TimberHearth && spawnPoint.IsShipSpawn() == isShip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -35,4 +35,4 @@ namespace QSB.ElevatorSync
|
||||
|
||||
public int GetId(Elevator elevator) => _elevators.IndexOf(elevator);
|
||||
}
|
||||
}
|
||||
}
|
@ -19,4 +19,4 @@ namespace QSB.ElevatorSync
|
||||
QSB.Helper.HarmonyHelper.AddPostfix<Elevator>("StartLift", typeof(ElevatorPatches), nameof(StartLift));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -26,4 +26,4 @@ namespace QSB.ElevatorSync.Events
|
||||
elevator?.RemoteCall(message.State);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -54,4 +54,4 @@ namespace QSB.ElevatorSync
|
||||
_interactVolume.DisableInteraction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -37,4 +37,4 @@
|
||||
public static string QSBChangeAnimType = "QSBPlayInstrument";
|
||||
public static string QSBServerSendPlayerStates = "QSBServerSendPlayerStates";
|
||||
}
|
||||
}
|
||||
}
|
@ -26,4 +26,4 @@
|
||||
ConversationStartEnd,
|
||||
PlayInstrument
|
||||
}
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
public interface IQSBEvent
|
||||
{
|
||||
void SetupListener();
|
||||
|
||||
void CloseListener();
|
||||
}
|
||||
}
|
||||
}
|
@ -65,4 +65,4 @@ namespace QSB.EventsCore
|
||||
OnReceiveRemote(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -64,4 +64,4 @@ namespace QSB.EventsCore
|
||||
_eventList = new List<IQSBEvent>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -33,4 +33,4 @@ namespace QSB.GeyserSync.Events
|
||||
geyser?.SetState(message.State);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -37,4 +37,4 @@ namespace QSB.GeyserSync
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -118,6 +118,7 @@ namespace QSB.Instruments
|
||||
case AnimationType.Chert:
|
||||
ChertDrum.SetActive(true);
|
||||
break;
|
||||
|
||||
case AnimationType.PlayerSuited:
|
||||
case AnimationType.PlayerUnsuited:
|
||||
ChertDrum.SetActive(false);
|
||||
@ -125,4 +126,4 @@ namespace QSB.Instruments
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace QSB.Instruments.QSBCamera
|
||||
{
|
||||
class CameraController : MonoBehaviour
|
||||
internal class CameraController : MonoBehaviour
|
||||
{
|
||||
private float _degreesX;
|
||||
private float _degreesY;
|
||||
@ -11,12 +11,13 @@ namespace QSB.Instruments.QSBCamera
|
||||
|
||||
// How far along the ray to move the camera. Avoids clipping into the walls.
|
||||
private const float PercentToMove = 0.80f;
|
||||
|
||||
// Maximum distance for camera clipping
|
||||
private const float RayLength = 5f;
|
||||
|
||||
public GameObject CameraObject;
|
||||
|
||||
void FixedUpdate()
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (CameraManager.Instance.Mode != CameraMode.ThirdPerson)
|
||||
{
|
||||
@ -76,4 +77,4 @@ namespace QSB.Instruments.QSBCamera
|
||||
transform.localRotation = localRotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -111,4 +111,4 @@ namespace QSB.Instruments.QSBCamera
|
||||
Mode = CameraMode.FirstPerson;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -5,4 +5,4 @@
|
||||
FirstPerson,
|
||||
ThirdPerson
|
||||
}
|
||||
}
|
||||
}
|
@ -19,4 +19,4 @@ namespace QSB.MessagesCore
|
||||
writer.Write((int)(object)Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ namespace QSB.Messaging
|
||||
public class MessageHandler<T> where T : MessageBase, new()
|
||||
{
|
||||
public event Action<T> OnClientReceiveMessage;
|
||||
|
||||
public event Action<T> OnServerReceiveMessage;
|
||||
|
||||
private readonly EventType _eventType;
|
||||
@ -70,6 +71,5 @@ namespace QSB.Messaging
|
||||
var message = netMsg.ReadMessage<T>();
|
||||
OnServerReceiveMessage?.Invoke(message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -19,4 +19,4 @@ namespace QSB.Messaging
|
||||
writer.Write(AboutId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -29,4 +29,4 @@ namespace QSB.OrbSync.Events
|
||||
orbSlot?.SetState(message.State);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -83,4 +83,4 @@ namespace QSB.OrbSync.Events
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -60,4 +60,4 @@ namespace QSB.OrbSync
|
||||
QSB.Helper.HarmonyHelper.AddPrefix<NomaiInterfaceSlot>("CheckOrbCollision", typeof(OrbPatches), nameof(CheckOrbCollision));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -35,4 +35,4 @@ namespace QSB.OrbSync
|
||||
WorldRegistry.RaiseEvent(InterfaceSlot, ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,4 +6,4 @@
|
||||
|
||||
public abstract void DoPatches();
|
||||
}
|
||||
}
|
||||
}
|
@ -46,4 +46,4 @@ namespace QSB.Patches
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,4 +6,4 @@
|
||||
OnClientConnect,
|
||||
OnNonServerClientConnect
|
||||
}
|
||||
}
|
||||
}
|
@ -36,4 +36,4 @@ namespace QSB.Player.Events
|
||||
DebugLog.ToAll(text, MessageType.Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -30,4 +30,4 @@ namespace QSB.Player.Events
|
||||
message.NetIds.ToList().ForEach(netId => QSBNetworkManager.Instance.CleanupNetworkBehaviour(netId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -49,4 +49,4 @@ namespace QSB.Player.Events
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -48,6 +48,5 @@ namespace QSB.Player.Events
|
||||
QSB.Helper.Events.Unity.RunWhen(() => transformSync?.SyncedTransform != null,
|
||||
() => transformSync?.SetReferenceSector(sector));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -31,4 +31,4 @@ namespace QSB.Player.Events
|
||||
writer.Write(SectorName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -32,4 +32,4 @@ namespace QSB.Player.Events
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -37,4 +37,4 @@ namespace QSB.Player.Events
|
||||
() => QSBPlayerManager.HandleFullStateMessage(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -54,6 +54,5 @@ namespace QSB.Player
|
||||
Destroy(_markerTarget.gameObject);
|
||||
Destroy(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -16,10 +16,12 @@ namespace QSB.Player
|
||||
|
||||
// Body Objects
|
||||
public GameObject Camera { get; set; }
|
||||
|
||||
public GameObject Body { get; set; }
|
||||
|
||||
// Tools
|
||||
public GameObject ProbeBody { get; set; }
|
||||
|
||||
public QSBProbe Probe { get; set; }
|
||||
public QSBFlashlight FlashLight => Camera?.GetComponentInChildren<QSBFlashlight>();
|
||||
public QSBTool Signalscope => GetToolByType(ToolType.Signalscope);
|
||||
@ -28,10 +30,12 @@ namespace QSB.Player
|
||||
|
||||
// Conversation
|
||||
public int CurrentDialogueID { get; set; }
|
||||
|
||||
public GameObject CurrentDialogueBox { get; set; }
|
||||
|
||||
// Animation
|
||||
public AnimationSync AnimationSync => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId);
|
||||
|
||||
public bool PlayingInstrument => AnimationSync.CurrentType != AnimationType.PlayerSuited
|
||||
&& AnimationSync.CurrentType != AnimationType.PlayerUnsuited;
|
||||
|
||||
|
@ -9,4 +9,4 @@ namespace QSB.Player
|
||||
public uint PreviousPlayerId { get; set; }
|
||||
public PlayerInfo Player => QSBPlayerManager.GetPlayer(PlayerId);
|
||||
}
|
||||
}
|
||||
}
|
@ -96,7 +96,7 @@ namespace QSB.Player
|
||||
syncObject.PreviousPlayerId = uint.MaxValue;
|
||||
return uint.MaxValue;
|
||||
}
|
||||
// If the player list count is not the same as the count of the same type syncobject (eg. 3 players and 4 PlayerTransformSyncs)
|
||||
// If the player list count is not the same as the count of the same type syncobject (eg. 3 players and 4 PlayerTransformSyncs)
|
||||
// and the highest ID below the syncobject's id is the same as the highest player id.
|
||||
if (PlayerList.Count != PlayerSyncObjects.Count(x => x.GetType() == syncObject.GetType()) && lowerBound == playerIds.Max())
|
||||
{
|
||||
@ -146,4 +146,4 @@ namespace QSB.Player
|
||||
return Enumerable.Range((int)player.PlayerId, count).Select(x => (uint)x).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
10
QSB/QSB.cs
10
QSB/QSB.cs
@ -48,9 +48,11 @@ namespace QSB
|
||||
case LogType.Assert:
|
||||
DebugLog.DebugWrite($"Assert - {condition}", MessageType.Message);
|
||||
break;
|
||||
|
||||
case LogType.Log:
|
||||
DebugLog.DebugWrite($"Log - {condition}", MessageType.Message);
|
||||
break;
|
||||
|
||||
case LogType.Warning:
|
||||
DebugLog.DebugWrite($"Warning - {condition}", MessageType.Warning);
|
||||
break;
|
||||
@ -69,8 +71,8 @@ namespace QSB
|
||||
|
||||
QSBPatchManager.DoPatchType(QSBPatchTypes.OnModStart);
|
||||
|
||||
// Turns out these are very finicky about what order they go. QSBNetworkManager seems to
|
||||
// want to go first-ish, otherwise the NetworkManager complains about the PlayerPrefab being
|
||||
// Turns out these are very finicky about what order they go. QSBNetworkManager seems to
|
||||
// want to go first-ish, otherwise the NetworkManager complains about the PlayerPrefab being
|
||||
// null (even though it isn't...)
|
||||
gameObject.AddComponent<QSBNetworkManager>();
|
||||
gameObject.AddComponent<QSBNetworkManagerHUD>();
|
||||
@ -87,7 +89,7 @@ namespace QSB
|
||||
Helper.HarmonyHelper.EmptyMethod(typeof(OWTime).GetMethod("Pause"));
|
||||
}
|
||||
|
||||
void Update()
|
||||
private void Update()
|
||||
{
|
||||
QSBNetworkIdentity.UNetStaticUpdate();
|
||||
}
|
||||
@ -103,4 +105,4 @@ namespace QSB
|
||||
DebugMode = config.GetSettingsValue<bool>("debugMode");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,10 +9,15 @@ namespace QSB
|
||||
public static QSBInputManager Instance;
|
||||
|
||||
public static event InputEvent ChertTaunt;
|
||||
|
||||
public static event InputEvent EskerTaunt;
|
||||
|
||||
public static event InputEvent RiebeckTaunt;
|
||||
|
||||
public static event InputEvent GabbroTaunt;
|
||||
|
||||
public static event InputEvent FeldsparTaunt;
|
||||
|
||||
public static event InputEvent ExitTaunt;
|
||||
|
||||
public void Awake() => Instance = this;
|
||||
@ -51,4 +56,4 @@ namespace QSB
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -67,4 +67,4 @@ namespace QSB
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@ namespace QSB
|
||||
public static QSBNetworkManager Instance { get; private set; }
|
||||
|
||||
public event Action OnNetworkManagerReady;
|
||||
|
||||
public bool IsReady { get; private set; }
|
||||
|
||||
private QSBNetworkLobby _lobby;
|
||||
|
@ -11,6 +11,7 @@ namespace QSB
|
||||
public static bool IsInUniverse => InUniverse(CurrentScene);
|
||||
|
||||
public static event Action<OWScene, bool> OnSceneLoaded;
|
||||
|
||||
public static event Action<OWScene> OnUniverseSceneLoaded;
|
||||
|
||||
static QSBSceneManager()
|
||||
@ -33,4 +34,4 @@ namespace QSB
|
||||
private static bool InUniverse(OWScene scene)
|
||||
=> scene == OWScene.SolarSystem || scene == OWScene.EyeOfTheUniverse;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBCRCMessage : MessageBase
|
||||
internal class QSBCRCMessage : MessageBase
|
||||
{
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
@ -29,4 +29,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
public QSBCRCMessageEntry[] scripts;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
struct QSBCRCMessageEntry
|
||||
internal struct QSBCRCMessageEntry
|
||||
{
|
||||
public string name;
|
||||
|
||||
public byte channel;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBChannelBuffer : IDisposable
|
||||
internal class QSBChannelBuffer : IDisposable
|
||||
{
|
||||
public QSBChannelBuffer(QSBNetworkConnection conn, int bufferSize, byte cid, bool isReliable, bool isSequenced)
|
||||
{
|
||||
@ -426,4 +426,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
private bool readingFragment = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
struct QSBChannelPacket
|
||||
internal struct QSBChannelPacket
|
||||
{
|
||||
public QSBChannelPacket(int packetSize, bool isReliable)
|
||||
{
|
||||
@ -79,4 +79,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
private bool m_IsReliable;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBClientAuthorityMessage : MessageBase
|
||||
internal class QSBClientAuthorityMessage : MessageBase
|
||||
{
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
@ -20,4 +20,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
public bool authority;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBLocalClient : QSBNetworkClient
|
||||
internal class QSBLocalClient : QSBNetworkClient
|
||||
{
|
||||
public override void Disconnect()
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBNetBuffer
|
||||
internal class QSBNetBuffer
|
||||
{
|
||||
public QSBNetBuffer()
|
||||
{
|
||||
@ -195,4 +195,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
private const int k_BufferSizeWarning = 134217728;
|
||||
}
|
||||
}
|
||||
}
|
@ -550,17 +550,44 @@ namespace QSB.QuantumUNET
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void PreStartClient() { }
|
||||
public virtual void OnNetworkDestroy() { }
|
||||
public virtual void OnStartServer() { }
|
||||
public virtual void OnStartClient() { }
|
||||
public virtual void OnStartLocalPlayer() { }
|
||||
public virtual void OnStartAuthority() { }
|
||||
public virtual void OnStopAuthority() { }
|
||||
public virtual void PreStartClient()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnNetworkDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnStartServer()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnStartClient()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnStartLocalPlayer()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnStartAuthority()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnStopAuthority()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool OnRebuildObservers(HashSet<QSBNetworkConnection> observers, bool initialize) => false;
|
||||
public virtual void OnSetLocalVisibility(bool vis) { }
|
||||
|
||||
public virtual void OnSetLocalVisibility(bool vis)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool OnCheckObserver(QSBNetworkConnection conn) => true;
|
||||
|
||||
public virtual int GetNetworkChannel() => 0;
|
||||
|
||||
public virtual float GetNetworkSendInterval() => 0.1f;
|
||||
|
||||
private float m_LastSendTime;
|
||||
@ -608,4 +635,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
internal static string GetErrorCode(this SocketException e) => e.ErrorCode.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@ -164,4 +164,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
private bool m_ScriptCRCCheck;
|
||||
}
|
||||
}
|
||||
}
|
@ -802,10 +802,12 @@ namespace QSB.QuantumUNET
|
||||
case ConnectState.Resolving:
|
||||
case ConnectState.Disconnected:
|
||||
return;
|
||||
|
||||
case ConnectState.Resolved:
|
||||
m_AsyncConnect = ConnectState.Connecting;
|
||||
ContinueConnect();
|
||||
return;
|
||||
|
||||
case ConnectState.Failed:
|
||||
GenerateConnectError(11);
|
||||
m_AsyncConnect = ConnectState.Disconnected;
|
||||
@ -853,6 +855,7 @@ namespace QSB.QuantumUNET
|
||||
m_MsgReader.SeekZero();
|
||||
m_Connection.TransportReceive(m_MsgBuffer, numBytes, channelId);
|
||||
break;
|
||||
|
||||
case NetworkEventType.ConnectEvent:
|
||||
if (LogFilter.logDebug)
|
||||
{
|
||||
@ -865,6 +868,7 @@ namespace QSB.QuantumUNET
|
||||
m_AsyncConnect = ConnectState.Connected;
|
||||
m_Connection.InvokeHandlerNoData(32);
|
||||
break;
|
||||
|
||||
case NetworkEventType.DisconnectEvent:
|
||||
if (LogFilter.logDebug)
|
||||
{
|
||||
@ -884,8 +888,10 @@ namespace QSB.QuantumUNET
|
||||
m_Connection.InvokeHandlerNoData(33);
|
||||
}
|
||||
break;
|
||||
|
||||
case NetworkEventType.Nothing:
|
||||
break;
|
||||
|
||||
default:
|
||||
if (LogFilter.logError)
|
||||
{
|
||||
@ -1190,4 +1196,4 @@ namespace QSB.QuantumUNET
|
||||
Failed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -557,4 +557,4 @@ namespace QSB.QuantumUNET
|
||||
public int bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -86,8 +86,6 @@ namespace QSB.QuantumUNET
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ReadOnlyCollection<QSBNetworkConnection> Observers
|
||||
{
|
||||
get
|
||||
@ -975,6 +973,7 @@ namespace QSB.QuantumUNET
|
||||
|
||||
[SerializeField]
|
||||
private bool m_LocalPlayerAuthority;
|
||||
|
||||
private bool m_IsServer;
|
||||
private QSBNetworkBehaviour[] m_NetworkBehaviours;
|
||||
|
||||
|
@ -256,4 +256,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
private bool m_ShowServer;
|
||||
}
|
||||
}
|
||||
}
|
@ -1710,4 +1710,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
private static string s_Address;
|
||||
}
|
||||
}
|
||||
}
|
@ -37,4 +37,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
public int channelId;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
public delegate void QSBNetworkMessageDelegate(QSBNetworkMessage netMsg);
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBNetworkMessageHandlers
|
||||
internal class QSBNetworkMessageHandlers
|
||||
{
|
||||
internal void RegisterHandlerSafe(short msgType, QSBNetworkMessageDelegate handler)
|
||||
{
|
||||
@ -86,4 +86,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
private Dictionary<short, QSBNetworkMessageDelegate> m_MsgHandlers = new Dictionary<short, QSBNetworkMessageDelegate>();
|
||||
}
|
||||
}
|
||||
}
|
@ -1064,4 +1064,4 @@ namespace QSB.QuantumUNET
|
||||
public List<PendingPlayerInfo> players;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBNetworkScene
|
||||
internal class QSBNetworkScene
|
||||
{
|
||||
private Dictionary<NetworkInstanceId, QSBNetworkIdentity> m_LocalObjects = new Dictionary<NetworkInstanceId, QSBNetworkIdentity>();
|
||||
|
||||
|
@ -2037,4 +2037,4 @@ namespace QSB.QuantumUNET
|
||||
private QSBNetworkServer m_Server;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -320,14 +320,18 @@ namespace QSB.QuantumUNET
|
||||
case NetworkEventType.DataEvent:
|
||||
this.HandleData(connectionId, channelId, receivedSize, b);
|
||||
break;
|
||||
|
||||
case NetworkEventType.ConnectEvent:
|
||||
this.HandleConnect(connectionId, b);
|
||||
break;
|
||||
|
||||
case NetworkEventType.DisconnectEvent:
|
||||
this.HandleDisconnect(connectionId, b);
|
||||
break;
|
||||
|
||||
case NetworkEventType.Nothing:
|
||||
break;
|
||||
|
||||
default:
|
||||
if (LogFilter.logError)
|
||||
{
|
||||
@ -580,4 +584,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
private QSBNetworkMessageHandlers m_MessageHandlers = new QSBNetworkMessageHandlers();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBObjectDestroyMessage : MessageBase
|
||||
internal class QSBObjectDestroyMessage : MessageBase
|
||||
{
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
@ -16,4 +16,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
public NetworkInstanceId netId;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBObjectSpawnFinishedMessage : MessageBase
|
||||
internal class QSBObjectSpawnFinishedMessage : MessageBase
|
||||
{
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
@ -16,4 +16,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
public uint state;
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBObjectSpawnMessage : MessageBase
|
||||
internal class QSBObjectSpawnMessage : MessageBase
|
||||
{
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
@ -37,4 +37,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
public Quaternion rotation;
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBObjectSpawnSceneMessage : MessageBase
|
||||
internal class QSBObjectSpawnSceneMessage : MessageBase
|
||||
{
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
@ -29,4 +29,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
public byte[] payload;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBOwnerMessage : MessageBase
|
||||
internal class QSBOwnerMessage : MessageBase
|
||||
{
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
@ -20,4 +20,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
public short playerControllerId;
|
||||
}
|
||||
}
|
||||
}
|
@ -37,4 +37,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
public const int MaxPlayersPerClient = 32;
|
||||
}
|
||||
}
|
||||
}
|
@ -16,4 +16,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
public short playerControllerId;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBULocalConnectionToClient : QSBNetworkConnection
|
||||
internal class QSBULocalConnectionToClient : QSBNetworkConnection
|
||||
{
|
||||
public QSBULocalConnectionToClient(QSBLocalClient localClient)
|
||||
{
|
||||
@ -64,4 +64,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
private QSBLocalClient m_LocalClient;
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.QuantumUNET
|
||||
{
|
||||
class QSBULocalConnectionToServer : QSBNetworkConnection
|
||||
internal class QSBULocalConnectionToServer : QSBNetworkConnection
|
||||
{
|
||||
public QSBULocalConnectionToServer(QSBNetworkServer localServer)
|
||||
{
|
||||
@ -65,4 +65,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
private QSBNetworkServer m_LocalServer;
|
||||
}
|
||||
}
|
||||
}
|
@ -60,4 +60,4 @@ namespace QSB.QuantumUNET
|
||||
|
||||
private static Dictionary<NetworkID, NetworkAccessToken> s_dictTokens = new Dictionary<NetworkID, NetworkAccessToken>();
|
||||
}
|
||||
}
|
||||
}
|
@ -17,4 +17,4 @@ namespace QSB.SectorSync
|
||||
ObjectId = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ namespace QSB.SectorSync
|
||||
QSBSceneManager.OnUniverseSceneLoaded += (OWScene scene) => RebuildSectors();
|
||||
DebugLog.DebugWrite("Sector Manager ready.", MessageType.Success);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
QSBSceneManager.OnUniverseSceneLoaded -= (OWScene scene) => RebuildSectors();
|
||||
@ -50,4 +51,4 @@ namespace QSB.SectorSync
|
||||
.First();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -46,4 +46,4 @@ namespace QSB.SectorSync
|
||||
GlobalMessenger<uint, QSBSector>.FireEvent(EventNames.QSBSectorChange, id, sector);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -24,4 +24,4 @@ namespace QSB.TimeSync.Events
|
||||
WakeUpSync.LocalInstance.OnClientReceiveMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -22,4 +22,4 @@ namespace QSB.TimeSync
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,4 +6,4 @@
|
||||
Pausing,
|
||||
Fastforwarding
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
|
||||
namespace QSB.TimeSync
|
||||
{
|
||||
class TimeSyncUI : MonoBehaviour
|
||||
internal class TimeSyncUI : MonoBehaviour
|
||||
{
|
||||
public static TimeSyncUI Instance;
|
||||
|
||||
@ -42,6 +42,7 @@ namespace QSB.TimeSync
|
||||
}
|
||||
|
||||
public static void Start(TimeSyncType type) => QSB.Helper.Events.Unity.RunWhen(() => Instance._isSetUp, () => Instance.StartTimeSync(type));
|
||||
|
||||
public static void Stop() => QSB.Helper.Events.Unity.RunWhen(() => Instance._isSetUp, () => Instance.EndTimeSync());
|
||||
|
||||
private void StartTimeSync(TimeSyncType type)
|
||||
@ -78,6 +79,7 @@ namespace QSB.TimeSync
|
||||
+ Environment.NewLine
|
||||
+ "Fast-forwarding to match server time...";
|
||||
break;
|
||||
|
||||
case TimeSyncType.Pausing:
|
||||
text = "Pausing to match server time...";
|
||||
break;
|
||||
|
@ -20,4 +20,4 @@ namespace QSB.TimeSync
|
||||
QSB.Helper.HarmonyHelper.AddPrefix<PlayerCameraEffectController>("OnStartOfTimeLoop", typeof(WakeUpPatches), nameof(OnStartOfTimeLoopPrefix));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user