示例#1
0
        private void SaveSettings()
        {
            XDocument doc = new XDocument(new XElement("serversettings"));

            ObjectProperty.SaveProperties(this, doc.Root, true);

            doc.Root.SetAttributeValue("SubSelection", subSelectionMode.ToString());
            doc.Root.SetAttributeValue("ModeSelection", modeSelectionMode.ToString());

            doc.Root.SetAttributeValue("TraitorsEnabled", TraitorsEnabled.ToString());

            if (GameMain.NetLobbyScreen != null && GameMain.NetLobbyScreen.ServerMessage != null)
            {
                doc.Root.SetAttributeValue("ServerMessage", GameMain.NetLobbyScreen.ServerMessage.Text);
            }

            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent = true;
            settings.NewLineOnAttributes = true;

            using (var writer = XmlWriter.Create(SettingsFile, settings))
            {
                doc.Save(writer);
            }
        }
示例#2
0
 void ToggleSelectionMode(SelectionMode mode)
 {
     if (GUILayout.Toggle((_selectionMode & mode) == SelectionMode.Unfiltered, mode.ToString(), null))
     {
         _selectionMode = _selectionMode | mode;
     }
     else
     {
         _selectionMode = _selectionMode & (~mode);
     }
 }
示例#3
0
        public IEnumerable <ScriptDescriptor> GetScriptDescriptors()
        {
            ScriptControlDescriptor desc = new ScriptControlDescriptor(GetType().FullName, ClientID);

            desc.AddProperty("clientStateFieldID", ClientID + "SelectedRowIndices");
            desc.AddProperty("selectedKeysStateFieldID", ClientID + "SelectedRowDataKeys");
            desc.AddProperty("SelectionMode", SelectionMode.ToString());

            string style = StyleToString(SelectedRowStyle);

            desc.AddProperty("SelectedRowStyle", style);
            desc.AddProperty("SelectedRowCSS", SelectedRowStyle.CssClass);

            style = StyleToString(RowStyle);
            desc.AddProperty("UnSelectedRowStyle", style);
            desc.AddProperty("UnSelectedRowCSS", RowStyle.CssClass);

            desc.AddProperty("SelectUsingDataKeys", SelectUsingDataKeys);


            if (AlternatingRowStyle != null)
            {
                style = StyleToString(AlternatingRowStyle);
                desc.AddProperty("AlternatingRowStyle", style);
                desc.AddProperty("AlternatingRowCSS", AlternatingRowStyle.CssClass);
            }
            else
            {
                // use the normal row style
                style = StyleToString(RowStyle);
                desc.AddProperty("UnSelectedRowStyle", style);
                desc.AddProperty("UnSelectedRowCSS", RowStyle.CssClass);
            }

            if (OnClientRowClick != null)
            {
                desc.AddEvent("onClientRowClick", OnClientRowClick);
            }

            if (OnClientRowDblClick != null)
            {
                desc.AddEvent("onClientRowDblClick", OnClientRowDblClick);
            }

            return(new ScriptDescriptor[] { desc });
        }
示例#4
0
        private void SaveSettings()
        {
            XDocument doc = new XDocument(new XElement("serversettings"));

            SerializableProperty.SerializeProperties(this, doc.Root, true);

            doc.Root.SetAttributeValue("name", name);
            doc.Root.SetAttributeValue("public", isPublic);
            doc.Root.SetAttributeValue("port", config.Port);
            doc.Root.SetAttributeValue("maxplayers", maxPlayers);
            doc.Root.SetAttributeValue("enableupnp", config.EnableUPnP);

            doc.Root.SetAttributeValue("autorestart", autoRestart);

            doc.Root.SetAttributeValue("SubSelection", subSelectionMode.ToString());
            doc.Root.SetAttributeValue("ModeSelection", modeSelectionMode.ToString());

            doc.Root.SetAttributeValue("TraitorsEnabled", TraitorsEnabled.ToString());

            doc.Root.SetAttributeValue("AllowedRandomMissionTypes", string.Join(",", AllowedRandomMissionTypes));

            doc.Root.SetAttributeValue("AllowedClientNameChars", string.Join(",", AllowedClientNameChars.Select(c => c.First + "-" + c.Second)));

#if SERVER
            doc.Root.SetAttributeValue("password", password);
#endif

            if (GameMain.NetLobbyScreen != null
#if CLIENT
                && GameMain.NetLobbyScreen.ServerMessage != null
#endif
                )
            {
                doc.Root.SetAttributeValue("ServerMessage", GameMain.NetLobbyScreen.ServerMessageText);
            }

            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.NewLineOnAttributes = true;

            using (var writer = XmlWriter.Create(SettingsFile, settings))
            {
                doc.Save(writer);
            }
        }
示例#5
0
        private void SaveSettings()
        {
            XDocument doc = new XDocument(new XElement("serversettings"));

            ObjectProperty.SaveProperties(this, doc.Root, true);

            doc.Root.SetAttributeValue("name", name);
            doc.Root.SetAttributeValue("public", isPublic);
            doc.Root.SetAttributeValue("port", config.Port);
            doc.Root.SetAttributeValue("maxplayers", maxPlayers);
            doc.Root.SetAttributeValue("enableupnp", config.EnableUPnP);

            doc.Root.SetAttributeValue("SubSelection", subSelectionMode.ToString());
            doc.Root.SetAttributeValue("ModeSelection", modeSelectionMode.ToString());

            doc.Root.SetAttributeValue("TraitorsEnabled", TraitorsEnabled.ToString());

#if SERVER
            doc.Root.SetAttributeValue("password", password);
#endif

            if (GameMain.NetLobbyScreen != null
#if CLIENT
                && GameMain.NetLobbyScreen.ServerMessage != null
#endif
                )
            {
                doc.Root.SetAttributeValue("ServerMessage", GameMain.NetLobbyScreen.ServerMessageText);
            }

            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.NewLineOnAttributes = true;

            using (var writer = XmlWriter.Create(SettingsFile, settings))
            {
                doc.Save(writer);
            }
        }
示例#6
0
 /// <summary>
 /// Sets the current selectionMode. SINGLE, MULTI or SIMPLE.
 /// </summary>
 /// <param name="mode">'SINGLE', 'MULTI' or 'SIMPLE'.</param>
 public void SetSelectionMode(SelectionMode mode)
 {
     this.Call("setSelectionMode", mode.ToString().ToLowerInvariant());
 }
 /// <summary>
 /// Sets the current selectionMode. SINGLE, MULTI or SIMPLE.
 /// </summary>
 /// <param name="mode">'SINGLE', 'MULTI' or 'SIMPLE'.</param>
 public void SetSelectionMode(SelectionMode mode)
 {
     this.Call("setSelectionMode", mode.ToString().ToLowerInvariant());   
 }
示例#8
0
 public static string DecodeSelectionModeInverse(SelectionMode sel)
 {
     return sel.ToString();
 }
示例#9
0
 public override string ToString()
 {
     return(string.Format("Selection type: {0} \nStop criteria: {1}\nContest size: {2}\nPopulation size: {3}\n" +
                          "Generation count: {4}\nTime: {5}\nMin range: {6}\nMax range: {7}", SelectionMode.ToString(), StopCriteria.ToString(),
                          ContestSize, PopulationSize, GenerationCount, Time, MinRange, MaxRange));
 }