public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        EditorGUILayout.Space();
        serializedObject.Update();
        Element2DCreate ele = target as Element2DCreate;

        if (GUILayout.Button("Clear All AssetBundle"))
        {
            AssetBundle.UnloadAllAssetBundles(true);
            ElementAsset.bundles.Clear();
            EditorModelManager2D.Clear();
        }
        if (GUILayout.Button("Create"))
        {
            Create(ele.Assetname, ele.dicpath, ele.gameObject);
        }
        if (GUILayout.Button("Clone"))
        {
            if (ele.bytesUI != null)
            {
                Clone(ele.Assetsname, ele.CloneName, ele.bytesUI.bytes, ele.transform);
            }
        }
        if (GUILayout.Button("CloneAll"))
        {
            if (ele.bytesUI != null)
            {
                CloneAll(ele.bytesUI.bytes, ele.transform);
            }
        }
        serializedObject.ApplyModifiedProperties();
    }
Esempio n. 2
0
 static void Clone(string CloneName, byte[] ui, Transform root, Element2DCreate ele)
 {
     if (ui != null)
     {
         if (CloneName != null)
         {
             if (CloneName != "")
             {
                 LoadBundle();
                 ModelManager2D.Initial(root);
                 ele.RegExtendComponent();
                 var assets = ModelManager2D.LoadModels(ui, "assTest");
                 var fake   = ModelManager2D.GameBuffer.FindChild(assets.models, CloneName);
                 var go     = ModelManager2D.GameBuffer.Clone(fake);
                 go.transform.SetParent(root);
             }
         }
     }
 }
Esempio n. 3
0
    static void Create(string Assetname, string dicpath, GameObject gameObject, Element2DCreate ele)
    {
        if (Assetname == null)
        {
            return;
        }
        if (Assetname == "")
        {
            return;
        }
        LoadBundle();
        Assetname = Assetname.Replace(" ", "");

        var dc = dicpath;

        if (dc == null | dc == "")
        {
            dc = Application.dataPath + "/AssetsBundle/";
        }
        ModelManager2D.Initial(gameObject.transform);
        ele.RegExtendComponent();
        ModelManager2D.SavePrefab(gameObject.transform, dc + Assetname);
        Debug.Log("create done");
    }