コード例 #1
0
ファイル: EffectControl.cs プロジェクト: Yogr/Wizard
        private void AddModifier_btn_Click(object sender, EventArgs e)
        {
            ListModifierObject mod = new ListModifierObject();
            mod.Type = (Effect.ModifierType)BaseMod_chooser.SelectedIndex;
            if(ModValue_text.Text != "")
            {
                mod.Value = Convert.ToInt32(ModValue_text.Text);
            }

            mod.SetDisplay();

            Modifiers_listbox.Items.Add(mod);
        }
コード例 #2
0
ファイル: EffectControl.cs プロジェクト: Yogr/Wizard
        /// <summary>
        /// Called when you want to load selected effect data to the form
        /// </summary>
        /// <param name="index">Currently selected index</param>
        private void _LoadEffectDataToForm(int index)
        {
            // Is this an existing effect to edit?
            if (index >= 0 && index < EffectManager.GetInstance().GetAllEffects().Count)
            {
                Effect e = EffectManager.GetInstance().GetEffectByIndex(index);

                // Name
                EffectName_text.Text = e.Name;

                // Modifiers
                Modifiers_listbox.Items.Clear();
                foreach(Effect.Modifier mod in e.GetModifiers())
                {
                    ListModifierObject modobj = new ListModifierObject();
                    modobj.Type = mod.Type;
                    modobj.Value = mod.Value;
                    modobj.SetDisplay();

                    Modifiers_listbox.Items.Add(modobj);
                }

                // Target options
                TargetPlayer_checkBox.Checked = e.CanTargetEntity(GameEntity.EntityType.TYPE_PLAYER);
                TargetCreature_checkBox.Checked = e.CanTargetEntity(GameEntity.EntityType.TYPE_CREATURE);
                TargetRelic_checkBox.Checked = e.CanTargetEntity(GameEntity.EntityType.TYPE_RELIC);
                TargetSpell_checkBox.Checked = e.CanTargetEntity(GameEntity.EntityType.TYPE_SPELL);
                TargetDefSpell_checkBox.Checked = e.CanTargetEntity(GameEntity.EntityType.TYPE_DEFSPELL);
                TargetHand_checkBox.Checked = e.CanTargetEntity(GameEntity.EntityType.TYPE_HAND);
                TargetLibrary_checkBox.Checked = e.CanTargetEntity(GameEntity.EntityType.TYPE_LIBRARY);
                TargetGraveyard_checkBox.Checked = e.CanTargetEntity(GameEntity.EntityType.TYPE_GRAVEYARD);

                // Target range
                TargetRange_chooser.SelectedIndex = Convert.ToInt32(e.Range);
            }
            else // Create new effect
            {
                // Name
                EffectName_text.Text = "";

                // Modifiers
                Modifiers_listbox.Items.Clear();

                // Target options
                TargetPlayer_checkBox.Checked = false;
                TargetCreature_checkBox.Checked = false;
                TargetRelic_checkBox.Checked = false;
                TargetSpell_checkBox.Checked = false;
                TargetDefSpell_checkBox.Checked = false;
                TargetHand_checkBox.Checked = false;
                TargetLibrary_checkBox.Checked = false;
                TargetGraveyard_checkBox.Checked = false;

                // Target range
                TargetRange_chooser.SelectedIndex = 0;
            }
        }