Esempio n. 1
0
        private void Form2_Load(object sender, EventArgs e)
        {
            currentCharacter = new Character("Current");
            uistats          = new List <UIStat>();
            var hpgroup = new UIValueGrowthMax {
                ValueRef = hpBox, GrowthRef = hpGrowthBox, MaxRef = maxHpBox
            };
            var strgroup = new UIValueGrowthMax {
                ValueRef = strBox, GrowthRef = strGrowthBox, MaxRef = maxStrBox
            };
            var maggroup = new UIValueGrowthMax {
                ValueRef = magBox, GrowthRef = magGrowthBox, MaxRef = maxMagBox
            };

            uistats.Add(new UIStat(new Stat()
            {
                Value = 0, Max = 0, Growth = 0
            }, hpgroup));
            uistats.Add(new UIStat(new Stat()
            {
                Value = 0, Max = 0, Growth = 0
            }, strgroup));
            uistats.Add(new UIStat(new Stat()
            {
                Value = 0, Max = 0, Growth = 0
            }, maggroup));
            Character one = new Character("1");
            Character two = new Character("2");

            listBox1.Items.Add(one);
            listBox1.Items.Add(two);
            allCharacters.Add(one);
            allCharacters.Add(two);
        }
Esempio n. 2
0
 /*Prototype: public UIStat(Stat statref, UIValueGrowthMax vgm);
  *  Description: Overloaded constructor for UIStat
  *  Arguments: A stat representing statRef and a UIValueGrowthMax representing uivalue
  *  Precondition: None.
  *  Postcondition: A UIStat is created with the values passed in.
  *  Protection: Public.*/
 public UIStat(Stat statref, UIValueGrowthMax vgm)
 {
     StatRef = statref;
     uivalue = vgm;
 }
Esempio n. 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            loadedCharacters = new List <Character>();
            uiStats          = new List <UIStat>();

            onCharacterChanged += UiRefresh;
            onCharacterChanged += SetBoxes;

            var path  = System.IO.Path.Combine(System.Environment.CurrentDirectory, "Characters");
            var files = Directory.GetFiles(path);

            foreach (var f in files)
            {
                var jsonstring = File.ReadAllText(f);
                var character  = JsonConvert.DeserializeObject <Character>(jsonstring);
                loadedCharacters.Add(character);
            }

            foreach (var c in loadedCharacters)
            {
                listBox1.Items.Add(c.Name);
            }

            ///-----------GROUP TEXTBOXES///
            var hpgroup = new UIValueGrowthMax {
                ValueRef = hpBox, GrowthRef = hpGrowthBox, MaxRef = maxHpBox
            };
            var strgroup = new UIValueGrowthMax {
                ValueRef = strBox, GrowthRef = strGrowthBox, MaxRef = maxStrBox
            };
            var maggroup = new UIValueGrowthMax {
                ValueRef = magBox, GrowthRef = magGrowthBox, MaxRef = maxMagBox
            };
            var skillgroup = new UIValueGrowthMax {
                ValueRef = skillBox, GrowthRef = skillGrowthBox, MaxRef = maxSkillBox
            };
            var spdgroup = new UIValueGrowthMax {
                ValueRef = spdBox, GrowthRef = spdGrowthBox, MaxRef = maxSpdBox
            };
            var luckgroup = new UIValueGrowthMax {
                ValueRef = luckBox, GrowthRef = luckGrowthBox, MaxRef = maxLuckBox
            };
            var defgroup = new UIValueGrowthMax {
                ValueRef = defBox, GrowthRef = defGrowthBox, MaxRef = maxDefBox
            };
            var resgroup = new UIValueGrowthMax {
                ValueRef = resBox, GrowthRef = resGrowthBox, MaxRef = maxResBox
            };

            ///------------STUFF UI IN A LIST/////
            uiStats.Add(new UIStat(new Stat("HP", 0, 0, 0, ""), hpgroup));
            uiStats.Add(new UIStat(new Stat("Str", 0, 0, 0, ""), strgroup));
            uiStats.Add(new UIStat(new Stat("Mag", 0, 0, 0, ""), maggroup));
            uiStats.Add(new UIStat(new Stat("Skill", 0, 0, 0, ""), skillgroup));
            uiStats.Add(new UIStat(new Stat("Spd", 0, 0, 0, ""), spdgroup));
            uiStats.Add(new UIStat(new Stat("Luck", 0, 0, 0, ""), luckgroup));
            uiStats.Add(new UIStat(new Stat("Def", 0, 0, 0, ""), defgroup));
            uiStats.Add(new UIStat(new Stat("Res", 0, 0, 0, ""), resgroup));

            if (loadedCharacters.Capacity == 0)
            {
                var one = new Character("Default");
                listBox1.Items.Add(one.Name);
                loadedCharacters.Add(one);
                listBox1.SelectedIndex = CurrentIndex;
            }

            CurrentCharacter = loadedCharacters[CurrentIndex];
            listBox1.SelectedIndexChanged += new System.EventHandler(Listchanged);
        }