Example #1
0
 void WriteEffect(ITimedEffect effect)
 {
     writer.Write(effect.EffectType);
     writer.Write(effect.BaseTime);
     writer.Write(effect.DeltaTime);
     writer.Write(effect.BaseDuration);
     writer.Write(effect.DeltaDuration);
     writer.Write(effect.GetParamValues().Length);
     foreach (string s in effect.GetParamValues())
     {
         writer.Write(s);
     }
 }
Example #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();
        }