Exemplo n.º 1
0
        public static void LoadDefinitions()
        {
            Definitions = new Dictionary <string, AbilityEffectDefinition>();
            string data = System.IO.File.ReadAllText("cfg\\ability_components.gdf");

            string[] lines = data.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string line in lines)
            {
                string[] parts = line.Split('|');
                AbilityEffectDefinition def = new AbilityEffectDefinition
                {
                    Icon         = GameObject.Utility.GetInt(parts[0]),
                    EffectType   = parts[1],
                    FriendlyName = parts[2],
                    Description  = parts[3],
                    parameters   = new List <Tuple <string, char> >()
                };
                for (int i = 4; i < parts.Length; i++)
                {
                    string[] parts2 = parts[i].Split(',');
                    def.parameters.Add(new Tuple <string, char>(parts2[0], parts2[1][0]));//just take whatever the first char is
                }
                Definitions.Add(def.EffectType, def);
            }
        }
Exemplo n.º 2
0
        public EditAbilityComponent(ITimedEffect effect)
        {
            InitializeComponent();
            CurrentEffect = effect;
            AbilityEffectDefinition aed = AbilityEffectDefinition.GetDefinition(effect.EffectType);

            this.label1.Text         = aed.FriendlyName;
            basetimevalue.Value      = (decimal)CurrentEffect.BaseTime;
            basedurationvalue.Value  = (decimal)CurrentEffect.BaseDuration;
            deltatimevalue.Value     = (decimal)CurrentEffect.DeltaTime;
            deltadurationvalue.Value = (decimal)CurrentEffect.DeltaDuration;
            desclabel.Text           = aed.Description;
            string[] values = effect.GetParamValues();

            for (int i = 0; i < aed.parameters.Count; i++)
            {
                string   name       = aed.parameters[i].Item1;
                char     ptype      = aed.parameters[i].Item2;
                string[] bothvalues = values[i].Split(',');
                string   basevalue  = bothvalues[0];
                string   deltavalue = bothvalues.Length == 2?bothvalues[1]:"";
                int      leftstart  = 20;
                int      topstart   = 80;
                int      topstride  = 40;
                int      leftinput  = 200;
                int      inputwidth = 64;


                Label l = new Label();
                l.Text     = name;
                l.AutoSize = true;
                l.Location = new Point(leftstart, topstart + topstride * i);
                this.Controls.Add(l);

                Control t1 = CraftInput(basevalue, ptype);
                t1.Width    = inputwidth;
                t1.Height   = 2;
                t1.Location = new Point(leftinput, topstart + topstride * i);
                this.Controls.Add(t1);
                this.Inputs.Add(t1);
                Control t2 = CraftInput(deltavalue, ptype);
                t2.Width    = inputwidth;
                t2.Height   = 2;
                t2.Location = new Point(leftinput + inputwidth, topstart + topstride * i);
                this.Controls.Add(t2);
                this.Inputs.Add(t2);
            }
            this.SuspendLayout();
            //add controls here!!


            this.ResumeLayout(false);
            this.PerformLayout();
        }
Exemplo n.º 3
0
 private void ReloadEffectList()
 {
     EffectList.Items.Clear();
     foreach (ITimedEffect effect in CurrentAbility.GetModules())
     {
         AbilityEffectDefinition adef = AbilityEffectDefinition.GetDefinition(effect.EffectType);
         string[]     ItemProps       = new string[] { adef.FriendlyName, effect.BaseTime.ToString(), effect.BaseDuration.ToString() };
         ListViewItem line            = new ListViewItem(ItemProps, adef.Icon)
         {
             Tag = effect
         };
         EffectList.Items.Add(line);
     }
 }
Exemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            AbilityEffectDefinition.LoadDefinitions();

            MagicFileReader fr = new MagicFileReader();

            abilities = fr.ReadAbilityFile();
            if (abilities.Count > 0)
            {
                foreach (ModularAbility ability in abilities)
                {
                    abilityselector.Items.Add(ability);
                }

                CurrentAbility = abilities[0];
                abilityselector.SelectedIndex = 0;
            }
            else
            {
                CurrentAbility = null;
            }
            EditCurrentAbility();

            classes = fr.ReadClassFile();
            if (classes.Count > 0)
            {
                foreach (CharacterTemplate t in classes)
                {
                    classlist.Items.Add(t);
                }

                CurrentClass            = classes[0];
                classlist.SelectedIndex = 0;
            }
            else
            {
                CurrentAbility = null;
            }
            EditCurrentClass();

            panel1.Refresh();
        }
Exemplo n.º 5
0
        public void SaveAndQuit()
        {
            AbilityEffectDefinition aed = AbilityEffectDefinition.GetDefinition(CurrentEffect.EffectType);

            this.label1.Text = aed.FriendlyName;
            string[] values = new string[aed.parameters.Count];

            for (int i = 0; i < aed.parameters.Count; i++)
            {
                string name  = aed.parameters[i].Item1;
                char   ptype = aed.parameters[i].Item2;

                values[i] = GetValue(Inputs[i * 2]) + "," + GetValue(Inputs[i * 2 + 1]);
            }
            CurrentEffect.SetParamValues(values);

            CurrentEffect.BaseTime      = (float)basetimevalue.Value;
            CurrentEffect.DeltaTime     = (float)deltatimevalue.Value;
            CurrentEffect.BaseDuration  = (float)basedurationvalue.Value;
            CurrentEffect.DeltaDuration = (float)deltadurationvalue.Value;

            this.Close();
        }
Exemplo n.º 6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            AbilityEffectDefinition.LoadDefinitions();

            MagicFileReader fr = new MagicFileReader();

            //load abilities
            abilities = fr.ReadAbilityFile();
            if (abilities.Count > 0)
            {
                foreach (ModularAbility ability in abilities)
                {
                    abilityselector.Items.Add(ability);
                }

                CurrentAbility = abilities[0];
                abilityselector.SelectedIndex = 0;
            }
            else
            {
                CurrentAbility = null;
            }
            EditCurrentAbility();

            //load classes
            classes = fr.ReadClassFile();
            if (classes.Count > 0)
            {
                foreach (CharacterTemplate t in classes)
                {
                    classlist.Items.Add(t);
                }

                CurrentClass            = classes[0];
                classlist.SelectedIndex = 0;
            }
            else
            {
                CurrentAbility = null;
            }
            EditCurrentClass();

            //load item type defs
            itemtypes = fr.ReadItemTypeDefinitionFile();
            if (itemtypes.Count > 0)
            {
                foreach (ItemTypeDefinition def in itemtypes)
                {
                    itemtypelist.Items.Add(def);
                }
                CurrentItemType            = itemtypes[0];
                itemtypelist.SelectedIndex = 0;
            }
            else
            {
                CurrentItemType = null;
            }


            //reload panel based editing controls
            panel1.Refresh();
        }