Exemplo n.º 1
0
 private void btnAddUp_Click(object sender, EventArgs e)
 {
     Effect eff = new Effect(0, true, 0);
     AddForm window = new AddForm(false, null, eff);
     window.ShowDialog();
     if (window.Ok)
     {
         LevelData level = getCurrentLevel();
         level.UpEffects.Add(eff);
         refreshUp();
     }
 }
Exemplo n.º 2
0
 public AddForm(bool isreq, Requirement req, Effect eff)
 {
     this.isreq = isreq;
     Req = req;
     Eff = eff;
     InitializeComponent();
     if (!isreq)
     {
         rbAtleast.Text = "Increase by";
         rbAtmost.Text = "Decrease by";
         groupBox2.Text = "Operation";
     }
     ShowInTaskbar = false;
 }
Exemplo n.º 3
0
 public static bool LoadPerks(String filename)
 {
     Perks = new List<Perk>();
     Perk cur = null;
     XmlTextReader reader = new XmlTextReader(filename);
     LevelData level = null;
     int levelid = -1;
     int state = -1;
     while(reader.Read())
     {
         switch(reader.NodeType)
         {
             case XmlNodeType.Element:
                 if(reader.Name.Equals("perks") && state == -1)
                 {
                     state = 0;
                     continue;
                 }
                 if(reader.Name.Equals("level") && state == 1)
                 {
                     level = new LevelData();
                     levelid = Int32.Parse(reader.GetAttribute(0));
                     level.JustRevert = reader.GetAttribute(1).Equals("1");
                     state = 2;
                     continue;
                 }
                 if(reader.Name.Equals("perk") && state == 0)
                 {
                     state = 1;
                     int id = Int32.Parse(reader.GetAttribute(0));
                     cur = new Perk(id, Config.MsgParser.GetMSGValue(id * 10 + 100001), Config.MsgParser.GetMSGValue(id * 10 + 100002));
                     cur.MaxLevel = Int32.Parse(reader.GetAttribute(1));
                     cur.Type = (Perk.PerkType)Int32.Parse(reader.GetAttribute(2));
                     Perks.Add(cur);
                     continue;
                 }
                 if(reader.Name.Equals("up") && state == 2)
                 {
                     int param = Int32.Parse(reader.GetAttribute(0));
                     bool increase = reader.GetAttribute(1).Equals("1");
                     int value = Int32.Parse(reader.GetAttribute(2));
                     Effect eff = new Effect(param, increase, value);
                     level.UpEffects.Add(eff);
                     continue;
                 }
                 if(reader.Name.Equals("down") && state == 2)
                 {
                     int param = Int32.Parse(reader.GetAttribute(0));
                     bool increase = reader.GetAttribute(1).Equals("1");
                     int value = Int32.Parse(reader.GetAttribute(2));
                     Effect eff = new Effect(param, increase, value);
                     level.DownEffects.Add(eff);
                     continue;
                 }
                 if(reader.Name.Equals("req") && state == 2)
                 {
                     int param = Int32.Parse(reader.GetAttribute(0));
                     bool atleast = reader.GetAttribute(1).Equals("1");
                     int value = Int32.Parse(reader.GetAttribute(2));
                     Requirement eff = new Requirement(param, atleast, value);
                     level.Requirements.Add(eff);
                     continue;
                 }
                 break;
             case XmlNodeType.Text:
                 break;
             case XmlNodeType.EndElement:
                 if(reader.Name.Equals("perks") && state == 0)
                 {
                     state = -1;
                     continue;
                 }
                 if(reader.Name.Equals("perk") && state == 1)
                 {
                     state = 0;
                     continue;
                 }
                 if(reader.Name.Equals("level") && state == 2)
                 {
                     cur.EnsureLevel(levelid - 1);
                     cur.Levels[levelid - 1] = level;
                     state = 1;
                     continue;
                 }
                 break;
         }
     }
     reader.Close();
     return true;
 }
Exemplo n.º 4
0
 public object Clone()
 {
     Effect r = new Effect(Param, Increase, Value);
     return r;
 }