示例#1
0
        public clsCraftingKey()
        {
            if (_dlg != null)
            {
                _dlg.Close();
                _dlg = null;
            }

            _result = new CraftingKey();
            _dlg = new dlgCraftKeyConfig(ResultCallback);
        }
        private void btn_OK_Click(object sender, RoutedEventArgs e)
        {
            CraftingKey craftkey = new CraftingKey();

            craftkey.ControlKey = chk_ControlKey.IsChecked == true;
            craftkey.Key = (Keys)Enum.Parse(typeof(Keys), lst_Key.Text, true);
            craftkey.CPCondition = chk_CP.IsChecked == true;
            craftkey.DurabilityCondition = chk_Durability.IsChecked == true;
            craftkey.ProgressCondition = chk_Progress.IsChecked == true;
            craftkey.ConditionCondition = chk_Condition.IsChecked == true;

            craftkey.CP = short.Parse(txt_CP.Text);
            craftkey.Progress = short.Parse(txt_Progress.Text);
            craftkey.Durability = short.Parse(txt_Durability.Text);
            craftkey.Condition = lst_Condition.Text;

            _callback.Invoke(craftkey);
            this.DialogResult = true;
        }
示例#3
0
 private static void ResultCallback(CraftingKey result)
 {
     _result = result;
 }
示例#4
0
        private void btn_LoadRecipe_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Filter = "Crafting Recipe (*.crft)|*.crft";
            if (dlg.ShowDialog() == false)
                return;

            IniParserLegacy.IniFile ini = new IniParserLegacy.IniFile(dlg.FileName);

            int keycount = int.Parse(ini.IniReadValue("Main", "KeyCount"));

            _keyConditions.Clear();

            for(int i = 0 ; i < keycount ; i++)
            {
                CraftingKey newkey = new CraftingKey();
                newkey.Key = (Keys)Enum.Parse(typeof(Keys), ini.IniReadValue("Key" + (i + 1), "key"), true);
                newkey.CP = short.Parse(ini.IniReadValue("Key" + (i + 1), "cp"));
                newkey.CPCondition = bool.Parse(ini.IniReadValue("Key" + (i + 1), "cpcondition"));

                newkey.Durability = short.Parse(ini.IniReadValue("Key" + (i + 1), "durability"));
                newkey.DurabilityCondition = bool.Parse(ini.IniReadValue("Key" + (i + 1), "durabilitycondition"));

                try
                {
                    newkey.ControlKey = bool.Parse(ini.IniReadValue("Key" + (i + 1), "controlkey"));
                } catch (Exception ex)
                {
                    newkey.ControlKey = false;
                }

                newkey.Condition = ini.IniReadValue("Key" + (i + 1), "condition");
                try
                {
                    newkey.ConditionCondition = bool.Parse(ini.IniReadValue("Key" + (i + 1), "conditioncondition"));
                } catch (Exception ex)
                {
                    newkey.ConditionCondition = false;
                }

                newkey.Progress = short.Parse(ini.IniReadValue("Key" + (i + 1), "progress"));
                newkey.ProgressCondition = bool.Parse(ini.IniReadValue("Key" + (i + 1), "progresscondition"));

                _keyConditions.Add(newkey);
            }
        }