Exemplo n.º 1
0
        /// <summary>
        /// 设置层级
        /// </summary>
        /// <param name="formBase"></param>
        /// <param name="isAdd"></param>
        internal void SetSortingOrder(UIFormBase formBase, bool isAdd)
        {
            if (isAdd)
            {
                //DODO:ui出现问题
                m_UILayerDic[formBase.GroupId] += 10;
            }
            else
            {
                m_UILayerDic[formBase.GroupId] -= 10;
            }

            //formBase.CurrCanvas.sortingOrder = m_UILayerDic[formBase.GroupId];
        }
Exemplo n.º 2
0
 /// <summary>
 /// ui回池
 /// </summary>
 /// <param name="form"></param>
 internal void Enqueue(UIFormBase form)
 {
     form.gameObject.SetActive(false);
     m_UIFormList.AddLast(form);
 }
Exemplo n.º 3
0
 /// <summary>
 /// ui回池
 /// </summary>
 /// <param name="form"></param>
 public void Enqueue(UIFormBase form)
 {
     m_UIPool.Enqueue(form);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 设置层级
 /// </summary>
 /// <param name="formBase"></param>
 /// <param name="isAdd"></param>
 internal void SetSortingOrder(UIFormBase formBase, bool isAdd)
 {
     m_UILayer.SetSortingOrder(formBase, isAdd);
 }
Exemplo n.º 5
0
 public void CloseUIForm(UIFormBase formBase)
 {
     m_UIManager.CloseUIForm(formBase);
 }
Exemplo n.º 6
0
        /// <summary>
        /// 打开ui窗口
        /// </summary>
        /// <param name="uiFormID">UI的对应id</param>
        /// <param name="userData">要传的数据</param>
        /// <param name="onOpen">回调</param>
        internal void OpenUIForm(int uiFormID, object userData = null, BaseAction <UIFormBase> onOpen = null)
        {
            if (IsExists(uiFormID))
            {
                return;
            }
            //1.读表
            Sys_UIFormEntity entity = GameEntry.DataTable.DataTableManager.Sys_UIFormDBModel.Get(uiFormID);

            if (entity == null)
            {
                Debug.Log(uiFormID + "对应的UI窗体不存在");
                return;
            }

            UIFormBase formBase = GameEntry.UI.Dequeue(uiFormID);

            if (formBase == null)
            {
                //TODO:异步加载ui需要时间 此处需要处理过滤加载中的ui

                string assetPath = null;
                switch (GameEntry.Localization.CurrLanguage)
                {
                case TQLanguage.Chinese:
                    assetPath = entity.AssetPath_Chinese;
                    break;

                case TQLanguage.English:
                    assetPath = entity.AssetPath_English;
                    break;
                }
                LoadUIAsset(assetPath, (ResourceEntity resourceEntity) =>
                {
                    GameObject uiObj = UnityEngine.Object.Instantiate((UnityEngine.Object)resourceEntity.Target) as GameObject;
                    //把克隆出来的资源 加入实例资源池
                    GameEntry.Pool.RegisterInstanceResource(uiObj.GetInstanceID(), resourceEntity);
                    uiObj.transform.SetParent(GameEntry.UI.GetGroup(entity.UIGroupId).Group);
                    uiObj.transform.localPosition = Vector3.zero;
                    uiObj.transform.localScale    = Vector3.one;

                    RectTransform rect = uiObj.GetComponent <RectTransform>();
                    rect.offsetMax     = new Vector2(0, 0);
                    rect.offsetMin     = new Vector2(0, 0);
                    formBase           = uiObj.GetComponent <UIFormBase>();

                    formBase.Init(uiFormID, entity.UIGroupId, entity.DisableUILayer == 1, entity.IsLock == 1, userData);

                    m_OpenUIFormList.AddLast(formBase);
                    if (onOpen != null)
                    {
                        onOpen(formBase);
                    }
                });
            }
            else
            {
                formBase.gameObject.SetActive(true);
                formBase.Open(userData);
                m_OpenUIFormList.AddLast(formBase);
                if (onOpen != null)
                {
                    onOpen(formBase);
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// 点击按钮关闭
 /// </summary>
 /// <param name="formBase"></param>
 internal void CloseUIForm(UIFormBase formBase)
 {
     m_OpenUIFormList.Remove(formBase);
     formBase.ToClose();
 }