예제 #1
0
        private void LoadData(GoodPet c)
        {
            GoodImage.Source = new BitmapImage(new Uri(c.Picture));
            GoodName.Text    = c.Name;
            GoodEnName.Text  = c.EnName;
            // 宠物死亡
            GoodDeadWrapPicButton.Source = StringProcess.GetGameResourcePath(c.Dead);
            // 跟随宠物
            var thickness = new Thickness(5, 0, 0, 0);

            if (c.Follow == null || c.Follow.Count == 0)
            {
                GoodFollowTextBlock.Visibility = Visibility.Collapsed;
                GoodFollowWrapPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                foreach (var picPath in c.Follow)
                {
                    var picButton = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin      = thickness,
                        Source      = StringProcess.GetGameResourcePath(picPath),
                        PictureSize = 90
                    };
                    picButton.Tapped += Good_Jump_Tapped;
                    GoodFollowWrapPanel.Children.Add(picButton);
                }
            }
            GoodIntroduction.Text = c.Introduction;
            ConsolePre.Text       = $"c_give(\"{c.Console}\",";
        }
        private void LoadData(GoodSapling c)
        {
            GoodImage.Source = new BitmapImage(new Uri(c.Picture));
            GoodName.Text    = c.Name;
            GoodEnName.Text  = c.EnName;
            // 来源于植物
            var thickness = new Thickness(5, 0, 0, 0);

            if (c.Plants == null || c.Plants.Count == 0)
            {
                GoodSourcePlantsTextBlock.Visibility = Visibility.Collapsed;
                GoodSourcePlantsWrapPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                foreach (var picPath in c.Plants)
                {
                    var picButton = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin      = thickness,
                        Source      = StringProcess.GetGameResourcePath(picPath),
                        PictureSize = 100
                    };
                    GoodSourcePlantsWrapPanel.Children.Add(picButton);
                }
            }
            GoodIntroduction.Text = c.Introduction;
            ConsolePre.Text       = $"c_give(\"{c.Console}\",";
        }
 private void LoadData(GoodTurf c)
 {
     GoodImage.Source = new BitmapImage(new Uri(c.Picture));
     GoodName.Text    = c.Name;
     GoodEnName.Text  = c.EnName;
     // 制作科技
     if (string.IsNullOrEmpty(c.Make))
     {
         GoodMakeStackPanel.Visibility = Visibility.Collapsed;
     }
     else
     {
         GoodMakePicButton.Source = StringProcess.GetGameResourcePath(c.Make);
     }
     // 草皮纹理
     GoodSourceTextureWrapPanel.Source = new BitmapImage(new Uri(StringProcess.GetGameResourcePath(c.Texture)));
     GoodIntroduction.Text             = c.Introduction;
     // 控制台
     if (c.Console != null)
     {
         ConsolePre.Text = $"c_give(\"{c.Console}\",";
     }
     else
     {
         CopyGrid.Visibility = Visibility.Collapsed;
     }
 }
        /// <summary>
        /// 显示燃烧后资源
        /// </summary>
        /// <param name="index">索引序号</param>
        private void ShowResourcesBurned(int index)
        {
            NaturalResourcesBurnedStackPanel.Children.Clear();
            var thickness = new Thickness(20, 0, 0, 0);

            if (_treeResourcesBurnedListStringList[index].Count == 0)
            {
                NaturalResourcesBurnedTextBlock.Visibility  = Visibility.Collapsed;
                NaturalResourcesBurnedStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                NaturalResourcesBurnedTextBlock.Visibility = Visibility.Visible;
                NaturalResourcesBurnedTextBlock.Visibility = Visibility.Visible;
                foreach (var str in _treeResourcesBurnedListStringList[index])
                {
                    //数量分割点
                    var breakPosition = str.IndexOf('|');
                    // 图片
                    var resourceSource = str.Substring(0, breakPosition);
                    // 数量文本
                    var resourceText = str.Substring(breakPosition + 1);
                    var picButton    = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin = thickness,
                        Source = StringProcess.GetGameResourcePath(resourceSource),
                        Text   = resourceText
                    };
                    //picButton.Click += Creature_Jump_Click;
                    NaturalResourcesBurnedStackPanel.Children.Add(picButton);
                }
            }
        }
예제 #5
0
        public async Task Deserialize()
        {
            _naturalBiomesData.Clear();
            var natural = JsonConvert.DeserializeObject <NaturalRootObject>(await StringProcess.GetJsonString("Natural.json"));

            foreach (var natureBiomesItems in natural.Biomes.NatureBiomes)
            {
                natureBiomesItems.Picture = StringProcess.GetGameResourcePath(natureBiomesItems.Picture);
                _naturalBiomesData.Add(natureBiomesItems);
            }
            foreach (var natureSmallPlantItems in natural.SmallPlants.NatureSmallPlant)
            {
                natureSmallPlantItems.Picture = StringProcess.GetGameResourcePath(natureSmallPlantItems.Picture);
                _naturalSmallPlantData.Add(natureSmallPlantItems);
            }
            foreach (var natureTreesItems in natural.Trees.NatureTree)
            {
                natureTreesItems.Picture = StringProcess.GetGameResourcePath(natureTreesItems.Picture);
                _naturalTreesData.Add(natureTreesItems);
            }
            foreach (var natureCreatureNestItems in natural.CreatureNests.NatureCreatureNest)
            {
                natureCreatureNestItems.Picture = StringProcess.GetGameResourcePath(natureCreatureNestItems.Picture);
                _naturalCreatureNestData.Add(natureCreatureNestItems);
            }
        }
예제 #6
0
        private void LoadData(GoodUnlock c)
        {
            GoodImage.Source = new BitmapImage(new Uri(c.Picture));
            GoodName.Text    = c.Name;
            GoodEnName.Text  = c.EnName;
            // 掉落
            var thickness = new Thickness(5, 0, 0, 0);

            if (c.DropBy == null || c.DropBy.Count == 0)
            {
                GoodDropByTextBlock.Visibility = Visibility.Collapsed;
                GoodDropByWrapPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                foreach (var picPath in c.DropBy)
                {
                    var picButton = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin      = thickness,
                        Source      = StringProcess.GetGameResourcePath(picPath),
                        PictureSize = 75
                    };
                    GoodDropByWrapPanel.Children.Add(picButton);
                }
            }
            // 解锁人物
            GoodUnlockCharacterWrapPicButton.Source = StringProcess.GetGameResourcePath(c.UnlockCharacter);
            GoodIntroduction.Text = c.Introduction;
            ConsolePre.Text       = $"c_give(\"{c.Console}\",";
        }
예제 #7
0
 /// <summary>
 /// 显示生物
 /// </summary>
 /// <param name="index"></param>
 private void ShowCreature(int index)
 {
     NaturalCreatureStackPanel.Children.Clear();
     if (_creatureNestCreatureListStringList[index].Count == 0)
     {
         NaturalCreatureTextBlock.Visibility  = Visibility.Collapsed;
         NaturalCreatureStackPanel.Visibility = Visibility.Collapsed;
     }
     else
     {
         NaturalCreatureTextBlock.Visibility  = Visibility.Visible;
         NaturalCreatureStackPanel.Visibility = Visibility.Visible;
         var thickness  = new Thickness(20, 0, 0, 0);
         var stackPanel = new StackPanel
         {
             Orientation = Orientation.Horizontal,
             Margin      = thickness
         };
         foreach (var creature in _creatureNestCreatureListStringList[index])
         {
             var picButton = new PicButton
             {
                 HorizontalAlignment = HorizontalAlignment.Left,
                 Source      = StringProcess.GetGameResourcePath(creature),
                 PictureSize = 75
             };
             stackPanel.Children.Add(picButton);
         }
         NaturalCreatureStackPanel.Children.Add(stackPanel);
     }
 }
 private void LoadData(Science c)
 {
     ScienceImage.Source   = new BitmapImage(new Uri(c.Picture));
     ScienceName.Text      = c.Name;
     ScienceEnName.Text    = c.EnName;
     Need1PicButton.Source = StringProcess.GetGameResourcePath(c.Need1);
     Need1PicButton.Text   = $"×{c.Need1Value}";
     if (c.Need2 != null)
     {
         Need2PicButton.Source     = StringProcess.GetGameResourcePath(c.Need2);
         Need2PicButton.Text       = $"×{c.Need2Value}";
         Need2PicButton.Visibility = Visibility.Visible;
     }
     if (c.Need3 != null)
     {
         Need3PicButton.Source     = StringProcess.GetGameResourcePath(c.Need3);
         Need3PicButton.Text       = $"×{c.Need3Value}";
         Need3PicButton.Visibility = Visibility.Visible;
     }
     if (c.Unlock == null && c.UnlockCharcter == null && c.UnlockBlueprint == null)
     {
         ScienceUnlockStackPanel.Visibility = Visibility.Collapsed;
     }
     else
     {
         if (c.Unlock != null && c.Unlock.Count > 0)
         {
             UnlockPicButton.Visibility = Visibility.Visible;
             UnlockPicButton.Source     = StringProcess.GetGameResourcePath(c.Unlock[0]);
             if (c.Unlock.Count == 2)
             {
                 Unlock2PicButton.Visibility = Visibility.Visible;
                 Unlock2PicButton.Source     = StringProcess.GetGameResourcePath(c.Unlock[1]);
             }
         }
         if (c.UnlockCharcter != null)
         {
             UnlockCharcterButton.Visibility = Visibility.Visible;
             UnlockCharcterImage.Source      = new BitmapImage(new Uri(StringProcess.GetGameResourcePath(c.UnlockCharcter)));
             _unlockCharcter = StringProcess.GetGameResourcePath(c.UnlockCharcter);
         }
         if (c.UnlockBlueprint != null)
         {
             UnlockBlueprintPicButton.Visibility = Visibility.Visible;
             UnlockBlueprintPicButton.Source     = StringProcess.GetGameResourcePath(c.UnlockBlueprint);
         }
     }
     ScienceIntroduction.Text = c.Introduction;
     // 控制台
     if (string.IsNullOrEmpty(c.ConsoleCommand))
     {
         ConsolePre.Text = $"c_give(\"{c.Console}\",";
     }
     else
     {
         ConsolePre.Text = c.ConsoleCommand + $"(\"{c.Console}\",";
     }
 }
        private void LoadData(GoodMaterial c)
        {
            GoodImage.Source = new BitmapImage(new Uri(c.Picture));
            GoodName.Text    = c.Name;
            GoodEnName.Text  = c.EnName;
            // 可制作科技/来源于生物
            var thickness = new Thickness(5, 0, 0, 0);

            if (c.Science == null || c.Science.Count == 0)
            {
                GoodScienceTextBlock.Visibility = Visibility.Collapsed;
                GoodScienceWrapPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                foreach (var picPath in c.Science)
                {
                    var picButton = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin = thickness,
                        Source = StringProcess.GetGameResourcePath(picPath)
                    };
                    picButton.Tapped += Good_Jump_Tapped;
                    GoodScienceWrapPanel.Children.Add(picButton);
                }
            }
            if (c.SourceCreature == null || c.SourceCreature.Count == 0)
            {
                GoodSourceCreatureTextBlock.Visibility = Visibility.Collapsed;
                GoodSourceCreatureWrapPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                foreach (var picPath in c.SourceCreature)
                {
                    var picButton = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin = thickness,
                        Source = StringProcess.GetGameResourcePath(picPath)
                    };
                    picButton.Tapped += Good_Jump_Tapped;
                    GoodSourceCreatureWrapPanel.Children.Add(picButton);
                }
            }
            // 介绍
            GoodIntroduction.Text = c.Introduction;
            // 控制台
            ConsolePre.Text = $"c_give(\"{c.Console}\",";
        }
        public async Task Deserialize()
        {
            _naturalBiomesData.Clear();
            var natural = JsonConvert.DeserializeObject <NaturalRootObject>(await StringProcess.GetJsonString("Natural.json"));

            foreach (var natureBiomesItems in natural.Biomes.Nature)
            {
                _naturalBiomesData.Add(natureBiomesItems);
            }
            foreach (var natureBiomesItems in _naturalBiomesData)
            {
                natureBiomesItems.Picture = StringProcess.GetGameResourcePath(natureBiomesItems.Picture);
            }
        }
        public async Task Deserialize()
        {
            _characterData.Clear();
            var character = JsonConvert.DeserializeObject <CharacterRootObject>(await StringProcess.GetJsonString("Characters.json"));

            foreach (var characterItems in character.Character)
            {
                _characterData.Add(characterItems);
            }
            foreach (var characterItems in _characterData)
            {
                characterItems.Picture = StringProcess.GetGameResourcePath(characterItems.Picture);
            }
        }
        public async void Deserialize()
        {
            var food = JsonConvert.DeserializeObject <FoodRootObject>(await StringProcess.GetJsonString("Foods.json"));

            foreach (var foodRecipeItems in food.FoodRecipe.FoodRecipes)
            {
                _foodRecipeData.Add(foodRecipeItems);
            }

            foreach (var foodMeatsItems in food.FoodMeats.Foods)
            {
                _foodMeatData.Add(foodMeatsItems);
            }
            foreach (var foodMeatsItems in _foodMeatData)
            {
                foodMeatsItems.Picture = StringProcess.GetGameResourcePath(foodMeatsItems.Picture);
            }
            foreach (var foodVegetablesItems in food.FoodVegetables.Foods)
            {
                _foodVegetableData.Add(foodVegetablesItems);
            }
            foreach (var foodVegetablesItems in _foodVegetableData)
            {
                foodVegetablesItems.Picture = StringProcess.GetGameResourcePath(foodVegetablesItems.Picture);
            }
            foreach (var foodFruitItems in food.FoodFruit.Foods)
            {
                _foodFruitData.Add(foodFruitItems);
            }
            foreach (var foodFruitItems in _foodFruitData)
            {
                foodFruitItems.Picture = StringProcess.GetGameResourcePath(foodFruitItems.Picture);
            }
            foreach (var foodEggsItems in food.FoodEggs.Foods)
            {
                _foodEggData.Add(foodEggsItems);
            }
            foreach (var foodEggsItems in _foodEggData)
            {
                foodEggsItems.Picture = StringProcess.GetGameResourcePath(foodEggsItems.Picture);
            }
            foreach (var foodOthersItems in food.FoodOthers.Foods)
            {
                _foodOtherData.Add(foodOthersItems);
            }
            foreach (var foodOthersItems in _foodOtherData)
            {
                foodOthersItems.Picture = StringProcess.GetGameResourcePath(foodOthersItems.Picture);
            }
        }
 private void LoadData(GoodCreatures c)
 {
     GoodImage.Source = new BitmapImage(new Uri(c.Picture));
     GoodName.Text    = c.Name;
     GoodEnName.Text  = c.EnName;
     // 保鲜
     if (c.Fresh == 0)
     {
         GoodFresh.Visibility = Visibility.Collapsed;
     }
     else
     {
         GoodFresh.Value    = c.Fresh;
         GoodFresh.BarColor = Global.ColorBlue;
     }
     // 杀害后获得
     if (c.Goods.Count == 0)
     {
         GoodGoodsTextBlock.Visibility = Visibility.Collapsed;
         GoodGoodsWrapPanel.Visibility = Visibility.Collapsed;
     }
     else
     {
         var thickness = new Thickness(20, 0, 0, 0);
         foreach (var str in c.Goods)
         {
             var breakPosition = str.IndexOf('|');
             var goodSource    = str.Substring(0, breakPosition);
             var goodText      = str.Substring(breakPosition + 1);
             var picButton     = new PicButton
             {
                 HorizontalAlignment = HorizontalAlignment.Left,
                 Margin = thickness,
                 Source = StringProcess.GetGameResourcePath(goodSource),
                 Text   = goodText
             };
             picButton.Tapped += Good_Jump_Tapped;
             GoodGoodsWrapPanel.Children.Add(picButton);
         }
     }
     ConsolePre.Text = $"c_give(\"{c.Console}\",";
 }
예제 #14
0
        private void LoadData(NatureSmallPlant c)
        {
            // 图片
            if (c.Pictures.Count == 0)
            {
                NatureImage.Source = new BitmapImage(new Uri(c.Picture));
            }
            else
            {
                SwitchLeftButton.Visibility  = Visibility.Visible;
                SwitchRightButton.Visibility = Visibility.Visible;
                // 数量分割点
                var breakPosition = c.Pictures[0].IndexOf('|');
                // 多名称多图
                if (breakPosition == -1)
                {
                    _smallPlantMaxIndex = c.Pictures.Count - 1;
                    foreach (var pic in c.Pictures)
                    {
                        _smallPlantList.Add(StringProcess.GetGameResourcePath(pic));
                    }
                    NatureImage.Source         = new BitmapImage(new Uri(_smallPlantList[0]));
                    SwitchLeftButton.IsEnabled = false;
                }
                // 单名称多图
                else
                {
                    var pictureText = c.Pictures[0].Substring(0, breakPosition);
                    var pictureNum  = int.Parse(c.Pictures[0].Substring(breakPosition + 1));
                    _smallPlantMaxIndex = pictureNum - 1;
                    for (var i = 1; i <= pictureNum; i++)
                    {
                        _smallPlantList.Add(StringProcess.GetGameResourcePath(pictureText + i));
                    }
                    NatureImage.Source         = new BitmapImage(new Uri(_smallPlantList[0]));
                    SwitchLeftButton.IsEnabled = false;
                }
            }
            //中英文名
            NatureName.Text   = c.Name;
            NatureEnName.Text = c.EnName;
            // 可再生、可燃
            if (c.IsRegenerate)
            {
                RegenerateCheckBox.IsChecked = true;
            }
            if (c.IsCombustible)
            {
                CombustibleCheckBox.IsChecked = true;
            }
            // 资源
            if (c.Resources.Count == 0)
            {
                NaturalResourceTextBlock.Visibility  = Visibility.Collapsed;
                NaturalResourceStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                _smallPlantResourceListStringList = new List <List <string> >();
                if (c.Resources.Count == 1)
                {
                    for (var i = 0; i <= _smallPlantMaxIndex; i++)
                    {
                        _smallPlantResourceListStringList.Add(c.Resources[0]);
                    }
                }
                else
                {
                    foreach (var strList in c.Resources)
                    {
                        _smallPlantResourceListStringList.Add(strList);
                    }
                }
                ShowResources(0);
            }
            // 烧毁后资源
            if (c.ResourcesBurned.Count == 0)
            {
                NaturalResourcesBurnedTextBlock.Visibility  = Visibility.Collapsed;
                NaturalResourcesBurnedStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                var thickness = new Thickness(20, 0, 0, 0);
                foreach (var str in c.ResourcesBurned)
                {
                    //数量分割点
                    var breakPosition = str.IndexOf('|');
                    // 图片
                    var resourceSource = str.Substring(0, breakPosition);
                    // 数量文本
                    var resourceText = str.Substring(breakPosition + 1);
                    var picButton    = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin = thickness,
                        Source = StringProcess.GetGameResourcePath(resourceSource),
                        Text   = resourceText
                    };
                    //picButton.Click += Creature_Jump_Click;
                    NaturalResourcesBurnedStackPanel.Children.Add(picButton);
                }
            }
            //特殊能力
            if (c.Ability.Count == 0)
            {
                NaturalAbilityTextBlock.Visibility  = Visibility.Collapsed;
                NaturalAbilityStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                var thickness = new Thickness(20, 0, 0, 0);
                foreach (var str in c.Ability)
                {
                    if (str.Substring(0, 2) == "A_")
                    {
                        var stackPanel = new StackPanel
                        {
                            Orientation = Orientation.Horizontal,
                            Margin      = thickness
                        };
                        var textBlock = new TextBlock
                        {
                            Text = "生成",
                            VerticalAlignment = VerticalAlignment.Center
                        };
                        var picButton = new PicButton
                        {
                            HorizontalAlignment = HorizontalAlignment.Left,
                            Margin = new Thickness(5, 0, 0, 0),
                            Source = StringProcess.GetGameResourcePath(str)
                        };
                        stackPanel.Children.Add(textBlock);
                        stackPanel.Children.Add(picButton);
                        NaturalAbilityStackPanel.Children.Add(stackPanel);
                    }
                    else
                    {
                        var textBlock = new TextBlock
                        {
                            Text   = str,
                            Margin = thickness
                        };
                        NaturalAbilityStackPanel.Children.Add(textBlock);
                    }
                    //picButton.Click += Creature_Jump_Click;
                }
            }
            // 主要生物群落
            var biomesThickness = new Thickness(2, 0, 2, 0);

            foreach (var str in c.Biomes)
            {
                var picButton = new PicButton
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Margin      = biomesThickness,
                    Source      = StringProcess.GetGameResourcePath(str),
                    PictureSize = 90
                };
                //picButton.Click += Creature_Jump_Click;
                NaturalBiomesWrapPanel.Children.Add(picButton);
            }
            // 介绍
            NatureIntroduction.Text = c.Introduction;
            // 控制台
            if (c.EnName.Contains("Diseased"))
            {
                CopyGrid.Visibility = Visibility.Collapsed;
            }
            else
            {
                ConsolePre.Text = $"c_spawn(\"{c.Console}\",";
            }
        }
 /// <summary>
 /// 烹饪食材属性
 /// </summary>
 /// <param name="source">食物代码</param>
 /// <param name="plus"></param>
 private void CS_Food_Property(string source, bool plus = true)
 {
     if (string.IsNullOrEmpty(source))
     {
         return;
     }
     source = StringProcess.GetGameResourcePath(source);
     foreach (var foodMeat in _foodMeatData.Where(temp => temp.Picture == source))
     {
         if (plus)
         {
             FoodHealth.Value += foodMeat.Health;
             FoodHunger.Value += foodMeat.Hunger;
             FoodSanity.Value += foodMeat.Sanity;
         }
         else
         {
             FoodHealth.Value -= foodMeat.Health;
             FoodHunger.Value -= foodMeat.Hunger;
             FoodSanity.Value -= foodMeat.Sanity;
         }
     }
     foreach (var foodVegetable in _foodVegetableData.Where(temp => temp.Picture == source))
     {
         if (plus)
         {
             FoodHealth.Value += foodVegetable.Health;
             FoodHunger.Value += foodVegetable.Hunger;
             FoodSanity.Value += foodVegetable.Sanity;
         }
         else
         {
             FoodHealth.Value -= foodVegetable.Health;
             FoodHunger.Value -= foodVegetable.Hunger;
             FoodSanity.Value -= foodVegetable.Sanity;
         }
     }
     foreach (var foodFruit in _foodFruitData.Where(temp => temp.Picture == source))
     {
         if (plus)
         {
             FoodHealth.Value += foodFruit.Health;
             FoodHunger.Value += foodFruit.Hunger;
             FoodSanity.Value += foodFruit.Sanity;
         }
         else
         {
             FoodHealth.Value -= foodFruit.Health;
             FoodHunger.Value -= foodFruit.Hunger;
             FoodSanity.Value -= foodFruit.Sanity;
         }
     }
     foreach (var foodEgg in _foodEggData.Where(temp => temp.Picture == source))
     {
         if (plus)
         {
             FoodHealth.Value += foodEgg.Health;
             FoodHunger.Value += foodEgg.Hunger;
             FoodSanity.Value += foodEgg.Sanity;
         }
         else
         {
             FoodHealth.Value -= foodEgg.Health;
             FoodHunger.Value -= foodEgg.Hunger;
             FoodSanity.Value -= foodEgg.Sanity;
         }
     }
     foreach (var foodOther in _foodOtherData.Where(temp => temp.Picture == source))
     {
         if (plus)
         {
             FoodHealth.Value += foodOther.Health;
             FoodHunger.Value += foodOther.Hunger;
             FoodSanity.Value += foodOther.Sanity;
         }
         else
         {
             FoodHealth.Value -= foodOther.Health;
             FoodHunger.Value -= foodOther.Hunger;
             FoodSanity.Value -= foodOther.Sanity;
         }
     }
 }
 /// <summary>
 /// 烹饪结果图片
 /// </summary>
 /// <param name="source">食物代码</param>
 private void CS_image_Food_Result_Source(string source)
 {
     FoodResultImage.Source = new BitmapImage(new Uri(StringProcess.GetGameResourcePath(source)));
 }
 private void LoadData(FoodRecipe2 c)
 {
     FoodRecipeImage.Source = new BitmapImage(new Uri(c.Picture));
     FoodRecipeName.Text    = c.Name;
     FoodRecipeEnName.Text  = c.EnName;
     if (c.PortableCrockPot)
     {
         FoodRecipePortableCrockPot.Visibility = Visibility.Visible;
         FoodRecipePortableCrockPot.Source     = new BitmapImage(new Uri("ms-appx:///Assets/GameResources/CP_PortableCrockPot.png"));
     }
     FoodRecipeHealth.Value           = c.Health;
     FoodRecipeHealth.BarColor        = Global.ColorGreen;
     FoodRecipeHunger.Value           = c.Hunger;
     FoodRecipeHunger.BarColor        = Global.ColorKhaki;
     FoodRecipeSanity.Value           = c.Sanity;
     FoodRecipeSanity.BarColor        = Global.ColorRed;
     FoodRecipePerish.Value           = c.Perish;
     FoodRecipePerish.MaxValue        = c.Perish > 20 ? 18750 : 20;
     FoodRecipePerish.BarColor        = Global.ColorBlue;
     FoodRecipeCooktime.Value         = c.Cooktime;
     FoodRecipeCooktime.BarColor      = Global.ColorPurple;
     FoodRecipePriority.ShowIfZero    = true;
     FoodRecipePriority.Value         = c.Priority;
     FoodRecipePriority.BarColor      = Global.ColorPink;
     FoodTemperature.Value            = c.Temperature;
     FoodTemperature.BarColor         = Global.ColorCyan;
     FoodTemperatureDuration.Value    = c.TemperatureDuration;
     FoodTemperatureDuration.BarColor = Global.ColorOrange;
     if (c.EnName != "Wet Goop")
     {
         Need1Button.Source = StringProcess.GetGameResourcePath(c.NeedPicture1);
         Need1Button.Text   = c.Need1;
     }
     else
     {
         FoodRecipeHhsColumnDefinition.Width         = new GridLength(0);
         FoodRecipePcpStackPanel.HorizontalAlignment = HorizontalAlignment.Center;
         FoodNeedStackPanel.Visibility      = Visibility.Collapsed;
         FoodRecommendStackPanel.Visibility = Visibility.Collapsed;
     }
     if (c.NeedOr != null)
     {
         NeedOrButton.Visibility = Visibility.Visible;
         NeedOrButton.Source     = StringProcess.GetGameResourcePath(c.NeedPictureOr);
         NeedOrButton.Text       = c.NeedOr;
     }
     if (c.Need2 != null)
     {
         Need2Button.Visibility = Visibility.Visible;
         Need2Button.Source     = StringProcess.GetGameResourcePath(c.NeedPicture2);
         Need2Button.Text       = c.Need2;
     }
     if (c.Need3 != null)
     {
         Need3Button.Visibility = Visibility.Visible;
         Need3Button.Source     = StringProcess.GetGameResourcePath(c.NeedPicture3);
         Need3Button.Text       = c.Need3;
     }
     #region restrictions
     var restrictions1          = new List <string>();
     var restrictions2          = new List <string>();
     var prePicture             = new[] { c.Restrictions1.Text, c.Restrictions2.Text, c.Restrictions3.Text, c.Restrictions4.Text, c.Restrictions5.Text };
     var pre                    = new[] { c.Restrictions1.Pre, c.Restrictions2.Pre, c.Restrictions3.Pre, c.Restrictions4.Pre, c.Restrictions5.Pre };
     var restrictionsAttributes = StringProcess.StringDelRepeatData(pre);
     if (pre[0] == restrictionsAttributes[0] && prePicture[0] != null)
     {
         restrictions1.Add(prePicture[0]);
     }
     if (pre[1] == restrictionsAttributes[0] && prePicture[1] != null)
     {
         restrictions1.Add(prePicture[1]);
     }
     if (pre[1] == restrictionsAttributes[1] && prePicture[1] != null)
     {
         restrictions2.Add(prePicture[1]);
     }
     if (pre[2] == restrictionsAttributes[0] && prePicture[2] != null)
     {
         restrictions1.Add(prePicture[2]);
     }
     if (pre[2] == restrictionsAttributes[1] && prePicture[2] != null)
     {
         restrictions2.Add(prePicture[2]);
     }
     if (pre[3] == restrictionsAttributes[0] && prePicture[3] != null)
     {
         restrictions1.Add(prePicture[3]);
     }
     if (pre[3] == restrictionsAttributes[1] && prePicture[3] != null)
     {
         restrictions2.Add(prePicture[3]);
     }
     if (pre[4] == restrictionsAttributes[0] && prePicture[4] != null)
     {
         restrictions1.Add(prePicture[4]);
     }
     if (pre[4] == restrictionsAttributes[1] && prePicture[4] != null)
     {
         restrictions2.Add(prePicture[4]);
     }
     if (c.Restrictions1.Pre != null)
     {
         var stackPanel1 = new StackPanel {
             Orientation = Orientation.Horizontal
         };
         var stackPanel2 = new StackPanel {
             Orientation = Orientation.Horizontal
         };
         if (restrictions1.Count != 0)
         {
             var textBlock = new TextBlock
             {
                 Text    = restrictionsAttributes[0],
                 Padding = new Thickness(0, 8, 5, 0)
             };
             stackPanel1.Children.Add(textBlock);
             foreach (var str in restrictions1)
             {
                 var picButton = new PicButton()
                 {
                     Source = $"ms-appx:///Assets/GameResources/Foods/{str}.png",
                 };
                 picButton.Tapped += Food_Jump_Tapped;
                 stackPanel1.Children.Add(picButton);
             }
             FoodRecipeRestrictionsStackPanel.Children.Add(stackPanel1);
         }
         if (restrictions2.Count != 0)
         {
             var textBlock = new TextBlock
             {
                 Text    = restrictionsAttributes[1],
                 Padding = new Thickness(0, 8, 5, 0)
             };
             stackPanel2.Children.Add(textBlock);
             foreach (var str in restrictions2)
             {
                 var picButton = new PicButton()
                 {
                     Source = $"ms-appx:///Assets/GameResources/Foods/{str}.png",
                 };
                 picButton.Tapped += Food_Jump_Tapped;
                 stackPanel2.Children.Add(picButton);
             }
             FoodRecipeRestrictionsStackPanel.Children.Add(stackPanel2);
         }
     }
     else
     {
         FoodRecipeRestrictionsTextBlock.Visibility = Visibility.Collapsed;
     }
     #endregion
     if (c.Recommend1 != null)
     {
         Recommend1Button.Source = StringProcess.GetGameResourcePath(c.Recommend1);
         Recommend2Button.Source = StringProcess.GetGameResourcePath(c.Recommend2);
         Recommend3Button.Source = StringProcess.GetGameResourcePath(c.Recommend3);
         Recommend4Button.Source = StringProcess.GetGameResourcePath(c.Recommend4);
     }
     FoodRecipeIntroduction.Text = c.Introduce;
     ConsolePre.Text             = $"c_give(\"{c.Console}\",";
 }
예제 #18
0
        private void LoadData(NatureCreatureNest c)
        {
            // 图片
            if (c.Pictures.Count == 0)
            {
                NatureImage.Source = new BitmapImage(new Uri(c.Picture));
            }
            else
            {
                SwitchLeftButton.Visibility  = Visibility.Visible;
                SwitchRightButton.Visibility = Visibility.Visible;
                // 数量分割点
                var breakPosition = c.Pictures[0].IndexOf('|');
                // 多名称多图
                if (breakPosition == -1)
                {
                    _creatureNestMaxIndex = c.Pictures.Count - 1;
                    foreach (var pic in c.Pictures)
                    {
                        _creatureNestList.Add(StringProcess.GetGameResourcePath(pic));
                    }
                    NatureImage.Source         = new BitmapImage(new Uri(_creatureNestList[0]));
                    SwitchLeftButton.IsEnabled = false;
                }
                // 单名称多图
                else
                {
                    var pictureText = c.Pictures[0].Substring(0, breakPosition);
                    var pictureNum  = int.Parse(c.Pictures[0].Substring(breakPosition + 1));
                    _creatureNestMaxIndex = pictureNum - 1;
                    for (var i = 1; i <= pictureNum; i++)
                    {
                        _creatureNestList.Add(StringProcess.GetGameResourcePath(pictureText + i));
                    }
                    NatureImage.Source         = new BitmapImage(new Uri(_creatureNestList[0]));
                    SwitchLeftButton.IsEnabled = false;
                }
            }
            //中英文名
            NatureName.Text   = c.Name;
            NatureEnName.Text = c.EnName;
            // 可再生、可摧毁
            if (c.IsRegenerate)
            {
                RegenerateCheckBox.IsChecked = true;
            }
            if (c.IsDestroable)
            {
                DestroableCheckBox.IsChecked = true;
            }
            else
            {
                RegenerateCheckBox.Visibility = Visibility.Collapsed;
                DestroableCheckBox.Margin     = new Thickness(0, 0, 0, 0);
            }
            // 生命
            if (c.Health == null)
            {
                CreatureHealth.Visibility = Visibility.Collapsed;
            }
            else
            {
                CreatureHealth.Value    = c.Health[0];
                CreatureHealth.BarColor = Global.ColorGreen;
                foreach (var health in c.Health)
                {
                    _creatureNestHealthIntList.Add(health);
                }
            }
            // 生物
            if (c.Creature.Count == 0)
            {
                NaturalCreatureTextBlock.Visibility  = Visibility.Collapsed;
                NaturalCreatureStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                _creatureNestCreatureListStringList = new List <List <string> >();
                if (c.Creature.Count == 1)
                {
                    for (var i = 0; i <= _creatureNestMaxIndex; i++)
                    {
                        _creatureNestCreatureListStringList.Add(c.Creature[0]);
                    }
                }
                else
                {
                    foreach (var strList in c.Creature)
                    {
                        _creatureNestCreatureListStringList.Add(strList);
                    }
                }
                ShowCreature(0);
            }
            // 摧毁后资源
            if (c.ResourcesDestroyed.Count == 0)
            {
                NaturalResourcesDestroyedTextBlock.Visibility  = Visibility.Collapsed;
                NaturalResourcesDestroyedStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                _creatureNestResourcesDestroyedListStringList = new List <List <string> >();
                if (c.ResourcesDestroyed.Count == 1)
                {
                    for (var i = 0; i <= _creatureNestMaxIndex; i++)
                    {
                        _creatureNestResourcesDestroyedListStringList.Add(c.ResourcesDestroyed[0]);
                    }
                }
                else
                {
                    foreach (var strList in c.ResourcesDestroyed)
                    {
                        _creatureNestResourcesDestroyedListStringList.Add(strList);
                    }
                }
                ShowResourcesDestroyed(0);
            }
            // ***中空树桩额外掉落***
            if (c.EnName == "Hollow Stump")
            {
                ShowHollowStumpDrops();
            }
            // ***蜜蜂女王摧毁后资源->资源***
            if (c.EnName == "Gigantic Beehive")
            {
                NaturalResourcesDestroyedTextBlock.Text = "资源:";
            }
            //特殊能力
            if (c.Ability.Count == 0)
            {
                NaturalAbilityTextBlock.Visibility  = Visibility.Collapsed;
                NaturalAbilityStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                _creatureNestAbilityListStringList = new List <List <string> >();
                if (c.Ability.Count == 1)
                {
                    for (var i = 0; i <= _creatureNestMaxIndex; i++)
                    {
                        _creatureNestAbilityListStringList.Add(c.Ability[0]);
                    }
                }
                else
                {
                    foreach (var strList in c.Ability)
                    {
                        _creatureNestAbilityListStringList.Add(strList);
                    }
                }
                ShowAbility(0);
            }
            // 主要生物群落
            var biomesThickness = new Thickness(2, 0, 2, 0);

            if (c.Biomes == null)
            {
                NaturalBiomesTextBlock.Visibility = Visibility.Collapsed;
                NaturalBiomesWrapPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                NaturalBiomesTextBlock.Visibility = Visibility.Visible;
                NaturalBiomesWrapPanel.Visibility = Visibility.Visible;
                foreach (var str in c.Biomes)
                {
                    var picButton = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin      = biomesThickness,
                        Source      = StringProcess.GetGameResourcePath(str),
                        PictureSize = 90
                    };
                    //picButton.Click += Creature_Jump_Click;
                    NaturalBiomesWrapPanel.Children.Add(picButton);
                }
            }
            // 介绍
            NatureIntroduction.Text = c.Introduction;
            // 控制台
            if (c.Console.Count != 0)
            {
                ConsolePre.Text = $"c_spawn(\"{c.Console[0]}\",";
                foreach (var console in c.Console)
                {
                    _creatureNestConsoleStringList.Add(console);
                }
            }
            else
            {
                CopyGrid.Visibility = Visibility.Collapsed;
            }
        }
예제 #19
0
        public async Task Deserialize()
        {
            _goodMaterialData.Clear();
            _goodEquipmentData.Clear();
            _goodSaplingData.Clear();
            _goodCreaturesData.Clear();
            _goodTrinketsData.Clear();
            _goodTurfData.Clear();
            _goodPetData.Clear();
            _goodUnlockData.Clear();
            _goodHallowedNightsData.Clear();
            _goodWintersFeastData.Clear();
            _goodYearOfTheGobblerData.Clear();
            _goodComponentData.Clear();
            _goodOthersData.Clear();
            var good = JsonConvert.DeserializeObject <GoodsRootObject>(await StringProcess.GetJsonString("Goods.json"));

            foreach (var goodMaterialItems in good.Material.GoodMaterial)
            {
                _goodMaterialData.Add(goodMaterialItems);
            }
            foreach (var goodMaterialItems in _goodMaterialData)
            {
                goodMaterialItems.Picture = StringProcess.GetGameResourcePath(goodMaterialItems.Picture);
            }
            foreach (var goodEquipmentItems in good.Equipment.GoodEquipment)
            {
                _goodEquipmentData.Add(goodEquipmentItems);
            }
            foreach (var goodEquipmentItems in _goodEquipmentData)
            {
                goodEquipmentItems.Picture = StringProcess.GetGameResourcePath(goodEquipmentItems.Picture);
            }
            foreach (var goodSaplingItems in good.Sapling.GoodSapling)
            {
                _goodSaplingData.Add(goodSaplingItems);
            }
            foreach (var goodSaplingItems in _goodSaplingData)
            {
                goodSaplingItems.Picture = StringProcess.GetGameResourcePath(goodSaplingItems.Picture);
            }
            foreach (var goodCreaturesItems in good.Creatures.GoodCreatures)
            {
                _goodCreaturesData.Add(goodCreaturesItems);
            }
            foreach (var goodCreaturesItems in _goodCreaturesData)
            {
                goodCreaturesItems.Picture = StringProcess.GetGameResourcePath(goodCreaturesItems.Picture);
            }
            foreach (var goodTrinketsItems in good.Trinkets.GoodTrinkets)
            {
                _goodTrinketsData.Add(goodTrinketsItems);
            }
            foreach (var goodTrinketsItems in _goodTrinketsData)
            {
                goodTrinketsItems.Picture = StringProcess.GetGameResourcePath(goodTrinketsItems.Picture);
            }
            foreach (var goodTurfItems in good.Turf.GoodTurf)
            {
                _goodTurfData.Add(goodTurfItems);
            }
            foreach (var goodTurfItems in _goodTurfData)
            {
                goodTurfItems.Picture = StringProcess.GetGameResourcePath(goodTurfItems.Picture);
            }
            foreach (var goodPetItems in good.Pet.GoodPet)
            {
                _goodPetData.Add(goodPetItems);
            }
            foreach (var goodPetItems in _goodPetData)
            {
                goodPetItems.Picture = StringProcess.GetGameResourcePath(goodPetItems.Picture);
            }
            foreach (var goodUnlockItems in good.Unlock.GoodUnlock)
            {
                _goodUnlockData.Add(goodUnlockItems);
            }
            foreach (var goodUnlockItems in _goodUnlockData)
            {
                goodUnlockItems.Picture = StringProcess.GetGameResourcePath(goodUnlockItems.Picture);
            }
            foreach (var goodHallowedNightsItems in good.HallowedNights.Good)
            {
                _goodHallowedNightsData.Add(goodHallowedNightsItems);
            }
            foreach (var goodHallowedNightsItems in _goodHallowedNightsData)
            {
                goodHallowedNightsItems.Picture = StringProcess.GetGameResourcePath(goodHallowedNightsItems.Picture);
            }
            foreach (var goodWintersFeastItems in good.WintersFeast.Good)
            {
                _goodWintersFeastData.Add(goodWintersFeastItems);
            }
            foreach (var goodWintersFeastItems in _goodWintersFeastData)
            {
                goodWintersFeastItems.Picture = StringProcess.GetGameResourcePath(goodWintersFeastItems.Picture);
            }
            foreach (var goodYearOfTheGobblerItems in good.YearOfTheGobbler.Good)
            {
                _goodYearOfTheGobblerData.Add(goodYearOfTheGobblerItems);
            }
            foreach (var goodYearOfTheGobblerItems in _goodYearOfTheGobblerData)
            {
                goodYearOfTheGobblerItems.Picture = StringProcess.GetGameResourcePath(goodYearOfTheGobblerItems.Picture);
            }
            foreach (var goodComponentItems in good.Component.Good)
            {
                _goodComponentData.Add(goodComponentItems);
            }
            foreach (var goodComponentItems in _goodComponentData)
            {
                goodComponentItems.Picture = StringProcess.GetGameResourcePath(goodComponentItems.Picture);
            }
            foreach (var goodGoodOthersItems in good.GoodOthers.Good)
            {
                _goodOthersData.Add(goodGoodOthersItems);
            }
            foreach (var goodGoodOthersItems in _goodOthersData)
            {
                goodGoodOthersItems.Picture = StringProcess.GetGameResourcePath(goodGoodOthersItems.Picture);
            }
        }
        private void LoadData(NatureTree c)
        {
            // 图片
            if (c.Pictures.Count == 0)
            {
                NatureImage.Source = new BitmapImage(new Uri(c.Picture));
            }
            else
            {
                SwitchLeftButton.Visibility  = Visibility.Visible;
                SwitchRightButton.Visibility = Visibility.Visible;
                // 数量分割点
                var breakPosition = c.Pictures[0].IndexOf('|');
                // 多名称多图
                if (breakPosition == -1)
                {
                    _treeMaxIndex = c.Pictures.Count - 1;
                    foreach (var pic in c.Pictures)
                    {
                        _treeList.Add(StringProcess.GetGameResourcePath(pic));
                    }
                    NatureImage.Source         = new BitmapImage(new Uri(_treeList[0]));
                    SwitchLeftButton.IsEnabled = false;
                }
                // 单名称多图
                else
                {
                    var pictureText = c.Pictures[0].Substring(0, breakPosition);
                    var pictureNum  = int.Parse(c.Pictures[0].Substring(breakPosition + 1));
                    _treeMaxIndex = pictureNum - 1;
                    for (var i = 1; i <= pictureNum; i++)
                    {
                        _treeList.Add(StringProcess.GetGameResourcePath(pictureText + i));
                    }
                    NatureImage.Source         = new BitmapImage(new Uri(_treeList[0]));
                    SwitchLeftButton.IsEnabled = false;
                }
            }
            //中英文名
            NatureName.Text   = c.Name;
            NatureEnName.Text = c.EnName;
            // 可再生、可燃
            if (c.IsRegenerate)
            {
                RegenerateCheckBox.IsChecked = true;
            }
            if (c.IsCombustible)
            {
                CombustibleCheckBox.IsChecked = true;
            }
            // 砍伐需求工具
            if (string.IsNullOrEmpty(c.CutDownTools))
            {
                NaturalCutDownTextBlock.Visibility  = Visibility.Collapsed;
                NaturalCutDownStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                if (c.CutDownTools == "Axe")
                {
                    NaturalCutDownStackPanel.Children.Add(new PicButton {
                        Source = StringProcess.GetGameResourcePath("S_axe")
                    });
                    NaturalCutDownStackPanel.Children.Add(new PicButton {
                        Source = StringProcess.GetGameResourcePath("S_goldenaxe")
                    });
                    NaturalCutDownStackPanel.Children.Add(new PicButton {
                        Source = StringProcess.GetGameResourcePath("S_pickaxe_1")
                    });
                    NaturalCutDownStackPanel.Children.Add(new PicButton {
                        Source = StringProcess.GetGameResourcePath("G_lucy_the_axe")
                    });
                }
                else if (c.CutDownTools == "Pickaxe")
                {
                    NaturalCutDownStackPanel.Children.Add(new PicButton {
                        Source = StringProcess.GetGameResourcePath("S_pickaxe")
                    });
                    NaturalCutDownStackPanel.Children.Add(new PicButton {
                        Source = StringProcess.GetGameResourcePath("S_goldenpickaxe")
                    });
                    NaturalCutDownStackPanel.Children.Add(new PicButton {
                        Source = StringProcess.GetGameResourcePath("S_pickaxe_1")
                    });
                }
            }
            // 资源
            if (c.Resources.Count == 0)
            {
                NaturalResourceTextBlock.Visibility  = Visibility.Collapsed;
                NaturalResourceStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                _treeResourceListStringList = new List <List <string> >();
                if (c.Resources.Count == 1)
                {
                    for (var i = 0; i <= _treeMaxIndex; i++)
                    {
                        _treeResourceListStringList.Add(c.Resources[0]);
                    }
                }
                else
                {
                    foreach (var strList in c.Resources)
                    {
                        _treeResourceListStringList.Add(strList);
                    }
                }
                ShowResources(0);
            }
            // 燃烧后资源
            if (c.ResourcesBurned.Count == 0)
            {
                NaturalResourcesBurnedTextBlock.Visibility  = Visibility.Collapsed;
                NaturalResourcesBurnedStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                _treeResourcesBurnedListStringList = new List <List <string> >();
                if (c.ResourcesBurned.Count == 1)
                {
                    for (var i = 0; i <= _treeMaxIndex; i++)
                    {
                        _treeResourcesBurnedListStringList.Add(c.ResourcesBurned[0]);
                    }
                }
                else
                {
                    foreach (var strList in c.ResourcesBurned)
                    {
                        _treeResourcesBurnedListStringList.Add(strList);
                    }
                }
                ShowResourcesBurned(0);
            }
            //特殊能力
            if (c.Ability.Count == 0)
            {
                NaturalAbilityTextBlock.Visibility  = Visibility.Collapsed;
                NaturalAbilityStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                var thickness = new Thickness(20, 0, 0, 0);
                foreach (var str in c.Ability)
                {
                    if (str.Substring(0, 2) == "A_")
                    {
                        var stackPanel = new StackPanel
                        {
                            Orientation = Orientation.Horizontal,
                            Margin      = thickness
                        };
                        var textBlock = new TextBlock
                        {
                            Text = "生成",
                            VerticalAlignment = VerticalAlignment.Center
                        };
                        var picButton = new PicButton
                        {
                            HorizontalAlignment = HorizontalAlignment.Left,
                            Margin = new Thickness(5, 0, 0, 0),
                            Source = StringProcess.GetGameResourcePath(str)
                        };
                        stackPanel.Children.Add(textBlock);
                        stackPanel.Children.Add(picButton);
                        NaturalAbilityStackPanel.Children.Add(stackPanel);
                    }
                    else
                    {
                        var textBlock = new TextBlock
                        {
                            Text   = str,
                            Margin = thickness
                        };
                        NaturalAbilityStackPanel.Children.Add(textBlock);
                    }
                    //picButton.Click += Creature_Jump_Click;
                }
            }
            // 主要生物群落
            var biomesThickness = new Thickness(2, 0, 2, 0);

            if (c.Biomes == null)
            {
                NaturalBiomesTextBlock.Visibility = Visibility.Collapsed;
                NaturalBiomesWrapPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                NaturalBiomesTextBlock.Visibility = Visibility.Visible;
                NaturalBiomesWrapPanel.Visibility = Visibility.Visible;
                foreach (var str in c.Biomes)
                {
                    var picButton = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin      = biomesThickness,
                        Source      = StringProcess.GetGameResourcePath(str),
                        PictureSize = 90
                    };
                    //picButton.Click += Creature_Jump_Click;
                    NaturalBiomesWrapPanel.Children.Add(picButton);
                }
            }
            // 介绍
            NatureIntroduction.Text = c.Introduction;
            // 控制台
            ConsolePre.Text = $"c_spawn(\"{c.Console[0]}\",";
            foreach (var console in c.Console)
            {
                _treeConsoleStringList.Add(console);
            }
        }
예제 #21
0
        private void LoadData(NatureBiomes c)
        {
            NatureImage.Source = new BitmapImage(new Uri(c.Picture));
            NatureName.Text    = c.Name;
            NatureEnName.Text  = c.EnName;
            // 富含/偶尔/稀有
            var thickness = new Thickness(5, 0, 0, 0);

            if (c.Abundant == null || c.Abundant.Count == 0)
            {
                NaturalAbundantTextBlock.Visibility = Visibility.Collapsed;
                NaturalAbundantWrapPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                foreach (var picPath in c.Abundant)
                {
                    var picButton = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin = thickness,
                        Source = StringProcess.GetGameResourcePath(picPath)
                    };
                    NaturalAbundantWrapPanel.Children.Add(picButton);
                }
            }
            if (c.Occasional == null || c.Occasional.Count == 0)
            {
                NaturalOccasionalTextBlock.Visibility = Visibility.Collapsed;
                NaturalOccasionalWrapPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                foreach (var picPath in c.Occasional)
                {
                    var picButton = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin = thickness,
                        Source = StringProcess.GetGameResourcePath(picPath)
                    };
                    NaturalOccasionalWrapPanel.Children.Add(picButton);
                }
            }
            if (c.Rare == null || c.Rare.Count == 0)
            {
                NaturalRareTextBlock.Visibility = Visibility.Collapsed;
                NaturalRareWrapPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                foreach (var picPath in c.Rare)
                {
                    var picButton = new PicButton
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Margin = thickness,
                        Source = StringProcess.GetGameResourcePath(picPath)
                    };
                    NaturalRareWrapPanel.Children.Add(picButton);
                }
            }
            // 介绍
            NatureIntroduction.Text = c.Introduction;
        }
예제 #22
0
        /// <summary>
        /// 显示中空树桩额外掉落表
        /// </summary>
        private void ShowHollowStumpDrops()
        {
            // 主StackPanel
            var stackPanel = new StackPanel
            {
                Margin = new Thickness(20, 10, 0, 0)
            };
            // 30%StackPanel
            var stackPanelP30 = new StackPanel
            {
                Orientation = Orientation.Horizontal
            };
            var textBlockP30 = new TextBlock
            {
                Text = "30%:",
                VerticalAlignment = VerticalAlignment.Center
            };

            stackPanelP30.Children.Add(textBlockP30);
            var picButtonP30 = new PicButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                Source = StringProcess.GetGameResourcePath("F_morsel")
            };

            stackPanelP30.Children.Add(picButtonP30);
            stackPanel.Children.Add(stackPanelP30);
            // 20%StackPanel
            var stackPanelP20 = new StackPanel
            {
                Orientation = Orientation.Horizontal
            };
            var textBlockP20 = new TextBlock
            {
                Text = "20%:",
                VerticalAlignment = VerticalAlignment.Center
            };

            stackPanelP20.Children.Add(textBlockP20);
            var picButtonP20 = new PicButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                Source = StringProcess.GetGameResourcePath("G_boneshard")
            };

            stackPanelP20.Children.Add(picButtonP20);
            stackPanel.Children.Add(stackPanelP20);
            // 5%StackPanel
            var stackPanelP5 = new StackPanel
            {
                Orientation = Orientation.Horizontal
            };
            var textBlockP5 = new TextBlock
            {
                Text = "5%:  ",
                VerticalAlignment = VerticalAlignment.Center
            };

            stackPanelP5.Children.Add(textBlockP5);
            var picButtonP51 = new PicButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                Source = StringProcess.GetGameResourcePath("S_rope")
            };

            stackPanelP5.Children.Add(picButtonP51);
            var picButtonP52 = new PicButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                Source = StringProcess.GetGameResourcePath("G_azure_feather")
            };

            stackPanelP5.Children.Add(picButtonP52);
            var picButtonP53 = new PicButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                Source = StringProcess.GetGameResourcePath("G_crimson_feather")
            };

            stackPanelP5.Children.Add(picButtonP53);
            var picButtonP54 = new PicButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                Source = StringProcess.GetGameResourcePath("G_jet_feather")
            };

            stackPanelP5.Children.Add(picButtonP54);
            if (Global.GameVersion < 2)
            {
                var picButtonP55 = new PicButton
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Source = StringProcess.GetGameResourcePath("G_saffron_feather")
                };
                stackPanelP5.Children.Add(picButtonP55);
            }
            stackPanel.Children.Add(stackPanelP5);
            // 2%StackPanel
            var stackPanelP2 = new StackPanel
            {
                Orientation = Orientation.Horizontal
            };
            var textBlockP2 = new TextBlock
            {
                Text = "2%:  ",
                VerticalAlignment = VerticalAlignment.Center
            };

            stackPanelP2.Children.Add(textBlockP2);
            var picButtonP21 = new PicButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                Source = StringProcess.GetGameResourcePath("A_redbird")
            };

            stackPanelP2.Children.Add(picButtonP21);
            var picButtonP22 = new PicButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                Source = StringProcess.GetGameResourcePath("A_snowbird")
            };

            stackPanelP2.Children.Add(picButtonP22);
            var picButtonP23 = new PicButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                Source = StringProcess.GetGameResourcePath("A_crow")
            };

            stackPanelP2.Children.Add(picButtonP23);
            if (Global.GameVersion < 2)
            {
                var picButtonP24 = new PicButton
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Source = StringProcess.GetGameResourcePath("A_canary")
                };
                stackPanelP2.Children.Add(picButtonP24);
            }
            var picButtonP25 = new PicButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                Source = StringProcess.GetGameResourcePath("A_rabbit")
            };

            stackPanelP2.Children.Add(picButtonP25);
            var picButtonP26 = new PicButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                Source = StringProcess.GetGameResourcePath("A_moleworm")
            };

            stackPanelP2.Children.Add(picButtonP26);
            stackPanel.Children.Add(stackPanelP2);
            // 添加进NaturesRootGrid
            NaturesRootGrid.Children.Add(stackPanel);
            Grid.SetRow(stackPanel, 9);
        }
예제 #23
0
        public async Task Deserialize()
        {
            _scienceToolData.Clear();
            _scienceLightData.Clear();
            _scienceNauticalData.Clear();
            _scienceSurvivalData.Clear();
            _scienceFoodData.Clear();
            _scienceTechnologyData.Clear();
            _scienceFightData.Clear();
            _scienceStructureData.Clear();
            _scienceRefineData.Clear();
            _scienceMagicData.Clear();
            _scienceDressData.Clear();
            _scienceAncientData.Clear();
            _scienceBookData.Clear();
            _scienceShadowData.Clear();
            _scienceCritterData.Clear();
            _scienceSculptData.Clear();
            _scienceCartographyData.Clear();
            _scienceOfferingsData.Clear();
            _scienceVolcanoData.Clear();
            var science = JsonConvert.DeserializeObject <ScienceRootObject>(await StringProcess.GetJsonString("Sciences.json"));

            foreach (var scienceToolItems in science.Tool.Science)
            {
                _scienceToolData.Add(scienceToolItems);
            }
            foreach (var scienceToolItems in _scienceToolData)
            {
                scienceToolItems.Picture = StringProcess.GetGameResourcePath(scienceToolItems.Picture);
            }
            foreach (var scienceLightItems in science.Light.Science)
            {
                _scienceLightData.Add(scienceLightItems);
            }
            foreach (var scienceLightItems in _scienceLightData)
            {
                scienceLightItems.Picture = StringProcess.GetGameResourcePath(scienceLightItems.Picture);
            }
            foreach (var scienceNauticalItems in science.Nautical.Science)
            {
                _scienceNauticalData.Add(scienceNauticalItems);
            }
            foreach (var scienceNauticalItems in _scienceNauticalData)
            {
                scienceNauticalItems.Picture = StringProcess.GetGameResourcePath(scienceNauticalItems.Picture);
            }
            foreach (var scienceSurvivalItems in science.Survival.Science)
            {
                _scienceSurvivalData.Add(scienceSurvivalItems);
            }
            foreach (var scienceSurvivalItems in _scienceSurvivalData)
            {
                scienceSurvivalItems.Picture = StringProcess.GetGameResourcePath(scienceSurvivalItems.Picture);
            }
            foreach (var scienceFoodItems in science.Foods.Science)
            {
                _scienceFoodData.Add(scienceFoodItems);
            }
            foreach (var scienceFoodItems in _scienceFoodData)
            {
                scienceFoodItems.Picture = StringProcess.GetGameResourcePath(scienceFoodItems.Picture);
            }
            foreach (var scienceTechnologyItems in science.Technology.Science)
            {
                _scienceTechnologyData.Add(scienceTechnologyItems);
            }
            foreach (var scienceTechnologyItems in _scienceTechnologyData)
            {
                scienceTechnologyItems.Picture = StringProcess.GetGameResourcePath(scienceTechnologyItems.Picture);
            }
            foreach (var scienceFightItems in science.Fight.Science)
            {
                _scienceFightData.Add(scienceFightItems);
            }
            foreach (var scienceFightItems in _scienceFightData)
            {
                scienceFightItems.Picture = StringProcess.GetGameResourcePath(scienceFightItems.Picture);
            }
            foreach (var scienceStructureItems in science.Structure.Science)
            {
                _scienceStructureData.Add(scienceStructureItems);
            }
            foreach (var scienceStructureItems in _scienceStructureData)
            {
                scienceStructureItems.Picture = StringProcess.GetGameResourcePath(scienceStructureItems.Picture);
            }
            foreach (var scienceRefineItems in science.Refine.Science)
            {
                _scienceRefineData.Add(scienceRefineItems);
            }
            foreach (var scienceRefineItems in _scienceRefineData)
            {
                scienceRefineItems.Picture = StringProcess.GetGameResourcePath(scienceRefineItems.Picture);
            }
            foreach (var scienceMagicItems in science.Magic.Science)
            {
                _scienceMagicData.Add(scienceMagicItems);
            }
            foreach (var scienceMagicItems in _scienceMagicData)
            {
                scienceMagicItems.Picture = StringProcess.GetGameResourcePath(scienceMagicItems.Picture);
            }
            foreach (var scienceDressItems in science.Dress.Science)
            {
                _scienceDressData.Add(scienceDressItems);
            }
            foreach (var scienceDressItems in _scienceDressData)
            {
                scienceDressItems.Picture = StringProcess.GetGameResourcePath(scienceDressItems.Picture);
            }
            foreach (var scienceAncientItems in science.Ancient.Science)
            {
                _scienceAncientData.Add(scienceAncientItems);
            }
            foreach (var scienceAncientItems in _scienceAncientData)
            {
                scienceAncientItems.Picture = StringProcess.GetGameResourcePath(scienceAncientItems.Picture);
            }
            foreach (var scienceBookItems in science.Book.Science)
            {
                _scienceBookData.Add(scienceBookItems);
            }
            foreach (var scienceBookItems in _scienceBookData)
            {
                scienceBookItems.Picture = StringProcess.GetGameResourcePath(scienceBookItems.Picture);
            }
            foreach (var scienceShadowItems in science.Shadow.Science)
            {
                _scienceShadowData.Add(scienceShadowItems);
            }
            foreach (var scienceShadowItems in _scienceShadowData)
            {
                scienceShadowItems.Picture = StringProcess.GetGameResourcePath(scienceShadowItems.Picture);
            }
            foreach (var scienceCritterItems in science.Critter.Science)
            {
                _scienceCritterData.Add(scienceCritterItems);
            }
            foreach (var scienceCritterItems in _scienceCritterData)
            {
                scienceCritterItems.Picture = StringProcess.GetGameResourcePath(scienceCritterItems.Picture);
            }
            foreach (var scienceSculptItems in science.Sculpt.Science)
            {
                _scienceSculptData.Add(scienceSculptItems);
            }
            foreach (var scienceSculptItems in _scienceSculptData)
            {
                scienceSculptItems.Picture = StringProcess.GetGameResourcePath(scienceSculptItems.Picture);
            }
            foreach (var scienceCartographyItems in science.Cartography.Science)
            {
                _scienceCartographyData.Add(scienceCartographyItems);
            }
            foreach (var scienceCartographyItems in _scienceCartographyData)
            {
                scienceCartographyItems.Picture = StringProcess.GetGameResourcePath(scienceCartographyItems.Picture);
            }
            foreach (var scienceOfferingsItems in science.Offerings.Science)
            {
                _scienceOfferingsData.Add(scienceOfferingsItems);
            }
            foreach (var scienceOfferingsItems in _scienceOfferingsData)
            {
                scienceOfferingsItems.Picture = StringProcess.GetGameResourcePath(scienceOfferingsItems.Picture);
            }
            foreach (var scienceVolcanoItems in science.Volcano.Science)
            {
                _scienceVolcanoData.Add(scienceVolcanoItems);
            }
            foreach (var scienceVolcanoItems in _scienceVolcanoData)
            {
                scienceVolcanoItems.Picture = StringProcess.GetGameResourcePath(scienceVolcanoItems.Picture);
            }
        }
예제 #24
0
        private void LoadData(Skin c)
        {
            // 颜色
            switch (c.Colors.Count)
            {
            case 0:
                ColorTextBlock.Visibility = Visibility.Collapsed;
                break;

            case 1:
                ColorTextBlock.Text = "颜色:" + c.Colors[0];
                break;

            default:
                SwitchLeftButton.Visibility  = Visibility.Visible;
                SwitchRightButton.Visibility = Visibility.Visible;
                _skinMaxIndex = c.Colors.Count - 1;
                foreach (var color in c.Colors)
                {
                    _skinColorList.Add(color);
                }
                SwitchLeftButton.IsEnabled = false;
                ColorTextBlock.Text        = "颜色:" + _skinColorList[0];
                break;
            }
            // 图片
            if (c.Colors.Count == 0)
            {
                // 套装
                if (string.IsNullOrEmpty(c.Introduction) && string.IsNullOrEmpty(c.Rarity))
                {
                    ImageButtonGrid.Width       = 258;
                    ImageButtonGrid.Height      = 170;
                    SkinImage.Height            = 170;
                    ImageColumnDefinition.Width = new GridLength(170);
                }
                SkinImage.Source = new BitmapImage(new Uri(c.Picture));
            }
            else
            {
                foreach (var color in c.Colors)
                {
                    _skinList.Add(StringProcess.GetGameResourcePath("P_" + color.Replace(" ", "_").Replace("-", "_") + "_" + c.EnName.Replace(" ", "_").Replace("-", "_")));
                }
                SkinImage.Source = new BitmapImage(new Uri(_skinList[0]));
            }
            //中英文名
            SkinName.Text   = c.Name;
            SkinEnName.Text = c.EnName;
            // 稀有度
            switch (c.Rarity)
            {
            case "Common":
                RarityTextBlock.Text = "普通 Common";
                break;

            case "Classy":
                RarityTextBlock.Text = "上等 Classy";
                break;

            case "Spiffy":
                RarityTextBlock.Text = "出色 Spiffy";
                break;

            case "Distinguished":
                RarityTextBlock.Text = "卓越 Distinguished";
                break;

            case "Elegant":
                RarityTextBlock.Text = "高雅 Elegant";
                break;

            case "Loyal":
                RarityTextBlock.Text = "忠诚 Loyal";
                break;

            case "Timeless":
                RarityTextBlock.Text = "永恒 Timeless";
                break;

            case "Event":
                RarityTextBlock.Text = "事件 Event";
                break;

            case "Proof of Purchase":
                RarityTextBlock.Text = "购买证明 Proof of Purchase";
                break;

            case "Reward":
                RarityTextBlock.Text = "奖励 Reward";
                break;

            default:
                RarityTextBlock.Visibility = Visibility.Collapsed;
                break;
            }
            RarityTextBlock.Foreground = GetSkinColor(c.Rarity);
            // 介绍
            if (c.Colors.Count == 0)
            {
                if (!string.IsNullOrEmpty(c.Introduction))
                {
                    SkinIntroduction.Text = c.Introduction;
                }
            }
            else
            {
                foreach (var color in c.Colors)
                {
                    _skinIntroductionList.Add(c.Introduction.Replace("{Color}", color));
                }
                SkinIntroduction.Text = _skinIntroductionList[0];
            }
        }
 private void LoadData(GoodEquipment c)
 {
     GoodImage.Source = new BitmapImage(new Uri(c.Picture));
     GoodName.Text    = c.Name;
     GoodEnName.Text  = c.EnName;
     if (c.Attack == 0 && c.MinAttack == 0 && c.MaxAttack == 0 && string.IsNullOrEmpty(c.AttackString) && c.AttackOnBoat == 0 &&
         c.AttackWet == 0 && string.IsNullOrEmpty(c.Durability) && c.Wet == 0 && c.ColdResistance == 0 && c.HeatResistance == 0 && c.Sanity == 0 && c.Hunger == 0 && c.Defense == 0)
     {
         BarChartGrid.Visibility = Visibility.Collapsed;
     }
     else
     {
         if (c.Attack == 0 && c.MinAttack == 0 && c.MaxAttack == 0 && string.IsNullOrEmpty(c.AttackString) && c.AttackOnBoat == 0 &&
             c.AttackWet == 0 && string.IsNullOrEmpty(c.Durability))
         {
             BarChartStackPanel1.Visibility          = Visibility.Collapsed;
             BarChartStackPanel2.HorizontalAlignment = HorizontalAlignment.Center;
             BarChartGridColumn1.Width = new GridLength(0);
         }
         if (c.Wet == 0 && c.ColdResistance == 0 && c.HeatResistance == 0 && c.Sanity == 0 && c.Hunger == 0 && c.Defense == 0)
         {
             BarChartStackPanel2.Visibility          = Visibility.Collapsed;
             BarChartStackPanel1.HorizontalAlignment = HorizontalAlignment.Center;
             BarChartGridColumn2.Width = new GridLength(0);
         }
     }
     if (c.Attack != 0)
     {
         GoodAttack.Value    = c.Attack;
         GoodAttack.BarColor = Global.ColorRed;
     }
     else
     {
         GoodAttack.Visibility = Visibility.Collapsed;
     }
     if (c.MinAttack != 0)
     {
         GoodMinAttack.Value    = c.MinAttack;
         GoodMinAttack.BarColor = Global.ColorRed;
     }
     else
     {
         GoodMinAttack.Visibility = Visibility.Collapsed;
     }
     if (c.MaxAttack != 0)
     {
         GoodMaxAttack.Value    = c.MaxAttack;
         GoodMaxAttack.BarColor = Global.ColorRed;
     }
     else
     {
         GoodMaxAttack.Visibility = Visibility.Collapsed;
     }
     GoodAttackString.Visibility = string.IsNullOrEmpty(c.AttackString) ? Visibility.Collapsed : Visibility.Visible;
     if (c.AttackOnBoat != 0)
     {
         GoodAttackOnBoat.Value    = c.AttackOnBoat;
         GoodAttackOnBoat.BarColor = Global.ColorRed;
     }
     else
     {
         GoodAttackOnBoat.Visibility = Visibility.Collapsed;
     }
     if (c.AttackWet != 0)
     {
         GoodAttackWet.Value    = c.AttackWet;
         GoodAttackWet.BarColor = Global.ColorRed;
     }
     else
     {
         GoodAttackWet.Visibility = Visibility.Collapsed;
     }
     if (string.IsNullOrEmpty(c.Durability) == false)
     {
         try
         {
             var regularExpressionsResult = System.Text.RegularExpressions.Regex.Replace(c.Durability, @"[^0-9]+", "");
             var doubleResult             = double.Parse(regularExpressionsResult);
             GoodDurability.Value = doubleResult;
             var regularExpressionsResult2 = System.Text.RegularExpressions.Regex.Replace(c.Durability, @"[0-9]+", "");
             GoodDurability.Unit     = regularExpressionsResult2;
             GoodDurability.BarColor = Global.ColorBlue;
         }
         catch
         {
             //ignore
         }
     }
     else
     {
         GoodDurability.Visibility = Visibility.Collapsed;
     }
     if (c.Wet != 0)
     {
         GoodWet.Value    = c.Wet;
         GoodWet.BarColor = Global.ColorCyan;
     }
     else
     {
         GoodWet.Visibility = Visibility.Collapsed;
     }
     if (c.ColdResistance != 0)
     {
         GoodColdResistance.Value    = c.ColdResistance;
         GoodColdResistance.BarColor = Global.ColorOrange;
     }
     else
     {
         GoodColdResistance.Visibility = Visibility.Collapsed;
     }
     if (c.HeatResistance != 0)
     {
         GoodHeatResistance.Value    = c.HeatResistance;
         GoodHeatResistance.BarColor = Global.ColorOrange;
     }
     else
     {
         GoodHeatResistance.Visibility = Visibility.Collapsed;
     }
     if (c.Sanity != 0)
     {
         GoodSanity.Value    = c.Sanity;
         GoodSanity.BarColor = Global.ColorPink;
     }
     else
     {
         GoodSanity.Visibility = Visibility.Collapsed;
     }
     if (c.Hunger != 0)
     {
         GoodHunger.Value    = c.Hunger;
         GoodHunger.BarColor = Global.ColorPurple;
     }
     else
     {
         GoodHunger.Visibility = Visibility.Collapsed;
     }
     if (c.Defense != 0)
     {
         GoodDefense.Value    = c.Defense;
         GoodDefense.BarColor = Global.ColorYellow;
     }
     else
     {
         GoodDefense.Visibility = Visibility.Collapsed;
     }
     // 特殊能力
     if (c.Ability.Count == 0)
     {
         AbilityTextBlock.Visibility  = Visibility.Collapsed;
         AbilityStackPanel.Visibility = Visibility.Collapsed;
     }
     else
     {
         foreach (var str in c.Ability)
         {
             var textBlock = new TextBlock
             {
                 HorizontalAlignment = HorizontalAlignment.Left,
                 TextWrapping        = TextWrapping.Wrap,
                 Text = str
             };
             AbilityStackPanel.Children.Add(textBlock);
         }
     }
     // 来源于生物
     if (string.IsNullOrEmpty(c.DropBy))
     {
         GoodSourceStackPanel.Visibility = Visibility.Collapsed;
     }
     else
     {
         GoodSourcePicButton.Source = StringProcess.GetGameResourcePath(c.DropBy);
     }
     // 介绍
     GoodIntroduction.Text = c.Introduction;
     // 控制台
     if (c.Console != null)
     {
         ConsolePre.Text = $"c_give(\"{c.Console}\",";
     }
     else
     {
         CopyGrid.Visibility = Visibility.Collapsed;
     }
 }
예제 #26
0
        /// <summary>
        /// 显示资源
        /// </summary>
        /// <param name="index">索引序号</param>
        private void ShowResources(int index)
        {
            NaturalResourceStackPanel.Children.Clear();
            var thickness = new Thickness(20, 0, 0, 0);

            if (_smallPlantResourceListStringList[index].Count == 0)
            {
                NaturalResourceTextBlock.Visibility  = Visibility.Collapsed;
                NaturalResourceStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                NaturalResourceTextBlock.Visibility  = Visibility.Visible;
                NaturalResourceStackPanel.Visibility = Visibility.Visible;
                foreach (var str in _smallPlantResourceListStringList[index])
                {
                    // 数量分割点
                    var breakPosition = str.IndexOf('|');
                    // 工具分割点
                    var toolBreakPosition = str.IndexOf('&');
                    // 图片
                    var resourceSource = str.Substring(0, breakPosition);
                    // 数量文本
                    var resourceText = str.Substring(breakPosition + 1, toolBreakPosition - breakPosition - 1);
                    // 工具
                    var toolText = str.Substring(toolBreakPosition + 1);
                    // 使用工具
                    if (toolText.Length > 0)
                    {
                        var stackPanel = new StackPanel
                        {
                            Orientation = Orientation.Horizontal,
                            Margin      = thickness
                        };
                        var picButton1 = new PicButton
                        {
                            HorizontalAlignment = HorizontalAlignment.Left,
                            Source = StringProcess.GetGameResourcePath(resourceSource),
                            Text   = resourceText + "("
                        };
                        stackPanel.Children.Add(picButton1);
                        PicButton picButton2;
                        PicButton picButton3;
                        if (toolText == "Shovel")
                        {
                            picButton2 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_shovel")
                            };
                            picButton3 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_goldenshovel"),
                                Text   = ")"
                            };
                            stackPanel.Children.Add(picButton2);
                            stackPanel.Children.Add(picButton3);
                        }
                        else if (toolText == "Machete")
                        {
                            picButton2 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_machete")
                            };
                            picButton3 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_luxury_machete"),
                            };
                            var picButton4 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_obsidian_machete"),
                                Text   = ")"
                            };
                            stackPanel.Children.Add(picButton2);
                            stackPanel.Children.Add(picButton3);
                            stackPanel.Children.Add(picButton4);
                        }
                        else if (toolText == "TrawlNet")
                        {
                            picButton2 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_trawl_net"),
                                Text   = ")"
                            };
                            stackPanel.Children.Add(picButton2);
                        }
                        //picButton1.Click += Creature_Jump_Click;
                        //picButton2.Click += Creature_Jump_Click;
                        NaturalResourceStackPanel.Children.Add(stackPanel);
                    }
                    else
                    {
                        var picButton = new PicButton
                        {
                            HorizontalAlignment = HorizontalAlignment.Left,
                            Margin = thickness,
                            Source = StringProcess.GetGameResourcePath(resourceSource),
                            Text   = resourceText
                        };
                        //picButton.Click += Creature_Jump_Click;
                        NaturalResourceStackPanel.Children.Add(picButton);
                    }
                }
            }
        }
예제 #27
0
        /// <summary>
        /// 显示摧毁后资源
        /// </summary>
        /// <param name="index">索引序号</param>
        private void ShowResourcesDestroyed(int index)
        {
            NaturalResourcesDestroyedStackPanel.Children.Clear();
            var thickness = new Thickness(20, 0, 0, 0);

            if (_creatureNestResourcesDestroyedListStringList[index].Count == 0)
            {
                NaturalResourcesDestroyedTextBlock.Visibility  = Visibility.Collapsed;
                NaturalResourcesDestroyedStackPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                NaturalResourcesDestroyedTextBlock.Visibility  = Visibility.Visible;
                NaturalResourcesDestroyedStackPanel.Visibility = Visibility.Visible;
                foreach (var str in _creatureNestResourcesDestroyedListStringList[index])
                {
                    // 数量分割点
                    var breakPosition = str.IndexOf('|');
                    // 工具分割点
                    var toolBreakPosition = str.IndexOf('&');
                    // 图片
                    var resourceSource = str.Substring(0, breakPosition);
                    // 数量文本
                    var resourceText = str.Substring(breakPosition + 1, toolBreakPosition - breakPosition - 1);
                    // 工具
                    var toolText = str.Substring(toolBreakPosition + 1);
                    // 使用工具
                    if (toolText.Length > 0)
                    {
                        var stackPanel = new StackPanel
                        {
                            Orientation = Orientation.Horizontal,
                            Margin      = thickness
                        };
                        if (resourceSource == "无")
                        {
                            var textBlock = new TextBlock
                            {
                                Text = "无(",
                                VerticalAlignment = VerticalAlignment.Center
                            };
                            stackPanel.Children.Add(textBlock);
                        }
                        else if (!string.IsNullOrEmpty(resourceSource))
                        {
                            var picButton1 = new PicButton
                            {
                                HorizontalAlignment = HorizontalAlignment.Left,
                                Source = StringProcess.GetGameResourcePath(resourceSource),
                                Text   = resourceText + "("
                            };
                            stackPanel.Children.Add(picButton1);
                        }
                        else if (string.IsNullOrEmpty(resourceSource))
                        {
                            var textBlock = new TextBlock
                            {
                                HorizontalAlignment = HorizontalAlignment.Left,
                                VerticalAlignment   = VerticalAlignment.Center,
                                Text = resourceText + "("
                            };
                            stackPanel.Children.Add(textBlock);
                        }
                        PicButton picButton2;
                        PicButton picButton3;
                        if (toolText == "Shovel")
                        {
                            picButton2 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_shovel")
                            };
                            picButton3 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_goldenshovel"),
                                Text   = ")"
                            };
                            stackPanel.Children.Add(picButton2);
                            stackPanel.Children.Add(picButton3);
                        }
                        else if (toolText == "Machete")
                        {
                            picButton2 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_machete")
                            };
                            picButton3 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_luxury_machete"),
                            };
                            var picButton4 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_obsidian_machete"),
                                Text   = ")"
                            };
                            stackPanel.Children.Add(picButton2);
                            stackPanel.Children.Add(picButton3);
                            stackPanel.Children.Add(picButton4);
                        }
                        else if (toolText == "Axe")
                        {
                            picButton2 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_axe")
                            };
                            picButton3 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_goldenaxe"),
                            };
                            var picButton4 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_pickaxe_1"),
                                Text   = ")"
                            };
                            stackPanel.Children.Add(picButton2);
                            stackPanel.Children.Add(picButton3);
                            stackPanel.Children.Add(picButton4);
                        }
                        else if (toolText == "Pickaxe")
                        {
                            picButton2 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_pickaxe")
                            };
                            picButton3 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_goldenpickaxe"),
                            };
                            var picButton4 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_pickaxe_1"),
                                Text   = ")"
                            };
                            stackPanel.Children.Add(picButton2);
                            stackPanel.Children.Add(picButton3);
                            stackPanel.Children.Add(picButton4);
                        }
                        else if (toolText == "Gunpowder")
                        {
                            picButton2 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_gunpowder")
                            };
                            picButton3 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_coconade"),
                            };
                            var picButton4 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_obsidian_coconade"),
                                Text   = ")"
                            };
                            stackPanel.Children.Add(picButton2);
                            stackPanel.Children.Add(picButton3);
                            stackPanel.Children.Add(picButton4);
                        }
                        else if (toolText == "Hammer")
                        {
                            picButton2 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_hammer"),
                                Text   = ")"
                            };
                            stackPanel.Children.Add(picButton2);
                        }
                        else if (toolText == "Torch")
                        {
                            picButton2 = new PicButton
                            {
                                Source = StringProcess.GetGameResourcePath("S_Torch"),
                                Text   = ")"
                            };
                            stackPanel.Children.Add(picButton2);
                        }
                        //picButton1.Click += Creature_Jump_Click;
                        //picButton2.Click += Creature_Jump_Click;
                        NaturalResourcesDestroyedStackPanel.Children.Add(stackPanel);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(resourceSource))
                        {
                            var picButton = new PicButton
                            {
                                HorizontalAlignment = HorizontalAlignment.Left,
                                Margin = thickness,
                                Source = StringProcess.GetGameResourcePath(resourceSource),
                                Text   = resourceText
                            };
                            //picButton.Click += Creature_Jump_Click;
                            NaturalResourcesDestroyedStackPanel.Children.Add(picButton);
                        }
                        else
                        {
                            var textBlock = new TextBlock
                            {
                                HorizontalAlignment = HorizontalAlignment.Left,
                                Margin            = thickness,
                                VerticalAlignment = VerticalAlignment.Center,
                                Text = resourceText
                            };
                            NaturalResourcesDestroyedStackPanel.Children.Add(textBlock);
                        }
                    }
                }
            }
        }
        public async Task Deserialize()
        {
            _creatureLandData.Clear();
            _creatureOceanData.Clear();
            _creatureFlyData.Clear();
            _creatureCaveData.Clear();
            _creatureEvilData.Clear();
            _creatureOthersData.Clear();
            _creatureBossData.Clear();
            var creature = JsonConvert.DeserializeObject <CreaturesRootObject>(await StringProcess.GetJsonString("Creatures.json"));

            foreach (var creatureLandItems in creature.Land.Creature)
            {
                _creatureLandData.Add(creatureLandItems);
            }
            foreach (var creatureLandItems in _creatureLandData)
            {
                creatureLandItems.Picture = StringProcess.GetGameResourcePath(creatureLandItems.Picture);
            }
            foreach (var creatureOceanItems in creature.Ocean.Creature)
            {
                _creatureOceanData.Add(creatureOceanItems);
            }
            foreach (var creatureOceanItems in _creatureOceanData)
            {
                creatureOceanItems.Picture = StringProcess.GetGameResourcePath(creatureOceanItems.Picture);
            }
            foreach (var creatureFlyItems in creature.Fly.Creature)
            {
                _creatureFlyData.Add(creatureFlyItems);
            }
            foreach (var creatureFlyItems in _creatureFlyData)
            {
                creatureFlyItems.Picture = StringProcess.GetGameResourcePath(creatureFlyItems.Picture);
            }
            foreach (var creatureCaveItems in creature.Cave.Creature)
            {
                _creatureCaveData.Add(creatureCaveItems);
            }
            foreach (var creatureCaveItems in _creatureCaveData)
            {
                creatureCaveItems.Picture = StringProcess.GetGameResourcePath(creatureCaveItems.Picture);
            }
            foreach (var creatureEvilItems in creature.Evil.Creature)
            {
                _creatureEvilData.Add(creatureEvilItems);
            }
            foreach (var creatureEvilItems in _creatureEvilData)
            {
                creatureEvilItems.Picture = StringProcess.GetGameResourcePath(creatureEvilItems.Picture);
            }
            foreach (var creatureOthersItems in creature.Others.Creature)
            {
                _creatureOthersData.Add(creatureOthersItems);
            }
            foreach (var creatureOthersItems in _creatureOthersData)
            {
                creatureOthersItems.Picture = StringProcess.GetGameResourcePath(creatureOthersItems.Picture);
            }
            foreach (var creatureBossItems in creature.Boss.Creature)
            {
                _creatureBossData.Add(creatureBossItems);
            }
            foreach (var creatureBossItems in _creatureBossData)
            {
                creatureBossItems.Picture = StringProcess.GetGameResourcePath(creatureBossItems.Picture);
            }
        }
예제 #29
0
        public async Task Deserialize()
        {
            _SkinsBodyData.Clear();
            _SkinsHandsData.Clear();
            _SkinsLegsData.Clear();
            _SkinsFeetData.Clear();
            _SkinsCharactersData.Clear();
            _SkinsItemsData.Clear();
            _SkinsStructuresData.Clear();
            _SkinsCrittersData.Clear();
            _SkinsSpecialData.Clear();
            _SkinsHallowedNightsSkinsData.Clear();
            _SkinsWintersFeastSkinsData.Clear();
            _SkinsYearOfTheGobblerSkinsData.Clear();
            _SkinsTheForgeData.Clear();
            _SkinsEmotesData.Clear();
            _SkinsOutfitSetsData.Clear();
            var Skins = JsonConvert.DeserializeObject <SkinsRootObject>(await StringProcess.GetJsonStringSkins());

            foreach (var SkinsBodyItems in Skins.Body.Skin)
            {
                SkinsBodyItems.Picture = StringProcess.GetGameResourcePath(SkinsBodyItems.Picture);
                SkinsBodyItems.Color   = GetSkinColor(SkinsBodyItems.Rarity);
                _SkinsBodyData.Add(SkinsBodyItems);
            }
            foreach (var SkinsHandsData in Skins.Hands.Skin)
            {
                SkinsHandsData.Picture = StringProcess.GetGameResourcePath(SkinsHandsData.Picture);
                SkinsHandsData.Color   = GetSkinColor(SkinsHandsData.Rarity);
                _SkinsHandsData.Add(SkinsHandsData);
            }
            foreach (var SkinsLegsItems in Skins.Legs.Skin)
            {
                SkinsLegsItems.Picture = StringProcess.GetGameResourcePath(SkinsLegsItems.Picture);
                SkinsLegsItems.Color   = GetSkinColor(SkinsLegsItems.Rarity);
                _SkinsLegsData.Add(SkinsLegsItems);
            }
            foreach (var SkinsFeetItems in Skins.Feet.Skin)
            {
                SkinsFeetItems.Picture = StringProcess.GetGameResourcePath(SkinsFeetItems.Picture);
                SkinsFeetItems.Color   = GetSkinColor(SkinsFeetItems.Rarity);
                _SkinsFeetData.Add(SkinsFeetItems);
            }
            foreach (var SkinsCharactersItems in Skins.Characters.Skin)
            {
                SkinsCharactersItems.Picture = StringProcess.GetGameResourcePath(SkinsCharactersItems.Picture);
                SkinsCharactersItems.Color   = GetSkinColor(SkinsCharactersItems.Rarity);
                _SkinsCharactersData.Add(SkinsCharactersItems);
            }
            foreach (var SkinsItemsItems in Skins.Items.Skin)
            {
                SkinsItemsItems.Picture = StringProcess.GetGameResourcePath(SkinsItemsItems.Picture);
                SkinsItemsItems.Color   = GetSkinColor(SkinsItemsItems.Rarity);
                _SkinsItemsData.Add(SkinsItemsItems);
            }
            foreach (var SkinsStructuresItems in Skins.Structures.Skin)
            {
                SkinsStructuresItems.Picture = StringProcess.GetGameResourcePath(SkinsStructuresItems.Picture);
                SkinsStructuresItems.Color   = GetSkinColor(SkinsStructuresItems.Rarity);
                _SkinsStructuresData.Add(SkinsStructuresItems);
            }
            foreach (var SkinsCrittersItems in Skins.Critters.Skin)
            {
                SkinsCrittersItems.Picture = StringProcess.GetGameResourcePath(SkinsCrittersItems.Picture);
                SkinsCrittersItems.Color   = GetSkinColor(SkinsCrittersItems.Rarity);
                _SkinsCrittersData.Add(SkinsCrittersItems);
            }
            foreach (var SkinsSpecialItems in Skins.Special.Skin)
            {
                SkinsSpecialItems.Picture = StringProcess.GetGameResourcePath(SkinsSpecialItems.Picture);
                SkinsSpecialItems.Color   = GetSkinColor(SkinsSpecialItems.Rarity);
                _SkinsSpecialData.Add(SkinsSpecialItems);
            }
            foreach (var SkinsHallowedNightsSkinsItems in Skins.HallowedNightsSkins.Skin)
            {
                SkinsHallowedNightsSkinsItems.Picture = StringProcess.GetGameResourcePath(SkinsHallowedNightsSkinsItems.Picture);
                SkinsHallowedNightsSkinsItems.Color   = GetSkinColor(SkinsHallowedNightsSkinsItems.Rarity);
                _SkinsHallowedNightsSkinsData.Add(SkinsHallowedNightsSkinsItems);
            }
            foreach (var SkinsWintersFeastSkinsItems in Skins.WintersFeastSkins.Skin)
            {
                SkinsWintersFeastSkinsItems.Picture = StringProcess.GetGameResourcePath(SkinsWintersFeastSkinsItems.Picture);
                SkinsWintersFeastSkinsItems.Color   = GetSkinColor(SkinsWintersFeastSkinsItems.Rarity);
                _SkinsWintersFeastSkinsData.Add(SkinsWintersFeastSkinsItems);
            }
            foreach (var SkinsYearOfTheGobblerSkinsItems in Skins.YearOfTheGobblerSkins.Skin)
            {
                SkinsYearOfTheGobblerSkinsItems.Picture = StringProcess.GetGameResourcePath(SkinsYearOfTheGobblerSkinsItems.Picture);
                SkinsYearOfTheGobblerSkinsItems.Color   = GetSkinColor(SkinsYearOfTheGobblerSkinsItems.Rarity);
                _SkinsYearOfTheGobblerSkinsData.Add(SkinsYearOfTheGobblerSkinsItems);
            }
            foreach (var SkinsTheForgeItems in Skins.TheForge.Skin)
            {
                SkinsTheForgeItems.Picture = StringProcess.GetGameResourcePath(SkinsTheForgeItems.Picture);
                SkinsTheForgeItems.Color   = GetSkinColor(SkinsTheForgeItems.Rarity);
                _SkinsTheForgeData.Add(SkinsTheForgeItems);
            }
            foreach (var SkinsEmotesItems in Skins.Emotes.Skin)
            {
                SkinsEmotesItems.Picture = StringProcess.GetGameResourcePath(SkinsEmotesItems.Picture);
                SkinsEmotesItems.Color   = GetSkinColor(SkinsEmotesItems.Rarity);
                _SkinsEmotesData.Add(SkinsEmotesItems);
            }
            foreach (var SkinsOutfitSetsItems in Skins.OutfitSets.Skin)
            {
                SkinsOutfitSetsItems.Picture = StringProcess.GetGameResourcePath(SkinsOutfitSetsItems.Picture);
                SkinsOutfitSetsItems.Color   = GetSkinColor(SkinsOutfitSetsItems.Rarity);
                _SkinsOutfitSetsData.Add(SkinsOutfitSetsItems);
            }
        }