Пример #1
0
        public void FromXml(XmlNode node)
        {
            _graphicsDriver    = GraphicsDriver.D3D9;
            _renderAtScreenRes = false;

            SerializeUtils.DeserializeFromXML(this, node);
        }
Пример #2
0
        public void FromXml(XmlNode node)
        {
            _totalScore                 = 0;
            _guid                       = Guid.Empty;
            _enableGameExplorer         = false;
            _description                = string.Empty;
            _releaseDate                = DateTime.Now;
            _genre                      = DEFAULT_GENRE;
            _version                    = DEFAULT_VERSION;
            _windowsExperienceIndex     = 1;
            _developerName              = string.Empty;
            _developerURL               = string.Empty;
            _enhancedSaveGames          = false;
            _saveGameExtension          = string.Empty;
            _saveGamesFolderName        = null;
            _binaryFilesInSourceControl = false;
            _guiAlphaStyle              = GUIAlphaStyle.Classic;
            _spriteAlphaStyle           = SpriteAlphaStyle.Classic;
            _runGameLoopsWhileDialogOptionsDisplayed = false;
            _inventoryHotspotMarker       = new InventoryHotspotMarker();
            _useLowResCoordinatesInScript = true;
            _audioIndexer    = 0;
            _enforceNewAudio = false;

            SerializeUtils.DeserializeFromXML(this, node);

            if (_guid == Guid.Empty)
            {
                _guid = Guid.NewGuid();
            }
            if (_saveGamesFolderName == null)
            {
                this.SaveGameFolderName = _gameName;
            }
        }
Пример #3
0
 public TextParser(XmlNode node)
 {
     foreach (XmlNode wordNode in SerializeUtils.GetChildNodes(node, "Words"))
     {
         _words.Add(new TextParserWord(wordNode));
     }
 }
Пример #4
0
 protected override void FromXmlBackwardsCompatability(System.Xml.XmlNode parentNodeForBackwardsCompatability)
 {
     Init(MAIN_UNLOADED_ROOM_FOLDER_NAME);
     foreach (XmlNode unloadedRoomNode in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "Rooms"))
     {
         _items.Add(new UnloadedRoom(unloadedRoomNode));
     }
 }
Пример #5
0
 public GlobalVariables(XmlNode node)
 {
     foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, "Variables"))
     {
         GlobalVariable newVariable = new GlobalVariable(childNode);
         _variables.Add(newVariable.Name, newVariable);
     }
 }
Пример #6
0
 protected override void FromXmlBackwardsCompatability(XmlNode parentNodeForBackwardsCompatability)
 {
     Init(MAIN_CHARACTER_FOLDER_NAME);
     foreach (XmlNode invNode in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "Characters"))
     {
         _items.Add(CreateItem(invNode));
     }
 }
Пример #7
0
 protected override void FromXmlBackwardsCompatability(System.Xml.XmlNode parentNodeForBackwardsCompatability)
 {
     Init(MAIN_DIALOG_FOLDER_NAME);
     foreach (XmlNode dialogNode in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "Dialogs"))
     {
         _items.Add(new Dialog(dialogNode));
     }
 }
Пример #8
0
 protected override void FromXmlBackwardsCompatability(System.Xml.XmlNode parentNodeForBackwardsCompatability)
 {
     Init(MAIN_INVENTORY_ITEM_FOLDER_NAME);
     foreach (XmlNode inventoryItemNode in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "InventoryItems"))
     {
         _items.Add(new InventoryItem(inventoryItemNode));
     }
 }
Пример #9
0
 public void FromXml(XmlNode node)
 {
     _propertyDefinitions.Clear();
     foreach (XmlNode child in SerializeUtils.GetChildNodes(node, "PropertyDefinitions"))
     {
         _propertyDefinitions.Add(new CustomPropertySchemaItem(child));
     }
 }
Пример #10
0
 public ViewLoop(XmlNode node)
 {
     ID          = Convert.ToInt32(SerializeUtils.GetElementString(node, "ID"));
     RunNextLoop = Boolean.Parse(SerializeUtils.GetElementString(node, "RunNextLoop"));
     foreach (XmlNode frameNode in SerializeUtils.GetChildNodes(node, "Frames"))
     {
         _frames.Add(new ViewFrame(frameNode));
     }
 }
Пример #11
0
Файл: View.cs Проект: stee01/ags
 public View(XmlNode node)
 {
     ID   = Convert.ToInt32(SerializeUtils.GetElementString(node, "ID"));
     Name = SerializeUtils.GetElementString(node, "Name");
     foreach (XmlNode loopNode in SerializeUtils.GetChildNodes(node, "Loops"))
     {
         _loops.Add(new ViewLoop(loopNode));
     }
 }
Пример #12
0
        public void FromXml(System.Xml.XmlNode node)
        {
            _lastBuildConfiguration = AGS.Types.BuildConfiguration.Unknown;

            // Allow for earlier versions of the XML
            if (node != null && node.SelectSingleNode("WorkspaceState") != null)
            {
                SerializeUtils.DeserializeFromXML(this, node);
            }
        }
Пример #13
0
        public virtual void ToXml(XmlTextWriter writer)
        {
            SerializeUtils.SerializeToXML(this, writer);

            writer.WriteStartElement("Controls");
            foreach (GUIControl control in _controls)
            {
                control.ToXml(writer);
            }
            writer.WriteEndElement();
        }
Пример #14
0
 public Translation(XmlNode node)
 {
     this.Name        = SerializeUtils.GetElementString(node, "Name");
     _modified        = false;
     _normalFont      = null;
     _speechFont      = null;
     _rightToLeftText = null;
     _encodingHint    = null;
     _encoding        = Encoding.Default;
     LoadData();
 }
Пример #15
0
 public void FromXml(XmlNode node)
 {
     Reset();
     foreach (XmlNode child in SerializeUtils.GetChildNodes(node, "Interactions"))
     {
         int index = SerializeUtils.GetAttributeInt(child, "Index");
         _scriptFunctionNames[index] = child.InnerText;
         if (_scriptFunctionNames[index] == string.Empty)
         {
             _scriptFunctionNames[index] = null;
         }
     }
 }
Пример #16
0
        private void FromXml(XmlNode node)
        {
            Init(node.Attributes["Name"].InnerText);

            foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, "SubFolders"))
            {
                _subFolders.Add(CreateFolder(childNode));
            }

            foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, this.XmlItemListNodeName))
            {
                _items.Add(CreateItem(childNode));
            }
        }
Пример #17
0
        public void FromXml(XmlNode node)
        {
            XmlNode lipSyncNode = node.SelectSingleNode("LipSync");

            this.Type         = (LipSyncType)Enum.Parse(typeof(LipSyncType), SerializeUtils.GetElementString(lipSyncNode, "Type"));
            this.DefaultFrame = Convert.ToInt32(SerializeUtils.GetElementString(lipSyncNode, "DefaultFrame"));
            int nodeIndex = 0;

            foreach (XmlNode frameNode in SerializeUtils.GetChildNodes(lipSyncNode, "Frames"))
            {
                _lipSyncCharsForFrame[nodeIndex] = frameNode.InnerText;
                nodeIndex++;
            }
        }
Пример #18
0
 protected override void FromXmlBackwardsCompatability(System.Xml.XmlNode parentNodeForBackwardsCompatability)
 {
     Init(MAIN_GUI_FOLDER_NAME);
     foreach (XmlNode guiNode in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "GUIs"))
     {
         if (guiNode.FirstChild.Name == NormalGUI.XML_ELEMENT_NAME)
         {
             _items.Add(new NormalGUI(guiNode));
         }
         else
         {
             _items.Add(new TextWindowGUI(guiNode));
         }
     }
 }
Пример #19
0
        public Dialog(XmlNode node)
        {
            _scriptChangedSinceLastCompile = true;
            _id             = Convert.ToInt32(SerializeUtils.GetElementString(node, "ID"));
            _name           = SerializeUtils.GetElementString(node, "Name");
            _showTextParser = Boolean.Parse(SerializeUtils.GetElementString(node, "ShowTextParser"));
            XmlNode scriptNode = node.SelectSingleNode("Script");

            // Luckily the CDATA section is easy to read back
            _script = scriptNode.InnerText;

            foreach (XmlNode child in SerializeUtils.GetChildNodes(node, "DialogOptions"))
            {
                _options.Add(new DialogOption(child));
            }
        }
Пример #20
0
        public InventoryItem(XmlNode node)
        {
            _currentlyDeserializing = true;

            _cursorImage = -1;

            SerializeUtils.DeserializeFromXML(this, node);

            if (_cursorImage == -1)
            {
                _cursorImage = _image;
            }

            _interactions.FromXml(node);

            _currentlyDeserializing = false;
        }
Пример #21
0
        public Sprite(XmlNode node)
        {
            _number     = Convert.ToInt32(node.Attributes["Slot"].InnerText);
            _width      = Convert.ToInt32(node.Attributes["Width"].InnerText);
            _height     = Convert.ToInt32(node.Attributes["Height"].InnerText);
            _colorDepth = Convert.ToInt32(node.Attributes["ColorDepth"].InnerText);

            if (node.Attributes["AlphaChannel"] != null)
            {
                _alphaChannel = Convert.ToBoolean(node.Attributes["AlphaChannel"].InnerText);
            }

            if (node.Attributes["ColoursLockedToRoom"] != null)
            {
                _coloursLockedToRoom = Convert.ToInt32(node.Attributes["ColoursLockedToRoom"].InnerText);
            }

            if (node.SelectSingleNode("Source") != null)
            {
                XmlNode sourceNode = node.SelectSingleNode("Source");

                try
                {
                    _sourceFile         = SerializeUtils.GetElementString(sourceNode, "FileName");
                    _offsetX            = Convert.ToInt32(SerializeUtils.GetElementString(sourceNode, "OffsetX"));
                    _offsetY            = Convert.ToInt32(SerializeUtils.GetElementString(sourceNode, "OffsetY"));
                    _frame              = Convert.ToInt32(SerializeUtils.GetElementString(sourceNode, "Frame"));
                    _remapToGamePalette = Convert.ToBoolean(SerializeUtils.GetElementString(sourceNode, "RemapToGamePalette"));
                    _remapToRoomPalette = Convert.ToBoolean(SerializeUtils.GetElementString(sourceNode, "RemapToRoomPalette"));
                    _tranparentColour   = (SpriteImportTransparency)Enum.Parse(typeof(SpriteImportTransparency), SerializeUtils.GetElementString(sourceNode, "ImportMethod"));
                }
                catch (InvalidDataException)
                {
                    // pass
                }

                try
                {
                    _importAlphaChannel = Convert.ToBoolean(SerializeUtils.GetElementString(sourceNode, "ImportAlphaChannel"));
                }
                catch (InvalidDataException)
                {
                    _importAlphaChannel = true;
                }
            }
        }
Пример #22
0
        public Script(XmlNode node)
        {
            if (node.Name != "Script")
            {
                throw new AGS.Types.InvalidDataException("Script node incorrect");
            }
            _fileName    = SerializeUtils.GetElementString(node, "FileName");
            _name        = SerializeUtils.GetElementString(node, "Name");
            _description = SerializeUtils.GetElementString(node, "Description");
            _author      = SerializeUtils.GetElementString(node, "Author");
            _version     = SerializeUtils.GetElementString(node, "Version");
            _uniqueKey   = Convert.ToInt32(SerializeUtils.GetElementString(node, "Key"));
            _isHeader    = Convert.ToBoolean(SerializeUtils.GetElementString(node, "IsHeader"));

            LoadFromDisk();

            _modified = false;
        }
Пример #23
0
        public GUI(XmlNode rootGuiNode)
            : this()
        {
            SerializeUtils.DeserializeFromXML(this, rootGuiNode);

            _controls = new List <GUIControl>();

            foreach (XmlNode node in SerializeUtils.GetChildNodes(rootGuiNode, "Controls"))
            {
                if (node.Name == "GUIButton")
                {
                    _controls.Add(new GUIButton(node));
                }
                else if (node.Name == "GUIInventory")
                {
                    _controls.Add(new GUIInventory(node));
                }
                else if (node.Name == "GUILabel")
                {
                    _controls.Add(new GUILabel(node));
                }
                else if (node.Name == "GUIListBox")
                {
                    _controls.Add(new GUIListBox(node));
                }
                else if (node.Name == "GUISlider")
                {
                    _controls.Add(new GUISlider(node));
                }
                else if (node.Name == "GUITextBox")
                {
                    _controls.Add(new GUITextBox(node));
                }
                else if (node.Name == "GUITextWindowEdge")
                {
                    _controls.Add(new GUITextWindowEdge(node));
                }
                else
                {
                    throw new InvalidDataException("Unknown control type: " + node.Name);
                }
            }
        }
Пример #24
0
 public PaletteEntry[] ReadPaletteFromXML(XmlNode parentOfPaletteNode)
 {
     PaletteEntry[] palette = new PaletteEntry[PALETTE_SIZE];
     for (int i = 0; i < palette.Length; i++)
     {
         palette[i]            = new PaletteEntry(i, _palette[i].Colour);
         palette[i].ColourType = _palette[i].ColourType;
     }
     foreach (XmlNode palNode in SerializeUtils.GetChildNodes(parentOfPaletteNode, "Palette"))
     {
         PaletteEntry paletteEntry = palette[Convert.ToInt32(palNode.Attributes["Index"].InnerText)];
         paletteEntry.Colour = Color.FromArgb(
             Convert.ToInt32(palNode.Attributes["Red"].InnerText),
             Convert.ToInt32(palNode.Attributes["Green"].InnerText),
             Convert.ToInt32(palNode.Attributes["Blue"].InnerText));
         paletteEntry.ColourType = (PaletteColourType)Enum.Parse(typeof(PaletteColourType), palNode.Attributes["Type"].InnerText);
     }
     return(palette);
 }
Пример #25
0
        public BaseFolderCollection(XmlNode node)
        {
            if (node.Name != this.XmlFolderNodeName)
            {
                throw new InvalidDataException("Incorrect node passed to " + this.XmlFolderNodeName);
            }
            _name       = node.Attributes["Name"].InnerText;
            _items      = new List <T>();
            _subFolders = new List <U>();

            foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, "SubFolders"))
            {
                _subFolders.Add(CreateFolder(childNode));
            }

            foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, this.XmlItemListNodeName))
            {
                _items.Add(CreateItem(childNode));
            }
        }
Пример #26
0
        public SpriteFolder(XmlNode node)
        {
            if (node.Name != "SpriteFolder")
            {
                throw new InvalidDataException("Incorrect node passed to SpriteFolder");
            }
            _name       = node.Attributes["Name"].InnerText;
            _sprites    = new List <Sprite>();
            _subFolders = new List <ISpriteFolder>();

            foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, "SubFolders"))
            {
                _subFolders.Add(new SpriteFolder(childNode));
            }

            foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, "Sprites"))
            {
                _sprites.Add(new Sprite(childNode));
            }
        }
Пример #27
0
 public Sprite(XmlNode node)
 {
     _number     = Convert.ToInt32(node.Attributes["Slot"].InnerText);
     _width      = Convert.ToInt32(node.Attributes["Width"].InnerText);
     _height     = Convert.ToInt32(node.Attributes["Height"].InnerText);
     _colorDepth = Convert.ToInt32(node.Attributes["ColorDepth"].InnerText);
     if (node.Attributes["AlphaChannel"] != null)
     {
         _alphaChannel = Convert.ToBoolean(node.Attributes["AlphaChannel"].InnerText);
     }
     if (node.SelectSingleNode("Source") != null)
     {
         XmlNode sourceNode = node.SelectSingleNode("Source");
         _sourceFile = SerializeUtils.GetElementString(sourceNode, "FileName");
     }
     if (node.Attributes["ColoursLockedToRoom"] != null)
     {
         _coloursLockedToRoom = Convert.ToInt32(node.Attributes["ColoursLockedToRoom"].InnerText);
     }
 }
Пример #28
0
        protected override void FromXmlBackwardsCompatability(System.Xml.XmlNode parentNodeForBackwardsCompatability)
        {
            Init(MAIN_SCRIPT_FOLDER_NAME);
            Script header = null;
            Script script = null;

            foreach (XmlNode node in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "Scripts"))
            {
                if (header == null)
                {
                    header = new Script(node);
                }
                else
                {
                    script = new Script(node);
                    _items.Add(new ScriptAndHeader(header, script));
                    header = null;
                    script = null;
                }
            }
        }
Пример #29
0
        public void FromXml(XmlNode node)
        {
            node = node.SelectSingleNode("Game");

            _settings.FromXml(node);

            if (node.SelectSingleNode(_defaultSetup.GetType().Name) != null)
            {
                // Only for >= 3.4.1
                _defaultSetup.FromXml(node);
            }

            _lipSync.FromXml(node);
            _propertySchema.FromXml(node);

            if (node.SelectSingleNode("InventoryHotspotMarker") != null)
            {
                // Pre-3.0.3
                InventoryHotspotMarker marker = new InventoryHotspotMarker();
                marker.FromXml(node);
                _settings.InventoryHotspotMarker = marker;
            }

            foreach (XmlNode msgNode in SerializeUtils.GetChildNodes(node, "GlobalMessages"))
            {
                _globalMessages[Convert.ToInt32(msgNode.Attributes["ID"].InnerText) - GLOBAL_MESSAGE_ID_START] = msgNode.InnerText;
            }

            _plugins.Clear();
            foreach (XmlNode pluginNode in SerializeUtils.GetChildNodes(node, "Plugins"))
            {
                _plugins.Add(new Plugin(pluginNode));
            }

            _rooms = new UnloadedRoomFolders(node.SelectSingleNode("Rooms").FirstChild, node);

            _guis = new GUIFolders(node.SelectSingleNode("GUIs").FirstChild, node);

            _inventoryItems = new InventoryItemFolders(node.SelectSingleNode("InventoryItems").FirstChild, node);

            _textParser = new TextParser(node.SelectSingleNode("TextParser"));

            _characters = new CharacterFolders(node.SelectSingleNode("Characters").FirstChild, node);

            _playerCharacter = null;
            string playerCharText = SerializeUtils.GetElementString(node, "PlayerCharacter");

            if (playerCharText.Length > 0)
            {
                int playerCharID = Convert.ToInt32(playerCharText);
                foreach (Character character in RootCharacterFolder.AllItemsFlat)
                {
                    if (character.ID == playerCharID)
                    {
                        _playerCharacter = character;
                        break;
                    }
                }
            }

            _dialogs = new DialogFolders(node.SelectSingleNode("Dialogs").FirstChild, node);

            _cursors.Clear();
            foreach (XmlNode cursNode in SerializeUtils.GetChildNodes(node, "Cursors"))
            {
                _cursors.Add(new MouseCursor(cursNode));
            }

            _fonts.Clear();
            foreach (XmlNode fontNode in SerializeUtils.GetChildNodes(node, "Fonts"))
            {
                _fonts.Add(new Font(fontNode));
            }

            _palette = ReadPaletteFromXML(node);

            _sprites = new SpriteFolder(node.SelectSingleNode("Sprites").FirstChild);

            _views = new ViewFolders(node.SelectSingleNode("Views").FirstChild);

            _deletedViewIDs.Clear();
            if (node.SelectSingleNode("DeletedViews") != null)
            {
                foreach (XmlNode transNode in SerializeUtils.GetChildNodes(node, "DeletedViews"))
                {
                    _deletedViewIDs.Add(Convert.ToInt32(transNode.InnerText), null);
                }
            }

            _scripts = new ScriptFolders(node.SelectSingleNode("Scripts").FirstChild, node);

            if (node.SelectSingleNode("AudioClips") != null)
            {
                _audioClips = new AudioClipFolders(node.SelectSingleNode("AudioClips").FirstChild);
            }
            else
            {
                _audioClips = new AudioClipFolders("Main");
                _audioClips.RootFolder.DefaultPriority = AudioClipPriority.Normal;
                _audioClips.RootFolder.DefaultRepeat   = InheritableBool.False;
                _audioClips.RootFolder.DefaultVolume   = 100;
            }

            _audioClipTypes.Clear();
            if (node.SelectSingleNode("AudioClipTypes") != null)
            {
                foreach (XmlNode clipTypeNode in SerializeUtils.GetChildNodes(node, "AudioClipTypes"))
                {
                    _audioClipTypes.Add(new AudioClipType(clipTypeNode));
                }
            }

            _translations.Clear();
            if (node.SelectSingleNode("Translations") != null)
            {
                foreach (XmlNode transNode in SerializeUtils.GetChildNodes(node, "Translations"))
                {
                    _translations.Add(new Translation(transNode));
                }
            }

            if (node.SelectSingleNode("GlobalVariables") != null)
            {
                _globalVariables = new GlobalVariables(node.SelectSingleNode("GlobalVariables"));
            }
            else
            {
                _globalVariables = new GlobalVariables();
            }

            _oldInteractionVariables.Clear();
            if (node.SelectSingleNode("OldInteractionVariables") != null)
            {
                foreach (XmlNode varNode in SerializeUtils.GetChildNodes(node, "OldInteractionVariables"))
                {
                    _oldInteractionVariables.Add(new OldInteractionVariable(SerializeUtils.GetAttributeString(varNode, "Name"), SerializeUtils.GetAttributeInt(varNode, "Value")));
                }
            }

            if (_savedXmlVersionIndex == null)
            {
                // Pre-3.0.3, upgrade co-ordinates
                ConvertCoordinatesToNativeResolution();
            }
        }
Пример #30
0
 public void ToXml(XmlTextWriter writer)
 {
     SerializeUtils.SerializeToXML(this, writer, false);
     writer.WriteElementString("FileLastModifiedDate", _fileLastModifiedDate.ToString("u"));
     writer.WriteEndElement();
 }