private void ActivityItemsCodeChange(object sender, RoutedEventArgs e) { if (FarmInfoRootData.Sons.Count() <= 0) { Microsoft.Win32.OpenFileDialog op = new Microsoft.Win32.OpenFileDialog(); op.Title = "请选择farms.data文件,这通常在remote文件夹中"; op.Filter = "farms.data文件|farms.data"; op.ShowDialog(); string addr = op.FileName; if (addr == "" || addr == null) { return; } SData.TotalLoadFromUserData(addr, FarmInfoRootData); } //下面是修改过程 string itemcodes = TxtItemCodes.Text; string legalcode = itemcodes.Replace("\"Rewards\":", "").TrimEnd(','); if (legalcode[0] != '[' || legalcode[legalcode.Length - 1] != ']') { MessageBox.Show("代码格式错误。请检查输入的代码。"); return; } SData dt = FarmInfoRootData.TurnTo("\"Rewards\""); dt.sonKind = 0; dt.Value = legalcode; if (SData.TotalSaveUserData()) { MessageBox.Show("修改成功!"); } }
private void ChangeChunkIdByWheel(object sender, MouseWheelEventArgs e) { if (RootData.Sons.Count() <= 0) { return; } Image obj = (Image)sender; string x = obj.Name.Split('_')[1]; string y = obj.Name.Split('_')[2]; int num = Convert.ToInt32(x) * 7 + Convert.ToInt32(y); int inc = 1; if (e.Delta > 0) { inc = -1; } ChunkNowIdNum[num] = (ChunkNowIdNum[num] + inc + ChunkIdDict.Count()) % ChunkIdDict.Count(); if (ChunkNowIdNum[num] < 0) { return; } obj.Source = new BitmapImage(new Uri("/Resources/" + ChunkIdDict[ChunkNowIdNum[num]] + ".png", UriKind.Relative)); SData thechunk = RootData.TurnTo("Chunks").Search("ChunkPosition", "\"" + x + "," + y + "\""); thechunk.TurnTo("ChunkId").Value = "\"" + ChunkIdDict[ChunkNowIdNum[num]] + "\""; Console.WriteLine(thechunk.TurnTo("ChunkPosition").Value); }
private void SetFlatAuto(object sender, RoutedEventArgs e) { if (RootData.Sons.Count <= 0 || gamesavepathNoName == "") { OpenFileAndLoad(null, null); } if (RootData.Sons.Count <= 0 || gamesavepathNoName == "") { return; } SData chunks = RootData.TurnTo("Chunks"); foreach (var chunk in chunks.Sons) { Console.WriteLine(chunk.TurnTo("ChunkPosition").Value); chunk.TurnTo("ChunkId").Value = "\"Flat_Chunk\""; } RefreshChunks(); SaveGame(); }