Example #1
0
 public void UseButton()
 {
     this.forceButton.SetActive(false);
     foreach (GameObject gameObject in PlayerManager.singleton.players)
     {
         CharacterClassManager component = gameObject.GetComponent <CharacterClassManager>();
         if (component.isLocalPlayer && gameObject.name == "Host")
         {
             component.ForceRoundStart();
         }
     }
 }
Example #2
0
 private void WaitingForPlayers()
 {
     if (firstrun)
     {
         firstrun = false;
         if (!Directory.Exists(Path.Combine(MainClass.pluginDir, "RecorderData")))
         {
             Directory.CreateDirectory(Path.Combine(MainClass.pluginDir, "RecorderData"));
         }
         if (!Directory.Exists(Path.Combine(MainClass.pluginDir, "RecorderData", Server.Port.ToString())))
         {
             Directory.CreateDirectory(Path.Combine(MainClass.pluginDir, "RecorderData", Server.Port.ToString()));
         }
     }
     if (RecorderCore.singleton.recordingStream != null)
     {
         RecorderCore.singleton.recordingStream.Close();
         RecorderCore.singleton.recordingStream.Dispose();
         RecorderCore.singleton.recordingStream = null;
         RecorderCore.recordPickups.Clear();
     }
     if (RecorderCore.isReplayReady)
     {
         Log.Info("Start replay");
         foreach (var itm in UnityEngine.Object.FindObjectsOfType <Pickup>())
         {
             NetworkServer.Destroy(itm.gameObject);
         }
         RoundSummary.RoundLock = true;
         CharacterClassManager.ForceRoundStart();
         RecorderCore.replayPickups.Clear();
         RecorderCore.replayPlayers.Clear();
     }
     else
     {
         core.StartRecording();
         RecorderCore.isRecording = true;
         Log.Info("New recorder instance created.");
         foreach (var pickup in UnityEngine.Object.FindObjectsOfType <Pickup>())
         {
             pickup.gameObject.AddComponent <RecordPickup>();
         }
     }
     waitingforplayers = true;
 }
    private static string EnterCommand(string cmds)
    {
        string result = "Command accepted.";

        string[] array = cmds.ToUpper().Split(new char[]
        {
            ' '
        });
        if (array.Length > 0)
        {
            string a = array[0];
            if (a == "FORCESTART")
            {
                bool       flag       = false;
                GameObject gameObject = GameObject.Find("Host");
                if (gameObject != null)
                {
                    CharacterClassManager component = gameObject.GetComponent <CharacterClassManager>();
                    if (component != null && component.isLocalPlayer && component.isServer && !component.roundStarted)
                    {
                        component.ForceRoundStart();
                        flag = true;
                    }
                }
                result = ((!flag) ? "Failed to force start.LOGTYPE14" : "Forced round start.");
            }
            else if (a == "CONFIG")
            {
                if (File.Exists(ConfigFile.path))
                {
                    Application.OpenURL(ConfigFile.path);
                }
                else
                {
                    result = "Config file not found!";
                }
            }
            else
            {
                result = GameConsole.Console.singleton.TypeCommand(cmds);
            }
        }
        return(result);
    }