/// <summary> /// Applies the default configuration to the bind group if defaults are defined. /// </summary> private void ResetBinds(object sender, EventArgs args) { if (DefaultBinds != null) { BindGroup.TryLoadBindData(DefaultBinds); UpdateBindGroup(); } }
/// <summary> /// descript.txt の定義内容から着せ替えグループ一覧を取得 /// </summary> /// <param name="targetCharacter">着せ替え対象のキャラクタ (sakura, kero, char2, char3, ...)</param> public virtual IDictionary <int, BindGroup> GetBindGroupsFromDescript(string targetCharacter) { var defaultRegex = new Regex(string.Format(@"\A{0}\.bindgroup(\d+)\.default\z", targetCharacter)); var addIdRegex = new Regex(string.Format(@"\A{0}\.bindgroup(\d+)\.addid\z", targetCharacter)); // descript.txt から着せ替え情報取得 var bindGroups = new Dictionary <int, BindGroup>(); foreach (var pair in Descript.Values) { // default指定 { var matched = defaultRegex.Match(pair.Key); if (matched.Success && pair.Value == "1") { var groupId = int.Parse(matched.Groups[1].Value); if (!bindGroups.ContainsKey(groupId)) { bindGroups[groupId] = new BindGroup(); } bindGroups[groupId].Default = true; continue; // 次の処理へ } } // addid指定 { var matched = addIdRegex.Match(pair.Key); if (matched.Success) { var groupId = int.Parse(matched.Groups[1].Value); if (!bindGroups.ContainsKey(groupId)) { bindGroups[groupId] = new BindGroup(); } bindGroups[groupId].AddId = new List <int>(); foreach (var idValue in pair.Value.Split(',')) { int id; if (int.TryParse(idValue, out id)) { bindGroups[groupId].AddId.Add(id); } } continue; // 次の処理へ } } } return(bindGroups); }
/// <summary> /// Returns the first bind group with the name given or creates /// a new one if one isn't found. /// </summary> public IBindGroup GetOrCreateGroup(string name) { name = name.ToLower(); BindGroup group = bindGroups.Find(x => (x.Name == name)); if (group == null) { group = new BindGroup(bindGroups.Count, name); bindGroups.Add(group); } return(group); }
public Bind(string name, int index, BindGroup group) { Name = name; Index = index; stopwatch = new Stopwatch(); this.group = group; IsPressedAndHeld = false; wasPressed = false; bindHits = 0; Analog = false; beingReleased = false; length = 0; }