Esempio n. 1
0
            public Items(BuilderConfig builderConfig, BuildOptions buildOptions)
            {
                _builderConfig = builderConfig;
                _buildOptions = buildOptions;

                _itemsDocuments = new Dictionary<string, XmlDocument>();

            }
Esempio n. 2
0
        public Resources(BuilderConfig builderConfig, BuildOptions buildOptions)
        {
            _builderConfig = builderConfig;
            _buildOptions = buildOptions;
            _backgroundsList = new List<FileName>();
            _resourcesFileName = _buildOptions.dstFolder + "\\resources.xml";

            _resourcesXmlDoc = new XmlDocument();

            _resourcesRoot = _resourcesXmlDoc.CreateElement(_buildOptions.sceneName);

            _texturePackNode = _resourcesXmlDoc.CreateElement("texture_pack");
        }
Esempio n. 3
0
        public TexturePack(BuilderConfig builderConfig, BuildOptions buildOptions)
        {
            _builderConfig = builderConfig;
            _buildOptions = buildOptions;

            texturePackDoc = new XmlDocument();

            texturePackRoot = texturePackDoc.CreateElement("texture_packer");
            texturePackRoot.SetAttribute("name", buildOptions.dstFolder + "\\texture_pack\\" + _builderConfig.TexturePackName);
            texturePackRoot.SetAttribute("max_size", "1024 1024");
            texturePackRoot.SetAttribute("extension", "png");
            texturePackRoot.SetAttribute("wide_screen_base", "1024");
        }
Esempio n. 4
0
        public Levels(BuilderConfig builderConfig, BuildOptions buildOptions)
        {
            _builderConfig = builderConfig;
            _buildOptions = buildOptions;

            _xmlFileName = _buildOptions.levelsXmlFileName;

            _sceneXmlDoc = new XmlDocument();

            if (_buildOptions.rebuildLevels)
            {
                if (File.Exists(_xmlFileName))
                {
                    _sceneXmlDoc.Load(_xmlFileName);
                }
            }

            _sceneRoot = (XmlElement)_sceneXmlDoc.DocumentElement;
            _layersNode_SE = (XmlElement)_sceneRoot.FirstChild;
            _layersNode_CE = (XmlElement)_sceneRoot.LastChild;
        }
Esempio n. 5
0
        public Scene(BuilderConfig builderConfig, BuildOptions buildOptions, string sceneName)
        {
            _builderConfig = builderConfig;
            _buildOptions = buildOptions;

            _scriptFileName = _buildOptions.sceneName + sceneName + ".lua";

            _xmlFileName = buildOptions.dstFolder + "\\" + buildOptions.sceneName + sceneName + ".xml";

            _sceneXmlDoc = new XmlDocument();

            SceneRootNodeName = buildOptions.sceneName + sceneName;

            if (_buildOptions.rebuildScene)
            {
                if (File.Exists(_xmlFileName))
                {
                    _sceneXmlDoc.Load(_xmlFileName);
                }
            }

            _sceneRoot = (XmlElement)_sceneXmlDoc.DocumentElement;

            if (_sceneRoot == null)
            {
                _sceneRoot = _sceneXmlDoc.CreateElement(SceneRootNodeName);
                _sceneRoot.SetAttribute("include", _builderConfig.IncludesLibFileName);
                _sceneRoot.SetAttribute("edit", "1");
                _sceneXmlDoc.AppendChild(_sceneRoot);
            }

            AddScriptsNodeIfNeeded();

            AddAnimationsNodeIfNeeded();

            AddLayersNodeIfNeeded();

            AddMapsNodeIfNeeded();
        }
Esempio n. 6
0
        public Navigation(BuilderConfig builderConfig, BuildOptions buildOptions)
        {
            _builderConfig = builderConfig;
            _buildOptions = buildOptions;

            NavigationsXML = new XmlDocument();
            QuestsXML = new XmlDocument();

            _NavFileName = null;
            _QuestsFileName = null;

            if (_buildOptions.rebuildNavigation)

            if (_buildOptions.sceneName.Contains("ce_"))
            {
                _NavFileName = "\\navigation_ce.xml";

                if (!File.Exists(_buildOptions.navigationFilePath + _NavFileName))
                {
                    _NavFileName = "\\navigation.xml";

                    if (!File.Exists(_buildOptions.navigationFilePath + _NavFileName))
                        _NavFileName = null;
                }

                _QuestsFileName = "\\quest_ce.xml";

                if (!File.Exists(_buildOptions.navigationFilePath + _QuestsFileName))
                {
                    _QuestsFileName = "\\quest.xml";

                    if (!File.Exists(_buildOptions.navigationFilePath + _QuestsFileName))
                        _QuestsFileName = null;
                }

            }
            else
            {
                _NavFileName = "\\navigation_se.xml";

                if (!File.Exists(_buildOptions.navigationFilePath + _NavFileName))
                {
                    _NavFileName = "\\navigation.xml";

                    if (!File.Exists(_buildOptions.navigationFilePath + _NavFileName))
                        _NavFileName = null;
                }

                _QuestsFileName = "\\quest_se.xml";

                if (!File.Exists(_buildOptions.navigationFilePath + _QuestsFileName))
                {
                    _QuestsFileName = "\\quest.xml";

                    if (!File.Exists(_buildOptions.navigationFilePath + _QuestsFileName))
                        _QuestsFileName = null;
                }
            }// end main if

            if (_NavFileName != null)
            {
                NavigationsXML.Load(_buildOptions.navigationFilePath + _NavFileName);

                _navRoot = (XmlElement)NavigationsXML.FirstChild;

                for (int i = 0; i < _navRoot.ChildNodes.Count; i++ )
                {
                    if (!_buildOptions.isHO)
                    {
                        if (_navRoot.ChildNodes[i].Name == _buildOptions.sceneName)
                        {
                            hasChildNodeNav = true;
                            break;
                        }
                    }
                    else
                    {
                        if (_buildOptions.isHo01)
                        {
                            if (_navRoot.ChildNodes[i].Name == _buildOptions.sceneName + "_01")
                            {
                                hasChildNodeNav = true;
                                break;
                            }
                        }

                        if (_buildOptions.isHo02)
                        {
                            if (_navRoot.ChildNodes[i].Name == _buildOptions.sceneName + "_02")
                            {
                                hasChildNodeNav = true;
                                break;
                            }
                        }
                    }

                }

            }// end Navigation file

            if (_QuestsFileName != null)
            {
                QuestsXML.Load(_buildOptions.navigationFilePath + _QuestsFileName);

                _questRoot = (XmlElement)QuestsXML.FirstChild;

                for (int i = 0; i < _questRoot.ChildNodes.Count; i++)
                {
                    if (!_buildOptions.isHO)
                    {
                        if (_questRoot.ChildNodes[i].Name == _buildOptions.sceneName)
                        {
                            hasChildNodeQuest = true;
                            break;
                        }
                    }
                    else
                    {
                        if (_buildOptions.isHo01)
                        {
                            if (_questRoot.ChildNodes[i].Name == _buildOptions.sceneName + "_01" )
                            {
                                hasChildNodeQuest = true;
                                break;
                            }
                        }
                        if (_buildOptions.isHo02)
                        {
                            if (_questRoot.ChildNodes[i].Name == _buildOptions.sceneName + "_02")
                            {
                                hasChildNodeQuest = true;
                                break;
                            }
                        }
                    }

                }

            }// end quests file
        }
Esempio n. 7
0
        public Texts(BuilderConfig builderConfig, BuildOptions buildOptions)
        {
            _builderConfig = builderConfig;
            _buildOptions = buildOptions;

            _textsXmlDoc = new XmlDocument();
            _TextsCENode = new XmlDocument();
            _TextsSENode = new XmlDocument();
            _TextsFHNode = new XmlDocument();

            _hoSets = new Dictionary<string, HoSet>();

            if (File.Exists(_buildOptions.textXmlFileName + "\\texts_config.xml"))
            {
                _textsXmlDoc.Load(_buildOptions.textXmlFileName + "\\texts_config.xml");
                //_hoItemsNode  = (XmlElement)_textsXmlDoc.DocumentElement.SelectSingleNode(HO_ITEMS_PATH);

                    if (_textsXmlDoc.ChildNodes[0] != null)
                    {
                        for (int i = 0; i < _textsXmlDoc.ChildNodes[0].ChildNodes.Count; i++)
                        {
                            switch (_textsXmlDoc.ChildNodes[0].ChildNodes[i].Attributes["file_name"].Value)
                            {
                                case "texts_first_hour.xml":
                                    _TextsFH = "\\texts_first_hour.xml";
                                    _TextsFHNode.Load(_buildOptions.textXmlFileName + _TextsFH);
                                    break;
                                case "texts_se.xml":
                                    _TextsSE = "\\texts_se.xml";
                                    _TextsSENode.Load(_buildOptions.textXmlFileName + _TextsSE);
                                    break;
                                case "texts_ce.xml":
                                    _TextsCE = "\\texts_ce.xml";
                                    _TextsCENode.Load(_buildOptions.textXmlFileName + _TextsCE);
                                    break;
                            }

                        }
                    }

                if (_buildOptions.sceneName.Contains("ce_"))
                {
                    if (_TextsCENode != null)
                    {
                        t_Document = _TextsCENode;
                        _pDocName = _TextsCE;
                    }
                }
                else
                {
                    if (_TextsFHNode != null)
                    {
                        t_Document = _TextsFHNode;
                        _pDocName = _TextsFH;
                    }
                }

                if (t_Document != null)
                {
                    String t_Desc = null;
                    String t_Desc2 = null;
                    if (_buildOptions.isMinigame)
                    {
                        t_Desc = MINIGAME_DESC_PATH;
                        t_Desc2 = "mini_games_descriptions";
                    }
                    else
                    {
                        t_Desc = HO_ITEMS_PATH;
                        t_Desc2 = "ho_items";
                    }

                    _hoItemsNode = (XmlElement)t_Document.DocumentElement.SelectSingleNode(t_Desc);
                    XmlElement _t_NodeGameplay = (XmlElement)t_Document.DocumentElement.SelectSingleNode("gameplay");

                    if (_hoItemsNode == null)
                    {
                        XmlElement t_hoItem = t_Document.CreateElement(t_Desc2);
                        _t_NodeGameplay.AppendChild(t_hoItem);
                        _hoItemsNode = t_hoItem;
                    }
                }
            }
            else if (File.Exists(_buildOptions.textXmlFileName + "\\texts.xml"))
            {
                _textsXmlDoc.Load(_buildOptions.textXmlFileName + "\\texts.xml");
                _pDocName = "texts.xml";

                String t_Desc = null;
                String t_Desc2 = null;
                if (_buildOptions.isMinigame)
                {
                    t_Desc = MINIGAME_DESC_PATH;
                    t_Desc2 = "mini_games_descriptions";
                }
                else
                {
                    t_Desc = HO_ITEMS_PATH;
                    t_Desc2 = "ho_items";
                }

                _hoItemsNode = (XmlElement)_textsXmlDoc.DocumentElement.SelectSingleNode(t_Desc);
                XmlElement _t_NodeGameplay = (XmlElement)_textsXmlDoc.DocumentElement.SelectSingleNode("gameplay");

                if (_hoItemsNode == null)
                {
                    XmlElement t_hoItem = _textsXmlDoc.CreateElement(t_Desc2);
                    _t_NodeGameplay.AppendChild(t_hoItem);
                    _hoItemsNode = t_hoItem;
                }

                t_Document = _textsXmlDoc;
            }
            else
            {
                throw new Exception("Texts file not found '" + _buildOptions.textXmlFileName +_pDocName + "'");
            }
        }