public static List <Tactic> ReadTactic(int id)
        {
            XmlDocument allTacticsPathPath = new XmlDocument();

            allTacticsPathPath.Load(AllTacticsPath);
            XmlNode        tacticRoot = allTacticsPathPath.DocumentElement;
            string         path       = tacticRoot.ChildNodes[id].InnerText;
            Character      character;
            List <IAction> actions1;
            List <Tactic>  tactics     = new List <Tactic> {
            };
            XmlDocument tacticDocument = new XmlDocument();

            tacticDocument.Load(path);
            XmlNode dummyRoot = tacticDocument.DocumentElement;


            foreach (XmlNode tacticNode in dummyRoot.ChildNodes)
            {
                character = ReadLoadCharacter.ReadCharacterBySideAndId(Convert.ToInt32(tacticNode.ChildNodes[0].InnerText), Convert.ToInt32(tacticNode.ChildNodes[1].InnerText));
                actions1  = ReadActionList(Convert.ToInt32(tacticNode.ChildNodes[2].InnerText));
                tactics.Add(new Tactic(actions1, character));
            }
            return(tactics);
        }
예제 #2
0
        static void Main(string[] args)
        {
            int[] att = new int[9] {
                10, 10, 10, 10, 10, 10, 10, 10, 10
            };
            int[][] tal = new int[9][]
            {
                new int[] { 10, 10, 10, 10, 10 },
                new int[] { 10, 10, 10, 10, 10 },
                new int[] { 10, 10, 10, 10, 10 },
                new int[] { 10, 10, 10, 10, 10 },
                new int[] { 10, 10, 10, 10, 10 },
                new int[] { 10, 10, 10, 10, 10 },
                new int[] { 10, 10, 10, 10, 10 },
                new int[] { 10, 10, 10, 10, 10 },
                new int[] { 10, 10, 10, 10, 10 }
            };
            //Coords start = new Coords(2, 2);
            //Coords finish = new Coords(0, 0);
            //Character Alex = new Character("Alex", 1, att, tal, 100, 100, 100, 100);
            //Character Berta = new Character("Berta", 1, att, tal, 100, 100, 100, 100);

            //ReadLoadCharacter.AddNewCharacter(Alex);
            //ReadLoadCharacter.AddNewCharacter(Berta);

            //Console.WriteLine("({0}/{1}) {2}", Alex.GetWeaponeAttribute(), Alex.GetWeaponeTalent(), Alex.GetWeaponeDamage());
            //Console.ReadLine();
            Functions.SetIds();
            Map.GetMap();
            Character Alex  = ReadLoadCharacter.ReadCharacterBySideAndId(1, 0);
            Character Berta = ReadLoadCharacter.ReadCharacterBySideAndId(1, 1);

            Alex.ShowAll();
            Berta.ShowAll();

            /*Character Clark = new Character("Clark", 1, att, tal, 100, 100, 100, 100);
             * ReadLoadCharacter.AddNewCharacter(Clark);*/
            Character Dummy = ReadLoadCharacter.ReadCharacterBySideAndId(2, 2);

            Town.AddFreeCharacter(Alex);
            Town.AddFreeCharacter(Berta);


            Hike hike;

            do
            {
                hike = PlayerInteractions.StartHike();
                hike.Go();
                Console.WriteLine("Press 9 to end the program");
            }while (Console.ReadLine() != "9");
            //Hike hike = ReadLoadHike.LoadHike(0);
            //hike.Go();
            ReadLoadCharacter.SaveCharacter(Alex);
        }
예제 #3
0
        public static Hike LoadHike(int id)
        {
            Hike        hike    = null;
            XmlDocument xACPDoc = new XmlDocument();

            xACPDoc.Load(AllHikesPathsPath);
            if (Functions.CheckHikeExistion(Convert.ToString(id)))
            {
                XmlDocument hikeDocument          = new XmlDocument();
                string      characterDocumentPath = prefix + namePrefix + id + extention;
                hikeDocument.Load(characterDocumentPath);
                XmlNode          hikeRoot   = hikeDocument.DocumentElement;
                string           name       = hikeRoot.ChildNodes[0].InnerText;
                int              progress   = Convert.ToInt32(hikeRoot.ChildNodes[1].InnerText);
                List <Character> characters = new List <Character> {
                };
                foreach (XmlNode characterNode in hikeRoot.ChildNodes[2])
                {
                    characters.Add(ReadLoadCharacter.ReadCharacterBySideAndId(characterNode.InnerText));
                }
                List <Coords> coords = new List <Coords> {
                };
                Coords coord;
                foreach (XmlNode coordNode in hikeRoot.ChildNodes[3])
                {
                    coord = new Coords(Convert.ToInt32(coordNode.ChildNodes[0].InnerText), Convert.ToInt32(coordNode.ChildNodes[1].InnerText));
                    coords.Add(coord);
                }
                Eventt quest = ReadLoadTile.GetEventt(hikeRoot.ChildNodes[4]);//!!!!!!!!!
                ReadLoadTile.tCheck();
                XmlNode StorageNode = hikeRoot.ChildNodes[5];
                int     maxVolume   = Convert.ToInt32(StorageNode.ChildNodes[0].InnerText);
                int     maxMass     = Convert.ToInt32(StorageNode.ChildNodes[1].InnerText);

                List <Item> items = new List <Item> {
                };
                foreach (XmlNode itemNode in StorageNode.ChildNodes[2])
                {
                    items.Add(ReadLoadItem.ReadItemById(Convert.ToInt32(itemNode.InnerText)));
                }
                Storage storage = new Storage(items, maxVolume, maxMass);
                hike = new Hike(name, progress, characters, coords, quest, storage);
            }
            return(hike);
        }