Ejemplo n.º 1
0
 public void OnDestroy()
 {
     UnRegister();
     Destroy();
     m_data    = null;
     m_luacode = null;
     m_handler = null;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 需要的初始化
 /// </summary>
 /// <param name="args"></param>
 public void Initialization(object[] args, PanelCompleteHandler handler = null)
 {
     Init();
     m_data = args;
     if (m_luacode != null)
     {
         m_luacode.uiData = m_data;
     }
     m_handler = handler;
 }
Ejemplo n.º 3
0
    /// <summary>
    /// 刷新
    /// </summary>
    /// <param name="args"></param>
    public void Refresh(object[] args, PanelCompleteHandler handler = null)
    {
        m_data    = args;
        m_handler = handler;
        if (m_luacode != null)
        {
            m_luacode.uiData = m_data;
            m_luacode.UnRegister();
        }

        UnRegister();
        Start();
    }
Ejemplo n.º 4
0
    public static void OpenPanelAsync(string uiName, bool ismaxDepth = false, PanelCompleteHandler handler = null, params object[] args)
    {
        UIBase ui = null;

        if (m_panels.TryGetValue(uiName, out ui))
        {
            ui.gameObject.SetActive(true);
            SetPanelDepth(ui, ismaxDepth);
            ui.Refresh(args, handler);
            return;
        }
        Instance.StartCoroutine(Instance.LoadPanelAsync(uiName, ismaxDepth, handler, args));
    }
Ejemplo n.º 5
0
 public void OnDestroy()
 {
     if (m_luacode != null && !LuaManager.isDispose)
     {
         m_luacode.UnRegister();
     }
     UnRegister();
     if (m_luacode != null && !LuaManager.isDispose)
     {
         m_luacode.Destroy();
     }
     Destroy();
     m_data    = null;
     m_luacode = null;
     m_handler = null;
 }
Ejemplo n.º 6
0
    private IEnumerator LoadPanelAsync(string uiName, bool ismaxDepth = false, PanelCompleteHandler handler = null, object[] args = null)
    {
        //string uipath = string.Format("ui/{0}.bundle", uiName.ToLower());
        string uipath  = uiName.ToLower();
        var    request = AssetBundleManager.LoadAssetAsync(uipath, uiName, typeof(GameObject));

        m_assetOps.Add(request);
        yield return(request);

        GameObject prefab = request.GetAsset <GameObject>();

        if (prefab != null)
        {
            GameObject go = Instantiate(prefab) as GameObject;
            SetPanel(go, uiName, ismaxDepth, handler, args);
        }
        yield break;
    }
Ejemplo n.º 7
0
    private static UIBase SetPanel(GameObject go, string uiName, bool ismaxDepth = false, PanelCompleteHandler handler = null, object[] args = null)
    {
        go.SetActive(true);


        Transform tparent = Main.GetUIRoot().FindChild("Camera");

        go.transform.SetParent(tparent);

        if (!GUIManager.m_panelExitList.ContainsKey(uiName))
        {
            GUIManager.m_panelExitList.Add(uiName, go);
        }

        bool nocshape = false;
        var  type     = Assembly.GetExecutingAssembly().GetType(uiName);

        if (type == null)
        {
            nocshape = true;
            type     = typeof(UIBase);
        }
        UIBase ui = go.GetComponent(type) as UIBase;

        if (ui == null)
        {
            ui = go.AddComponent(type) as UIBase;
        }

        m_panels.Add(uiName, ui);
        go.transform.localScale    = Vector3.one;
        go.transform.localPosition = Vector3.zero;
        if (ui != null)
        {
            go.GetComponent <UIPanel>().depth = ui.setDepth;
            ui.nocshape = nocshape;
            ui.Initialization(args, handler);
        }
        else
        {
        }

        return(ui);
    }