예제 #1
0
        /// <summary>
        /// Called when we connect to a server
        /// </summary>
        /// <param name="connection"></param>
        public override void Connected(BoltConnection connection)
        {
            StaticCoroutineRunner.StartStaticCoroutine(MultiplayerPlayerNameManager.DownloadDataFromFirebase());

            ModBotUserIdentifier.Instance.OnLocalClientConnected();
            ModsManager.Instance.PassOnMod.OnClientConnectedToServer();
        }
예제 #2
0
        /// <summary>
        /// The same as <see cref="Mod.OnCommandRan(string)"/>, but called in Mod-Bot
        /// </summary>
        /// <param name="command"></param>
        public static void OnCommandRan(string command)
        {
            string[] subCommands = command.ToLower().Split(' ');

            if (subCommands[0] == "ignoreallcrashes")
            {
                if (subCommands.Length < 2)
                {
                    debug.Log("Usage: ignoreallcrashes [1 - 0], [on - off], [true, false]");
                    return;
                }

                bool value;
                if (subCommands[1] == "1" || subCommands[1] == "on" || subCommands[1] == "true")
                {
                    value = true;
                }
                else if (subCommands[1] == "0" || subCommands[1] == "off" || subCommands[1] == "false")
                {
                    value = false;
                }
                else
                {
                    debug.Log("Usage: ignoreallcrashes[1 - 0], [on - off], [true, false]");
                    return;
                }

                IgnoreCrashesManager.SetIsIgnoringCrashes(value);
            }

            if (subCommands[0] == "crash")
            {
                DelegateScheduler.Instance.Schedule(Crash, 1f);
            }

            if (subCommands[0] == "unittest")
            {
                if (subCommands.Length > 1)
                {
                    bool foundUnitTest = ModBotUnitTestManager.TryRunUnitTest(subCommands[1]);
                    if (!foundUnitTest)
                    {
                        debug.Log("Unit test failed: Unit test \"" + subCommands[1] + "\" not found", Color.red);
                        return;
                    }
                }

                ModBotUnitTestManager.RunAllUnitTests();
            }

            if (subCommands[0] == "getplayfabids")
            {
                debug.Log("spawned players playfabids: ");
                List <FirstPersonMover> players = CharacterTracker.Instance.GetAllPlayers();
                foreach (FirstPersonMover player in players)
                {
                    string playfabID = player.state.PlayFabID;
                    MultiplayerPlayerInfoManager.Instance.TryGetDisplayName(playfabID, delegate(string displayName)
                    {
                        if (displayName != null)
                        {
                            debug.Log(displayName + ": " + playfabID);
                        }
                    });
                }
            }
            if (subCommands[0] == "redownloaddata")
            {
                StaticCoroutineRunner.StartStaticCoroutine(MultiplayerPlayerNameManager.DownloadDataFromFirebase());
                debug.Log("redownloading data...");
            }
        }