public void LoadBranches() { StreamReader reader = new StreamReader(_brfname); if (reader != null) { _branches = new List <Storybook>(); string line = reader.ReadLine(); int pageno; string storytitle; string[] array; Storybook book; Storypage page; List <Storypage> pages; while (line != null) { pageno = Convert.ToInt32(line); storytitle = reader.ReadLine(); pages = new List <Storypage>(); for (int i = 0; i < pageno; i++) { array = reader.ReadLine().Split('|'); page = new Storypage(array[0], array[1]); pages.Add(page); } book = new Storybook(storytitle, pages); _branches.Add(book); line = reader.ReadLine(); } reader.Close(); } }
public List <TileV> LoadBooks(List <TileV> tiles, TileVBuilder builder) { StreamReader reader = new StreamReader(_bofname); if (reader != null) { string line = reader.ReadLine(); int pageno, x, y, special; string storytitle; string[] array; Storybook book; Storypage page; List <Storypage> pages; TileV tile; while (line != null) { array = line.Split('|'); pageno = Convert.ToInt32(array[0]); special = Convert.ToInt32(array[1]); array = reader.ReadLine().Split('|'); x = Convert.ToInt32(array[0]); y = Convert.ToInt32(array[1]); storytitle = reader.ReadLine(); pages = new List <Storypage>(); for (int i = 0; i < pageno; i++) { array = reader.ReadLine().Split('|'); page = new Storypage(array[0], array[1]); pages.Add(page); } book = new Storybook(storytitle, pages); if (special == 1) { pageno = Convert.ToInt32(reader.ReadLine()); for (int j = 0; j < pageno; j++) { line = reader.ReadLine(); array = line.Split('|'); if (HasBranch(array[1])) { book.AddChoice(array[0], FindBranch(array[1])); } } } tile = builder.FindTileAt(tiles, x, y); if (tile != null) { if (!tile.Blocked) { tile.Storybook = book; } } line = reader.ReadLine(); } reader.Close(); } return(tiles); }
/// <summary> /// convert convo to GO (tile) /// </summary> /// <param name="bk"></param> /// <param name="xtile"></param> /// <param name="ytile"></param> /// <returns></returns> public static GraphicObject Convert(Storybook bk, int xtile, int ytile) { int w = _size; int h = _size; int x = xtile; int y = ytile; GraphicObject go = new GraphicObject(new GameDetails(x, y, w, h)); go.Name = "common|convo"; go.Priority = 3; return(go); }
/// <summary> /// convert speaking person to char sprite /// </summary> /// <param name="page"></param> /// <returns></returns> public static GraphicObject Convert(Storybook book) { int w = _places["person"].Width; int h = _places["person"].Height; int x = _places["person"].X; int y = _places["person"].Y; Storypage page = book.GetCurrPage(); GraphicObject go = new GraphicObject(new GameDetails(x, y, w, h)); if (page != null) { go.Name = "characters|" + page.PersonSpeaking; go.Priority = 2; } return(go); }
public static Zone LoadCharacter(Player p) { List <GraphicObject> bus = new List <GraphicObject>(); Storybook book = p.GetCurrBook(); GraphicObject go = Convert(book); bus.Add(go); GraphicObject bug = CreateButton("default", 1); bug.Name = "backgrounds|" + book.Name; bus.Add(bug); Zone zn = new Zone(new GameDetails(0, 0, 800, 600), bus, 0, 5); zn.Priority = 2; return(zn); }