Exemplo n.º 1
0
 public FormData(int type, UIConsts.FORM_ID formType, string path, int faderType, EFormCreationMethod creationMethod = EFormCreationMethod.Static)
 {
     Type           = type;
     Id             = formType;
     CreationMethod = creationMethod;
     Path           = path;
     FaderType      = faderType;
 }
Exemplo n.º 2
0
    private void parseXmlData()
    {
        TextAsset _xmlString = Resources.Load <TextAsset>("Data/GameFlow");

        NanoXMLDocument document = new NanoXMLDocument(_xmlString.text);
        NanoXMLNode     RotNode  = document.RootNode;

        foreach (NanoXMLNode node in RotNode.SubNodes)
        {
            if (node.Name.Equals("screens"))
            {
                foreach (NanoXMLNode nodeScreens in node.SubNodes)
                {
                    string    sceneName        = nodeScreens.GetAttribute("name").Value;
                    SceneData sceneData        = new SceneData(sceneName);
                    string    preloadNextScene = nodeScreens.GetAttribute("preloadNextScene").Value;
                    if (!String.IsNullOrEmpty(preloadNextScene))
                    {
                        sceneData.PreloadSceneName = convertSceneNameToID(preloadNextScene);
                    }


                    string designResolutionWidth = nodeScreens.GetAttribute("DesignResolutionWidth").Value;
                    if (!String.IsNullOrEmpty(designResolutionWidth))
                    {
                        sceneData.DesignResolutionWidth = Int32.Parse(designResolutionWidth);
                    }

                    string designResolutionHeight = nodeScreens.GetAttribute("DesignResolutionHeight").Value;
                    if (!String.IsNullOrEmpty(designResolutionHeight))
                    {
                        sceneData.DesignResolutionHeight = Int32.Parse(designResolutionHeight);
                    }

                    string designMatchWidthOrHeight = nodeScreens.GetAttribute("DesignMatchWidthOrHeight").Value;
                    if (!String.IsNullOrEmpty(designMatchWidthOrHeight))
                    {
                        sceneData.DesignMatchWidthOrHeight = float.Parse(designMatchWidthOrHeight);
                    }

                    if (nodeScreens.Name.Equals("screen"))
                    {
                        foreach (NanoXMLNode nodeScreensScreen in nodeScreens.SubNodes)
                        {
                            string           formName = nodeScreensScreen.GetAttribute("name").Value.ToString();
                            UIConsts.FORM_ID formID   = (UIConsts.FORM_ID)System.Enum.Parse(typeof(UIConsts.FORM_ID), formName);
                            int formType = int.Parse(nodeScreensScreen.GetAttribute("type").Value);
                            EFormCreationMethod creationMethod = EFormCreationMethod.Static;
                            string           path     = UIConsts.DEFAULT_UI_PATH + formName;
                            NanoXMLAttribute attrPath = nodeScreensScreen.GetAttribute("path");
                            if (attrPath != null)
                            {
                                path = attrPath.Value;
                            }
                            int faderType = 1;                             //show transparrent
                            NanoXMLAttribute attrFader = nodeScreensScreen.GetAttribute("fader");
                            if (attrFader != null)
                            {
                                faderType = int.Parse(attrFader.Value);
                            }
                            NanoXMLAttribute attr = nodeScreensScreen.GetAttribute("creation");
                            if (attr != null)
                            {
                                if (!string.IsNullOrEmpty(attr.Value))
                                {
                                    if (attr.Value.ToLower() == "static")
                                    {
                                        creationMethod = EFormCreationMethod.Static;
                                    }
                                    else
                                    if (attr.Value.ToLower() == "dynamic")
                                    {
                                        creationMethod = EFormCreationMethod.Dynamic;
                                    }
                                }
                            }

                            FormData formData = new FormData(formType, formID, path, faderType, creationMethod);
                            sceneData.Forms.Add(formData);
                            if (formType == 1)
                            {
                                sceneData.Menu = formID;
                            }
                        }
                    }
                    _scenesData.Add(sceneName, sceneData);
                }
            }
        }
    }