示例#1
0
    public static HCanvas GetData(HGUIRender render)
    {
        string guid = render.GetGuid();

        for (int i = 0; i < CanvasCash.Count; i++)
        {
            if (guid == CanvasCash[i].guid)
            {
                return(CanvasCash[i].Root as HCanvas);
            }
        }
        string dic  = Environment.CurrentDirectory + "/hgui2";
        string path = dic + "/" + render.GetGuid() + ".bytes";

        if (File.Exists(path))
        {
            byte[] dat = File.ReadAllBytes(path);
            huqiang.Core.HGUI.UIElement.DisposeAll();
            if (HGUIManager.GameBuffer == null)
            {
                HGUIManager.Initial();
            }
            if (render.canvas == null)
            {
                render.canvas = new HCanvas();
            }
            CloneAll(new DataBuffer(dat), render.canvas);
            DataContext dc = new DataContext();
            dc.guid = guid;
            dc.Root = render.canvas;
            CanvasCash.Add(dc);
            return(render.canvas);
        }
        return(null);
    }
示例#2
0
    static void Create(string Assetname, string dicpath, GameObject gameObject)
    {
        if (Assetname == null)
        {
            return;
        }
        if (Assetname == "")
        {
            return;
        }
        LoadBundle();
        Assetname = Assetname.Replace(" ", "");
        var dc = dicpath;

        if (dc == null | dc == "")
        {
            dc = Application.dataPath + "/AssetsBundle/";
            if (!Directory.Exists(dc))
            {
                Directory.CreateDirectory(dc);
            }
        }
        dc += Assetname;
        HGUIManager.Initial(gameObject.transform);
        HGUIManager.SavePrefab(gameObject.transform, dc);
        Debug.Log("create done path:" + dc);
    }
示例#3
0
 static void CloneAll(byte[] ui, Transform root)
 {
     if (ui != null)
     {
         HGUIManager.Initial(root);
         var fake  = HGUIManager.LoadModels(ui, "assTest").models;
         var child = HGUIManager.GetAllChild(fake);
         if (child != null)
         {
             Initializer initializer = new Initializer();
             for (int i = 0; i < child.Length; i++)
             {
                 var go = HGUIManager.Clone(child[i], initializer);
                 if (go != null)
                 {
                     var trans = go.transform;
                     trans.SetParent(root);
                     trans.localPosition = Vector3.zero;
                     trans.localScale    = Vector3.one;
                     trans.localRotation = Quaternion.identity;
                 }
             }
         }
     }
 }
示例#4
0
文件: App.cs 项目: pkwzsqsdly/HGUI
        static void CreateUI()
        {
            UIPage.Initial(UIRoot);
            UIMenu.Initial(UIRoot);
            UINotify.Initial(UIRoot);

            var buff = new GameObject("Buffer");

            buff.transform.SetParent(UIRoot);
            buff.SetActive(false);
            buff.transform.localScale = Vector3.one;
            HGUIManager.Initial(buff.transform);
        }
示例#5
0
文件: App.cs 项目: huqiang0204/HGUI
        static void CreateUI()
        {
            UIPage.Initial(UIRoot);
            UIMenu.Initial(UIRoot);
            UINotify.Initial(UIRoot);

            var buff = new UIElement();

            buff.name = "Buffer";
            buff.SetParent(UIRoot);
            buff.activeSelf = false;
            buff.localScale = Vector3.one;
            HGUIManager.Initial();
        }
示例#6
0
    public void Initital()
    {
        LoadBundle();
        HGUIManager.Initial();
        var db = HGUIManager.GetPrefab(TargetCanvas);

        HGUIManager.prefabAssets.Clear();
        HGUIManager.LoadModels(db, AssetName);
        var c = transform.childCount;

        for (int i = 0; i < c; i++)
        {
            GameObject.Destroy(transform.GetChild(i).gameObject);
        }
    }
示例#7
0
        static void CreateUI()
        {
            var page = new GameObject("page");

            UIPage.Root = page.transform;
            page.transform.SetParent(UIRoot);
            UIPage.Root.localPosition = Vector3.zero;
            UIPage.Root.localScale    = Vector3.one;
            UIPage.Root.localRotation = Quaternion.identity;

            var buff = new GameObject("buffer");

            buff.transform.SetParent(UIRoot);
            buff.SetActive(false);
            buff.transform.localScale = Vector3.one;
            HGUIManager.Initial(buff.transform);
        }
示例#8
0
 static void Clone(string CloneName, byte[] ui, Transform root)
 {
     if (ui != null)
     {
         if (CloneName != null)
         {
             if (CloneName != "")
             {
                 HGUIManager.Initial(root);
                 HGUIManager.LoadModels(ui, "assTest");
                 var go = HGUIManager.GameBuffer.Clone(HGUIManager.FindModel("assTest", CloneName));
                 if (go != null)
                 {
                     var trans = go.transform;
                     trans.SetParent(root);
                 }
             }
         }
     }
 }
示例#9
0
 static void CloneAll(byte[] ui, Transform root)
 {
     if (ui != null)
     {
         HGUIManager.Initial(root);
         var fake  = HGUIManager.LoadModels(ui, "assTest").models;
         var child = HGUIManager.GetAllChild(fake);
         if (child != null)
         {
             for (int i = 0; i < child.Length; i++)
             {
                 var go = HGUIManager.GameBuffer.Clone(child[i]);
                 if (go != null)
                 {
                     var trans = go.transform;
                     trans.SetParent(root);
                 }
             }
         }
     }
 }
    public void Initital()
    {
        LoadBundle();
        HGUIManager.Initial(transform);
        DataBuffer db = new DataBuffer(1024);

        db.fakeStruct = HGUIManager.GameBuffer.GetDataLoader(0).LoadFromObject(transform, db);
        PrefabAsset asset = new PrefabAsset();

        asset.models = db.fakeStruct;
        asset.name   = AssetName;
        HGUIManager.prefabAssets.Clear();
        HGUIManager.prefabAssets.Add(asset);
        var c = transform.childCount;

        for (int i = 0; i < c; i++)
        {
            GameObject.Destroy(transform.GetChild(i).gameObject);
        }
        App.Initial(transform);
    }
示例#11
0
 static void Clone(string CloneName, byte[] ui, Transform root)
 {
     if (ui != null)
     {
         if (CloneName != null)
         {
             if (CloneName != "")
             {
                 HGUIManager.Initial(root);
                 HGUIManager.LoadModels(ui, "assTest");
                 Initializer initializer = new Initializer();
                 var         go          = HGUIManager.Clone(HGUIManager.FindModel("assTest", CloneName), initializer);
                 if (go != null)
                 {
                     var trans = go.transform;
                     trans.SetParent(root);
                     trans.localScale    = Vector3.one;
                     trans.localScale    = Vector3.one;
                     trans.localRotation = Quaternion.identity;
                 }
             }
         }
     }
 }