finished creach addition, added case for 1 footsie

This commit is contained in:
Pecha 2020-09-13 00:34:29 +10:00
parent d03ccb755e
commit 7c692f0369
10 changed files with 60 additions and 19 deletions

2
.vscode/launch.json vendored
View file

@ -14,7 +14,7 @@
"args": [], "args": [],
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole", "console": "integratedTerminal",
"stopAtEntry": false "stopAtEntry": false
}, },
{ {

View file

@ -43,6 +43,8 @@ namespace creachopedia {
if(this.footsies == 0){ if(this.footsies == 0){
Console.WriteLine("I cannot stip or step! I have 0 footsies! I am however quite powerful in my own way 0u0"); Console.WriteLine("I cannot stip or step! I have 0 footsies! I am however quite powerful in my own way 0u0");
Console.WriteLine("Silly creacher..."); Console.WriteLine("Silly creacher...");
} else if(footsies == 1){
Console.WriteLine($"The {this.name} only has 1 footsie, but it does its best.");
} else { } else {
Console.WriteLine($"The {this.name} steps, and rather well I might add."); Console.WriteLine($"The {this.name} steps, and rather well I might add.");
} }

View file

@ -13,14 +13,18 @@ namespace creachopedia {
var substatus = 1; var substatus = 1;
var tempdict = new Dictionary<string, string>(); var tempdict = new Dictionary<string, string>();
var creacherdict = JsonConvert.DeserializeObject<Dictionary<string, Creacher>>(File.ReadAllText("creachopedia.json")); var creacherdict = JsonConvert.DeserializeObject<Dictionary<string, Creacher>>(File.ReadAllText("creachopedia.json"));
// creacherdict.Add("paca", new GroundCreacher("paca", 4)); var shortdefs = new Dictionary<string, string>(){
// creacherdict.Add("llama", new GroundCreacher("llama", 4)); {"a", "At"},
// creacherdict.Add("stingray", new WaterCreacher("stingray", 0)); {"b", "Below"},
// var jsonsettings = new JsonSerializerSettings{ {"v", "Above"},
// TypeNameHandling = TypeNameHandling.Auto {"n", "None"},
// }; {"w", "Walker"},
// string jsonstring = JsonConvert.SerializeObject(creacherdict, Formatting.Indented, jsonsettings); {"s", "Swimmer"},
// File.WriteAllText("creachopedia.json", jsonstring); {"h", "Hopper"},
{"f", "Flier"},
{"l", "Slitherer"},
{"i", "Incher"}
};
while (true) { while (true) {
@ -46,6 +50,8 @@ namespace creachopedia {
case 5: case 5:
Console.WriteLine("Please enter your creacher's relation to the surface: [b]elow, [a]t, abo[v]e"); Console.WriteLine("Please enter your creacher's relation to the surface: [b]elow, [a]t, abo[v]e");
break; break;
case 6:
break;
} }
break; break;
} }
@ -120,15 +126,20 @@ namespace creachopedia {
var relsurfacematcher = new Regex(@"^[abv]$"); var relsurfacematcher = new Regex(@"^[abv]$");
if (relsurfacematcher.Match(luserin).Success) { if (relsurfacematcher.Match(luserin).Success) {
tempdict.Add("surfacerel", luserin); tempdict.Add("surfacerel", luserin);
substatus ++; substatus++;
} }
else { else {
Console.WriteLine("Sorry, this surface relation did not match one of the three listed above. Please try again."); Console.WriteLine("Sorry, this surface relation did not match one of the three listed above. Please try again.");
} }
} }
else if (substatus == 6) { else if (substatus == 6) {
return; Console.WriteLine("test0");
var tempcreach = new Creacher(tempdict["name"], int.Parse(tempdict["footsies"]), tempdict["biome"], (Locomotion)Enum.Parse(typeof(Locomotion), shortdefs[tempdict["locomethod"]]), (SurfaceRel)Enum.Parse(typeof(SurfaceRel), shortdefs[tempdict["surfacerel"]]));
creacherdict.Add(tempdict["name"], tempcreach);
File.WriteAllText("creachopedia.json", JsonConvert.SerializeObject(creacherdict, Formatting.Indented));
Console.WriteLine("Creacher adde! 0u0");
status = "base";
substatus = 1;
} }
foreach (var i in tempdict) { foreach (var i in tempdict) {
Console.WriteLine("{0}:{1}", i.Key, i.Value); Console.WriteLine("{0}:{1}", i.Key, i.Value);
@ -136,7 +147,7 @@ namespace creachopedia {
} }
Console.WriteLine(""); Console.WriteLine("");
Thread.Sleep(1000); Thread.Sleep(500);
} }
} }
} }

View file

@ -1,20 +1,22 @@
{ {
"paca": { "paca": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land", "type": "creacher of the land",
"name": "paca", "name": "paca",
"_footsies": 4 "_footsies": 4
}, },
"llama": { "llama": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land", "type": "creacher of the land",
"name": "llama", "name": "llama",
"_footsies": 4 "_footsies": 4
}, },
"stingray": { "stingray": {
"$type": "creachopedia.WaterCreacher, creachopedia",
"type": "creacher of the water", "type": "creacher of the water",
"name": "stingray", "name": "stingray",
"_footsies": 0 "_footsies": 0
},
"Snool": {
"type": "creacher of the urban",
"name": "Snool",
"_footsies": 1
} }
} }

20
json.bak Normal file
View file

@ -0,0 +1,20 @@
{
"paca": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land",
"name": "paca",
"_footsies": 4
},
"llama": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land",
"name": "llama",
"_footsies": 4
},
"stingray": {
"$type": "creachopedia.WaterCreacher, creachopedia",
"type": "creacher of the water",
"name": "stingray",
"_footsies": 0
}
}

View file

@ -1,4 +1,10 @@
name, footsycount, biome///, locomotion, surfacerel, name, footsycount, biome, locomotion, surfacerel,
None, Walker, Swimmer, Hopper, Flier, Slitherer, Incher None, Walker, Swimmer, Hopper, Flier, Slitherer, Incher
FOR NEXT VERSION:
- individuals/species distinction
- ability to add individuals without a previously-created species by creating them together
- maybe get rid of Newtonsoft JSON stuff- polymorphism no longer necessary w/ sunsetting of inheritance