public static ComboDataBase Create(DataBaseXML temp, ComboDataBase db)
    {
        ComboDataBase asset = ScriptableObject.CreateInstance <ComboDataBase>();

        asset.combos = temp.combos;
        AssetDatabase.CreateAsset(asset, "Assets/" + db + ".asset");
        AssetDatabase.SaveAssets();
        return(asset);
    }
Esempio n. 2
0
    void ExportDataBase()
    {
        XmlSerializer serializer = new XmlSerializer(typeof(DataBaseXML));
        FileStream    stream     = new FileStream(Application.streamingAssetsPath + "/ComboData.xml", FileMode.Create);

        xml        = new DataBaseXML();
        xml.combos = temp.combos;
        serializer.Serialize(stream, xml);
        stream.Close();
    }
Esempio n. 3
0
    void ImportDataBase()
    {
        string        absPath    = EditorUtility.OpenFilePanel("Select Combo Database XML", "", "");
        XmlSerializer serializer = new XmlSerializer(typeof(DataBaseXML));
        FileStream    stream     = null;

        stream      = new FileStream(absPath, FileMode.Open);
        xml         = serializer.Deserialize(stream) as DataBaseXML;
        temp.combos = xml.combos;
        stream.Close();
    }
Esempio n. 4
0
    void OnEnable()
    {
        if (temp == null)
        {
            temp = new DataBaseXML();
            if (EditorPrefs.HasKey("ObjectPath"))
            {
                string objectPath = EditorPrefs.GetString("ObjectPath");
                db = AssetDatabase.LoadAssetAtPath(objectPath, typeof(ComboDataBase)) as ComboDataBase;

                if (temp.combos == null)
                {
                    temp.combos = db.combos;
                }
            }
        }
    }