public CharacterPastLifeClass() { NumHeroic = ClassModel.GetNumClasses(); NumIconic = RaceModel.GetNumIconic(); PastLifeHerioc = new int[NumHeroic]; PastLifeIconic = new int[NumIconic]; //TODO: Epic Lives when destiny is done //NumEpic = HeroicNames = ClassModel.GetNames(); IconicNames = RaceModel.GetIconicNames(); //TODO: Epic Lives when destiny is done //EpicNames = for (int i = 0; i < NumHeroic; ++i) { PastLifeHerioc[i] = 0; } for (int i = 0; i < NumIconic; ++i) { PastLifeIconic[i] = 0; } //TODO:Epic Lives when destiny is done // for(int i = 0; i< NumEpic; ++i) // PastLifeEpic[i]=0; }
public PastLifeEditScreen() { InitializeComponent(); NumClasses = ClassModel.GetNumClasses(); NumSkills = SkillModel.GetNumSkills(); NumIconic = RaceModel.GetNumIconic(); AllowChange = false; int xpos = 4; int ypos = 0; float iconposx = 4; float iconposy = 0; int currentrow = 0; int PanelHeight = PastLifeClassPanel.Height; int PanelWidth = PastLifeClassPanel.Width; int maxrow = (int)System.Math.Ceiling((decimal)NumClasses / 4); StringBuilder controlName; ClassPanelEntry.ClassIcon = new IconClass[NumClasses]; //ClassPanelEntry.ClassPastLifeValue = new Label[NumClasses]; ClassPanelEntry.ClassPastLifeUpDown = new NumericUpDownWithBlank[NumClasses]; ClassNames = ClassModel.GetNames(); int xposstart = 10; for (int i = 0; i < NumClasses; i++) { //create Icon ClassPanelEntry.ClassIcon[i] = new IconClass("Classes\\" + ClassNames[i]); //create updown data entry controlName = new StringBuilder(); controlName.Append("ClassUpDown"); controlName.Append(i); ClassPanelEntry.ClassPastLifeUpDown[i] = new NumericUpDownWithBlank(); ClassPanelEntry.ClassPastLifeUpDown[i].Name = controlName.ToString(); PastLifeClassPanel.Controls.Add(ClassPanelEntry.ClassPastLifeUpDown[i]); ClassPanelEntry.ClassPastLifeUpDown[i].Size = new Size(39, 20); ClassPanelEntry.ClassPastLifeUpDown[i].Blank = true; ClassPanelEntry.ClassPastLifeUpDown[i].ValueChanged += ClassUpDownValueChanged; ClassPanelEntry.ClassPastLifeUpDown[i].Minimum = 1; //TODO: Hardcoded value! Remove into the database ClassPanelEntry.ClassPastLifeUpDown[i].Maximum = 3; //create position start point currentrow = (int)i / 4; xpos = (i - (currentrow * 4)) * 100 + xposstart; iconposx = ((float)xpos / (float)PanelWidth); ypos = 30 + ((PastLifeClassPanel.Height - 30) / maxrow) * currentrow; iconposy = ((float)ypos / (float)PanelHeight); // Place Icon and control ClassPanelEntry.ClassIcon[i].SetLocation(PastLifeClassPanel.Width, PastLifeClassPanel.Height, new PointF(iconposx, iconposy)); ClassPanelEntry.ClassPastLifeUpDown[i].Location = new Point(xpos + 40, ypos + 5); } //populate the Iconic past life panel xpos = 4; ypos = 0; iconposx = 0; iconposy = 0; currentrow = 0; PanelHeight = PastLifeIconicPanel.Height; PanelWidth = PastLifeIconicPanel.Width; maxrow = (int)System.Math.Ceiling((decimal)NumIconic / 4); IconicPanelEntry.IconicIcon = new IconClass[NumIconic]; IconicPanelEntry.IconicPastLifeUpDown = new NumericUpDownWithBlank[NumIconic]; IconicNames = RaceModel.GetIconicNames(); for (int i = 0; i < NumIconic; i++) { //create Icon IconicPanelEntry.IconicIcon[i] = new IconClass("Races\\" + IconicNames[i] + " Icon"); //create updown data entry controlName = new StringBuilder(); controlName.Append("IconicUpDown"); controlName.Append(i); IconicPanelEntry.IconicPastLifeUpDown[i] = new NumericUpDownWithBlank(); IconicPanelEntry.IconicPastLifeUpDown[i].Name = controlName.ToString(); PastLifeIconicPanel.Controls.Add(IconicPanelEntry.IconicPastLifeUpDown[i]); IconicPanelEntry.IconicPastLifeUpDown[i].Size = new Size(39, 20); IconicPanelEntry.IconicPastLifeUpDown[i].Blank = true; IconicPanelEntry.IconicPastLifeUpDown[i].ValueChanged += IconiocUpDownValueChanged; IconicPanelEntry.IconicPastLifeUpDown[i].Minimum = 1; //TODO: Hardcoded value! Remove into the database IconicPanelEntry.IconicPastLifeUpDown[i].Maximum = 3; //create position start point currentrow = (int)i / 4; xpos = (i - (currentrow * 4)) * 100 + xposstart; iconposx = ((float)xpos / (float)PanelWidth); ypos = 30 + ((PastLifeClassPanel.Height - 30) / maxrow) * currentrow; iconposy = ((float)ypos / (float)PanelHeight); // Place Icon and control IconicPanelEntry.IconicIcon[i].SetLocation(PastLifeIconicPanel.Width, PastLifeIconicPanel.Height, new PointF(iconposx, iconposy)); IconicPanelEntry.IconicPastLifeUpDown[i].Location = new Point(xpos + 40, ypos + 10); } //populate the skills panel SkillNames = Enum.GetNames(typeof(CharacterSkillClass.Skills)).ToList(); SkillTomePanelEntry.SkillLabel = new Label[NumSkills]; SkillTomePanelEntry.SkillUpDown = new NumericUpDownWithBlank[NumSkills]; xpos = 20; ypos = 0; Control[] control; NumericUpDownWithBlank upDown; int rowsplit = (int)System.Math.Ceiling((decimal)NumSkills / 2); for (int i = 0; i < NumSkills; i++) { ypos = 30 * i; if (i >= rowsplit) { ypos -= 30 * rowsplit; } SkillTomePanelEntry.SkillLabel[i] = new Label(); SkillTomeSubPanel.Controls.Add(SkillTomePanelEntry.SkillLabel[i]); SkillTomePanelEntry.SkillLabel[i].Text = SkillNames[i].Replace("_", " "); SkillTomePanelEntry.SkillLabel[i].Location = new Point(xpos, ypos + 3); SkillTomePanelEntry.SkillLabel[i].AutoSize = true; SkillTomePanelEntry.SkillLabel[i].ForeColor = System.Drawing.Color.Gold; SkillTomePanelEntry.SkillLabel[i].Font = new Font("Times New Roman", 9, FontStyle.Bold); SkillTomePanelEntry.SkillLabel[i].Name = "SkillLabel" + i; SkillTomePanelEntry.SkillUpDown[i] = new NumericUpDownWithBlank(); SkillTomeSubPanel.Controls.Add(SkillTomePanelEntry.SkillUpDown[i]); SkillTomePanelEntry.SkillUpDown[i].Location = new Point(xpos + 120, ypos); SkillTomePanelEntry.SkillUpDown[i].Name = "SkillUpDown" + SkillNames[i]; SkillTomePanelEntry.SkillUpDown[i].Size = new Size(39, 20); SkillTomePanelEntry.SkillUpDown[i].Blank = true; SkillTomePanelEntry.SkillUpDown[i].Minimum = 1; SkillTomePanelEntry.SkillUpDown[i].ValueChanged += SkillUpDownValueChanged; System.Guid SkillID = SkillModel.GetIdFromName(SkillNames[i].Replace("_", " ")); int UpDownMax = TomeModel.GetMaxBonus(SkillID); SkillTomePanelEntry.SkillUpDown[i].Maximum = UpDownMax; if (i >= rowsplit - 1) { xpos = 200; } } AllowChange = true; for (int i = 0; i < NumSkills; ++i) { SetSkillUpDown(SkillTomePanelEntry.SkillUpDown[i]); } SetAbilityUpDown(StrUpDown); SetAbilityUpDown(DexUpDown); SetAbilityUpDown(ConUpDown); SetAbilityUpDown(IntUpDown); SetAbilityUpDown(WisUpDown); SetAbilityUpDown(ChaUpDown); for (int i = 0; i < NumClasses; ++i) { controlName = new StringBuilder(); controlName.Append("ClassUpDown"); controlName.Append(i); control = Controls.Find(controlName.ToString(), true); upDown = (NumericUpDownWithBlank)control[0]; if (upDown == null) { continue; } SetClassUpDown(upDown); } for (int i = 0; i < NumIconic; ++i) { controlName = new StringBuilder(); controlName.Append("IconicUpDown"); controlName.Append(i); control = Controls.Find(controlName.ToString(), true); upDown = (NumericUpDownWithBlank)control[0]; if (upDown == null) { continue; } SetIconicUpDown(upDown); } ClassTooltipDisplay = -1; IconicTooltipDisplay = -1; }