private void limitSkill_BindData(LimitSkillMaster skill, ActiveSkillMaster[] laSkill) { if (skill == null || skill.id == 0) { UnitInfo_LimitSkill.Visibility = Visibility.Collapsed; return; } UnitInfo_LimitSkill.Visibility = Visibility.Visible; limitSkill_id.Text = skill.id.ToString(); limitSkill_name.Text = skill.name; limitSkill_general_text.Document = Utility.ParseTextToDocument(skill.general_text); limitSkill_coefficient.Text = skill.coefficient.ToString(); UnitInfo_LimitSkill_AS.Children.Clear(); for (int i = 0; i < 3; i++) { ActiveSkillMaster askill = laSkill[i]; Grid grid = new Grid(); if (askill.id == 0) { continue; } grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); TextBlock tblTitle = new TextBlock() { FontWeight = FontWeights.Bold, Text = string.Format("L_AS{0}", i.ToString()) }; tblTitle.SetValue(Grid.ColumnProperty, 0); tblTitle.SetValue(Grid.RowProperty, 0); grid.Children.Add(tblTitle); TextBox tbId = new TextBox() { Text = askill.id.ToString() }; tbId.SetValue(Grid.ColumnProperty, 1); tbId.SetValue(Grid.RowProperty, 0); grid.Children.Add(tbId); TextBox tbName = new TextBox() { Text = askill.name }; tbName.SetValue(Grid.ColumnProperty, 2); tbName.SetValue(Grid.RowProperty, 0); tbName.SetValue(Grid.ColumnSpanProperty, 2); grid.Children.Add(tbName); RichTextBox rtb = new RichTextBox() { Document = Utility.ParseTextToDocument(askill.text) }; rtb.SetValue(Grid.ColumnProperty, 0); rtb.SetValue(Grid.RowProperty, 1); rtb.SetValue(Grid.ColumnSpanProperty, 4); grid.Children.Add(rtb); TextBlock tblType = new TextBlock() { Text = "type" }; tblType.SetValue(Grid.ColumnProperty, 0); tblType.SetValue(Grid.RowProperty, 2); grid.Children.Add(tblType); TextBox tbTypeId = new TextBox() { Text = askill.type.ToString() }; tbTypeId.SetValue(Grid.ColumnProperty, 1); tbTypeId.SetValue(Grid.RowProperty, 2); grid.Children.Add(tbTypeId); TextBox tbType = new TextBox() { Text = Utility.ParseSkillType((ActiveSkillType)askill.type) }; tbType.SetValue(Grid.ColumnProperty, 2); tbType.SetValue(Grid.RowProperty, 2); tbType.SetValue(Grid.ColumnSpanProperty, 2); grid.Children.Add(tbType); TextBlock tblAttr = new TextBlock() { Text = "attribute" }; tblAttr.SetValue(Grid.ColumnProperty, 0); tblAttr.SetValue(Grid.RowProperty, 3); grid.Children.Add(tblAttr); TextBox tbAttr = new TextBox() { Text = Utility.ParseAttributeToString(askill.attribute) }; tbAttr.SetValue(Grid.ColumnProperty, 1); tbAttr.SetValue(Grid.RowProperty, 3); grid.Children.Add(tbAttr); TextBox tbSubAttr = new TextBox() { Text = Utility.ParseAttributeToString(askill.sub_attr) }; tbSubAttr.SetValue(Grid.ColumnProperty, 2); tbSubAttr.SetValue(Grid.RowProperty, 3); grid.Children.Add(tbSubAttr); //gridStyle Grid gridStyle = new Grid(); gridStyle.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50) }); gridStyle.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); TextBlock tblStyle = new TextBlock() { Text = "style" }; tblStyle.SetValue(Grid.ColumnProperty, 0); gridStyle.Children.Add(tblStyle); TextBox tbStyle = new TextBox() { Text = Utility.ParseStyletype(askill.style) }; tbStyle.SetValue(Grid.ColumnProperty, 1); gridStyle.Children.Add(tbStyle); gridStyle.SetValue(Grid.ColumnProperty, 3); gridStyle.SetValue(Grid.RowProperty, 3); grid.Children.Add(gridStyle); //gridInfo Grid gridInfo = new Grid(); gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); TextBlock tblPhase = new TextBlock() { Text = "phase" }; tblPhase.SetValue(Grid.ColumnProperty, 0); gridInfo.Children.Add(tblPhase); TextBox tbPhase = new TextBox() { Text = ((SkillPhase)askill.phase).ToString() }; tbPhase.SetValue(Grid.ColumnProperty, 1); gridInfo.Children.Add(tbPhase); TextBlock tblSoul = new TextBlock() { Text = "soul" }; tblSoul.SetValue(Grid.ColumnProperty, 2); gridInfo.Children.Add(tblSoul); WarningTextBox tbSoul = new WarningTextBox(){ Text = askill.soul.ToString(), SafeValue = "0" }; tbSoul.SetValue(Grid.ColumnProperty, 3); gridInfo.Children.Add(tbSoul); TextBlock tblLimitNum = new TextBlock() { Text = "limit_num" }; tblLimitNum.SetValue(Grid.ColumnProperty, 4); gridInfo.Children.Add(tblLimitNum); WarningTextBox tbLimitNum = new WarningTextBox() { Text = askill.limit_num.ToString(), SafeValue = "0" }; tbLimitNum.SetValue(Grid.ColumnProperty, 5); gridInfo.Children.Add(tbLimitNum); gridInfo.SetValue(Grid.ColumnSpanProperty, 4); gridInfo.SetValue(Grid.RowProperty, 4); grid.Children.Add(gridInfo); //gridNum Grid gridNum = new Grid(); gridNum.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); gridNum.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); gridNum.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); gridNum.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); TextBox tbNum = new TextBox() { Text = askill.num.ToString() }; tbNum.SetValue(Grid.ColumnProperty, 0); gridNum.Children.Add(tbNum); TextBox tbNum01 = new TextBox() { Text = askill.num_01.ToString() }; tbNum01.SetValue(Grid.ColumnProperty, 1); gridNum.Children.Add(tbNum01); TextBox tbNum02 = new TextBox() { Text = askill.num_02.ToString() }; tbNum02.SetValue(Grid.ColumnProperty, 2); gridNum.Children.Add(tbNum02); TextBox tbNum03 = new TextBox() { Text = askill.num_03.ToString() }; tbNum03.SetValue(Grid.ColumnProperty, 3); gridNum.Children.Add(tbNum03); gridNum.SetValue(Grid.ColumnSpanProperty, 4); gridNum.SetValue(Grid.RowProperty, 5); grid.Children.Add(gridNum); UnitInfo_LimitSkill_AS.Children.Add(grid); } }
private void InitSkills(int p_skill_id, int a_skill_id, int panel_skill_id, int limit_skill_id, int level = 1) { PartySkillRankMaster partyRank = DAL.ToSingle<PartySkillRankMaster>(string.Format("SELECT * FROM PARTY_SKILL_RANK_MASTER WHERE id={0}", p_skill_id)); ActiveSkillRankMaster activeRank = DAL.ToSingle<ActiveSkillRankMaster>(string.Format("SELECT * FROM ACTIVE_SKILL_RANK_MASTER WHERE id={0}", a_skill_id)); PanelSkillRankMaster panelRank = DAL.ToSingle<PanelSkillRankMaster>(string.Format("SELECT * FROM PANEL_SKILL_RANK_MASTER WHERE id={0}", panel_skill_id)); LimitSkillRankMaster limitRank = DAL.ToSingle<LimitSkillRankMaster>(string.Format("SELECT * FROM LIMIT_SKILL_RANK_MASTER WHERE id={0}", limit_skill_id)); //get real skill id from rank int partySkillId = 0, activeSkillId = 0, panelSkillId = 0, limitSkillId = 0; //party if (partyRank == null) { partySkillId = 0; } else if (level < 10) { partySkillId = partyRank.skill_01_09; } else if (level < 20) { partySkillId = partyRank.skill_10_19; } else if (level < 30) { partySkillId = partyRank.skill_20_29; } else if (level < 40) { partySkillId = partyRank.skill_30_39; } else if (level < 50) { partySkillId = partyRank.skill_40_49; } else if (level < 60) { partySkillId = partyRank.skill_50_59; } else if (level < 70) { partySkillId = partyRank.skill_60_69; } else if (level < 80) { partySkillId = partyRank.skill_70_79; } else if (level < 90) { partySkillId = partyRank.skill_80_89; } else if (level < 100) { partySkillId = partyRank.skill_90_99; } else if (level == 100) { partySkillId = partyRank.skill_100; } else { partySkillId = 0; } //active if (activeRank == null) { activeSkillId = 0; } else if (level < 10) { activeSkillId = activeRank.skill_01_09; } else if (level < 20) { activeSkillId = activeRank.skill_10_19; } else if (level < 30) { activeSkillId = activeRank.skill_20_29; } else if (level < 40) { activeSkillId = activeRank.skill_30_39; } else if (level < 50) { activeSkillId = activeRank.skill_40_49; } else if (level < 60) { activeSkillId = activeRank.skill_50_59; } else if (level < 70) { activeSkillId = activeRank.skill_60_69; } else if (level < 80) { activeSkillId = activeRank.skill_70_79; } else if (level < 90) { activeSkillId = activeRank.skill_80_89; } else if (level < 100) { activeSkillId = activeRank.skill_90_99; } else if (level == 100) { activeSkillId = activeRank.skill_100; } else { activeSkillId = 0; } //panel if (panelRank == null) { panelSkillId = 0; } else if (level < 10) { panelSkillId = panelRank.skill_01_09; } else if (level < 20) { panelSkillId = panelRank.skill_10_19; } else if (level < 30) { panelSkillId = panelRank.skill_20_29; } else if (level < 40) { panelSkillId = panelRank.skill_30_39; } else if (level < 50) { panelSkillId = panelRank.skill_40_49; } else if (level < 60) { panelSkillId = panelRank.skill_50_59; } else if (level < 70) { panelSkillId = panelRank.skill_60_69; } else if (level < 80) { panelSkillId = panelRank.skill_70_79; } else if (level < 90) { panelSkillId = panelRank.skill_80_89; } else if (level < 100) { panelSkillId = panelRank.skill_90_99; } else if (level == 100) { panelSkillId = panelRank.skill_100; } else { panelSkillId = 0; } //limit if (limitRank == null) { limitSkillId = 0; } else if (level < 10) { limitSkillId = limitRank.skill_01_09; } else if (level < 20) { limitSkillId = limitRank.skill_10_19; } else if (level < 30) { limitSkillId = limitRank.skill_20_29; } else if (level < 40) { limitSkillId = limitRank.skill_30_39; } else if (level < 50) { limitSkillId = limitRank.skill_40_49; } else if (level < 60) { limitSkillId = limitRank.skill_50_59; } else if (level < 70) { limitSkillId = limitRank.skill_60_69; } else if (level < 80) { limitSkillId = limitRank.skill_70_79; } else if (level < 90) { limitSkillId = limitRank.skill_80_89; } else if (level < 100) { limitSkillId = limitRank.skill_90_99; } else if (level == 100) { limitSkillId = limitRank.skill_100; } else { limitSkillId = 0; } partySkill = DAL.ToSingle<PartySkillMaster>(string.Format("SELECT * FROM PARTY_SKILL_MASTER WHERE id={0}", partySkillId)); activeSkill = DAL.ToSingle<ActiveSkillMaster>(string.Format("SELECT * FROM ACTIVE_SKILL_MASTER WHERE id={0}", activeSkillId)); panelSkill = DAL.ToSingle<PanelSkillMaster>(string.Format("SELECT * FROM PANEL_SKILL_MASTER WHERE id={0}", panelSkillId)); limitSkill = DAL.ToSingle<LimitSkillMaster>(string.Format("SELECT * FROM LIMIT_SKILL_MASTER WHERE id={0}", limitSkillId)); limitActiveSkill = new ActiveSkillMaster[3]; if ((limitSkill == null || limitSkill.id == 0) == false) { limitActiveSkill[0] = DAL.ToSingle<ActiveSkillMaster>(string.Format("SELECT * FROM ACTIVE_SKILL_MASTER WHERE id={0}", limitSkill.skill_id_00)); limitActiveSkill[1] = DAL.ToSingle<ActiveSkillMaster>(string.Format("SELECT * FROM ACTIVE_SKILL_MASTER WHERE id={0}", limitSkill.skill_id_01)); limitActiveSkill[2] = DAL.ToSingle<ActiveSkillMaster>(string.Format("SELECT * FROM ACTIVE_SKILL_MASTER WHERE id={0}", limitSkill.skill_id_02)); } }