Beispiel #1
0
 private void _DestroyUI(BaseUIObject ui, string uiName)
 {
     if (ui.IsOpen())
     {
         ui.Close();
     }
     ui.Destroy();
     GameObject.Destroy(ui.GameObject);
     m_UIObjectDict.Remove(uiName);
 }
Beispiel #2
0
        private void _CloseUI(BaseUIObject ui)
        {
            if (!ui.IsOpen())
            {
                return;
            }

            ui.Close();
            ui.GameObject.SetActive(false);
        }
Beispiel #3
0
 static int Destroy(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         ANFramework.BaseUIObject obj = (ANFramework.BaseUIObject)ToLua.CheckObject <ANFramework.BaseUIObject>(L, 1);
         obj.Destroy();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #4
0
 static int AddSubUI(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         ANFramework.BaseUIObject obj = (ANFramework.BaseUIObject)ToLua.CheckObject <ANFramework.BaseUIObject>(L, 1);
         string arg0 = ToLua.CheckString(L, 2);
         obj.AddSubUI(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #5
0
 static int IsOpen(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         ANFramework.BaseUIObject obj = (ANFramework.BaseUIObject)ToLua.CheckObject <ANFramework.BaseUIObject>(L, 1);
         bool o = obj.IsOpen();
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #6
0
 static int GetSubUI(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         ANFramework.BaseUIObject obj = (ANFramework.BaseUIObject)ToLua.CheckObject <ANFramework.BaseUIObject>(L, 1);
         System.Collections.Generic.List <string> o = obj.GetSubUI();
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #7
0
 static int SetRoot(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         ANFramework.BaseUIObject obj  = (ANFramework.BaseUIObject)ToLua.CheckObject <ANFramework.BaseUIObject>(L, 1);
         UnityEngine.GameObject   arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 2, typeof(UnityEngine.GameObject));
         obj.SetRoot(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #8
0
 static int GetUI(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         ANFramework.UIManager obj = (ANFramework.UIManager)ToLua.CheckObject <ANFramework.UIManager>(L, 1);
         string arg0 = ToLua.CheckString(L, 2);
         ANFramework.BaseUIObject o = obj.GetUI(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #9
0
    static int set_Transform(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ANFramework.BaseUIObject obj  = (ANFramework.BaseUIObject)o;
            UnityEngine.Transform    arg0 = (UnityEngine.Transform)ToLua.CheckObject <UnityEngine.Transform>(L, 2);
            obj.Transform = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Transform on a nil value"));
        }
    }
Beispiel #10
0
    static int set_GameObject(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ANFramework.BaseUIObject obj  = (ANFramework.BaseUIObject)o;
            UnityEngine.GameObject   arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 2, typeof(UnityEngine.GameObject));
            obj.GameObject = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index GameObject on a nil value"));
        }
    }
Beispiel #11
0
    static int set_ResourceName(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ANFramework.BaseUIObject obj = (ANFramework.BaseUIObject)o;
            string arg0 = ToLua.CheckString(L, 2);
            obj.ResourceName = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index ResourceName on a nil value"));
        }
    }
Beispiel #12
0
    static int get_GameObject(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ANFramework.BaseUIObject obj = (ANFramework.BaseUIObject)o;
            UnityEngine.GameObject   ret = obj.GameObject;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index GameObject on a nil value"));
        }
    }
Beispiel #13
0
    static int get_ResourceName(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ANFramework.BaseUIObject obj = (ANFramework.BaseUIObject)o;
            string ret = obj.ResourceName;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index ResourceName on a nil value"));
        }
    }
Beispiel #14
0
    static int get_Transform(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ANFramework.BaseUIObject obj = (ANFramework.BaseUIObject)o;
            UnityEngine.Transform    ret = obj.Transform;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Transform on a nil value"));
        }
    }
Beispiel #15
0
        public void OpenSubUI(string parentName, string uiName, Transform parent)
        {
            BaseUIObject parentUI;

            if (!m_UIObjectDict.TryGetValue(parentName, out parentUI))
            {
                Debug.LogError(string.Format("【UI】打开子界面({0})失败,主界面({1})并未打开。", uiName, parentName));
                return;
            }
            if (parent == null)
            {
                parent = parentUI.Transform;
            }
            BaseUIObject ui = _OpenUI(uiName, parent);

            parentUI.AddSubUI(uiName);
        }
Beispiel #16
0
        private BaseUIObject _CreateUI(string resourceName, Transform parent)
        {
            string path = string.Format("{0}/{1}", UIFolderPath, resourceName);

            GameObject gameObject = ANF.Core.Mgr.Resource.Instance(path);

            if (gameObject == null)
            {
                return(null);
            }

            Transform transform = gameObject.transform;

            transform.SetParent(parent);
            if (transform as RectTransform)
            {
                ((RectTransform)transform).sizeDelta = Vector3.zero;
            }
            transform.localPosition = Vector3.zero;
            transform.localScale    = Vector3.one;
            gameObject.name         = resourceName;

            string uiName = resourceName;

            if (m_UINameDict.ContainsKey(uiName))
            {
                m_UINameDict[uiName] += 1;
                uiName += m_UINameDict[uiName];
            }

            BaseUIObject ui = new BaseUIObject(uiName, resourceName);

            ui.SetRoot(gameObject);

            m_UIObjectDict.Add(uiName, ui);
            ANF.Core.Mgr.Lua.CallTableFunc("ANF.UIMgr:__CreateUIFromCS", ui);

            return(ui);
        }
Beispiel #17
0
    static int _CreateANFramework_BaseUIObject(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                string arg0 = ToLua.CheckString(L, 1);
                string arg1 = ToLua.CheckString(L, 2);
                ANFramework.BaseUIObject obj = new ANFramework.BaseUIObject(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: ANFramework.BaseUIObject.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }