public sbyte CrockPotMaxPriority = -128; //优先度最大值 #endregion //添加食材 private void CS_Add(string Name) { if (CS_Recipe_1 == "") { CS_Recipe_1 = Name; Image_CS_Food_1.Source = RSN.PictureShortName(Name); } else if (CS_Recipe_2 == "") { CS_Recipe_2 = Name; Image_CS_Food_2.Source = RSN.PictureShortName(Name); } else if (CS_Recipe_3 == "") { CS_Recipe_3 = Name; Image_CS_Food_3.Source = RSN.PictureShortName(Name); } else if (CS_Recipe_4 == "") { CS_Recipe_4 = Name; Image_CS_Food_4.Source = RSN.PictureShortName(Name); } if (CS_Recipe_1 != "" && CS_Recipe_2 != "" && CS_Recipe_3 != "" && CS_Recipe_4 != "") { CS_CrockPotCalculation(); } }
public ExpanderStackpanel(string textblockText = "", string imageSource = "") { InitializeComponent(); UCTextBlock.Text = textblockText; if (imageSource != "") { Thickness T = new Thickness(); T.Left = 32; UCTextBlock.Margin = T; UCImage.Visibility = Visibility.Visible; UCImage.Source = RSN.PictureShortName(imageSource); } }
public ButtonWithPicture(string imageSource, string imageSourceSecond = "") { InitializeComponent(); if (imageSourceSecond == "") { UCImage.Source = RSN.PictureShortName(RSN.ShortName(imageSource)); } else { UCImage.Source = RSN.PictureShortName(RSN.ShortName(imageSource, imageSourceSecond)); } //MessageBox.Show(UCImage.Source.ToString()); }
//窗口置顶 private void Se_button_Topmost_Click(object sender, RoutedEventArgs e) { if (Topmost == false) { Topmost = true; Se_image_Topmost.Source = RSN.PictureShortName(RSN.ShortName("Setting_Top_T")); Se_textblock_Topmost.Text = "永远置顶"; RegeditRW.RegWrite("Topmost", 1); } else { Topmost = false; Se_image_Topmost.Source = RSN.PictureShortName(RSN.ShortName("Setting_Top_F")); Se_textblock_Topmost.Text = "永不置顶"; RegeditRW.RegWrite("Topmost", 0); } }
//WrapPanel_Left_Character控件创建事件 private void Character_Click_Handle(string[] BWTTag) { try { WrapPanel_Left_Character.Children.Clear();//清空WrapPanel_Left_Character Grid GI = new Grid(); GI = PG.GridInterval(20); WrapPanel_Left_Character.Children.Add(GI); #region "图片 BWTTag[0]" Grid gPicture = PG.GridInit(180); Image iPicture = new Image(); iPicture.Height = 160; iPicture.Width = 140; iPicture.HorizontalAlignment = HorizontalAlignment.Center; iPicture.Source = RSN.PictureShortName(BWTTag[0]); gPicture.Children.Add(iPicture); WrapPanel_Left_Character.Children.Add(gPicture); #endregion GI = PG.GridInterval(5); WrapPanel_Left_Character.Children.Add(GI); #region "中文名 BWTTag[1]" Grid gName = PG.GridInit(); TextBlock tbName = new TextBlock(); tbName.HorizontalAlignment = HorizontalAlignment.Center; tbName.Text = BWTTag[1]; tbName.FontSize = 26.667; gName.Children.Add(tbName); WrapPanel_Left_Character.Children.Add(gName); #endregion #region "英文名 BWTTag[2]" Grid gEnName = PG.GridInit(); TextBlock tbEnName = new TextBlock(); tbEnName.HorizontalAlignment = HorizontalAlignment.Center; tbEnName.Text = BWTTag[2]; tbEnName.FontSize = 26.667; tbEnName.Margin = new Thickness(-5, 0, 0, 0); gEnName.Children.Add(tbEnName); WrapPanel_Left_Character.Children.Add(gEnName); #endregion #region "座右铭 BWTTag[3]" if (BWTTag[3] != "") { GI = PG.GridInterval(5); WrapPanel_Left_Character.Children.Add(GI); Grid gMotto = PG.GridInit(20); TextBlock tbMotto = new TextBlock(); tbMotto.HorizontalAlignment = HorizontalAlignment.Center; tbMotto.Text = BWTTag[3]; tbMotto.FontSize = 16; gMotto.Children.Add(tbMotto); WrapPanel_Left_Character.Children.Add(gMotto); } #endregion #region "描述_1 BWTTag[4]" if (BWTTag[4] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDescriptions_1 = PG.GridInit(); TextBlock tbDescriptions_1 = new TextBlock(); tbDescriptions_1.HorizontalAlignment = HorizontalAlignment.Left; tbDescriptions_1.Text = BWTTag[4]; tbDescriptions_1.FontSize = 14; tbDescriptions_1.Margin = new Thickness(25, 0, 0, 0); gDescriptions_1.Children.Add(tbDescriptions_1); WrapPanel_Left_Character.Children.Add(gDescriptions_1); } #endregion #region "描述_2 BWTTag[5]" if (BWTTag[5] != "") { Grid gDescriptions_2 = PG.GridInit(); TextBlock tbDescriptions_2 = new TextBlock(); tbDescriptions_2.HorizontalAlignment = HorizontalAlignment.Left; tbDescriptions_2.Text = BWTTag[5]; tbDescriptions_2.FontSize = 14; tbDescriptions_2.Margin = new Thickness(25, 0, 0, 0); gDescriptions_2.Children.Add(tbDescriptions_2); WrapPanel_Left_Character.Children.Add(gDescriptions_2); } #endregion #region "描述_3 BWTTag[6]" if (BWTTag[6] != "") { Grid gDescriptions_3 = PG.GridInit(); TextBlock tbDescriptions_3 = new TextBlock(); tbDescriptions_3.HorizontalAlignment = HorizontalAlignment.Left; tbDescriptions_3.Text = BWTTag[6]; tbDescriptions_3.FontSize = 14; tbDescriptions_3.Margin = new Thickness(25, 0, 0, 0); gDescriptions_3.Children.Add(tbDescriptions_3); WrapPanel_Left_Character.Children.Add(gDescriptions_3); } #endregion #region "生命 BWTTag[7]" if (BWTTag[7] != "") { GI = PG.GridInterval(25); WrapPanel_Left_Character.Children.Add(GI); Grid gHealth = PG.GridInit(15); PropertyBar pbHealth = new PropertyBar(); pbHealth.UCTextBlockName.Width = 57; pbHealth.UCTextBlockName.Text = "生命"; pbHealth.UCProgressBar.Value = Convert.ToDouble(BWTTag[7]) / 3; pbHealth.UCProgressBar.Foreground = BC.brushConverter(PBCGreen); pbHealth.UCTextBlockValue.Width = 32; pbHealth.UCTextBlockValue.Text = BWTTag[7]; gHealth.Children.Add(pbHealth); WrapPanel_Left_Character.Children.Add(gHealth); } #endregion #region "饥饿 BWTTag[8]" if (BWTTag[8] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gHunger = PG.GridInit(15); PropertyBar pbHunger = new PropertyBar(); pbHunger.UCTextBlockName.Width = 57; pbHunger.UCTextBlockName.Text = "饥饿"; pbHunger.UCProgressBar.Value = Convert.ToDouble(BWTTag[8]) / 3; pbHunger.UCProgressBar.Foreground = BC.brushConverter(PBCOrange); pbHunger.UCTextBlockValue.Width = 32; pbHunger.UCTextBlockValue.Text = BWTTag[8]; gHunger.Children.Add(pbHunger); if (BWTTag[1] == "沃尔夫冈") { Slider WolfgangSlider = new Slider(); WolfgangSlider.Style = (Style)FindResource("SliderStyle"); WolfgangSlider.Focusable = false; WolfgangSlider.IsSelectionRangeEnabled = true; WolfgangSlider.Value = 200; WolfgangSlider.Maximum = 300; WolfgangSlider.Minimum = 0; WolfgangSlider.SmallChange = 1; WolfgangSlider.LargeChange = 10; WolfgangSlider.ValueChanged += WolfgangSlider_ValueChanged; Thickness TSlider = new Thickness(); TSlider.Left = 72; TSlider.Right = 37; WolfgangSlider.Margin = TSlider; gHunger.Children.Add(WolfgangSlider); } WrapPanel_Left_Character.Children.Add(gHunger); } #endregion #region "精神 BWTTag[9]" if (BWTTag[9] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gSanity = PG.GridInit(15); PropertyBar pbSanity = new PropertyBar(); pbSanity.UCTextBlockName.Width = 57; pbSanity.UCTextBlockName.Text = "精神"; pbSanity.UCProgressBar.Value = Convert.ToDouble(BWTTag[9]) / 2.5; pbSanity.UCProgressBar.Foreground = BC.brushConverter(PBCRed); pbSanity.UCTextBlockValue.Width = 32; pbSanity.UCTextBlockValue.Text = BWTTag[9]; gSanity.Children.Add(pbSanity); WrapPanel_Left_Character.Children.Add(gSanity); } #endregion #region "树木值 BWTTag[10]" if (BWTTag[10] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDamage = PG.GridInit(15); PropertyBar pbDamage = new PropertyBar(); pbDamage.UCTextBlockName.Width = 57; pbDamage.UCTextBlockName.Text = "树木值"; pbDamage.UCProgressBar.Value = Convert.ToDouble(BWTTag[10]); pbDamage.UCProgressBar.Foreground = BC.brushConverter(PBCPink); pbDamage.UCTextBlockValue.Width = 32; pbDamage.UCTextBlockValue.Text = BWTTag[10]; gDamage.Children.Add(pbDamage); WrapPanel_Left_Character.Children.Add(gDamage); } #endregion #region "伤害 BWTTag[11]" if (BWTTag[11] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDamage = PG.GridInit(15); PropertyBar pbDamage = new PropertyBar(); pbDamage.UCTextBlockName.Width = 57; pbDamage.UCTextBlockName.Text = "伤害"; pbDamage.UCProgressBar.Value = Convert.ToDouble(BWTTag[11]) * 50; pbDamage.UCProgressBar.Foreground = BC.brushConverter(PBCBlue); pbDamage.UCTextBlockValue.Width = 32; if (BWTTag[1] != "海獭伍迪") { pbDamage.UCTextBlockValue.Text = BWTTag[11] + "X"; } else { pbDamage.UCTextBlockValue.Text = BWTTag[11]; } gDamage.Children.Add(pbDamage); WrapPanel_Left_Character.Children.Add(gDamage); } #endregion #region "伤害(白天) BWTTag[12]" if (BWTTag[12] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDamage = PG.GridInit(15); PropertyBar pbDamage = new PropertyBar(); pbDamage.UCTextBlockName.Width = 57; pbDamage.UCTextBlockName.Text = "伤害(白天)"; pbDamage.UCProgressBar.Value = Convert.ToDouble(BWTTag[12]) * 2.5; pbDamage.UCProgressBar.Foreground = BC.brushConverter(PBCBlue); pbDamage.UCTextBlockValue.Width = 32; pbDamage.UCTextBlockValue.Text = BWTTag[12]; gDamage.Children.Add(pbDamage); WrapPanel_Left_Character.Children.Add(gDamage); } #endregion #region "伤害(黄昏) BWTTag[13]" if (BWTTag[13] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDamage = PG.GridInit(15); PropertyBar pbDamage = new PropertyBar(); pbDamage.UCTextBlockName.Width = 57; pbDamage.UCTextBlockName.Text = "伤害(黄昏)"; pbDamage.UCProgressBar.Value = Convert.ToDouble(BWTTag[13]) * 2.5; pbDamage.UCProgressBar.Foreground = BC.brushConverter(PBCBlue); pbDamage.UCTextBlockValue.Width = 32; pbDamage.UCTextBlockValue.Text = BWTTag[13]; gDamage.Children.Add(pbDamage); WrapPanel_Left_Character.Children.Add(gDamage); } #endregion #region "伤害(夜晚) BWTTag[14]" if (BWTTag[14] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDamage = PG.GridInit(15); PropertyBar pbDamage = new PropertyBar(); pbDamage.UCTextBlockName.Width = 57; pbDamage.UCTextBlockName.Text = "伤害(夜晚)"; pbDamage.UCProgressBar.Value = Convert.ToDouble(BWTTag[14]) * 2.5; pbDamage.UCProgressBar.Foreground = BC.brushConverter(PBCBlue); pbDamage.UCTextBlockValue.Width = 32; pbDamage.UCTextBlockValue.Text = BWTTag[14]; gDamage.Children.Add(pbDamage); WrapPanel_Left_Character.Children.Add(gDamage); } #endregion #region "介绍 BWTTag[15]" GI = PG.GridInterval(20); WrapPanel_Left_Character.Children.Add(GI); Grid gIntroduce = PG.GridInit(); TextBlock tbIntroduce = new TextBlock(); tbIntroduce.HorizontalAlignment = HorizontalAlignment.Left; tbIntroduce.TextWrapping = TextWrapping.Wrap; tbIntroduce.Text = BWTTag[15]; tbIntroduce.FontSize = 13; tbIntroduce.Margin = new Thickness(15, 0, 0, 0); gIntroduce.Children.Add(tbIntroduce); WrapPanel_Left_Character.Children.Add(gIntroduce); #endregion GI = PG.GridInterval(20); WrapPanel_Left_Character.Children.Add(GI); WrapPanel_Left_Character_SizeChanged(null, null);//调整位置 } catch { } }
//处理XML private void HandleXml(XmlNode list) { if (WrapPanel_Left_Character != null) { WrapPanel_Left_Character.Children.Clear(); } if (WrapPanel_Right_Character != null) { WrapPanel_Right_Character.Children.Clear(); } if (WrapPanel_Left_Food != null) { WrapPanel_Left_Food.Children.Clear(); } if (WrapPanel_Right_Food != null) { WrapPanel_Right_Food.Children.Clear(); } foreach (XmlNode Node in list) { #region "人物" if (Node.Name == "CharacterNode") { foreach (XmlNode childNode in Node) { if (childNode.Name == "Character") { string Picture = ""; string Name = ""; string EnName = ""; string Motto = ""; string Descriptions_1 = ""; string Descriptions_2 = ""; string Descriptions_3 = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string LogMeter = ""; string Damage = ""; string DamageDay = ""; string DamageDusk = ""; string DamageNight = ""; string Introduce = ""; foreach (XmlNode Character in childNode) { switch (Character.Name) { case "Picture": Picture = RSN.ShortName(Character.InnerText, "GameResources/Character/"); break; case "Name": Name = Character.InnerText; break; case "EnName": EnName = Character.InnerText; break; case "Motto": Motto = Character.InnerText; break; case "Descriptions_1": Descriptions_1 = Character.InnerText; break; case "Descriptions_2": Descriptions_2 = Character.InnerText; break; case "Descriptions_3": Descriptions_3 = Character.InnerText; break; case "Health": Health = Character.InnerText; break; case "Hunger": Hunger = Character.InnerText; break; case "Sanity": Sanity = Character.InnerText; break; case "LogMeter": LogMeter = Character.InnerText; break; case "Damage": Damage = Character.InnerText; break; case "DamageDay": DamageDay = Character.InnerText; break; case "DamageDusk": DamageDusk = Character.InnerText; break; case "DamageNight": DamageNight = Character.InnerText; break; case "Introduce": Introduce = Character.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.Height = 205; BWT.Width = 140; BWT.ButtonGrid.Height = 190; BWT.ButtonGrid.Width = 140; BWT.GridPictureHeight.Height = new GridLength(160); BWT.UCImage.Height = 160; BWT.UCImage.Width = 140; BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.FontSize = 20; BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Motto, Descriptions_1, Descriptions_2, Descriptions_3, Health, Hunger, Sanity, LogMeter, Damage, DamageDay, DamageDusk, DamageNight, Introduce }; object obj = BWTTag; if (Name == "威尔逊") { Character_Click_Handle(BWTTag); } BWT.UCButton.Tag = obj; BWT.UCButton.Click += Character_Click; try { WrapPanel_Right_Character.Children.Add(BWT); } catch { } } } } #endregion #region "食物" if (Node.Name == "FoodNode") { foreach (XmlNode childNode in Node) { switch (childNode.Name) { #region "食谱" case "FoodRecipe": ExpanderStackpanel ESRecipe = new ExpanderStackpanel("食谱", "../Resources/CP_CrockPot.png"); WrapPanel_Right_Food.Children.Add(ESRecipe); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string PortableCrockPot = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Cooktime = ""; string Priority = ""; string NeedPicture_1 = ""; string Need_1 = ""; string NeedPicture_or = ""; string Need_or = ""; string NeedPicture_2 = ""; string Need_2 = ""; string NeedPicture_3 = ""; string Need_3 = ""; string Restrictions_1 = ""; string RestrictionsAttributes_1 = ""; string Restrictions_2 = ""; string RestrictionsAttributes_2 = ""; string Restrictions_3 = ""; string RestrictionsAttributes_3 = ""; string Restrictions_4 = ""; string RestrictionsAttributes_4 = ""; string Restrictions_5 = ""; string RestrictionsAttributes_5 = ""; string Recommend_1 = ""; string Recommend_2 = ""; string Recommend_3 = ""; string Recommend_4 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "PortableCrockPot": PortableCrockPot = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Cooktime": Cooktime = Food.InnerText; break; case "Priority": Priority = Food.InnerText; break; case "NeedPicture_1": NeedPicture_1 = Food.InnerText; break; case "Need_1": Need_1 = Food.InnerText; break; case "NeedPicture_or": NeedPicture_or = Food.InnerText; break; case "Need_or": Need_or = Food.InnerText; break; case "NeedPicture_2": NeedPicture_2 = Food.InnerText; break; case "Need_2": Need_2 = Food.InnerText; break; case "NeedPicture_3": NeedPicture_3 = Food.InnerText; break; case "Need_3": Need_3 = Food.InnerText; break; case "Restrictions_1": Restrictions_1 = Food.InnerText; if (Food.Attributes["pre"] != null) { RestrictionsAttributes_1 = Food.Attributes["pre"].Value; } break; case "Restrictions_2": Restrictions_2 = Food.InnerText; if (Food.Attributes["pre"] != null) { RestrictionsAttributes_2 = Food.Attributes["pre"].Value; } break; case "Restrictions_3": Restrictions_3 = Food.InnerText; if (Food.Attributes["pre"] != null) { RestrictionsAttributes_3 = Food.Attributes["pre"].Value; } break; case "Restrictions_4": Restrictions_4 = Food.InnerText; if (Food.Attributes["pre"] != null) { RestrictionsAttributes_4 = Food.Attributes["pre"].Value; } break; case "Restrictions_5": Restrictions_5 = Food.InnerText; if (Food.Attributes["pre"] != null) { RestrictionsAttributes_5 = Food.Attributes["pre"].Value; } break; case "Recommend_1": Recommend_1 = Food.InnerText; break; case "Recommend_2": Recommend_2 = Food.InnerText; break; case "Recommend_3": Recommend_3 = Food.InnerText; break; case "Recommend_4": Recommend_4 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, PortableCrockPot, Health, Hunger, Sanity, Perish, Cooktime, Priority, NeedPicture_1, Need_1, NeedPicture_or, Need_or, NeedPicture_2, Need_2, NeedPicture_3, Need_3, Restrictions_1, RestrictionsAttributes_1, Restrictions_2, RestrictionsAttributes_2, Restrictions_3, RestrictionsAttributes_3, Restrictions_4, RestrictionsAttributes_4, Restrictions_5, RestrictionsAttributes_5, Recommend_1, Recommend_2, Recommend_3, Recommend_4, Introduce }; object obj = BWTTag; if (Name == "培根煎蛋") { Food_Recipe_Click_Handle(BWTTag); } BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Recipe_Click; try { ESRecipe.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "肉类" case "FoodMeats": ExpanderStackpanel ESMeast = new ExpanderStackpanel("肉类", "../Resources/GameResources/Food/FC_Meats.png"); WrapPanel_Right_Food.Children.Add(ESMeast); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string AttributeValue = ""; string Attribute_2 = ""; string AttributeValue_2 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "AttributeValue": AttributeValue = Food.InnerText; break; case "Attribute_2": Attribute_2 = Food.InnerText; break; case "AttributeValue_2": AttributeValue_2 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, AttributeValue, Attribute_2, AttributeValue_2, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Click; try { ESMeast.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "蔬菜" case "FoodVegetables": ExpanderStackpanel ESVegetables = new ExpanderStackpanel("蔬菜", "../Resources/GameResources/Food/FC_Vegetables.png"); WrapPanel_Right_Food.Children.Add(ESVegetables); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string AttributeValue = ""; string Attribute_2 = ""; string AttributeValue_2 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "AttributeValue": AttributeValue = Food.InnerText; break; case "Attribute_2": Attribute_2 = Food.InnerText; break; case "AttributeValue_2": AttributeValue_2 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, AttributeValue, Attribute_2, AttributeValue_2, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Click; try { ESVegetables.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "水果" case "FoodFruit": ExpanderStackpanel ESFruit = new ExpanderStackpanel("水果", "../Resources/GameResources/Food/FC_Fruit.png"); WrapPanel_Right_Food.Children.Add(ESFruit); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string AttributeValue = ""; string Attribute_2 = ""; string AttributeValue_2 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "AttributeValue": AttributeValue = Food.InnerText; break; case "Attribute_2": Attribute_2 = Food.InnerText; break; case "AttributeValue_2": AttributeValue_2 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, AttributeValue, Attribute_2, AttributeValue_2, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Click; try { ESFruit.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "蛋类" case "FoodEggs": ExpanderStackpanel ESEggs = new ExpanderStackpanel("蛋类", "../Resources/GameResources/Food/FC_Eggs.png"); WrapPanel_Right_Food.Children.Add(ESEggs); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string AttributeValue = ""; string Attribute_2 = ""; string AttributeValue_2 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "AttributeValue": AttributeValue = Food.InnerText; break; case "Attribute_2": Attribute_2 = Food.InnerText; break; case "AttributeValue_2": AttributeValue_2 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, AttributeValue, Attribute_2, AttributeValue_2, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Click; try { ESEggs.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "其他" case "FoodOthers": ExpanderStackpanel ESOthers = new ExpanderStackpanel("其他", "../Resources/GameResources/Food/F_twigs.png"); WrapPanel_Right_Food.Children.Add(ESOthers); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string AttributeValue = ""; string Attribute_2 = ""; string AttributeValue_2 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "AttributeValue": AttributeValue = Food.InnerText; break; case "Attribute_2": Attribute_2 = Food.InnerText; break; case "AttributeValue_2": AttributeValue_2 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, AttributeValue, Attribute_2, AttributeValue_2, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Click; try { ESOthers.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "非食材" case "FoodNoFC": ExpanderStackpanel ESNoFC = new ExpanderStackpanel("非食材", "../Resources/GameResources/Food/F_petals.png"); WrapPanel_Right_Food.Children.Add(ESNoFC); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_NoFC_Click; try { ESNoFC.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion } } } #endregion } }
//烹饪结果图片 private void CS_image_Food_Result_Source(string source) { Image_CS_Food_Result.Source = RSN.PictureShortName(RSN.ShortName(source, CS_ResourceDir)); }