Ejemplo n.º 1
0
        public override void OnLevelWasLoaded(int level)
        {
            if (level == -1)
            {
                return;
            }

            MelonLogger.Log("Loaded scene " + level.ToString() + "(" + BoneworksSceneManager.GetSceneNameFromScenePath(level) + ") (from " + SceneManager.GetActiveScene().name + ")");

            OnLevelWasLoadedEvent?.Invoke(level);
            BWUtil.UpdateGunOffset();
        }
Ejemplo n.º 2
0
        public override void OnGUI()
        {
#if DEBUG
            GUILayout.BeginVertical(null);

            if (GUILayout.Button("Create Dummy", null))
            {
                if (dummyRep == null)
                {
                    dummyRep = new PlayerRep("Dummy", SteamClient.SteamId);
                }
                else
                {
                    dummyRep.Delete();
                }
            }

            if (GUILayout.Button("Create Main Panel", null))
            {
                Features.UI.CreateMainPanel();
            }

            if (GUILayout.Button("Test Object IDs", null))
            {
                var    testObj  = GameObject.Find("[RigManager (Default Brett)]/[SkeletonRig (GameWorld Brett)]/Brett@neutral");
                string fullPath = BWUtil.GetFullNamePath(testObj);

                MelonLogger.Log($"Got path {fullPath} for Brett@neutral");
                MelonLogger.Log("Trying to get object from path...");

                var gotObj = BWUtil.GetObjectFromFullPath(fullPath);

                if (gotObj == testObj)
                {
                    MelonLogger.Log("Success!!!!!");
                }
                else
                {
                    MelonLogger.Log($"Failed :( Got {gotObj.name}");
                }
            }

            GUILayout.EndVertical();
#endif
        }
Ejemplo n.º 3
0
        public unsafe override void OnApplicationStart()
        {
            if (!SteamClient.IsValid)
            {
                SteamClient.Init(823500);
            }

            Features.Guard.GetSteamFriends();
            Features.Guard.GetLocalGuard();

#if DEBUG
            MelonModLogger.LogWarning("Debug build!");
#endif

            MelonModLogger.Log($"Multiplayer initialising with protocol version {PROTOCOL_VERSION}.");

            // Set up prefs
            ModPrefs.RegisterCategory("MPMod", "Multiplayer Settings");
            ModPrefs.RegisterPrefBool("MPMod", "BaldFord", false, "90% effective hair removal solution");

            // Initialise transport layer
            TransportLayer = new SteamTransportLayer();

            // Create the UI and cache the PlayerRep's model
            ui     = new MultiplayerUI();
            client = new Client(ui, TransportLayer);
            server = new Server(ui, TransportLayer);
            PlayerRep.LoadFord();

            // Configures if the PlayerRep's are showing or hiding certain parts
            PlayerRep.showBody = true;
            PlayerRep.showHair = ModPrefs.GetBool("MPMod", "BaldFord");

            // Initialize Discord's RichPresence
            RichPresence.Initialise(701895326600265879);
            client.SetupRP();

            Extras.GunResources.Load();
            BWUtil.Hook();
        }