Esempio n. 1
0
        private Charakter createNewCharater()
        {
            Charakter charakter = new Charakter();

            String path;

            path = Path.Combine(ManagmentSaveStrings.currentDirectory, rootPath);
            path = Path.Combine(path, ManagmentSaveStrings.SaveLocation);

            controllTalent = new ControllTalent(getResourcePath());
            charakter.addTalent(controllTalent.getTalentList <TalentClose>());
            charakter.addTalent(controllTalent.getTalentList <TalentRange>());
            charakter.addTalent(controllTalent.getTalentList <TalentWeaponless>());

            charakter.addTalent(controllTalent.getTalentList <TalentCrafting>());
            charakter.addTalent(controllTalent.getTalentList <TalentKnwoldage>());
            charakter.addTalent(controllTalent.getTalentList <TalentNature>());
            charakter.addTalent(controllTalent.getTalentList <TalentPhysical>());
            charakter.addTalent(controllTalent.getTalentList <TalentSocial>());

            charakter.addTalent(controllTalent.getTalentList <LanguageTalent>());
            charakter.addTalent(controllTalent.getTalentList <FontTalent>());

            controllLanguageFamily = new ControllLanguageFamily(charakter, getResourcePath());

            return(charakter);
        }
Esempio n. 2
0
        public static Charakter loadCharakter(String fileName, Charakter charakter, ControllTalent Tcontroller)
        {
            XmlDocument characterFile   = new XmlDocument();
            XmlNode     saveFile        = null;
            XmlNode     characterNode   = null;
            XmlNode     heldenbriefNode = null;
            XmlNode     talentbriefNode = null;

            comments  = new List <String>();
            tControll = Tcontroller;

            characterFile.Load(fileName);

            try
            {
                //Load Current Save Version -> Version2
                saveFile        = characterFile.SelectSingleNode("/" + ManagmentXMLStrings.SaveFile);
                characterNode   = saveFile.SelectSingleNode(ManagmentXMLStrings.CharacterBogenElement);
                heldenbriefNode = characterNode.SelectSingleNode(ManagmentXMLStrings.HeldenBriefElement);
                talentbriefNode = characterNode.SelectSingleNode(ManagmentXMLStrings.TalentBriefElement);
            }
            catch
            {
                //Try to Load old Save Version -> Version1
                characterNode   = characterFile.SelectSingleNode("/" + ManagmentXMLStrings.CharacterBogenElement);
                heldenbriefNode = characterNode.SelectSingleNode(ManagmentXMLStrings.HeldenBriefElement);
                talentbriefNode = characterNode.SelectSingleNode(ManagmentXMLStrings.TalentBriefElement);
            }
            finally
            {
                if (characterNode == null || heldenbriefNode == null || talentbriefNode == null)
                {
                    Exception e = new Exception("This file is not Supported");
                    Log.throwError(e);
                    throw e;
                }
            }

            loadHeldenbrief(heldenbriefNode, charakter);
            loadTalentbrief(talentbriefNode, charakter);

            return(charakter);
        }