示例#1
0
 private void MainDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     lock (selectionLock)
     {
         var grid    = (DataGrid)sender;
         var setting = grid.SelectedItems.Cast <UserSetting>().FirstOrDefault();
         _CurrentUserSetting = setting;
         // Get device attached to user setting.
         _CurrentUserDevice = setting == null
                                 ? new UserDevice()
                                 : SettingsManager.GetDevice(setting.InstanceGuid);
         // Get mappings attached to user setting.
         _CurrentPadSetting = setting == null
                                 ? new PadSetting()
                                 : SettingsManager.GetPadSetting(setting.PadSettingChecksum);
         DPadPanel.SetBinding(_CurrentPadSetting);
         GeneralPanel.SetBinding(MappedTo, _CurrentPadSetting);
         AdvancedPanel.SetBinding(_CurrentPadSetting);
         LeftTriggerPanel.SetBinding(_CurrentPadSetting);
         RightTriggerPanel.SetBinding(_CurrentPadSetting);
         LeftThumbXPanel.SetBinding(_CurrentPadSetting);
         LeftThumbYPanel.SetBinding(_CurrentPadSetting);
         RightThumbXPanel.SetBinding(_CurrentPadSetting);
         RightThumbYPanel.SetBinding(_CurrentPadSetting);
         ForceFeedbackPanel.SetBinding(MappedTo, _CurrentPadSetting);
         ForceFeedbackPanel.LeftForceFeedbackMotorPanel.SetBinding(_CurrentPadSetting, 0);
         ForceFeedbackPanel.RightForceFeedbackMotorPanel.SetBinding(_CurrentPadSetting, 1);
         PadFootPanel.SetBinding(MappedTo, _CurrentUserDevice, _CurrentPadSetting);
         SettingsManager.Current.LoadPadSettingsIntoSelectedDevice(MappedTo, _CurrentPadSetting);
         OnSettingChanged?.Invoke(this, new EventArgs <UserSetting>(setting));
     }
 }
示例#2
0
        public static string Get(string key, string sDefault, string error, bool create)
        {
            for (int i = 0; i < Dict.Count; i++)
            {
                ConfValue KV = Dict[i];
                //Trace.WriteLine(KV.Key + " <- " + key);
                if (KV.Key.Trim().ToLower() == key.Trim().ToLower())
                {
                    //T//race.WriteLineIf(string.IsNullOrEmpty(KV.Value), "Empty Value");
                    return(KV.Value);
                }
            }
            //Trace.WriteLine("Setting Not found");
            if (create)
            {
                ConfValue c = new ConfValue(key, sDefault);
                Dict.Add(c);

                if (OnSettingChanged != null)
                {
                    OnSettingChanged.Invoke(c);
                }

                if (key == "#Settings|Save On Modification" || Settings.Get("#Settings|Save On Modification", true))
                {
                    Save();
                }
                return(sDefault);
            }
            return(error);
        }
示例#3
0
        /// <summary>
        /// Renders the treeview and footer
        /// </summary>
        /// <param name="viewRect">The Rect inside which to draw the tree view and footer</param>
        public void OnGUI(Rect viewRect)
        {
            var treeviewRect = new Rect(viewRect.x, viewRect.y, viewRect.width, viewRect.height - k_LineHeight);
            var toolbarRect  = new Rect(viewRect.x, viewRect.y + treeviewRect.height, viewRect.width, k_LineHeight);

            if (GUI.Button(new Rect(toolbarRect.x + 2.5f, toolbarRect.y, toolbarRect.width - 5f, toolbarRect.height),
                           m_CreateSettingButtonContent))
            {
                OnSettingChanged?.Invoke(null, new JObject());
            }
            treeView.OnGUI(treeviewRect);
        }
示例#4
0
    public void SetSettable(GameManagerInstance.UnlockStateID id, bool state)
    {
        // if id must alter other settables check here and turn off other settings

        bool oldState = false;

        if (Settables.ContainsKey(id))
        {
            oldState = Settables[id];
        }

        Settables[id] = state;
        OnSettingChanged?.Invoke(id, oldState, Settables[id]);
    }
示例#5
0
        public void onConfigurationReload()
        {
            Log.IsDebug = DebugMode.ToBool();

#if DEBUG
            Log.IsDebug = true;
#endif

            mods_pic_output = null;
            if (source == UsingSource.OsuRTDataProvider)
            {
                TryCreateModsPictureGenerator(out mods_pic_output);
            }
            OnSettingChanged?.Invoke();
        }
示例#6
0
 private void MainDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     lock (selectionLock)
     {
         var grid    = (DataGrid)sender;
         var setting = grid.SelectedItems.Cast <UserSetting>().FirstOrDefault();
         _CurrentUserSetting = setting;
         // Get device attached to user setting.
         _CurrentUserDevice = setting == null
                                 ? new UserDevice()
                                 : SettingsManager.GetDevice(setting.InstanceGuid);
         // Load pad settings.
         LoadPadSetting(setting?.PadSettingChecksum);
         OnSettingChanged?.Invoke(this, new EventArgs <UserSetting>(setting));
     }
 }
示例#7
0
        public static void Set(string key, string value)
        {
            for (int i = 0; i < Dict.Count; i++)
            {
                ConfValue KV = Dict[i];

                if (KV.Key == key)
                {
                    KV.Value = value;

                    if (key == "#Settings|Save On Modification" || Settings.Get("#Settings|Save On Modification", true))
                    {
                        Save();
                    }
                    if (OnSettingChanged != null)
                    {
                        OnSettingChanged.Invoke(KV);
                    }
                    return;
                }
            }

            ConfValue c = new ConfValue(key, value);

            Dict.Add(c);

            if (OnSettingChanged != null)
            {
                OnSettingChanged.Invoke(c);
            }

            if (key == "#Settings|Save On Modification" || Settings.Get("#Settings|Save On Modification", true))
            {
                Save();
            }
        }
示例#8
0
 void OnUpdateSetting(JObject oldItem, JObject newItem)
 {
     OnSettingChanged?.Invoke(oldItem, newItem);
 }
示例#9
0
 public static void SettingChanged()
 {
     OnSettingChanged?.Invoke();
 }