mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
Custom network manager configures itself
This commit is contained in:
parent
65c8943bd8
commit
e454653c29
11
QSB/QSB.cs
11
QSB/QSB.cs
@ -6,6 +6,7 @@ using UnityEngine.Networking;
|
||||
|
||||
namespace QSB {
|
||||
public class QSB: ModBehaviour {
|
||||
public static IModHelper Helper;
|
||||
static QSB _instance;
|
||||
public static Dictionary<uint, Transform> playerSectors;
|
||||
|
||||
@ -22,17 +23,11 @@ namespace QSB {
|
||||
|
||||
void Start () {
|
||||
_instance = this;
|
||||
Helper = ModHelper;
|
||||
|
||||
playerSectors = new Dictionary<uint, Transform>();
|
||||
|
||||
var assetBundle = ModHelper.Assets.LoadBundle("assets/network");
|
||||
//var networkManager = Instantiate(assetBundle.LoadAsset<GameObject>("assets/networkmanager.prefab"));
|
||||
var networkPlayerPrefab = assetBundle.LoadAsset<GameObject>("assets/networkplayer.prefab");
|
||||
networkPlayerPrefab.AddComponent<NetworkPlayer>();
|
||||
|
||||
var networkManager = gameObject.AddComponent<QSBNetworkManager>();
|
||||
networkManager.playerPrefab = networkPlayerPrefab;
|
||||
|
||||
gameObject.AddComponent<QSBNetworkManager>();
|
||||
gameObject.AddComponent<NetworkManagerHUD>();
|
||||
|
||||
ModHelper.HarmonyHelper.AddPrefix<PlayerSectorDetector>("OnAddSector", typeof(Patches), "OnAddSector");
|
||||
|
@ -1,18 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace QSB {
|
||||
class QSBNetworkManager: NetworkManager {
|
||||
void Awake () {
|
||||
var assetBundle = QSB.Helper.Assets.LoadBundle("assets/network");
|
||||
playerPrefab = assetBundle.LoadAsset<GameObject>("assets/networkplayer.prefab");
|
||||
playerPrefab.AddComponent<NetworkPlayer>();
|
||||
}
|
||||
|
||||
public override void OnClientConnect (NetworkConnection conn) {
|
||||
base.OnClientConnect(conn);
|
||||
public override void OnStartClient (NetworkClient client) {
|
||||
base.OnStartClient(client);
|
||||
|
||||
QSB.Log("OnClientConnect");
|
||||
QSB.Log("start client");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user