コード例 #1
0
ファイル: MapListRoom.cs プロジェクト: regenerativep/fourkay
 public MapListRoom(Game1 game, Room parent, bool useEditor) : base(game, parent)
 {
     //find all of the maps
     string[] directories = Directory.GetDirectories("maps");
     for (int i = 0; i < directories.Length; i++)
     {
         string  dir       = directories[i];
         string  json      = File.ReadAllText(dir + "/map.json");
         JObject mapObject = JObject.Parse(json);
         string  name      = (string)mapObject.GetValue("name").ToObject(typeof(string));
         ButtonList.Add(new KeyValuePair <string, Action>(name, () =>
         {
             MapRoom room;
             if (useEditor)
             {
                 room = new EditorRoom(Game, this);
             }
             else
             {
                 room = new MapRoom(Game, this);
             }
             Uri uri = new Uri(dir, UriKind.Relative);
             room.LoadMap(uri);
             room.Randomized  = false;
             Game.CurrentRoom = room;
         }));
     }
 }
コード例 #2
0
ファイル: EndRoom.cs プロジェクト: regenerativep/fourkay
 public EndRoom(Game1 game, Room parent, MapRoom mapRoom)
 {
     Game             = game;
     Parent           = parent;
     level            = mapRoom;
     keyPressCooldown = keyPressCooldownReset;
     textList         = new KeyValuePair <float, string>[]
     {
         new KeyValuePair <float, string>(2f, "Level finished"),
         new KeyValuePair <float, string>(1.5f, "Score: " + level.Score),
         new KeyValuePair <float, string>(1.5f, "Accuracy: " + level.GetAccuracyAsString()),
         new KeyValuePair <float, string>(1f, "Press the enter key or Z key to return to level select")
     };
 }