Пример #1
0
 public WorldMapState(WorldMapDefinition definition, bool discovered)
 {
     _definition      = definition;
     _discovered      = discovered;
     _levelIconStates = new List <LevelIconState>();
     _levelPathStates = new List <LevelPathState>();
 }
Пример #2
0
 public LevelPathDefinition(WorldMapDefinition definition, int id, string levelIconAUid, string levelIconBUid)
 {
     _definition    = definition;
     _id            = id;
     _levelIconAUid = levelIconAUid;
     _levelIconBUid = levelIconBUid;
     _pathKeys      = new List <LevelPathKey>();
 }
Пример #3
0
 public LevelPathDefinition(WorldMapDefinition definition, int id, string levelIconAUid, string levelIconBUid)
 {
     _definition = definition;
     _id = id;
     _levelIconAUid = levelIconAUid;
     _levelIconBUid = levelIconBUid;
     _pathKeys = new List<LevelPathKey>();
 }
Пример #4
0
 public LevelIconDefinition(WorldMapDefinition definition, string uid, string levelUid, string finishedTextureUid, string unfinishedTextureUid, string title, string description, Vector2 position)
 {
     _definition           = definition;
     _uid                  = uid;
     _levelUid             = levelUid;
     _finishedTextureUid   = finishedTextureUid;
     _unfinishedTextureUid = unfinishedTextureUid;
     _title                = title;
     _description          = description;
     _position             = position;
 }
Пример #5
0
 public LevelIconDefinition(WorldMapDefinition definition, string uid, string levelUid, string finishedTextureUid, string unfinishedTextureUid, string title, string description, Vector2 position)
 {
     _definition = definition;
     _uid = uid;
     _levelUid = levelUid;
     _finishedTextureUid = finishedTextureUid;
     _unfinishedTextureUid = unfinishedTextureUid;
     _title = title;
     _description = description;
     _position = position;
 }
Пример #6
0
        // Create world map manager
        private static WorldMapManager createWorldMapManager()
        {
            List<WorldMapDefinition> definitions = new List<WorldMapDefinition>();
            List<XElement> allWorldMapData = ResourceManager.worldMapResources;

            foreach (XElement worldMapData in allWorldMapData)
            {
                WorldMapDefinition worldMapDefinition = new WorldMapDefinition(worldMapData.Attribute("uid").Value, worldMapData.Attribute("texture_uid").Value, Loader.loadVector2("position", Vector2.Zero));

                foreach (XElement levelIconData in worldMapData.Elements("LevelIcon"))
                {
                    worldMapDefinition.levelIconDefinitions.Add(
                        new LevelIconDefinition(
                            worldMapDefinition,
                            levelIconData.Attribute("uid").Value,
                            levelIconData.Attribute("level_uid").Value,
                            levelIconData.Attribute("finished_texture_uid").Value,
                            levelIconData.Attribute("unfinished_texture_uid").Value,
                            levelIconData.Attribute("title").Value,
                            levelIconData.Attribute("description").Value,
                            Loader.loadVector2(levelIconData.Attribute("position"), Vector2.Zero)));
                }

                foreach (XElement levelPathData in worldMapData.Elements("LevelPath"))
                {
                    LevelPathDefinition levelPathDefinition = new LevelPathDefinition(
                        worldMapDefinition,
                        int.Parse(levelPathData.Attribute("id").Value),
                        levelPathData.Attribute("level_icon_a_uid").Value,
                        levelPathData.Attribute("level_icon_b_uid").Value);

                    foreach (XElement pathKeyData in levelPathData.Elements("PathKey"))
                    {
                        levelPathDefinition.pathKeys.Add(
                            new LevelPathKey(
                                levelPathDefinition,
                                Loader.loadVector2(pathKeyData.Attribute("p0"), Vector2.Zero),
                                Loader.loadVector2(pathKeyData.Attribute("p1"), Vector2.Zero),
                                Loader.loadVector2(pathKeyData.Attribute("p2"), Vector2.Zero),
                                Loader.loadVector2(pathKeyData.Attribute("p3"), Vector2.Zero)));
                    }

                    worldMapDefinition.levelPathDefinitions.Add(levelPathDefinition);
                }

                definitions.Add(worldMapDefinition);
            }

            return new WorldMapManager(definitions);
        }