-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
SteveWillowby
committed
Nov 18, 2016
1 parent
856b0e6
commit 120534f
Showing
4 changed files
with
91 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* Parses a requirement line */ | ||
using System; | ||
|
||
public class EffectParser | ||
{ | ||
public enum Type | ||
{ | ||
Put | ||
, Remove | ||
, Create | ||
, Delete | ||
, Distribute | ||
, Disown | ||
, Players | ||
, SetTimer | ||
}; | ||
|
||
protected static char[] dot = {'.'}; | ||
|
||
public Effect Parse(Line header, Line line) | ||
{ | ||
Action<Object[]> affector = o => {}; | ||
|
||
string t = line.tokens[1].val; | ||
Type type = ParseType(t); | ||
|
||
if(type == Type.Put) | ||
{ | ||
} | ||
else if(type == Type.Remove) | ||
{ | ||
} | ||
else if(type == Type.Delete) | ||
{ | ||
} | ||
else if(type == Type.Distribute) | ||
{ | ||
} | ||
else if(type == Type.Disown) | ||
{ | ||
} | ||
else if(type == Type.Players) | ||
{ | ||
} | ||
else if(type == Type.SetTimer) | ||
{ | ||
} | ||
|
||
return new Effect(affector); | ||
} | ||
|
||
protected static Type ParseType(string t) | ||
{ | ||
switch(t) | ||
{ | ||
case "put": | ||
return Type.Put; | ||
case "remove": | ||
return Type.Remove; | ||
case "create": | ||
return Type.Create; | ||
case "delete": | ||
return Type.Delete; | ||
case "distribute": | ||
return Type.Distribute; | ||
case "disown": | ||
return Type.Disown; | ||
case "players": | ||
return Type.Players; | ||
case "settimer": | ||
return Type.SetTimer; | ||
default: | ||
throw new Exception("Invalid requirement type " + t); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters