예제 #1
0
    static int IntToEnum(IntPtr L)
    {
        int arg0 = (int)LuaDLL.lua_tonumber(L, 1);

        QFramework.UILevel o = (QFramework.UILevel)arg0;
        ToLua.Push(L, o);
        return(1);
    }
예제 #2
0
    static int OpenPanel(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                string             arg0 = ToLua.CheckString(L, 1);
                QFramework.UIPanel o    = QFramework.UIMgr.OpenPanel(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2)
            {
                string             arg0 = ToLua.CheckString(L, 1);
                QFramework.UILevel arg1 = (QFramework.UILevel)ToLua.CheckObject(L, 2, typeof(QFramework.UILevel));
                QFramework.UIPanel o    = QFramework.UIMgr.OpenPanel(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3)
            {
                string             arg0 = ToLua.CheckString(L, 1);
                QFramework.UILevel arg1 = (QFramework.UILevel)ToLua.CheckObject(L, 2, typeof(QFramework.UILevel));
                string             arg2 = ToLua.CheckString(L, 3);
                QFramework.UIPanel o    = QFramework.UIMgr.OpenPanel(arg0, arg1, arg2);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: QFramework.UIMgr.OpenPanel"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #3
0
 static void Push(IntPtr L, QFramework.UILevel arg)
 {
     ToLua.Push(L, arg);
 }
예제 #4
0
 public static UIPanel OpenPanel(string panelName, UILevel level = UILevel.Common, string assetBundleName = null)
 {
     return(UIManager.Instance.OpenUI(panelName, level, null, assetBundleName) as UIPanel);
 }
예제 #5
0
 /// <summary>
 /// Create&ShowUI
 /// </summary>
 public T OpenUI <T>(UILevel canvasLevel = UILevel.Common, IUIData uiData = null, string assetBundleName = null,
                     string prefabName   = null) where T : UIPanel
 {
     return(OpenUI(prefabName ?? GetUIBehaviourName <T>(), canvasLevel, uiData, assetBundleName) as T);
 }
예제 #6
0
 internal static T OpenPanel <T>(UILevel canvasLevel    = UILevel.Common, IUIData uiData = null,
                                 string assetBundleName = null,
                                 string prefabName      = null) where T : UIPanel
 {
     return(UIManager.Instance.OpenUI <T>(canvasLevel, uiData, assetBundleName, prefabName));
 }
예제 #7
0
 internal static UIPanel OpenPanel(string panelName, UILevel canvasLevel = UILevel.Common, IUIData uiData = null,
                                   string assetBundleName = null)
 {
     return(QUIManager.Instance.OpenUI(panelName, canvasLevel, assetBundleName) as UIPanel);
 }
예제 #8
0
        public IPanel CreateUI(string uiBehaviourName, UILevel level = UILevel.Common, IUIData uiData = null,
                               string assetBundleName = null)
        {
            IPanel ui;

            if (mAllUI.TryGetValue(uiBehaviourName, out ui))
            {
                return(ui);
            }

            ui = UIPanel.Load(uiBehaviourName, assetBundleName);

            switch (level)
            {
            case UILevel.Bg:
                ui.Transform.SetParent(mBgTrans);
                break;

            case UILevel.AnimationUnderPage:
                ui.Transform.SetParent(mAnimationUnderTrans);
                break;

            case UILevel.Common:
                ui.Transform.SetParent(mCommonTrans);
                break;

            case UILevel.AnimationOnPage:
                ui.Transform.SetParent(mAnimationOnTrans);
                break;

            case UILevel.PopUI:
                ui.Transform.SetParent(mPopUITrans);
                break;

            case UILevel.Const:
                ui.Transform.SetParent(mConstTrans);
                break;

            case UILevel.Toast:
                ui.Transform.SetParent(mToastTrans);
                break;

            case UILevel.Forward:
                ui.Transform.SetParent(mForwardTrans);
                break;
            }

            var uiGoRectTrans = ui.Transform as RectTransform;

            uiGoRectTrans.offsetMin          = Vector2.zero;
            uiGoRectTrans.offsetMax          = Vector2.zero;
            uiGoRectTrans.anchoredPosition3D = Vector3.zero;
            uiGoRectTrans.anchorMin          = Vector2.zero;
            uiGoRectTrans.anchorMax          = Vector2.one;

            ui.Transform.LocalScaleIdentity();
            ui.Transform.gameObject.name = uiBehaviourName;

            ui.PanelInfo = new UIPanelInfo
            {
                AssetBundleName = assetBundleName, Level = level, PanelName = uiBehaviourName
            };

            mAllUI.Add(uiBehaviourName, ui);

            ui.Init(uiData);

            return(ui);
        }
예제 #9
0
        /// <summary>
        /// 创建UIPanel
        /// </summary>
        /// <param name="uiBehaviourName"></param>
        /// <param name="uiLevel"></param>
        /// <param name="initData"></param>
        /// <returns></returns>
        public GameObject CreateUIObj(string uiBehaviourName, UILevel uiLevel, string assetBundleName = null)
        {
            IPanel ui;

            if (mAllUI.TryGetValue(uiBehaviourName, out ui))
            {
                Log.W("{0}: already exist", uiBehaviourName);
                // 直接返回,不要再调一次Init(),Init()应该只能调用一次
                return(ui.Transform.gameObject);
            }

            ui = UIPanel.Load(uiBehaviourName, assetBundleName);

            switch (uiLevel)
            {
            case UILevel.Bg:
                ui.Transform.SetParent(mBgTrans);
                break;

            case UILevel.AnimationUnderPage:
                ui.Transform.SetParent(mAnimationUnderTrans);
                break;

            case UILevel.Common:
                ui.Transform.SetParent(mCommonTrans);
                break;

            case UILevel.AnimationOnPage:
                ui.Transform.SetParent(mAnimationOnTrans);
                break;

            case UILevel.PopUI:
                ui.Transform.SetParent(mPopUITrans);
                break;

            case UILevel.Const:
                ui.Transform.SetParent(mConstTrans);
                break;

            case UILevel.Toast:
                ui.Transform.SetParent(mToastTrans);
                break;

            case UILevel.Forward:
                ui.Transform.SetParent(mForwardTrans);
                break;
            }

            var uiGoRectTrans = ui.Transform as RectTransform;

            uiGoRectTrans.offsetMin          = Vector2.zero;
            uiGoRectTrans.offsetMax          = Vector2.zero;
            uiGoRectTrans.anchoredPosition3D = Vector3.zero;
            uiGoRectTrans.anchorMin          = Vector2.zero;
            uiGoRectTrans.anchorMax          = Vector2.one;

            ui.Transform.LocalScaleIdentity();
            ui.Transform.gameObject.name = uiBehaviourName;

            ui.PanelInfo = new UIPanelInfo {
                AssetBundleName = assetBundleName, Level = uiLevel, PanelName = uiBehaviourName
            };
            return(ui.Transform.gameObject);
        }
예제 #10
0
 public void SetLevelOfPanel(UILevel level, IPanel panel)
 {
     panel.Transform.SetParent(transform);
     MakeSureCanvas(level, panel);
 }
예제 #11
0
 public static UIPanel OpenPanel(string panelName, UILevel level = UILevel.Common, string assetBundleName = null)
 {
     return(UIKit.OpenPanel(panelName, level, assetBundleName));
 }
예제 #12
0
        public IPanel OpenUI(string uiBehaviourName, UITransitionType transitionType, UILevel canvasLevel,
                             IUIData uiData = null, string assetBundleName = null, bool CanOpenPrevious = true)
        {
            IPanel retPanel = null;

            if (!mAllUI.TryGetValue(uiBehaviourName, out retPanel))
            {
                retPanel = CreateUI(uiBehaviourName, transitionType, canvasLevel, uiData, assetBundleName, CanOpenPrevious);
            }

            retPanel.Open(uiData);
            retPanel.Show();
            return(retPanel);
        }
예제 #13
0
 //public static UIPanel OpenPanel(string panelName, UILevel level = UILevel.Common, string assetBundleName = null)
 //{
 //	return UIManager.Instance.OpenUI(panelName, level, null, assetBundleName) as UIPanel;
 //}
 public static UIPanel OpenPanel(string panelName, UILevel level = UILevel.Common, IUIData data = null)
 {
     return(UIManager.Instance.OpenUI(panelName, level, data, null) as UIPanel);
 }