//properties //methods public List <TileV> SetInput(List <TileV> tiles) { List <Button> bus; foreach (TileV tile in tiles) { if (tile.Object != null) { if (tile.Object is ActionObject) { bus = new List <Button> { new ClickButton("game_but|button_use"), new KbButton(Microsoft.Xna.Framework.Input.Keys.C) }; (tile.Object as ActionObject).ActionLine.PlayerInput = PlayerInput.GetInput2(bus); } else if (tile.Object is GameObject) { bus = new List <Button> { new ClickButton("game_but|button_pickplace"), new KbButton(Microsoft.Xna.Framework.Input.Keys.E) }; ConLine hline = new ConLine(new ActionVoid(_player.HoldObject), new ConToken(tile.Object.Name + "|pickplace|000")); hline.PlayerInput = PlayerInput.GetInput2(bus); bus = new List <Button> { new ClickButton("game_but|button_pickplace"), new KbButton(Microsoft.Xna.Framework.Input.Keys.R) }; ConLine cline = new ConLine(new ActionVoid(_player.PlaceObject), new ConToken(tile.Object.Name + "|pickplace|000")); cline.PlayerInput = PlayerInput.GetInput2(bus); tile.Object.SetMovePlace(hline, cline); } } } return(tiles); }
private ActionObject GetActionObject(List <string> array, StreamReader reader) { string name = array[0]; int numcon = Convert.ToInt32(array[1]); string line; int numreq; ConToken ctoken; List <ClearToken> tokens = new List <ClearToken>(); List <ConToken> ctokens = new List <ConToken>(); //make action line line = reader.ReadLine(); ConToken utoken = new ConToken(line); ctokens.Add(utoken); numreq = Convert.ToInt32(reader.ReadLine()); for (int j = 0; j < numreq; j++) { tokens.Add(new ClearToken(reader.ReadLine())); } ConLine cline = new ConLine(new ActionUse(_player.UseArtifact), utoken, tokens); //make move/place lines for (int i = 0; i < numcon - 1; i++) { ctoken = new ConToken(reader.ReadLine()); ctokens.Add(ctoken); } ActionObject obj = new ActionObject(name, cline); obj.SetTokens(ctokens); return(obj); }
//constructors public ActionObject(string name, ConLine cline) : base(name) { _ctokens = new List <ConToken>(); _cline = cline; _solved = false; }