private void OnMinPlayersInputChanged(string value)
        {
            uint minPlayers = 0;

            if (!uint.TryParse(value, out minPlayers))
            {
                MinPlayers = 2;
                minPlayersInputField.text = "2";
                return;
            }

            if (minPlayers < 2)
            {
                MinPlayers = 2;
                minPlayersInputField.text = "2";
                return;
            }

            if (MaxPlayers < minPlayers)
            {
                MaxPlayers = (uint)Mathf.Clamp(minPlayers, 2, MaxPlayersAllowed);
                maxPlayersInputField.text = MaxPlayers.ToString();
            }

            if (minPlayers > MaxPlayersAllowed)
            {
                MinPlayers = MaxPlayersAllowed;
                minPlayersInputField.text = MaxPlayersAllowed.ToString();
                return;
            }

            MinPlayers = minPlayers;
        }
示例#2
0
 public override string CommandLine()
 {
     return(" -console" +
            ((!string.IsNullOrWhiteSpace(Map)) ? " +map \"" + Map + "\"" : "") +
            (" " + ArgsSufix + "maxplayers " + MaxPlayers.ToString()) +
            ((!string.IsNullOrWhiteSpace(RconPassword)) ? " +rcon_password \"" + RconPassword + "\"" : "") +
            ((Vac) ? "" : " -insecure") +
            ((NoIpx) ? " -noipx" : "") +
            ((NoMaster) ? " -nomaster" : "") +
            ((SvLan) ? " +sv_lan" : "") +
            base.CommandLine());
 }
示例#3
0
        public override string ToString()
        {
            StringBuilder sB = new StringBuilder();

            if (!String.IsNullOrEmpty(Name))
            {
                sB.Append("*Название:* " + Name);
            }
            sB.Append("\n*Роли:* " + Roles);
            if (MaxPlayers != 0)
            {
                sB.Append("\n*Максимум игроков:* " + MaxPlayers.ToString());
            }

            return(sB.ToString());
        }
        /// <summary>
        /// Converts this match into its XML representation.
        /// </summary>
        /// <param name="writer"></param>
        public void WriteXml(System.Xml.XmlWriter writer)
        {
            writer.WriteAttributeString("ID", ID.ToString());
            writer.WriteAttributeString("SetsWon", SetsWon.ToString());
            writer.WriteAttributeString("MaxPlayers", MaxPlayers.ToString());
            writer.WriteAttributeString("ContestantNr", ContestantNr.ToString());

            //players
            writer.WriteStartElement("Players");

            foreach (var item in Players)
            {
                item.WriteXml(writer);
            }

            writer.WriteEndElement();
        }
        public override string ToString()
        {
            string maxPleyers = MaxPlayers <= 0 ? "Unlimited" : MaxPlayers.ToString();

            var options = new DictionaryOptions();

            options.Add("Id", Id);
            options.Add("Address", Address);
            options.Add("Type", Type.ToString());
            options.Add("Name", Name);
            options.Add("Region", string.IsNullOrEmpty(Region) ? "International" : Region);
            options.Add("IsPasswordProtected", IsPasswordProtected);
            options.Add("MaxPlayers", maxPleyers);
            options.Add("OnlinePlayers", $"{OnlinePlayers}/{maxPleyers}");
            options.Append(CustomOptions);

            return($"[GameInfo: {options.ToReadableString()}]");
        }
示例#6
0
        public string GetField(int field)
        {
            switch (field)
            {
            case 0: return(HostName);

            case 1: return(GameName);

            case 2: return(GameVersion);

            case 3: return(MapName);

            case 4: return(GameType);

            case 5: return(GameVariant);

            case 6: return(NumPlayers.ToString());

            case 7: return(MaxPlayers.ToString());

            case 8: return(GameMode);

            case 9: return((Password ? 1 : 0).ToString());

            case 10: return(TimeLimit.ToString());

            case 11: return(RoundTime.ToString());

            case 12: return(HostPort.ToString());

            case 13: return((Dedicated ? 1 : 0).ToString());

            case 14: return((Ranked ? 1 : 0).ToString());

            case 15: return((AntiCheat ? 1 : 0).ToString());

            case 16: return(OS);

            case 17: return((BattleRecorder ? 1 : 0).ToString());

            case 18: return(BRIndex);

            case 19: return(BRDownload);

            case 20: return((Voip ? 1 : 0).ToString());

            case 21: return((AutoBalance ? 1 : 0).ToString());

            case 22: return((FriendlyFire ? 1 : 0).ToString());

            case 23: return(TKMode);

            case 24: return(StartDelay.ToString());

            case 25: return(SpawnTime.ToString("0.000000", CultureInfo.InvariantCulture));

            case 26: return(ServerText);

            case 27: return(ServerLogo);

            case 28: return(CommunityWebsite);

            case 29: return(ScoreLimit.ToString());

            case 30: return(TicketRatio.ToString());

            case 31: return(TeamRatio.ToString("0.000000", CultureInfo.InvariantCulture));

            case 32: return(Team1Name);

            case 33: return(Team2Name);

            case 34: return((CoopEnabled ? 1 : 0).ToString());

            case 35: return((Pure ? 1 : 0).ToString());

            case 36: return(MapSize.ToString());

            case 37: return((Unlocks ? 1 : 0).ToString());

            case 38: return(Fps.ToString());

            case 39: return((Plasma ? 1 : 0).ToString());

            case 40: return(ReservedSlots.ToString());

            case 41: return(CoopBotRatio.ToString());

            case 42: return(CoopBotCount.ToString());

            case 43: return(CoopBotDifficulty.ToString());

            case 44: return((NoVehicles ? 1 : 0).ToString());

            default:
                return("");
            }
        }
示例#7
0
 public override string ToString()
 {
     return(PlayerCount.ToString() + " / " + MaxPlayers.ToString());
 }
 public void                    Display(bool blnRest = false)
 {
     ServerNameObject.GetComponent <Text>().text   = ServerName;
     ServerPlayerObject.GetComponent <Text>().text = CurPlayers.ToString() + "/" + MaxPlayers.ToString();
     ServerPasswordContainer.SetActive(PasswordRequired);
     ServerPasswordInputField.GetComponent <InputField>().text = "";
     ServerConnectButton.GetComponent <Button>().interactable  = CurPlayers < MaxPlayers;
 }
示例#9
0
 public void OnMaxPlayerSliderValueChange()
 {
     //+ Mindestspieleranzahl
     MaxPlayers = (byte)(mSlider.value + mMinPlayers);
     mMaxPlayerSliderIndicator.text = MaxPlayers.ToString();
 }