Exemplo n.º 1
0
    void SaveToJson()
    {
        string savePath   = PrefabsPath + SceneName + "/" + SceneName + ".asset";
        string bundlePath = exportPath + SceneName + "/" + SceneName + ".ab";

        mSceneClient             = new Scene();
        mSceneClient.name        = SceneName;
        mSceneClient.terrainFile = SceneName + "/" + SceneName + ".unity3d";
        mSceneClient.objects     = new List <SceneNode>();


        foreach (SceneNodeE node in PrefabsList)
        {
            writeObjectToScene(mSceneClient, node);
        }
        EditorSerializer.SerializeObjectAndSave(mSceneClient, exportPath + SceneName + "/" + SceneName + ".json");

        //save to asset
        StringHolder jsonAsset = ScriptableObject.CreateInstance <StringHolder>();

        string[] stringholder = { EditorSerializer.ObjectToJson(mSceneClient) };
        jsonAsset.content = stringholder;
        AssetDatabase.CreateAsset(jsonAsset, savePath);
        Object o = AssetDatabase.LoadAssetAtPath(savePath, typeof(StringHolder));

        BuildPipeline.BuildAssetBundle(o, null, bundlePath);
        AssetDatabase.DeleteAsset(savePath);
    }
Exemplo n.º 2
0
    void OnWizardCreate()
    {
        ResourceManager.VersionInfo version = new ResourceManager.VersionInfo();
        version.nVersionDBC   = nVersionDBC;
        version.nVersionUI    = nVersionUI;
        version.nVersionScene = nVersionScene;

        EditorSerializer.SerializeObjectAndSave(version, "version.txt");
    }
Exemplo n.º 3
0
    void SaveAssetXML()
    {
        //XmlDocument doc = new XmlDocument();

        //XmlElement root = doc.CreateElement("AssetBundle");
        //doc.AppendChild(root);

        //foreach (Assets asset in mAssets)
        //{

        //    XmlElement assets = doc.CreateElement("Assets");
        //    XmlAttribute name = doc.CreateAttribute("name");
        //    assets.SetAttributeNode(name);
        //    assets.SetAttribute("name", asset.Name);
        //    root.AppendChild(assets);

        //    foreach (string file in asset.Objects)
        //    {
        //        XmlElement child = doc.CreateElement("Object");
        //        XmlAttribute fileName = doc.CreateAttribute("File");
        //        child.SetAttributeNode(fileName);
        //        child.SetAttribute("File", file);
        //        assets.AppendChild(child);
        //    }
        //}
        EditorSerializer.SerializeObjectAndSave(mAssets, exportPath + "Assets.json");

        //foreach (Assets asset in mAssetsTexture)
        //{

        //    XmlElement assets = doc.CreateElement("Textures");
        //    XmlAttribute name = doc.CreateAttribute("name");
        //    assets.SetAttributeNode(name);
        //    assets.SetAttribute("name", asset.Name);
        //    root.AppendChild(assets);

        //    foreach (string file in asset.Objects)
        //    {
        //        XmlElement child = doc.CreateElement("Texture");
        //        XmlAttribute fileName = doc.CreateAttribute("File");
        //        child.SetAttributeNode(fileName);
        //        child.SetAttribute("File", file);
        //        assets.AppendChild(child);
        //    }
        //}

        EditorSerializer.SerializeObjectAndSave(mAssetsTexture, exportPath + "Textures.json");

        //doc.Save(exportPath + "Assets.xml");
    }