Пример #1
0
 private void Main_Load(object sender, EventArgs e)
 {
     if (System.IO.File.Exists(@"DataLists\\CharacterList.db"))
     {
         EnableAccuracyMenu.Enabled = true;
     }
     if (System.IO.File.Exists(@"wcatBasicEditer.exe"))
     {
         DefaultDataMenuItem.Enabled = true;
     }
     if (System.IO.File.Exists(@"wcatCharaDBEditer.exe"))
     {
         wcatCharaMenuItem.Enabled = true;
     }
     if (!System.IO.File.Exists(@"DataLists\\SpecifiedBindList.db") || !System.IO.File.Exists(@"DataLists\\JobList.db") || !System.IO.File.Exists(@"DataLists\\TypeList.db") || !System.IO.File.Exists(@"DataLists\\MapList.db"))
     {
         MessageBox.Show("SpecifiedBindList.db、JobList.db、TypeList.db、MapListのいずれかが見つかりませんでした。", "", MessageBoxButtons.OK);
         Application.Exit();
     }
     serializer = new XmlSerializer(typeof(Settings));
     if (System.IO.File.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\GalaxySoftware\\wcatManager\\DataLists\\Settings.xml"))
     {
         sr       = new StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\GalaxySoftware\\wcatManager\\DataLists\\Settings.xml");
         settings = (Settings)serializer.Deserialize(sr);
         sr.Close();
         EnableAccuracyMenu.Checked = settings._AccuracyEnabled;
         ResultOnNewWindow.Checked  = settings._ResultOnNewWindow;
     }
     else
     {
         sw = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\GalaxySoftware\\wcatManager\\DataLists\\Settings.xml");
         settings.Save(EnableAccuracyMenu.Checked, ResultOnNewWindow.Checked);
         serializer.Serialize(sw, settings);
         sw.Close();
     }
     Timerfor4          = new Timer();
     Timerfor4.Tick    += new EventHandler(timerfor4);
     DesidePlace        = new Timer();
     DesidePlace.Tick  += new EventHandler(place);
     Timer4Custom       = new Timer();
     Timer4Custom.Tick += new EventHandler(custom);
     ConnectDB();
     LoadDefaultList(JobCmd, "SELECT Job FROM JobList", JobListBox, "Job", JobCon);
     LoadDefaultList(TypeCmd, "SELECT Type FROM TypeList", TypeListBox, "Type", TypeCon);
     LoadDefaultList(BindCmd, "SELECT Bind FROM SpecifiedBindList", SpecifiedListBox, "Bind", BindCon);
     RefreshMapList();
     RefreshCustomList();
     RefreshTeamList();
     for (int cnt = 0; cnt < JobListBox.Items.Count; cnt++)
     {
         JobListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < TypeListBox.Items.Count; cnt++)
     {
         TypeListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < RarityListBox.Items.Count; cnt++)
     {
         RarityListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < RareTypeListBox.Items.Count; cnt++)
     {
         RareTypeListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < AttributeListBox.Items.Count; cnt++)
     {
         AttributeListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < SortListBox.Items.Count; cnt++)
     {
         SortListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < SpecifiedListBox.Items.Count; cnt++)
     {
         SpecifiedListBox.SetItemChecked(cnt, true);
     }
 }
Пример #2
0
        public string SetConditions()
        {
            string ErrorMsg = null;

            if (JobEnabled.Checked)
            {
                JobList.Clear();
                for (int i = 0; i <= (JobListBox.Items.Count - 1); i++)
                {
                    if (JobListBox.GetItemChecked(i))
                    {
                        JobList.Add(JobListBox.Items[i].ToString());
                    }
                }
                if (JobList.Count != 0)
                {
                    if (OneJobOnly.Checked)
                    {
                        job = Convert.ToString((string)JobList[random.Next(0, JobList.Count)]);
                    }
                    if (JobList.Count < 4 && JobExistFalse.Checked)
                    {
                        Error     = true;
                        ErrorMsg += ("職業を被らせない設定は選択している職業数が4つ以上である必要があります。\n");
                    }
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("職業が選択されていません。\n");
                }
            }
            if (TypeEnabled.Checked)
            {
                TypeList.Clear();
                for (int i = 0; i <= (TypeListBox.Items.Count - 1); i++)
                {
                    if (TypeListBox.GetItemChecked(i))
                    {
                        TypeList.Add(TypeListBox.Items[i].ToString());
                    }
                }
                if (TypeList.Count != 0)
                {
                    if (OneTypeOnly.Checked)
                    {
                        type = Convert.ToString((string)TypeList[random.Next(0, TypeList.Count)]);
                    }
                    if (TypeList.Count < 4 && TypeExistFalse.Checked)
                    {
                        Error     = true;
                        ErrorMsg += ("タイプを被らせない設定は選択しているタイプ数が4つ以上である必要があります。\n");
                    }
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("タイプが選択されていません。\n");
                }
            }
            if (RarityEnabled.Checked)
            {
                RareList.Clear();
                if (UseRarity.Checked)
                {
                    for (int i = 0; i <= (RarityListBox.Items.Count - 1); i++)
                    {
                        if (RarityListBox.GetItemChecked(i))
                        {
                            RareList.Add(RarityListBox.Items[i].ToString());
                        }
                    }
                    TRResult.Text = "";
                    if (RareList.Count == 0)
                    {
                        Error     = true;
                        ErrorMsg += ("レアリティが選択されていません。\n");
                    }
                }
                if (UseTotalRarity.Checked)
                {
                    TRResult.Text = "レアリティ合計値:" + random.Next((int)TRMinimum.Value, (int)TRMax.Value);
                }
            }
            if (RareTypeEnabled.Checked)
            {
                RareTypeList.Clear();
                for (int i = 0; i <= (RareTypeListBox.Items.Count - 1); i++)
                {
                    if (RareTypeListBox.GetItemChecked(i))
                    {
                        RareTypeList.Add(RareTypeListBox.Items[i].ToString());
                    }
                }
                if (RareTypeList.Count != 0)
                {
                    if (OneRareTypeOnly.Checked)
                    {
                        raretype = Convert.ToString((string)RareTypeList[random.Next(0, RareTypeList.Count)]);
                    }
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("種類が選択されていません。\n");
                }
            }
            if (AttributeEnabled.Checked)
            {
                AttributeList.Clear();
                for (int i = 0; i <= (AttributeListBox.Items.Count - 1); i++)
                {
                    if (AttributeListBox.GetItemChecked(i))
                    {
                        AttributeList.Add(AttributeListBox.Items[i].ToString());
                    }
                }
                if (AttributeList.Count != 0)
                {
                    attribute = Convert.ToString((string)AttributeList[random.Next(0, AttributeList.Count)]);
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("属性が選択されていません。\n");
                }
            }
            if (!JobEnabled.Checked && !TypeEnabled.Checked && !RarityEnabled.Checked && !RareTypeEnabled.Checked && !AttributeEnabled.Checked)
            {
                Error     = true;
                ErrorMsg += ("有効になっている条件がありません。");
            }
            return(ErrorMsg);
        }