Exemplo n.º 1
0
    public static void SaveManifest()
    {
#if !(UNITY_WP8 || UNITY_METRO)
        FileStaticAPI.CreateFolder(MANIFEST_FOLDER_PATH);

        XmlDocument newDoc = new XmlDocument();
        //Create XML header
        XmlNode docNode = newDoc.CreateXmlDeclaration("1.0", "UTF-8", null);
        newDoc.AppendChild(docNode);

        XmlElement child = newDoc.CreateElement("manifest");
        _manifestTemplate.ToXmlElement(newDoc, child);
        newDoc.AppendChild(child);

        newDoc.Save(Application.dataPath + MANIFEST_FILE_PATH);

        //Replace 'android___' pattern with 'android:'
        TextReader reader      = new StreamReader(Application.dataPath + MANIFEST_FILE_PATH);
        string     src         = reader.ReadToEnd();
        string     pattern     = @"android___";
        string     replacement = "android:";
        Regex      regex       = new Regex(pattern);
        src = regex.Replace(src, replacement);
        reader.Close();

        TextWriter writer = new StreamWriter(Application.dataPath + MANIFEST_FILE_PATH);
        writer.Write(src);
        writer.Close();

        AssetDatabase.Refresh();
#endif
    }
Exemplo n.º 2
0
        private static Object GetSettingObjectOfType(System.Type inType)
        {
            Object outObj = null;

            outObj = Resources.Load(Path.Combine(BaseConstants.RelativeSettingsPath, inType.Name));

            Debug.Log("Name: " + outObj);

            if (outObj != null)
            {
                return(outObj);
            }

            outObj = ScriptableObject.CreateInstance(inType);

#if UNITY_EDITOR
            FileStaticAPI.CreateFolder(BaseConstants.ProjectSettingsPath);

            string fullPath = Path.Combine(Path.Combine("Assets", BaseConstants.ProjectSettingsPath),
                                           inType.Name + BaseConstants.ProjectSettingsAssetExtension
                                           );

            AssetDatabase.CreateAsset(outObj, fullPath);
#endif

            return(outObj);
        }