Example #1
0
        public static bool HasUIForm(this UIComponent uiComponent, int uiFormId, string uiGroupName = null)
        {
            UIFormDBModel uiFormDBModel = GameEntry.DataTable.GetDataTable <UIFormDBModel>();
            UIFormEntity  uiFormEntity  = uiFormDBModel.Get(uiFormId);

            if (uiFormEntity == null)
            {
                return(false);
            }

            string assetName = AssetUtility.GetUIFormAsset(uiFormEntity.AssetName);

            if (string.IsNullOrEmpty(uiGroupName))
            {
                return(uiComponent.HasUIForm(assetName));
            }

            UIGroup uiGroup = uiComponent.GetUIGroup(uiGroupName);

            if (uiGroup == null)
            {
                return(false);
            }

            return(uiGroup.HasUIForm(assetName));
        }
Example #2
0
        public static int?OpenUIForm(this UIComponent uiComponent, int uiFormId, object userData = null)
        {
            UIFormDBModel uiFormDBModel = GameEntry.DataTable.GetDataTable <UIFormDBModel>();
            UIFormEntity  uiFormEntity  = uiFormDBModel.Get(uiFormId);

            if (uiFormEntity == null)
            {
                Log.Warning("Can not load UI form '{0}' from data table.", uiFormId.ToString());
                return(null);
            }

            string assetName = AssetUtility.GetUIFormAsset(uiFormEntity.AssetName);

            //读表
            if (!uiFormEntity.AllowMultiInstance)
            {
                if (uiComponent.IsLoadingUIForm(assetName))
                {
                    return(null);
                }

                if (uiComponent.HasUIForm(assetName))
                {
                    return(null);
                }
            }

            return(uiComponent.OpenUIForm(assetName, uiFormEntity.UIGroupName, Constant.AssetPriority.UIFormAsset, uiFormEntity.PauseCoveredUIForm, userData));
        }