Ejemplo n.º 1
0
        private async static void SetupServer()
        {
            // Register Command Processor
            var cmd = new NetworkCommandListener(42000);

            cmd.RegisterCommandClass <CommandContainer>();

            cmd.ListeningStarted += Cmd_ListeningStarted;
            cmd.SessionStarted   += Cmd_SessionStarted;
            cmd.SessionEnded     += Cmd_SessionEnded;
            cmd.CommandReceived  += Cmd_CommandReceived;

            await cmd.StartAsync(CancellationToken.None);
        }
Ejemplo n.º 2
0
        public static void Load(UnityModManager.ModEntry entry)
        {
            Mod                 = entry;
            entry.OnUnload      = Unload;
            entry.OnFixedUpdate = OnUpdate;
            entry.OnGUI         = OnGui;

            CmdHandler = new CommandHandler();
            NetHandler = new NetworkCommandListener();

            _harmony = HarmonyInstance.Create(entry.Info.Id);
            _harmony.PatchAll();

            Console.onLogReceived += ChatOnChatChanged;

            GameObject gameObject = new GameObject();

            gameObject.AddComponent <SetDontDestroyOnLoad>();
            _hudContainer = gameObject.AddComponent <HudContainer>();
        }