/// <summary> /// Saves the specified node uid. /// </summary> /// <param name="NodeUid">The node uid.</param> /// <param name="ControlUid">The control uid.</param> public void Save(string NodeUid, string ControlUid) { ControlSettings settings = new ControlSettings(); DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid); if (dNode != null) { settings = dNode.GetSettings(dNode.NodeUID); dNode.IsModified = true; } else { settings = PageDocument.Current.StaticNode.Controls[NodeUid]; if (settings == null) { settings = new ControlSettings(); PageDocument.Current.StaticNode.Controls.Add(NodeUid, settings); } } if (settings.Params == null) { settings.Params = new Param(); } settings.IsModified = true; CommonHelper.SaveParameter(settings, "DisplayTemplate", DisplayTemplate.SelectedValue); CommonHelper.SaveParameter(settings, "DataSource", DataSourceList.SelectedValue); CommonHelper.SaveParameter(settings, "DataMember", DSMemberList.SelectedValue); }
void Start() { ControlSettings = Settings.CS; ControlsPanel = GameObject.Find("ControlsPanel"); WaitingPanel = GameObject.Find("WaitingPanel"); ControlPanelButton = GameObject.Find("ControlsButton").GetComponent<Button>(); ControlsDefaultButton = GameObject.Find("ControlsDefaultButton").GetComponent<Button>(); ControlsCloseButton = GameObject.Find("ControlsCloseButton").GetComponent<Button>(); GameObject go; foreach(Controls Control in Settings.CS.Keys){ go = (GameObject)Instantiate(Templet); go.transform.SetParent(ControlsPanel.transform.GetChild(0)); go.name = Control.Name; if (Control.Key != 0) { Control.Key = Control.Default; } go.transform.GetChild(0).GetComponent<Text>().text = Control.Name + ": " + Control.Key; } ControlPanelButton.onClick.AddListener(ShowPanel); ControlsDefaultButton.onClick.AddListener(Default); ControlsCloseButton.onClick.AddListener(ShowPanel); ControlsPanel.SetActive(false); WaitingPanel.SetActive(false); }
/// <summary> /// Saves the specified node uid. /// </summary> /// <param name="NodeUid">The node uid.</param> /// <param name="ControlUid">The control uid.</param> void IPropertyPage.Save(string NodeUid, string ControlUid) { ControlSettings settings = new ControlSettings(); DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid); if (dNode != null) { settings = dNode.GetSettings(dNode.NodeUID); dNode.IsModified = true; } else { settings = PageDocument.Current.StaticNode.Controls[NodeUid]; if (settings == null) { settings = new ControlSettings(); PageDocument.Current.StaticNode.Controls.Add(NodeUid, settings); } } if (settings.Params == null) { settings.Params = new Param(); } settings.IsModified = true; settings.Params.Remove("ImageUrl"); if (!String.IsNullOrEmpty(txtUrl.Text)) { settings.Params.Add("ImageUrl", txtUrl.Text); } }
public void Init(Framework framework, ControlSettings settings, object[] args) { this.framework = framework; this.settings = settings; this.args = args; OnInit(); }
void Load() { if (File.Exists(Application.persistentDataPath + "/player-controls.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/player-controls.dat", FileMode.Open); ControlSettings data = (ControlSettings)bf.Deserialize(file); file.Close(); axisUp = data.axisUp; axisDown = data.axisDown; axisLeft = data.axisLeft; axisRight = data.axisRight; jump = data.jump; zoom = data.zoom; gravityUp = data.gravityUp; gravityDown = data.gravityDown; gravityLeft = data.gravityLeft; gravityRight = data.gravityRight; glue = data.glue; MusicPlayer.Instance.SetVolume(data.musicVolume); if (gravityUp.ToString().Length > 4) { if (gravityUp.ToString().Substring(0, 5) == "Mouse") { Debug.Log("Gravity using mouse control"); gravityControlScheme = 0; } else { gravityControlScheme = 1; } } else { gravityControlScheme = 1; } if (glue.ToString().Length > 4) { if (glue.ToString().Substring(0, 5) == "Mouse") { Debug.Log("Glue using mouse control"); glueControlScheme = 0; } else { glueControlScheme = 1; } } else { glueControlScheme = 1; } glue = data.glue; } }
public GameSession(int mapWidth, int bottomMapHeight, int topSideMapHeight, ControlSettings controlSettings) { this.controlSettings = controlSettings; bottomSideState = new GameState(bottomMapHeight, mapWidth); topSideState = new GameState(topSideMapHeight, mapWidth); GameForm = new GameForm(mapWidth, bottomMapHeight + topSideMapHeight); gameInProcess = false; }
/// <summary> /// Saves the parameter. /// </summary> /// <param name="settings">The settings.</param> /// <param name="paramName">Name of the param.</param> /// <param name="paramValue">The param value.</param> public static void SaveParameter(ControlSettings settings, string paramName, string paramValue) { settings.Params.Remove(paramName); if (!String.IsNullOrEmpty(paramValue)) { settings.Params.Add(paramName, paramValue); } }
public static void Save() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/player-controls.dat", FileMode.Create); ControlSettings data = new ControlSettings(); data.axisUp = axisUp; data.axisDown = axisDown; data.axisLeft = axisLeft; data.axisRight = axisRight; data.jump = jump; data.zoom = zoom; data.gravityUp = gravityUp; data.gravityDown = gravityDown; data.gravityLeft = gravityLeft; data.gravityRight = gravityRight; data.glue = glue; data.musicVolume = MusicPlayer.Instance.GetComponent <AudioSource>().volume; bf.Serialize(file, data); file.Close(); if (gravityUp.ToString().Length > 4) { if (gravityUp.ToString().Substring(0, 5) == "Mouse") { Debug.Log("Gravity using mouse control"); gravityControlScheme = 0; } else { gravityControlScheme = 1; } } else { gravityControlScheme = 1; } if (glue.ToString().Length > 4) { if (glue.ToString().Substring(0, 5) == "Mouse") { Debug.Log("Glue using mouse control"); glueControlScheme = 0; } else { glueControlScheme = 1; } } else { glueControlScheme = 1; } Debug.Log("Controls saved."); }
private void btnCancel_Click(object sender, EventArgs e) { grpAddTask.Enabled = false; grpScheduledTask.Enabled = true; ControlSettings.SetTextToNull(grpAddTask); ControlSettings.SetComboToFirstItem(cmbNameFormat); ControlSettings.SetAllRadioButtonToFalse(grpAddTask); cmbSelected.SelectedIndex = 1; }
/// <summary> /// Sets the param info. /// </summary> /// <param name="param">The param.</param> public void SetParamInfo(object param) { ControlSettings settings = (ControlSettings)param; if (settings != null && settings.Params != null) { this.DataBind(); } }
/// <summary> /// Sets the param info. /// </summary> /// <param name="param">The param.</param> public void SetParamInfo(object param) { ControlSettings cs = (ControlSettings)param; if (cs.Params != null && cs.Params["InnerText"] != null) { label.innerText = cs.Params["InnerText"].ToString(); } }
/// <summary> /// Loads the specified node uid. /// </summary> /// <param name="NodeUid">The node uid.</param> /// <param name="ControlUid">The control uid.</param> void IPropertyPage.Load(string NodeUid, string ControlUid) { ControlSettings settings = new ControlSettings(); DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid); if (dNode != null) { settings = dNode.GetSettings(NodeUid); } else { settings = PageDocument.Current.StaticNode.Controls[NodeUid]; } // Bind templates DisplayTemplate.Items.Clear(); DisplayTemplate.Items.Add(new ListItem("(use default)", "")); TemplateDto templates = DictionaryManager.GetTemplateDto(); if (templates.main_Templates.Count > 0) { DataView view = templates.main_Templates.DefaultView; view.RowFilter = "TemplateType = 'menu'"; foreach (DataRowView row in view) { DisplayTemplate.Items.Add(new ListItem(row["FriendlyName"].ToString(), row["Name"].ToString())); } DisplayTemplate.DataBind(); } string selectedMember = String.Empty; if (settings != null && settings.Params != null) { Param prm = settings.Params; if ((prm["DisplayTemplate"] != null) && (prm["DisplayTemplate"] is string)) { CommonHelper.SelectListItem(DisplayTemplate, prm["DisplayTemplate"].ToString()); } if ((prm["DataSource"] != null) && (prm["DataSource"] is string)) { CommonHelper.SelectListItem(DataSourceList, prm["DataSource"].ToString()); } if ((prm["DataMember"] != null) && (prm["DataMember"] is string)) { selectedMember = prm["DataMember"].ToString(); } } BindSourceMembers(selectedMember); }
private void AddToControlSettings(ButtonItem button) { if (ControlSettings.InvokeRequired) { ControlSettings.Invoke(new Action <ButtonItem>(AddToControlSettings), button); return; } ControlSettings.Items.Add(button); }
/// <summary> /// Renders frame border. /// </summary> /// <param name="graphics">graphics to render to.</param> /// <param name="X">X position.</param> /// <param name="Y">Y position.</param> /// <param name="Width">Width.</param> /// <param name="Height">Height.</param> internal void RenderFrameBorder(Graphics graphics, int x, int y, int w, int h) { if (false == this.menu.Skinned) { if (true == this.menu.Window.Desktop.Theme.Menu.IsSimple) { this.menu.RenderBorderVertexXYWH(graphics, x, y, w, h, true, this.menu.BorderColorLight1, this.menu.BorderColorLight2, this.menu.BorderColorDark1, this.menu.BorderColorDark2); } else { graphics.SetColor(this.menu.BorderColorDark2); graphics.DrawBox(x, y, w, h); } } else { if (null == this.borders[0]) { ControlSettings settings = this.menu.Window.Desktop.Theme.GetControlSettings(Menu.TypeName); String folder = ""; if (false == this.menu.Window.Desktop.Theme.Menu.IsSimple) { folder = this.menu.Window.Desktop.Theme.ThemeFolder + settings.BordersFilePrefix + "_flat"; } else { folder = this.menu.Window.Desktop.Theme.ThemeFolder + settings.BordersFilePrefix + "_raised_double"; } this.borders[0] = this.engine.CreateImage(folder + "top_left"); this.borders[1] = this.engine.CreateImage(folder + "left"); this.borders[2] = this.engine.CreateImage(folder + "bottom_left"); this.borders[3] = this.engine.CreateImage(folder + "top"); this.borders[4] = this.engine.CreateImage(folder + "bottom"); this.borders[5] = this.engine.CreateImage(folder + "top_right"); this.borders[6] = this.engine.CreateImage(folder + "bottom_right"); this.borders[7] = this.engine.CreateImage(folder + "right"); } graphics.SetColor(Colors.White); int width = w; int height = h; graphics.DrawImage(x - borders[1].Width + 2, y + 2, borders[1].Width, height - 4, borders[1]); graphics.DrawImage(x + 2, y - borders[3].Height + 2, width - 4, borders[3].Height, borders[3]); graphics.DrawImage(x + 2, y - 2 + height, width - 4, borders[4].Height, borders[4]); graphics.DrawImage(x - 2 + width, y + 2, borders[7].Width, height - 4, borders[7]); graphics.DrawImage(x - borders[0].Width + 2, y - borders[0].Height + 2, borders[0].Width, borders[0].Height, borders[0]); graphics.DrawImage(x - borders[2].Width + 2, y - 2 + height, borders[2].Width, borders[2].Height, borders[2]); graphics.DrawImage(x + width - 2, y - borders[5].Height + 2, borders[5].Width, borders[5].Height, borders[5]); graphics.DrawImage(x + width - 2, y - 2 + height, borders[6].Width, borders[6].Height, borders[6]); } }
public ControlViewModel(ControlModel model, IPackageContext packageContext) { _model = model; _packageContext = packageContext; _settings = packageContext.ControlSettings; _buildProgressViewModel = new BuildProgressViewModel(_settings); packageContext.ControlSettingsChanged += OnControlSettingsChanged; }
// ---------------------------------------------------------------------- public SettingListBox() { if (DesignMode) { return; } ControlSettings controlSettings = new ControlSettings(this); controlSettings.Settings.Add(new PropertySetting(this, "SelectedIndex")); } // SettingListBox
public static KeyBinding GetBindingByKey(this ControlSettings settings, Key key) { if (settings is null) { throw new ArgumentNullException(nameof(settings)); } var keyBinding = settings.SettingsItems?.SingleOrDefault(binding => binding.BoundKey == key); return(keyBinding); }
/// <summary> /// Saves the specified node uid. /// </summary> /// <param name="NodeUid">The node uid.</param> /// <param name="ControlUid">The control uid.</param> void IPropertyPage.Save(string NodeUid, string ControlUid) { ControlSettings settings = new ControlSettings(); DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid); if (dNode != null) { settings = dNode.GetSettings(dNode.NodeUID); dNode.IsModified = true; settings.IsModified = true; } if (settings.Params == null) { settings.Params = new Param(); } settings.IsModified = true; CommonHelper.SaveParameter(settings, "DisplayTemplate", DisplayTemplate.SelectedValue); CommonHelper.SaveParameter(settings, "NodeCode", NodeCode.Text); CommonHelper.SaveParameter(settings, "RecordsPerPage", NumberOfRecords.Text); CommonHelper.SaveParameter(settings, "Catalogs", CatalogList); CommonHelper.SaveParameter(settings, "EntryTypes", EntryTypeList); CommonHelper.SaveParameter(settings, "EntryClasses", MetaClassList); /* * CommonHelper.SaveParameter(settings, "FTSPhrase", FTSPhrase.Text); * CommonHelper.SaveParameter(settings, "AdvancedFTSPhrase", AdvancedFTSPhrase.Text); * CommonHelper.SaveParameter(settings, "SQLClause", SQLClause.Text); * CommonHelper.SaveParameter(settings, "MetaSQLClause", MetaSQLClause.Text); * */ // Orderby string orderByValue = String.Empty; if (!String.IsNullOrEmpty(OrderByList.SelectedValue)) { if (OrderByList.SelectedValue == "custom") { orderByValue = OrderBy.Text; } else { orderByValue = OrderByList.SelectedValue; if (OrderDesc.Checked) { orderByValue = orderByValue + " DESC"; } } } CommonHelper.SaveParameter(settings, "OrderBy", orderByValue); }
public static List <Key> GetBoundKeys(this ControlSettings settings) { if (settings is null) { throw new ArgumentNullException(nameof(settings)); } var keys = settings.SettingsItems?.Select(si => si.BoundKey).NotNull().Cast <Key>().ToList(); return(keys); }
private void frmFileSync_Load(object sender, EventArgs e) { if (!DBUtil.isSuccess) { MessageBox.Show("This progam will exit.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Close(); } PopulateListView(); ControlSettings.SetComboToFirstItem(cmbSelected); ControlSettings.SetComboToFirstItem(cmbNameFormat); }
public Player(Vector4 color, Vector2 position, ControlSettings controlSettings) : base(position, color, Constants.PlayerSize, Constants.PlayerHealth, Constants.PlayerSpeed) { Control = controlSettings; GunBulletCount = Constants.PlayerGunBulletCount; MiniGunBulletCount = Constants.PlayerMiniGunBulletCount; FuelCount = Constants.PlayerFuelCount; }
public static void UnsetKey(this ControlSettings settings, Key key) { var binding = settings.GetBindingByKey(key); if (binding is null) { return; } binding.BoundKey = null; }
/// <summary> /// Selects the list. /// </summary> /// <param name="settings">The settings.</param> /// <param name="paramName">Name of the param.</param> /// <param name="list">The list.</param> public static void SelectList(ControlSettings settings, string paramName, ListBox list) { if ((settings.Params[paramName] != null) && (settings.Params[paramName] is string)) { string[] paramArr = settings.Params[paramName].ToString().Split(new char[] { ',' }); foreach (string param in paramArr) { CommonHelper.SelectListItem(list, param, false); } } }
// Returns the default settings instance and creates it if it doesn't exist yet private GameSettings GetDefaultSettings() { if (_defaultSettings == null) { AudioSettings audioSettings = new AudioSettings { Enabled = true, Volume = 100, SfxSet = 1 }; VideoSettings videoSettings = new VideoSettings { Resolution = SettingsConstants.DefaultResolution, VSync = true }; Type paddleType = typeof(PlayerPaddle); GameplaySettings gameplaySettings = new GameplaySettings { BallCount = 1, GameSpeed = 1F, LeftPaddleType = paddleType, RightPaddleType = paddleType, ScoreLimit = 5 }; ControlSettings controls = new ControlSettings { LeftPaddle = new ControlScheme { MoveUp = Keys.W, MoveDown = Keys.S }, RightPaddle = new ControlScheme { MoveUp = Keys.Up, MoveDown = Keys.Down } }; _defaultSettings = new GameSettings { Audio = audioSettings, Video = videoSettings, Gameplay = gameplaySettings, Controls = controls }; } return(_defaultSettings); }
/// <summary> /// Saves the specified node uid. /// </summary> /// <param name="NodeUid">The node uid.</param> /// <param name="ControlUid">The control uid.</param> void IPropertyPage.Save(string NodeUid, string ControlUid) { ControlSettings settings = new ControlSettings(); DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid); if (dNode != null) { settings = dNode.GetSettings(dNode.NodeUID); dNode.IsModified = true; } if (settings.Params == null) { settings.Params = new Param(); } settings.IsModified = true; settings.Params.Remove("DisplayTemplate"); if (!String.IsNullOrEmpty(DisplayTemplate.SelectedValue)) { settings.Params.Add("DisplayTemplate", DisplayTemplate.SelectedValue); } settings.Params.Remove("NodeCode"); if (!String.IsNullOrEmpty(NodeCode.Text)) { settings.Params.Add("NodeCode", NodeCode.Text); } settings.Params.Remove("EntryCode"); if (!String.IsNullOrEmpty(NodeCode.Text)) { settings.Params.Add("EntryCode", EntryCode.Text); } settings.Params.Remove("CatalogName"); if (!String.IsNullOrEmpty(CatalogList.SelectedValue)) { settings.Params.Add("CatalogName", CatalogList.SelectedValue); } settings.Params.Remove(DEPOSITORY_KEY); if (!String.IsNullOrEmpty(this.ddlDepository.SelectedValue)) { settings.Params[DEPOSITORY_KEY] = this.ddlDepository.SelectedValue; } }
/// <remarks> /// Settings are stored under "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\[12.0Exp]\BuildVision\". /// </remarks> private static void SaveSettings(ControlSettings settings, IServiceProvider serviceProvider) { WritableSettingsStore store = GetWritableSettingsStore(serviceProvider); if (!store.CollectionExists(SettingsCategoryName)) { store.CreateCollection(SettingsCategoryName); } string value = settings.Serialize(); store.SetString(SettingsCategoryName, SettingsPropertyName, value); }
/// <summary> /// Initializes a new instance of the DriveHelperTest class. /// </summary> public DriveHelperTest() { var mock = new Mock <ICommunicationHelper>(); mock.Setup(x => x.SendMessageToRobot(It.IsAny <string>())).Returns(true); this.communicationHelper = mock.Object; this.controlSettings = new ControlSettings(); // Специально для тестов переопределяю максимальные скорости нормального и турбо режимов моторов. this.controlSettings.DriveModeNormalMaxSpeed = 190; this.controlSettings.DriveModeTurboMaxSpeed = 255; }
public FollowView(Camera3D camera, PlayerCharacter player, ControlSettings settings) : base(camera) { this.player = player; this.settings = settings; player.FollowView = this; Properties.Access(this); MessageSystem.Subscribe(this, CoreMessageTypes.Input, (messageType, data, dt) => { ProcessInput((FullInputData)data); }); }
/// <remarks> /// Settings are stored under "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\[12.0Exp]\BuildVision\". /// </remarks> private static void SaveSettings(ControlSettings settings, IServiceProvider serviceProvider) { var store = GetWritableSettingsStore(serviceProvider); if (!store.CollectionExists(settingsCategoryName)) { store.CreateCollection(settingsCategoryName); } var legacySerializer = new LegacyConfigurationSerializer <ControlSettings>(); var value = legacySerializer.Serialize(settings); store.SetString(settingsCategoryName, settingsPropertyName, value); }
private static ControlSettings LoadSettings(IServiceProvider serviceProvider) { ControlSettings settings = null; WritableSettingsStore store = GetWritableSettingsStore(serviceProvider); if (store.PropertyExists(SettingsCategoryName, SettingsPropertyName)) { string value = store.GetString(SettingsCategoryName, SettingsPropertyName); settings = value.Deserialize <ControlSettings>(); } return(settings ?? new ControlSettings()); }
private void CopyFolder(DirectoryInfo sourceDirectory, string newFolderName, bool overwrite) { try { ControlSettings.DirectoryCopy(sourceDirectory.FullName, newFolderName, true, overwrite); } catch (Exception e) { //Logging for error. } finally { sourceDirectory = null; } }
/// <summary> /// Initializes a new instance of the <see cref="Settings"/> class. /// </summary> public InstanceSettings(GlobalSettings globalSettings) { Global = globalSettings; Away = new AwaySettings(); BadNickname = new BadNicknameSettings(); Control = new ControlSettings(); Event = new EventSettings(); Idle = new IdleSettings(); Message = new MessageSettings(); Record = new RecordSettings(); Sticky = new StickySettings(); TeamSpeak = new TeamSpeakServerSettings(); Vote = new VoteSettings(); }
/// <summary> /// Initializes a new instance of the <see cref="Settings"/> class. /// </summary> public InstanceSettings(GlobalSettings globalSettings) { Global = globalSettings; Away = new AwaySettings(); BadNickname = new BadNicknameSettings(); Control = new ControlSettings(); Event = new EventSettings(); Idle = new IdleSettings(); Message = new MessageSettings(); Record = new RecordSettings(); Sticky = new StickySettings(); TeamSpeak = new TeamSpeakServerSettings(); Vote = new VoteSettings(); }
/// <summary> /// WARNING: Except for AppKfs, no other app makes use of this base class /// functionnality of serialization. If you ever need m_settings in other classes, /// make sure to include a call to base(...) in the constructor / GetObjectData methods. /// </summary> public KwsApp(SerializationInfo info, StreamingContext context) { Settings = info.GetValue("m_settings", typeof(ControlSettings)) as ControlSettings; }
void Start() { OptionsControls = GameObject.Find("UIManager").GetComponent<OptionsControls>(); ControlSettings = Settings.CS; GetComponent<Button>().onClick.AddListener(Button); }
/// <summary> /// Loads control settings from xml file. /// </summary> /// <param name="element">xml file to load from.</param> private void LoadControl(IXmlElement element) { String controlName = element.GetAttributeValue("control", ""); if (controlName.Length <= 0) { return; } ControlSettings controlSettings = new ControlSettings(); controlSettings.Name = controlName; controlSettings.ColorBack = this.Colors.GetColor(element.GetAttributeValue("backColor", ""), Colors.Control); controlSettings.ColorBorderLight1 = this.Colors.GetColor(element.GetAttributeValue("borderLight1", ""), Colors.ControlLight); controlSettings.ColorBorderLight2 = this.Colors.GetColor(element.GetAttributeValue("borderLight2", ""), Colors.Control); controlSettings.ColorBorderDark1 = this.Colors.GetColor(element.GetAttributeValue("borderDark1", ""), Colors.ControlDark); controlSettings.ColorBorderDark2 = this.Colors.GetColor(element.GetAttributeValue("borderDark2", ""), Colors.ControlDarkDark); controlSettings.BordersFilePrefix = element.GetAttributeValue("imagesPrefix", "images/control_"); controlSettings.Skinned = UIUtils.FromString(element.GetAttributeValue("skinned", ""), this.skinned); controlSettings.BorderWidth = UIUtils.FromString(element.GetAttributeValue("borderWidth", null), 2); controlSettings.BackImage = element.GetAttributeValue("backImage", ""); controlSettings.ControlSize = UIUtils.FromString(element.GetAttributeValue("controlSize", null), controlSettings.ControlSize); this.controlsSettings[controlName] = controlSettings; }
/// <summary> /// Gets controls default settings. /// </summary> /// <param name="controlType">control type.</param> /// <returns>control settings object.</returns> public ControlSettings GetControlSettings(String controlType) { ControlSettings cs = null; this.controlsSettings.TryGetValue(controlType, out cs); if (null == cs) { cs = new ControlSettings(); cs.ColorBack = this.Colors.Control; cs.ColorBorderLight1 = this.Colors.ControlLight; cs.ColorBorderLight2 = this.Colors.Control; cs.ColorBorderDark1 = this.Colors.ControlDark; cs.ColorBorderDark2 = this.Colors.ControlDarkDark; cs.Name = controlType; cs.Skinned = this.skinned; cs.BordersFilePrefix = "images/control_"; cs.BorderWidth = 2; cs.BackImage = ""; this.controlsSettings[controlType] = cs; } return cs; }
public void ParseControls(ControlSettings cs) { var con = statedyn["controls"]; cs.MouseSensitivity = (float?) con["mouse_sensitivity"] ?? 0; cs.MouseScaleX = (float?) con["mouse_scale_x"] ?? 0; cs.MouseScaleY = (float?) con["mouse_scale_y"] ?? 0; cs.UseJoy = (bool?) con["use_joy"] ?? false; cs.JoyNumber = (int?) con["joy_number"] ?? 0; cs.JoyRumble = (bool?) con["joy_rumble"] ?? false; cs.JoyAxisMap[(int) AXES.LookX] = (int?) con["joy_look_axis_x"] ?? 0; cs.JoyAxisMap[(int) AXES.LookY] = (int?) con["joy_look_axis_y"] ?? 0; cs.JoyAxisMap[(int) AXES.MoveX] = (int?) con["joy_move_axis_x"] ?? 0; cs.JoyAxisMap[(int) AXES.MoveY] = (int?) con["joy_move_axis_y"] ?? 0; cs.JoyLookInvertX = (bool?) con["joy_look_invert_x"] ?? false; cs.JoyLookInvertY = (bool?) con["joy_look_invert_y"] ?? false; cs.JoyLookSensitivity = (float?) con["joy_look_sensitivity"] ?? 0; cs.JoyLookDeadzone = (short?) con["joy_look_deadzone"] ?? 0; cs.JoyMoveInvertX = (bool?) con["joy_move_invert_x"] ?? false; cs.JoyMoveInvertY = (bool?) con["joy_move_invert_y"] ?? false; cs.JoyMoveSensitivity = (float?) con["joy_move_sensitivity"] ?? 0; cs.JoyMoveDeadzone = (short?) con["joy_move_deadzone"] ?? 0; }