latias1290

Untitled

Feb 19th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 14.58 KB | None | 0 0
  1. // Nicely Aligned^TM
  2. #region Load assets
  3. m_allTheBitmaps = new Dictionary<string, Bitmap>() {
  4.     /* Namespaces:
  5.      * s: room backgrounds (screens)
  6.      * i: inventory items
  7.      * w: world items
  8.      * p: placed items
  9.      * h: hotspot backgrounds
  10.      * n: npc
  11.      */
  12.     { "s/gate_inside",          new Bitmap("screens/gate_inside.jpg") },
  13.     { "s/gate_outside",         new Bitmap("screens/gate_outside.jpg") },
  14.     { "s/wall",                 new Bitmap("screens/wall.jpg") },
  15.     { "s/shed",                 new Bitmap("screens/shed.jpg") },
  16.     { "s/inside_shed",          new Bitmap("screens/inside_shed.png") },
  17.     { "s/stables",              new Bitmap("screens/stables.png") },
  18.     { "s/inside_stables",       new Bitmap("screens/inside_stables.png") },
  19.     { "s/castle",               new Bitmap("screens/castle.png") },
  20.     { "s/inside_castle",        new Bitmap("screens/inside_castle.png") },
  21.     { "s/alchemist",            new Bitmap("screens/alchemist.png") },
  22.     { "i/endGame",              new Bitmap("items/endGame.png") },
  23.     { "i/shovel",               new Bitmap("items/shovel.png") },
  24.     { "i/coal",                 new Bitmap("items/coal.png") },
  25.     { "i/hayBale",              new Bitmap("items/hayBale.png") },
  26.     { "i/planksAndNails",       new Bitmap("items/planks.png") },
  27.     { "i/water",                new Bitmap("items/water.png") },
  28.     { "i/nitrite",              new Bitmap("items/nitrite.png") },
  29.     { "i/sulfur",               new Bitmap("items/sulfur.png") },
  30.     { "i/nitric_acid",          new Bitmap("items/nitric_acid.png") },
  31.     { "i/sulfuric_acid",        new Bitmap("items/sulfuric_acid.png") },
  32.     { "i/glycerol",             new Bitmap("items/glycerol.png") },
  33.     { "i/conc_acid",            new Bitmap("items/conc_acid.png") },
  34.     { "i/explosive",            new Bitmap("items/explosive.png") },
  35.     { "w/hayBale-shed",         new Bitmap("worlditems/hayBale-shed.png") },
  36.     { "w/hayBale-stables",      new Bitmap("worlditems/hayBale-stables.png") },
  37.     { "w/planksAndNails",       new Bitmap("worlditems/planks.png") },
  38.     { "w/shovel",               new Bitmap("worlditems/shovel.png") },
  39.     { "w/coal",                 new Bitmap("worlditems/coal.png") },
  40.     { "p/coal",                 new Bitmap("placeditems/coal.png") },
  41.     { "p/explosive",            new Bitmap("placeditems/explosive.png") },
  42.     { "p/hayBale",              new Bitmap("placeditems/hayBale.png") },
  43.     { "p/plankedGate",          new Bitmap("placeditems/plankedGate.png") },
  44.     // TODO FIXME test object
  45.     { "n/stickFigure",          new Bitmap("npc/stick.png") },
  46. };
  47.  
  48. m_measuringFont = new System.Drawing.Font("Arial", 12.0f / 96.0f, System.Drawing.GraphicsUnit.Inch);
  49. #endregion Load assets
  50.  
  51. #region Initialize game objects
  52. m_allTheRooms = new Dictionary<string, GameScreen>() {
  53.     { "gate",                   new GameScreen("Gate",                  m_allTheBitmaps["s/gate_inside"]) },
  54.     { "outside_gate",           new GameScreen("Outside castle walls",  m_allTheBitmaps["s/gate_outside"]) },
  55.     { "wall",                   new GameScreen("West wall",             m_allTheBitmaps["s/wall"]) },
  56.     { "shed",                   new GameScreen("Shed",                  m_allTheBitmaps["s/shed"]) },
  57.     { "inside_shed",            new GameScreen("Inside the shed",       m_allTheBitmaps["s/inside_shed"]) },
  58.     { "stables",                new GameScreen("Stables",               m_allTheBitmaps["s/stables"]) },
  59.     { "inside_stables",         new GameScreen("Inside the stables",    m_allTheBitmaps["s/inside_stables"]) },
  60.     { "castle",                 new GameScreen("Castle",                m_allTheBitmaps["s/castle"]) },
  61.     { "inside_castle",          new GameScreen("Inside castle",         m_allTheBitmaps["s/inside_castle"]) },
  62.     { "alchemist",              new GameScreen("Alchemist room",        m_allTheBitmaps["s/alchemist"]) },
  63. };
  64.  
  65. m_allTheInvItems = new Dictionary<string, InventoryItem>() {
  66.     { "endGame",                new InventoryItem("Finish game",        m_allTheBitmaps["i/endGame"]) }, // Specially handled item
  67.     { "shovel",                 new InventoryItem("Shovel",             m_allTheBitmaps["i/shovel"]) },
  68.     { "coal",                   new InventoryItem("Coal",               m_allTheBitmaps["i/coal"]) },
  69.     { "hayBale",                new InventoryItem("Hay bale",           m_allTheBitmaps["i/hayBale"]) },
  70.     { "planksAndNails",         new InventoryItem("Planks and nails",   m_allTheBitmaps["i/planksAndNails"]) },
  71.     { "water",                  new InventoryItem("Water",              m_allTheBitmaps["i/water"]) },
  72.     { "sulfur",                 new InventoryItem("Sulfur",             m_allTheBitmaps["i/sulfur"]) },
  73.     { "nitrite",                new InventoryItem("Nitrite",            m_allTheBitmaps["i/nitrite"]) },
  74.     { "nitric_acid",            new InventoryItem("Nitric Acid",        m_allTheBitmaps["i/nitric_acid"]) },
  75.     { "sulfuric_acid",          new InventoryItem("Sulfuric Acid",      m_allTheBitmaps["i/sulfuric_acid"]) },
  76.     { "conc_acid",              new InventoryItem("Concentrated Acid",  m_allTheBitmaps["i/conc_acid"]) },
  77.     { "glycerol",               new InventoryItem("Glycerol",           m_allTheBitmaps["i/glycerol"]) },
  78.     { "explosive",              new InventoryItem("Explosive",          m_allTheBitmaps["i/explosive"]) },
  79. };
  80.  
  81. m_allTheWorldItems = new Dictionary<string, WorldItem>() {
  82.     { "coal",                   new WorldItem("Coal",                   m_allTheBitmaps["w/coal"],            new Vector2f(47,  854),  m_allTheInvItems["coal"]) },
  83.     { "hayBale-shed",           new WorldItem("Hay bale",               m_allTheBitmaps["w/hayBale-shed"],    new Vector2f(1155, 125), m_allTheInvItems["hayBale"]) },
  84.     { "hayBale-stables",        new WorldItem("Hay bale",               m_allTheBitmaps["w/hayBale-stables"], new Vector2f(1416, 701), m_allTheInvItems["hayBale"]) },
  85.     { "shovel",                 new WorldItem("Shovel",                 m_allTheBitmaps["w/shovel"],          new Vector2f(243,  694), m_allTheInvItems["shovel"]) },
  86.     { "water1",                 new WorldItem("Water",                  m_allTheBitmaps["i/water"],           new Vector2f(665, 678),  m_allTheInvItems["water"]) },
  87.     { "water2",                 new WorldItem("Water",                  m_allTheBitmaps["i/water"],           new Vector2f(665, 678),  m_allTheInvItems["water"]) },
  88.     { "nitrite",                new WorldItem("Nitrite",                m_allTheBitmaps["i/nitrite"],         new Vector2f(792, 704),  m_allTheInvItems["nitrite"]) },
  89.     { "sulfur",                 new WorldItem("Sulfur",                 m_allTheBitmaps["i/sulfur"],          new Vector2f(907, 705),  m_allTheInvItems["sulfur"]) },
  90.     { "glycerol",               new WorldItem("Glycerol",               m_allTheBitmaps["i/glycerol"],        new Vector2f(641, 716),  m_allTheInvItems["glycerol"]) },
  91.     { "plankAndNails",          new WorldItem("Planks and nails",       m_allTheBitmaps["w/planksAndNails"],  new Vector2f(0, 594),    m_allTheInvItems["planksAndNails"]) },
  92. };
  93.  
  94. m_allThePlacedItems = new Dictionary<string, PlacedItem>() {
  95.     { "hayBale",                new PlacedItem(m_allTheBitmaps["p/hayBale"],       10, new Rectanglef(817,  694, 285, 105), m_allTheInvItems["hayBale"]) },
  96.     { "plankedGate",            new PlacedItem(m_allTheBitmaps["p/plankedGate"],   20, new Rectanglef(674,  394, 549, 549), null) },
  97.     { "coal1",                  new PlacedItem(m_allTheBitmaps["p/coal"],          15, new Rectanglef(786,  576, 224, 226), m_allTheInvItems["coal"]) },
  98.     { "explosive1",             new PlacedItem(m_allTheBitmaps["p/explosive"],     20, new Rectanglef(786,  560, 224, 226), m_allTheInvItems["explosive"]) },
  99.     { "coal2",                  new PlacedItem(m_allTheBitmaps["p/coal"],          15, new Rectanglef(1010, 576, 224, 226), m_allTheInvItems["coal"]) },
  100.     { "explosive2",             new PlacedItem(m_allTheBitmaps["p/explosive"],     20, new Rectanglef(1010, 560, 224, 226), m_allTheInvItems["explosive"]) },
  101. };
  102.  
  103. m_allTheHotspots = new Dictionary<string, ItemHotspot>() {
  104.     { "gate",                   new ItemHotspot("Gate", new Rectanglef(818,  471, 285, 334)) },
  105.     { "wall1",                  new ItemHotspot("Wall", new Rectanglef(786,  576, 224, 226)) },
  106.     { "wall2",                  new ItemHotspot("Wall", new Rectanglef(1010, 576, 224, 226)) },
  107. };
  108.  
  109. m_allThePossibilities = new Dictionary<string, HotspotPossibility>() {
  110.     // Key is "hotspot:inventoryItem"
  111.     { "gate:hayBale",           new HotspotPossibility(m_allTheInvItems["hayBale"],        m_allThePlacedItems["hayBale"]) },
  112.     { "gate:planksAndNails",    new HotspotPossibility(m_allTheInvItems["planksAndNails"], m_allThePlacedItems["plankedGate"]) },
  113.     { "wall:coal1",             new HotspotPossibility(m_allTheInvItems["coal"],           m_allThePlacedItems["coal1"]) },
  114.     { "wall:explosive1",        new HotspotPossibility(m_allTheInvItems["explosive"],      m_allThePlacedItems["explosive1"]) },
  115.     { "wall:coal2",             new HotspotPossibility(m_allTheInvItems["coal"],           m_allThePlacedItems["coal2"]) },
  116.     { "wall:explosive2",        new HotspotPossibility(m_allTheInvItems["explosive"],      m_allThePlacedItems["explosive2"]) },
  117. };
  118.  
  119. m_allTheNPCs = new Dictionary<string, NPC>() {
  120.     // TODO FIXME test objects
  121.     { "stickFigure",            new NPC("Stickfigure", m_allTheBitmaps["n/stickFigure"], new Rectanglef(1314, 448, 285, 334)) },
  122. };
  123.  
  124. m_allTheQuests = new Dictionary<string, NPCQuest>() {
  125.     // TODO FIXME test objects
  126.     { "stickFigureOne", new NPCQuest(NPCQuestRequirement.PUT_ITEM, new object[] { m_allTheHotspots["gate"], m_allThePlacedItems["hayBale"] },
  127.                                      NPCQuestReward.ITEM, new object[] { m_allTheInvItems["planksAndNails"] },
  128.                                      new string[] { "Put hay at the gate", "do it", "mawfakka" }) },
  129.     { "stickFigureTwo", new NPCQuest(NPCQuestRequirement.NULL, null,
  130.                                      NPCQuestReward.NULL, null,
  131.                                      new string[] { "have this plank and nails", "go away now" }) },
  132. };
  133.  
  134.  
  135. // Finish quest creation
  136. // TODO FIXME test object
  137. m_allTheQuests["stickFigureOne"].SetNextQuest(m_allTheQuests["stickFigureTwo"]);
  138.  
  139. // Finish NPC creation
  140. // TODO FIXME test object
  141. m_allTheNPCs["stickFigure"].CurrentQuest = m_allTheQuests["stickFigureOne"];
  142. #endregion Initialize game objects
  143.  
  144. #region Link objects
  145. // Link rooms
  146. m_allTheRooms["gate"]           .AddLink(ScreenEdges.LEFT,                      m_allTheRooms["wall"]);
  147. m_allTheRooms["gate"]           .AddLink(ScreenEdges.RIGHT,                     m_allTheRooms["shed"]);
  148. m_allTheRooms["gate"]           .AddLink(ScreenEdges.DOWN,                      m_allTheRooms["castle"]);
  149. m_allTheRooms["gate"]           .AddLink(new Rectanglef(815,  400, 287, 402),   m_allTheRooms["outside_gate"]);
  150. m_allTheRooms["outside_gate"]   .AddLink(new Rectanglef(815,  400, 287, 402),   m_allTheRooms["gate"]);
  151. m_allTheRooms["wall"]           .AddLink(ScreenEdges.RIGHT,                     m_allTheRooms["gate"]);
  152. m_allTheRooms["shed"]           .AddLink(ScreenEdges.LEFT,                      m_allTheRooms["gate"]);
  153. m_allTheRooms["shed"]           .AddLink(ScreenEdges.RIGHT,                     m_allTheRooms["stables"]);
  154. m_allTheRooms["shed"]           .AddLink(new Rectanglef(753,  449, 413, 549),   m_allTheRooms["inside_shed"]);
  155. m_allTheRooms["stables"]        .AddLink(ScreenEdges.LEFT,                      m_allTheRooms["shed"]);
  156. m_allTheRooms["stables"]        .AddLink(new Rectanglef(1134, 729, 114, 275),   m_allTheRooms["inside_stables"]);
  157. m_allTheRooms["castle"]         .AddLink(new Rectanglef(0,    960, 803, 118),   m_allTheRooms["gate"]);
  158. m_allTheRooms["castle"]         .AddLink(new Rectanglef(1117, 960, 803, 118),   m_allTheRooms["gate"]);
  159. m_allTheRooms["castle"]         .AddLink(new Rectanglef(804,  860, 314, 220),   m_allTheRooms["inside_castle"]);
  160. m_allTheRooms["inside_castle"]  .AddLink(ScreenEdges.LEFT,                      m_allTheRooms["alchemist"]);
  161. m_allTheRooms["inside_castle"]  .AddLink(ScreenEdges.DOWN,                      m_allTheRooms["castle"]);
  162. m_allTheRooms["alchemist"]      .AddLink(ScreenEdges.RIGHT,                     m_allTheRooms["inside_castle"]);
  163. m_allTheRooms["inside_shed"]    .AddLink(new Rectanglef(532,  957, 754, 144),   m_allTheRooms["shed"]);
  164. m_allTheRooms["inside_stables"] .AddLink(new Rectanglef(599,  944, 498, 131),   m_allTheRooms["stables"]);
  165.  
  166. // Place items in rooms
  167. m_allTheRooms["inside_shed"]    .AddItem(m_allTheWorldItems["shovel"]);
  168. m_allTheRooms["inside_shed"]    .AddItem(m_allTheWorldItems["coal"]);
  169. m_allTheRooms["inside_shed"]    .AddItem(m_allTheWorldItems["hayBale-shed"]);
  170. m_allTheRooms["inside_stables"] .AddItem(m_allTheWorldItems["hayBale-stables"]);
  171. m_allTheRooms["alchemist"]      .AddItem(m_allTheWorldItems["water1"]);
  172. m_allTheRooms["alchemist"]      .AddItem(m_allTheWorldItems["water2"]); // Intentionally twice
  173. m_allTheRooms["alchemist"]      .AddItem(m_allTheWorldItems["nitrite"]);
  174. m_allTheRooms["alchemist"]      .AddItem(m_allTheWorldItems["sulfur"]);
  175. m_allTheRooms["alchemist"]      .AddItem(m_allTheWorldItems["glycerol"]);
  176. m_allTheRooms["inside_stables"] .AddItem(m_allTheWorldItems["plankAndNails"]);
  177.  
  178. // Place NPCs
  179. // TODO FIXME test object
  180. m_allTheRooms["inside_stables"].AddNPC(m_allTheNPCs["stickFigure"]);
  181.  
  182. // Add crafting combinations
  183. m_allTheInvItems["water"]       .AddCombination(m_allTheInvItems["sulfur"],         m_allTheInvItems["sulfuric_acid"]);
  184. m_allTheInvItems["water"]       .AddCombination(m_allTheInvItems["nitrite"],        m_allTheInvItems["nitric_acid"]);
  185. m_allTheInvItems["nitric_acid"] .AddCombination(m_allTheInvItems["sulfuric_acid"],  m_allTheInvItems["conc_acid"]);
  186. m_allTheInvItems["conc_acid"]   .AddCombination(m_allTheInvItems["glycerol"],       m_allTheInvItems["explosive"]);
  187.  
  188. // Add hotspots to screens
  189. m_allTheRooms["gate"].AddHotspot(m_allTheHotspots["gate"]);
  190. m_allTheRooms["wall"].AddHotspot(m_allTheHotspots["wall1"]);
  191. m_allTheRooms["wall"].AddHotspot(m_allTheHotspots["wall2"]);
  192.  
  193. // Add possibilities to hotspots
  194. m_allTheHotspots["gate"] .AddPossibility(m_allThePossibilities["gate:hayBale"]);
  195. m_allTheHotspots["gate"] .AddPossibility(m_allThePossibilities["gate:planksAndNails"]);
  196. m_allTheHotspots["wall1"].AddPossibility(m_allThePossibilities["wall:coal1"]);
  197. m_allTheHotspots["wall1"].AddPossibility(m_allThePossibilities["wall:explosive1"]);
  198. m_allTheHotspots["wall2"].AddPossibility(m_allThePossibilities["wall:coal2"]);
  199. m_allTheHotspots["wall2"].AddPossibility(m_allThePossibilities["wall:explosive2"]);
  200. #endregion Link objects
Advertisement
Add Comment
Please, Sign In to add comment