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; ConsolePre.Text = $"c_give(\"{c.Console}\","; }
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); } }
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 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 void CalculateSize() { _displayString = Text; var font = IsLargeText ? Main.fontDeathText : Main.fontMouseText; if (SizeStyle == SizeStyle.Inline) { Size = MeasureSize(Text); } else { _displayString = StringProcess.GetClampStringWithEllipses(font, _displayString, TextScale, Width); Size = new Vector2(Size.X, MeasureSize(_displayString).Y); } }
public string getSynTime(String teamName, String musicName) { //return "::"+ teamName+"++"+musicName; string result = "ss"; try { DbProcess msd = new DbProcess(teamName); // 验证是否已存在某条舞团播放信息 if (msd.getTeam()) {// true为已存在 // 获取音乐播放状态 msd.setSyncIdFromTeamName(teamName); if (msd.getMusicState() == 1) { // 1-播放中;0-暂停;-1-默认状态 // 获取音乐开始播放日期时间 DateTime ts = msd.getStartDateTime(); // 开始播放的日期时间 long s = StringProcess.ConvertDataTimeLong(DateTime.Now) - StringProcess.ConvertDataTimeLong(ts); return("" + s);//播放进度 } else if (msd.getMusicState() == 0) { long s = msd.getPauseTime(); return("" + -1);//"已在"+s+"毫秒处暂停"; } else { return("" + -2);//"播放状态错误"; } } else { // 添加 System.Diagnostics.Debug.Write(msd.getTeam()); if (msd.addNewMusic(musicName)) { return("" + 0); //"已添加成功"; } return("" + -3); //"添加失败"; } } catch (Exception e) { result = 2017 + e.ToString(); } return(result); }
public async Task <IActionResult> Register([Bind("IdUser,Username,Password,HoTen,NgaySinh,GioiTinh,DiaChi,SDT,LoaiTaiKhoan")] UserModel userModel) { userModel.Password = StringProcess.CreateMD5Hash(userModel.Password).ToString(); _context.Add(userModel); await _context.SaveChangesAsync(); if (userModel.Username == null) { HttpContext.Session.SetString("Userthuong", ""); } else { HttpContext.Session.SetString("Userthuong", userModel.Username); } return(RedirectToAction(nameof(Index))); }
public void ChangeLayout(string _layout) { if (layout == _layout) { return; } layout = _layout; foreach (System.Reflection.FieldInfo field in typeof(Input_Profile).GetFields()) { if (field.FieldType == typeof(string)) { field.SetValue(this, StringProcess.QwertyAzerty((string)field.GetValue(this))); } } }
private async void Science_Jump_Tapped(object sender, TappedRoutedEventArgs e) { var picturePath = ((PicButton)sender).Source; var rootFrame = Global.RootFrame; var shortName = StringProcess.GetFileName(picturePath); var frameTitle = Global.FrameTitle; await Global.SetAutoSuggestBoxItem(); foreach (var suggestBoxItem in Global.AutoSuggestBoxItemSource) { if (picturePath != suggestBoxItem.Picture) { continue; } var picHead = shortName.Substring(0, 1); var extraData = new List <string> { suggestBoxItem.SourcePath, suggestBoxItem.Picture }; switch (picHead) { case "F": frameTitle.Text = "食物"; Global.PageJump(1); rootFrame.Navigate(typeof(FoodPage), extraData); Global.PageStack.Push(new PageStackItem { TypeName = typeof(FoodPage), Object = extraData }); break; case "S": rootFrame.Navigate(typeof(SciencePage), extraData); Global.PageStack.Push(new PageStackItem { TypeName = typeof(SciencePage), Object = extraData }); break; case "G": frameTitle.Text = "物品"; Global.PageJump(6); rootFrame.Navigate(typeof(GoodPage), extraData); Global.PageStack.Push(new PageStackItem { TypeName = typeof(GoodPage), Object = extraData }); break; } } }
public MainPage() { InitializeComponent(); if (Width <= 641) { AutoSuggestButton.Visibility = Visibility.Visible; SearchAutoSuggestBox.Visibility = Visibility.Collapsed; } else { AutoSuggestButton.Visibility = Visibility.Collapsed; SearchAutoSuggestBox.Visibility = Visibility.Visible; } //订阅后退按钮事件 SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested; //Global类里的一些设定 Global.RootGrid = RootGrid; Global.FrameTitle = Global.GetOsVersion() >= 16299 ? FrameTitleAcrylic : FrameTitle; Global.AutoSuggestGrid = AutoSuggestGrid; Global.RootFrame = RootFrame; Global.IconsListViewGameData = IconsListViewGameData; Global.IconsListViewSettingAndAbout = IconsListViewSettingAndAbout; // 设置Frame标题Margin属性 SetFrameTitleMargin(); // 汉堡菜单边框 //HamburgerGrid.BorderBrush = new SolidColorBrush(Global.AccentColor); //亚克力背景颜色及透明度设置读取 Global.TinkOpacity = SettingSet.AcrylicOpacitySettingRead(); Global.TinkColor = StringProcess.StringToColor(SettingSet.AcrylicColorSettingRead()); // 默认页 RootFrame.SourcePageType = typeof(CharacterPage); Global.PageStack.Push(new PageStackItem { TypeName = typeof(CharacterPage) }); // 设置SearchAutoSuggestBox的ItemSource属性 SearchAutoSuggestBox.ItemsSource = Global.AutoSuggestBoxItem; // 设置主题 if (Global.GetOsVersion() >= 16299) { ((Frame)Window.Current.Content).RequestedTheme = ElementTheme.Dark; } else { ((Frame)Window.Current.Content).RequestedTheme = SettingSet.ThemeSettingRead() ? ElementTheme.Dark : ElementTheme.Light; } }
/// <summary> /// 取得したDataRowをModelにマッピングする /// </summary> /// <typeparam name="T">モデルの型</typeparam> /// <param name="dr">検索結果のDataRow</param> /// <param name="columnNames">検索結果のカラム名リスト</param> /// <param name="propetyNames">バインドするモデルのカラム名リスト</param> /// <returns>検索結果のDataRowを指定したモデルにマッピングした結果を返す</returns> private T MappingModelByDataRow <T>(DataRow dr, List <string> columnNames, List <string> propetyNames) where T : class { // 戻り値のモデルインスタンス作成 var resultInstance = Activator.CreateInstance(typeof(T)) as T; foreach (var columnName in columnNames) { //TODO スネークケースかどうかの判定をプロパティに変更する //接続先のカラム名の命名規則によってキャメルケースに変更する処理 var propetyName = (ColumnNameRole == DBColumnNameRole.SnakeCase) ? StringProcess.ToCamelBySnake(columnName) : columnName; if (propetyNames.Any(m => m == propetyName)) { //戻り値のモデルインスタンスにカラム情報をマッピングする resultInstance.GetType().GetProperty(propetyName).SetValue(resultInstance, dr[columnName] is DBNull ? null : dr[columnName]); } } return(resultInstance); }
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; ConsolePre.Text = $"c_give(\"{c.Console}\","; }
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}\","; }
private void btn_HuoBiStart_Click(object sender, EventArgs e) { //初始化WebSocket HuobiWSApi.Init(); HuobiWSApi.OnMessage += HuobiWSApi_OnMessage; //查询数据库配置 Vmp_ConfigCollection configColl = new Vmp_ConfigCollection(); if (!configColl.ListByPlatformCode("HuoBi")) { return; } //订阅多个交易对深度 foreach (Vmp_Config item in configColl) { string topic = StringProcess.HuoBiString(item.CurrencyCode, item.ExCurrencyCode); HuobiWSApi.Subscribe(topic, item.PairId.ToString()); } }
private static async void Good_Jump_Tapped(object sender, TappedRoutedEventArgs e) { var picturePath = ((PicButton)sender).Source; var rootFrame = Global.RootFrame; var shortName = StringProcess.GetFileName(picturePath); var frameTitle = Global.FrameTitle; await Global.SetAutoSuggestBoxItem(); foreach (var suggestBoxItem in Global.AutoSuggestBoxItemSource) { if (picturePath != suggestBoxItem.Picture) { continue; } var picHead = shortName.Substring(0, 1); var viewExtraData = new ViewExtraData { Classify = suggestBoxItem.SourcePath, Picture = suggestBoxItem.Picture }; switch (picHead) { case "S": frameTitle.Text = "科技"; Global.PageJump(3); rootFrame.Navigate(typeof(SciencePage), viewExtraData); Global.PageStack.Push(new PageStackItem { SourcePageType = typeof(SciencePage), Parameter = viewExtraData }); break; case "A": frameTitle.Text = "生物"; Global.PageJump(4); rootFrame.Navigate(typeof(CreaturePage), viewExtraData); Global.PageStack.Push(new PageStackItem { SourcePageType = typeof(CreaturePage), Parameter = viewExtraData }); break; } } }
public async Task <IActionResult> Create([Bind("IDTK,Ten,Password,HinhAnh,Quyen,TrangThai")] TaiKhoan taiKhoan, IFormFile ful) { if (ModelState.IsValid) { taiKhoan.Password = StringProcess.CreateMD5Hash(taiKhoan.Password); _context.Add(taiKhoan); await _context.SaveChangesAsync(); var parth = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/Admin/avatar", taiKhoan.IDTK + "." + ful.FileName.Split(".")[ful.FileName.Split(".").Length - 1]); using (var stream = new FileStream(parth, FileMode.Create)) { await ful.CopyToAsync(stream); } taiKhoan.HinhAnh = taiKhoan.IDTK + "." + ful.FileName.Split(".")[ful.FileName.Split(".").Length - 1]; _context.Update(taiKhoan); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(taiKhoan)); }
/// <summary> /// 添加食材 /// </summary> /// <param name="foodName">食材名称</param> private void AddFood(string foodName) { if (string.IsNullOrEmpty(CsRecipe1) && string.IsNullOrEmpty(CsRecipe2) && string.IsNullOrEmpty(CsRecipe3) && string.IsNullOrEmpty(CsRecipe4)) { FoodHealth.Value = 0; FoodHunger.Value = 0; FoodSanity.Value = 0; } if (string.IsNullOrEmpty(CsRecipe1) || string.IsNullOrEmpty(CsRecipe2) || string.IsNullOrEmpty(CsRecipe3) || string.IsNullOrEmpty(CsRecipe4)) { CS_Food_Property(foodName); } if (string.IsNullOrEmpty(CsRecipe1)) { CsRecipe1 = StringProcess.GetFileName(foodName); Food1Image.Source = new BitmapImage(new Uri(foodName)); } else if (string.IsNullOrEmpty(CsRecipe2)) { CsRecipe2 = StringProcess.GetFileName(foodName); Food2Image.Source = new BitmapImage(new Uri(foodName)); } else if (string.IsNullOrEmpty(CsRecipe3)) { CsRecipe3 = StringProcess.GetFileName(foodName); Food3Image.Source = new BitmapImage(new Uri(foodName)); } else if (string.IsNullOrEmpty(CsRecipe4)) { CsRecipe4 = StringProcess.GetFileName(foodName); Food4Image.Source = new BitmapImage(new Uri(foodName)); } if (CsRecipe1 != "" && CsRecipe2 != "" && CsRecipe3 != "" && CsRecipe4 != "") { CS_CrockPotCalculation(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (Global.GetOsVersion() >= 16299) { var dimGrayAcrylicBrush = new AcrylicBrush { BackgroundSource = AcrylicBackgroundSource.HostBackdrop, FallbackColor = Colors.Transparent, TintColor = Global.TinkColor, TintOpacity = Global.TinkOpacity }; RootStackPanel.Background = dimGrayAcrylicBrush; //隐藏主题设置 ThemeStackPanel.Visibility = Visibility.Collapsed; //显示亚克力背景设置 AcrylicOpacityStackPanel.Visibility = Visibility.Visible; AcrylicBackgroundStackPanel.Visibility = Visibility.Visible; //添加ColorPicker控件 var colorPicker = new ColorPicker { HorizontalAlignment = HorizontalAlignment.Left, Color = Color.FromArgb(255, 105, 105, 105), RenderTransformOrigin = new Point(0, 0), RenderTransform = new CompositeTransform { ScaleX = 0.7, ScaleY = 0.7 } }; colorPicker.ColorChanged += ColorPicker_ColorChanged; AcrylicBackgroundStackPanel.Children.Add(colorPicker); AcrylicOpacitySlider.Value = SettingSet.AcrylicOpacitySettingRead(); _acrylicOpacitySetted = true; colorPicker.Color = StringProcess.StringToColor(SettingSet.AcrylicColorSettingRead()); } }
/// <summary> /// 读取世界选项的文件,赋值到selectConfigWorld,类型 /// </summary> private void ReadEditWorldJson() { // 先清空,再赋值 _leveldataOverrideObject = new LeveldataoverrideObject(); // 读取文件,填入到字典 var serverConfig = JsonConvert.DeserializeObject <EditWorldRootObject>(StringProcess.GetJsonString("EditWorld/EditWorld.json")); if (!_isCave) { var master = serverConfig.EditWorld.Master; foreach (var world in master.World) { _leveldataOverrideObject.World.Add(new LeveldataoverrideWorld { Picture = @"/Resources/DedicatedServer/World/" + world.Key + ".png", Key = world.Key, Value = world.Value.Split(',').ToList() }); } foreach (var resources in master.Resources) { _leveldataOverrideObject.Resources.Add(new LeveldataoverrideResources { Picture = @"/Resources/DedicatedServer/World/" + resources.Key + ".png", Key = resources.Key, Value = resources.Value.Split(',').ToList() }); } foreach (var foods in master.Foods) { _leveldataOverrideObject.Foods.Add(new LeveldataoverrideFoods { Picture = @"/Resources/DedicatedServer/World/" + foods.Key + ".png", Key = foods.Key, Value = foods.Value.Split(',').ToList() }); } foreach (var animals in master.Animals) { _leveldataOverrideObject.Animals.Add(new LeveldataoverrideAnimals { Picture = @"/Resources/DedicatedServer/World/" + animals.Key + ".png", Key = animals.Key, Value = animals.Value.Split(',').ToList() }); } foreach (var monsters in master.Monsters) { _leveldataOverrideObject.Monsters.Add(new LeveldataoverrideMonsters { Picture = @"/Resources/DedicatedServer/World/" + monsters.Key + ".png", Key = monsters.Key, Value = monsters.Value.Split(',').ToList() }); } foreach (var world in _leveldataOverrideObject.World) { world.Index = GetIndex(world); } foreach (var resources in _leveldataOverrideObject.Resources) { resources.Index = GetIndex(resources); } foreach (var foods in _leveldataOverrideObject.Foods) { foods.Index = GetIndex(foods); } foreach (var animals in _leveldataOverrideObject.Animals) { animals.Index = GetIndex(animals); } foreach (var monsters in _leveldataOverrideObject.Monsters) { monsters.Index = GetIndex(monsters); } } else { var caves = serverConfig.EditWorld.Caves; foreach (var world in caves.World) { _leveldataOverrideObject.World.Add(new LeveldataoverrideWorld { Picture = @"/Resources/DedicatedServer/World/" + world.Key + ".png", Key = world.Key, Value = world.Value.Split(',').ToList() }); } foreach (var resources in caves.Resources) { _leveldataOverrideObject.Resources.Add(new LeveldataoverrideResources { Picture = @"/Resources/DedicatedServer/World/" + resources.Key + ".png", Key = resources.Key, Value = resources.Value.Split(',').ToList() }); } foreach (var foods in caves.Foods) { _leveldataOverrideObject.Foods.Add(new LeveldataoverrideFoods { Picture = @"/Resources/DedicatedServer/World/" + foods.Key + ".png", Key = foods.Key, Value = foods.Value.Split(',').ToList() }); } foreach (var animals in caves.Animals) { _leveldataOverrideObject.Animals.Add(new LeveldataoverrideAnimals { Picture = @"/Resources/DedicatedServer/World/" + animals.Key + ".png", Key = animals.Key, Value = animals.Value.Split(',').ToList() }); } foreach (var monsters in caves.Monsters) { _leveldataOverrideObject.Monsters.Add(new LeveldataoverrideMonsters { Picture = @"/Resources/DedicatedServer/World/" + monsters.Key + ".png", Key = monsters.Key, Value = monsters.Value.Split(',').ToList() }); } foreach (var world in _leveldataOverrideObject.World) { world.Index = GetIndex(world); } foreach (var resources in _leveldataOverrideObject.Resources) { resources.Index = GetIndex(resources); } foreach (var foods in _leveldataOverrideObject.Foods) { foods.Index = GetIndex(foods); } foreach (var animals in _leveldataOverrideObject.Animals) { animals.Index = GetIndex(animals); } foreach (var monsters in _leveldataOverrideObject.Monsters) { monsters.Index = GetIndex(monsters); } } }
/// <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; } } }
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}\","; } }
private void HandlerServerRequest(HttpContext context, ref string url) { Cache cache = new Cache(HttpContext.Current.Application); string strRq = context.Request.Url.AbsolutePath; string currentUser = context.User.Identity.Name; string path = context.Request.Url.AbsolutePath.ToLower(); // Kiểm tra Cache xem đường dẫn này đã xử lý lần nào chưa - so voi ca duong dan that string newsRef = "", templistRef = "", newstemp = "", multiref = "";//dung trong cac truong hop:Co so, lay cpmode, template, bien k so string[] newsParams; //cắt ký tự đầu "/" string tabRef = path.Substring(path.IndexOf("/") + 1); //path.Substring(path.LastIndexOf("/") + 1); Replace(strRoot, "");// get "TabRef.ext" //cắt ký tự cuối ".aspx" tabRef = tabRef.Substring(0, tabRef.LastIndexOf(".aspx")); // get "TabRef" // Kiểm tra để tách lọc phần mã tham chiếu của tin - Them co che do tin newsRef va luu url vao cache de khoi ton tai nguyen. if (tabRef != "") { //mảng các thành phần url string[] _arrReferenceParts = tabRef.Split("/".ToCharArray()); //truong hop khi thong so cua tabref nhanh duoc co tu 2 phan tro len thi: //1. xac dinh xem thanh phan cuoi co phai ID cua tin khong? Neu phai thi day la dang tab --> News (Co the dat them dau hieu de nhan dien news //2. Neu khong phai la ID cua tin thi co 2 truong hop say ra 1- la tabref luon , 2- la mot loai query moi //nếu là tin if ((_arrReferenceParts.Length >= 2 && StringProcess.IsNumber(_arrReferenceParts[_arrReferenceParts.Length - 1])) || (_arrReferenceParts.Length >= 2 && _arrReferenceParts[_arrReferenceParts.Length - 1].IndexOf("_tm,") > 0)) { string[] str = { "_tm," }; //mảng tách bởi chỗi _tm, newsParams = _arrReferenceParts[_arrReferenceParts.Length - 1].Split(str, StringSplitOptions.None); newsRef = newsParams[0]; if (newsParams.Length > 0) { //chuoi co dang home/parent/child/newsid_tm,3_title.aspx if (_arrReferenceParts[_arrReferenceParts.Length - 1].IndexOf("_tm,") > 0) { //newstemp co dang 3_title newstemp = newsParams[newsParams.Length - 1].Substring(0, 1); } //lay phan con lai lam tabref :home/parent/child tabRef = tabRef.Replace("/" + _arrReferenceParts[_arrReferenceParts.Length - 1], ""); } _arrReferenceParts = String.Join("/", _arrReferenceParts, 0, _arrReferenceParts.Length - 1).Split("/".ToCharArray()); templistRef = _arrReferenceParts[_arrReferenceParts.Length - 1]; tabRef = String.Join("/", _arrReferenceParts, 0, _arrReferenceParts.Length - 1); } else { //truong hop khong phai newsref if (_arrReferenceParts.Length >= 2) { if (_arrReferenceParts.Length == 2) { templistRef = _arrReferenceParts[_arrReferenceParts.Length - 1]; tabRef = String.Join("/", _arrReferenceParts, 0, _arrReferenceParts.Length - 1); } else { templistRef = _arrReferenceParts[_arrReferenceParts.Length - 2]; newsRef = _arrReferenceParts[_arrReferenceParts.Length - 1]; if (newsRef.IndexOf(",") > -1) { multiref = newsRef; newsRef = ""; } tabRef = String.Join("/", _arrReferenceParts, 0, _arrReferenceParts.Length - 2); } } } } Dictionary <string, string> r = new Dictionary <string, string>(); foreach (string key in context.Request.QueryString.Keys) { r[key] = context.Request[key]; } //kiem tra xem - neu truong hop tabref co bao nhieu / thi lui ra bay nhieu lan de tro vao dung muc int intSecNum = 0; string[] strSecs = tabRef.Split("/".ToCharArray()); intSecNum = strSecs.Length; if (":chuyenmuc:users:office:adminportal:login:"******":" + tabRef.ToLower() + ":") != -1) { url = Config.GetMainPage(currentUser); } else { url = context.Request.Url.AbsolutePath.TrimStart('/'); } r["TabRef"] = tabRef.Replace("/", "."); r["NewsRef"] = newsRef; r["cpmode"] = templistRef; r["multiref"] = multiref; bool firstParam = true; foreach (KeyValuePair <string, string> e in r) { if (firstParam) { url += "?"; firstParam = false; } else { url += "&"; } url += e.Key + "=" + e.Value; } url = "~/" + url; }
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); } }
public IActionResult Login(UserModel userModel) { var r = _context.userModels.FirstOrDefault(m => m.Username == userModel.Username && m.Password == StringProcess.CreateMD5Hash(userModel.Password)); if (r == null) { return(RedirectToAction("Login", "Home")); } var str = JsonConvert.SerializeObject(r); i++; if (r.LoaiTaiKhoan == true) { HttpContext.Session.SetString("User", str); var url = Url.RouteUrl(new { controller = "PhimModels", action = "Index", area = "Admin" }); return(Redirect(url)); } HttpContext.Session.SetString("UserThuong", str); return(RedirectToAction("Index", "Home")); }
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); } }
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}\","; }
/// <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); } } } }
/// <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 ConsoleNum_TextChanged(object sender, TextChangedEventArgs e) { var textbox = (TextBox)sender; StringProcess.ConsoleNumTextCheck(textbox); }
static void Main(string[] args) { /////////////////////////////////////////////////////////////////////////////// //介绍性开头 Console.WriteLine("++++++++++++++++++++++++++++++++++++++++++++++++++++++"); Console.WriteLine("+++ Download Hour Rain From CmissServer V1.0 +++"); Console.WriteLine("+++++ Supported By CaoYong 2018.08.29 +++++++++"); Console.WriteLine("+++++ QQ: 403637605 +++++++++"); Console.WriteLine("++++++++++++++++++++++++++++++++++++++++++++++++++++++"); /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //打开计时器 Stopwatch sw = new Stopwatch(); //创建计时器 sw.Start(); //开启计数器 /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// ///通用设置 string appDir = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; //程序启动文件夹 //string appDir = @"E:/Test/DownloadHourRainCimissData_V1/"; //程序启动文件夹测试 Environment.CurrentDirectory = appDir; //设置shell启动文件夹 string logPath = StringProcess.DateReplace(appDir + "log/YYYYMMDD.txt", DateTime.Now, 000); //日志文件夹地址 Log simpleLog = new Log(logPath); //建立log对象,用于日志的记录 //输出站点ID计算信息 /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// try { /////////////////////////////////////////////////////////////////////////// //时间处理(北京时) DateTime dtNow = DateTime.Now; //程序启动时间(北京时) if (args.Length == 0) //实时运算处理 { dtNow = DateTime.Now; //实际运行 //dtNow = new DateTime(2018, 12, 06, 10, 05, 00); //测试运行 } else if (args.Length == 1 && args[0].Length == 12) //指定日期运算处理 { try { dtNow = DateTime.ParseExact(args[0], "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture); } catch { simpleLog.WriteError("Date Args Content Is Not Right!", 1); return; } } else { simpleLog.WriteError("Date Args Number Is Not Right!", 1); return; } /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //读取控制文件 string paraFilePath = appDir + @"para/para.ini"; //控制文件地址 string r01hStaSamplePath = null; //站点数据保存地址(小时降水) if (!File.Exists(paraFilePath)) { simpleLog.WriteError("Para File Is Not Exist!", 1); return; } else { FileStream paraFS = new FileStream(paraFilePath, FileMode.Open, FileAccess.Read); StreamReader paraSR = new StreamReader(paraFS, Encoding.GetEncoding("gb2312")); { try { string strTmp = paraSR.ReadLine(); string[] strArrayTmp = strTmp.Split(new char[] { '=' }); r01hStaSamplePath = strArrayTmp[1].Trim(); //站点数据保存地址 } catch { simpleLog.WriteError("Para Content Is Not Right!", 1); return; } } paraSR.Close(); paraFS.Close(); } /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //下载小时级站点降水 { Console.WriteLine("Step2: Download Hour Pre Data..."); DataQueryClient client = new DataQueryClient(); string userId = ConCmiss.USERID; string pwd = ConCmiss.PWD; string interfaceId = "getSurfEleByTime"; Dictionary <String, String> paramsData = new Dictionary <String, String> { { "dataCode", "SURF_CHN_MUL_HOR" }, // 资料代码 { "elements", "Station_Id_d,Lon,Lat,PRE_1h" }, // 检索要素:站号、小时降水 { "orderby", "Station_Id_d:ASC" }, // 排序:按照站号从小到大 { "times", "20180831030000" } // 检索时间 }; RetArray2D rddata = new RetArray2D(); client.initResources(); DateTime dtBase = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, dtNow.Hour, 00, 00).AddHours(-8); //下载数据基准时间,并转化为世界时 for (int beforeMin = 0; beforeMin <= 60 * 24; beforeMin = beforeMin + 60) //冗余设置,下载过去24小时内的逐1小时降水 { DateTime dtNeed = dtBase.AddMinutes(-1.0 * beforeMin); //所需下载数据所在时间 paramsData["times"] = dtNeed.ToString("yyyyMMddHHmm00"); //更新下载参数中时间 string outputPath = StringProcess.DateReplace(r01hStaSamplePath, dtNeed, 000); if (File.Exists(outputPath)) //如果文件存在则不予下载 { continue; } client.callAPI_to_array2D(userId, pwd, interfaceId, paramsData, rddata); List <PointData> ltOutput = new List <PointData>(); for (int n = 0; n < rddata.data.GetLength(0); n++) { ltOutput.Add(new PointData(rddata.data[n][0].Trim(), double.Parse(rddata.data[n][1]), double.Parse(rddata.data[n][2]), double.Parse(rddata.data[n][3]))); } ScatterData sdOutput = new ScatterData(ltOutput.ToArray()); sdOutput.ClearToNumGreaterThan(0.0, 100.0); //简单质量控制 sdOutput.ClearToNumLessThan(0.0, 0.0); if (sdOutput.StaData.Length >= 55000) //如果数据量超过5500条,则认为数据已经完整,则写出数据,否则不予写出,配合更新数据 { string strHeader = StringProcess.DateReplace("diamond 3 YYYY年MM月DD日HH时NN分_逐01小时降水 YY MM DD HH -1 0 1 0 0", dtNeed, 000); sdOutput.WriterToMicaps3(outputPath, strHeader); } Console.Write("\rfinish {0,8:f2} %", 100.0 * (beforeMin) / (60 * 24)); } client.destroyResources(); Console.WriteLine("\rfinish ok! "); } /////////////////////////////////////////////////////////////////////////////// } catch (Exception ex) { simpleLog.WriteError(ex.Message, 1); } /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// sw.Stop(); simpleLog.WriteInfo("Time Elasped: " + sw.Elapsed, 1); /////////////////////////////////////////////////////////////////////////////// }