Exemple #1
0
        public SkillTomePanel()
        {
            int posx = 10;
            int posy = 60;
            int MaxLevel;

            MaxLevel = DDOCharacterPlanner.Utility.Constant.MaxLevels;
            InitializeComponent();
            SkillNames = Enum.GetNames(typeof(CharacterSkillClass.Skills)).ToList();
            NumSkills  = SkillNames.Count;
            List <Model.Tome.TomeModel> TomeList;

            TomeList = Model.Tome.TomeModel.GetAllByType("Skill");
            TomeList.Sort((x, y) => x.TomeLongName.CompareTo(y.TomeLongName));
            Dictionary <Guid, string> SkillbyID;

            SkillbyID = new Dictionary <Guid, string>();
            SkillbyID = SkillModel.GetNamesByID();
            //get max number of Tomes
            int TomeCount = TomeModel.GetCountByModifiedId(SkillbyID.Keys.First());

            SkillTomePanelEntry              = new SkillTomePanelEntryStruct();
            SkillTomePanelEntry.SkillLabel   = new Label[NumSkills];
            SkillTomePanelEntry.PastLifeTome = new Label[NumSkills];
            SkillTomePanelEntry.TomeUpDown   = new NumericUpDownWithBlank[NumSkills, TomeCount];

            //create Skill Labels
            for (int i = 0; i < NumSkills; ++i)
            {
                SkillTomePanelEntry.SkillLabel[i]      = new Label();
                SkillTomePanelEntry.SkillLabel[i].Name = SkillNames[i].ToString() + "Label";
                SkillTomePanelEntry.SkillLabel[i].Text = SkillNames[i].ToString().Replace("_", " ");

                SkillTomePanelEntry.SkillLabel[i].Location  = new Point(posx, posy + 27 * i);
                SkillTomePanelEntry.SkillLabel[i].Width     = 100;
                SkillTomePanelEntry.SkillLabel[i].Font      = new Font("Times New Roman", 9, FontStyle.Bold);
                SkillTomePanelEntry.SkillLabel[i].TextAlign = ContentAlignment.MiddleLeft;
            }
            //create past life Labels
            posx = 500;
            for (int i = 0; i < NumSkills; ++i)
            {
                SkillTomePanelEntry.PastLifeTome[i]      = new Label();
                SkillTomePanelEntry.PastLifeTome[i].Name = SkillNames[i].ToString() + "PastLifeLabel";
                SkillTomePanelEntry.PastLifeTome[i].Text = "0";

                SkillTomePanelEntry.PastLifeTome[i].Location  = new Point(posx, posy + 27 * i);
                SkillTomePanelEntry.PastLifeTome[i].Width     = 50;
                SkillTomePanelEntry.PastLifeTome[i].Font      = new Font("Times New Roman", 9, FontStyle.Bold);
                SkillTomePanelEntry.PastLifeTome[i].TextAlign = ContentAlignment.MiddleCenter;
            }

            posx = 127;

            foreach (TomeModel Tome in TomeList)
            {
                int skillIndex;
                int skillBonus;
                skillIndex = SkillNames.IndexOf(SkillbyID[Tome.ModifiedID].Replace(" ", "_"));
                skillBonus = Tome.TomeBonus - 1;

                SkillTomePanelEntry.TomeUpDown[skillIndex, skillBonus]          = new NumericUpDownWithBlank();
                SkillTomePanelEntry.TomeUpDown[skillIndex, skillBonus].Name     = SkillbyID[Tome.ModifiedID] + "UpDwn" + (skillBonus + 1);
                SkillTomePanelEntry.TomeUpDown[skillIndex, skillBonus].Location = new Point(posx + (skillBonus) * 70, posy + skillIndex * 27);
                SkillTomePanelEntry.TomeUpDown[skillIndex, skillBonus].Width    = 40;

                SkillTomePanelEntry.TomeUpDown[skillIndex, skillBonus].Minimum = 1;
                SkillTomePanelEntry.TomeUpDown[skillIndex, skillBonus].Maximum = MaxLevel;
                if (CharacterManagerClass.CharacterManager.CharacterSkill.Tome[skillIndex, skillBonus] > 0)
                {
                    SkillTomePanelEntry.TomeUpDown[skillIndex, skillBonus].Value = CharacterManagerClass.CharacterManager.CharacterSkill.Tome[skillIndex, skillBonus];
                    SkillTomePanelEntry.TomeUpDown[skillIndex, skillBonus].Blank = false;
                }
                else
                {
                    SkillTomePanelEntry.TomeUpDown[skillIndex, skillBonus].Blank = true;
                }
                SkillTomePanelEntry.TomeUpDown[skillIndex, skillBonus].ValueChanged += TomeChanged;
            }



            foreach (Label newcontrol in SkillTomePanelEntry.SkillLabel)
            {
                if (newcontrol != null)
                {
                    Skilltome.Controls.Add(newcontrol);
                }
            }
            foreach (Label newcontrol in SkillTomePanelEntry.PastLifeTome)
            {
                if (newcontrol != null)
                {
                    Skilltome.Controls.Add(newcontrol);
                }
            }
            foreach (NumericUpDownWithBlank newcontrol in SkillTomePanelEntry.TomeUpDown)
            {
                if (newcontrol != null)
                {
                    Skilltome.Controls.Add(newcontrol);
                }
            }

            //set Pastlife tomeValues
            handlePastlifeSkillTomeChange();

            //apply Skin
            SkillTomePanelSkin();

            // listen for events
            UIManagerClass.UIManager.ScreenMessenger.RegisterListen(UIManagerClass.ChildScreen.SkillTomeEditScreen, ScreenMessengerClass.ChangeList.SkillChange, handlePastlifeSkillTomeChange);
        }