private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (dontRefresh) return;
     string conflict = lstConflicts.SelectedItem.ToString();
     string[] conflictSplit = conflict.Split(':');
     selectedFunnel = "";
     lstFunnel.SelectedIndex = -1;
     if (MainForm.SelectedCharacter != null && ConflictManager.Instance.ConflictRules.ContainsKey(MainForm.SelectedCharacter.Name)
                                             && ConflictManager.Instance.ConflictRules[MainForm.SelectedCharacter.Name].ContainsKey(conflictSplit[1]))
     {
         try
         {
             selectedConflict = ConflictManager.Instance.ConflictRules[MainForm.SelectedCharacter.Name][conflictSplit[1]][(ConflictRule.ConflictTypes)Enum.Parse(typeof(ConflictRule.ConflictTypes), conflictSplit[0])];
             tabConflictRule.Enabled = true;
             RefreshSelectedConflict();
         }
         catch (Exception ex)
         {
             ConflictManager.Instance.DebugException(ex);
             selectedConflict = null;
             tabConflictRule.Enabled = false;
         }
         
     }
 }
예제 #2
0
 public void SetFunnel(Character character, ConflictRule selectedConflict, string selectedFunnel)
 {
     conflictRules[character.Name][selectedConflict.FullEventName][selectedConflict.ConflictType].AddFunnel(selectedFunnel);
     SaveSettings(character);
 }
예제 #3
0
 public void SetRule(Character character, string fullEventName, ConflictRule.ConflictTypes conflictType, string clientName, bool ruleState)
 {
     lock (conflictRules)
     {
         if (conflictRules.ContainsKey(character.Name) && conflictRules[character.Name].ContainsKey(fullEventName) && conflictRules[character.Name][fullEventName].ContainsKey(conflictType))
         {
             bool changed = false;
             ConflictRule rule = conflictRules[character.Name][fullEventName][conflictType];
             if (rule.ClientsRules.ContainsKey(clientName) && rule.ClientsRules[clientName] != ruleState) changed = true;
             rule.ClientsRules[clientName] = ruleState;
             if (rule.UnsolvedClients.Contains(clientName)) rule.UnsolvedClients.Remove(clientName);
             if (rule.UnsolvedClients.Count == 0) rule.Solved = true;
             conflictRules[character.Name][fullEventName][conflictType] = rule;
             if (changed) SaveSettings(character);
         }
     }
 }
예제 #4
0
 private void CreateRule(string character, string fullEventName, ConflictRule.ConflictTypes conflictType, List<string> clientsList, ConflictSettings.DefaultRuleType defaultRule)
 {
     ConflictRule cr = new ConflictRule(fullEventName, conflictType);
     if (defaultRule != ConflictSettings.DefaultRuleType.Ignore)
     {
         foreach (string client in clientsList) cr.ClientsRules[client] = defaultRule == ConflictSettings.DefaultRuleType.All;
     }
     else
     {
         foreach (string client in clientsList) cr.UnsolvedClients.Add(client);
     }
     if (!conflictRulesBuffer.ContainsKey(character)) conflictRulesBuffer[character] = new Dictionary<string, Dictionary<ConflictRule.ConflictTypes, ConflictRule>>();
     if (!conflictRulesBuffer[character].ContainsKey(fullEventName)) conflictRulesBuffer[character][fullEventName] = new Dictionary<ConflictRule.ConflictTypes, ConflictRule>();
     conflictRulesBuffer[character][fullEventName][conflictType] = cr;
 }
예제 #5
0
 private bool IsRuleSolved(string character, string fullEventName, ConflictRule.ConflictTypes conflictType, List<string> clientsList, ConflictSettings.DefaultRuleType defaultRule)
 {
     if (!conflictRules.ContainsKey(character)) return false;
     if (!conflictRules[character].ContainsKey(fullEventName)) return false;
     if (!conflictRules[character][fullEventName].ContainsKey(conflictType)) return false;
     if (!conflictRules[character][fullEventName][conflictType].Solved) return false;
     return true;
 }
        private void RefreshInfo()
        {
            dontRefresh = true;
            if (MainForm.SelectedCharacter !=null && ConflictManager.Instance.ConflictRules.ContainsKey(MainForm.SelectedCharacter.Name)) {
                lstConflicts.Enabled = true;
                lstConflicts.Items.Clear();
                foreach (string conflictEvent in ConflictManager.Instance.ConflictRules[MainForm.SelectedCharacter.Name].Keys)
                {
                    foreach (KeyValuePair<ConflictRule.ConflictTypes, ConflictRule> conflictType in ConflictManager.Instance.ConflictRules[MainForm.SelectedCharacter.Name][conflictEvent])
                    {
                        lstConflicts.Items.Add(conflictType.Key.ToString() + ":" + conflictType.Value.FullEventName);
                    }
                }

                if (selectedConflict != null)
                {
                    tabConflictRule.Enabled = true;
                    bool found = false;
                    for (int i = 0; i < lstConflicts.Items.Count; i++)
                    {
                        if (lstConflicts.Items[i].ToString() == selectedConflict.ConflictType + ":" + selectedConflict.FullEventName)
                        {
                            lstConflicts.SelectedIndex = i;
                            found = true;
                            break;
                        }
                    }
                    if (!found) selectedConflict = null;
                    else
                    {
                        RefreshSelectedConflict();
                    }
                }
                else
                {
                    tabConflictRule.Enabled = false;
                }

                switch (ConflictManager.Instance.DefaultRuleOnActionPublishingConflict)
                {
                    case ConflictSettings.DefaultRuleType.All:
                        radActionPublishersAll.Checked = true;
                        break;
                    case ConflictSettings.DefaultRuleType.Ignore:
                        radActionPublishersIgnore.Checked = true;
                        break;
                    default:
                        radActionPublishersNone.Checked = true;
                        break;
                }
                switch (ConflictManager.Instance.DefaultRuleOnActionSubscriptionConflict)
                {
                    case ConflictSettings.DefaultRuleType.All:
                        radActionSubscribersAll.Checked = true;
                        break;
                    case ConflictSettings.DefaultRuleType.Ignore:
                        radActionSubscribersIgnore.Checked = true;
                        break;
                    default:
                        radActionSubscribersNone.Checked = true;
                        break;
                }
                switch (ConflictManager.Instance.DefaultRuleOnPerceptionPublishingConflict)
                {
                    case ConflictSettings.DefaultRuleType.All:
                        radPerceptionPublishersAll.Checked = true;
                        break;
                    case ConflictSettings.DefaultRuleType.Ignore:
                        radPerceptionPublishersIgnore.Checked = true;
                        break;
                    default:
                        radPerceptionPublishersNone.Checked = true;
                        break;
                }
                switch (ConflictManager.Instance.DefaultRuleOnPerceptionSubscriptionConflict)
                {
                    case ConflictSettings.DefaultRuleType.All:
                        radPerceptionSubscribersAll.Checked = true;
                        break;
                    case ConflictSettings.DefaultRuleType.Ignore:
                        radPerceptionSubscribersIgnore.Checked = true;
                        break;
                    default:
                        radPerceptionSubscribersNone.Checked = true;
                        break;
                }
            }
            else{
                lstConflicts.Enabled = false;
                lstConflicts.Items.Clear();
                lstConflicts.Items.Add("No Conflicts.");
            }
            
            dontRefresh = false;
        }