Beispiel #1
0
    public void DoNewFuncIconFlyEffect(GuideDefine.FuncOpenShowData showData)
    {
        CompleteNewFuncOpen(showData);
        Action <GuideDefine.FuncOpenShowData> onComplete = (data) =>
        {
            //执行下一个工作流
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOW);
        };

        if (null == m_newFuncFlyGrid)
        {
            Transform flyTs = UIManager.GetObj(GridID.Uinewfuncflygrid);
            Util.AddChildToTarget(UIRootHelper.Instance.StretchTransRoot, flyTs);
            GameObject gObj = flyTs.gameObject;
            m_newFuncFlyGrid = gObj.GetComponent <UINewFuncFlyGrid>();
            if (null == m_newFuncFlyGrid)
            {
                m_newFuncFlyGrid = gObj.gameObject.AddComponent <UINewFuncFlyGrid>();
            }
            NGUITools.MarkParentAsChanged(gObj);
        }
        if (null != m_newFuncFlyGrid)
        {
            m_newFuncFlyGrid.StartFlyToTarget(showData, NewFuncFlyStartPos, onComplete);
        }
        else
        {
            onComplete.Invoke(showData);
        }
    }
Beispiel #2
0
    protected override UIBaseWindow ReadyToShowBaseWindow(WindowID id)
    {
        // 检测控制权限
        if (!this.IsWindowInControl(id))
        {
            Debug.Log("UIManager has no control power of " + id.ToString());
            return(null);
        }
        if (ShownWindows.ContainsKey(id))
        {
            return(null);
        }

        // 隐藏callWindowId指向窗口

        /*if(showData != null)
         *  HideWindow(showData.callWindowId, null);*/

        UIBaseWindow baseWindow = GetGameWindow(id);
        bool         newAdded   = false;

        if (!baseWindow)
        {
            newAdded = true;
            // 窗口不存在从内存进行加载
            if (AppConst.windowPrefabPath.ContainsKey(id))
            {
                GameObject prefab = ResourcesMgr.Instance.LoadResource <GameObject>(ResourceType.RESOURCE_UI, AppConst.windowPrefabPath[id]);
                if (prefab != null)
                {
                    GameObject uiObject = (GameObject)GameObject.Instantiate(prefab);
                    Util.SetActive(uiObject, true);
                    baseWindow = uiObject.GetComponent <UIBaseWindow>();
                    Util.AddChildToTarget(UINormalWindowRoot, baseWindow.transform);
                    AllWindows[id] = baseWindow;
                }
            }
        }

        if (baseWindow == null)
        {
            Debug.LogError("[window instance is null.]" + id.ToString());
            return(null);
        }

        if (newAdded)
        {
            baseWindow.ResetWindow();
        }

        //// 导航系统数据更新
        //RefreshBackSequenceData(baseWindow);
        //// 调整层级depth
        //AdjustBaseWindowDepth(baseWindow);
        //// 添加背景Collider
        //AddColliderBgForWindow(baseWindow);
        return(baseWindow);
    }
Beispiel #3
0
    protected override void OnLoading()
    {
        base.OnLoading();
        emgr = DataManager.Manager <EquipManager>();
        Transform tempTrans = null;

        if (null != m_trans_CostRoot && null == m_growCost)
        {
            tempTrans = UIManager.GetObj(GridID.Uiitemshowgrid);
            if (null != tempTrans)
            {
                Util.AddChildToTarget(m_trans_CostRoot, tempTrans);
                m_growCost = tempTrans.GetComponent <UIItemShowGrid>();
                if (null == m_growCost)
                {
                    m_growCost = tempTrans.gameObject.AddComponent <UIItemShowGrid>();
                }
            }
        }

        if (null == cardArray && null != m_trans_ResultRoot)
        {
            StringBuilder rootBuilder = new StringBuilder();
            cardArray = new UICompoundSelectAttrGrid[3];
            UICompoundSelectAttrGrid tempGrid = null;
            Transform parentTs = null;
            for (int i = 0, max = cardArray.Length; i < max; i++)
            {
                rootBuilder.Remove(0, rootBuilder.Length);
                rootBuilder.Append("ResultRoot");
                rootBuilder.Append(i + 1);
                parentTs = m_trans_ResultRoot.Find(rootBuilder.ToString());
                if (null == parentTs)
                {
                    continue;
                }

                tempTrans = UIManager.GetObj(GridID.Uicompoundattrselectgrid);
                if (null != tempTrans)
                {
                    Util.AddChildToTarget(parentTs, tempTrans);
                    tempGrid = tempTrans.GetComponent <UICompoundSelectAttrGrid>();
                    if (null == tempGrid)
                    {
                        tempGrid = tempTrans.gameObject.AddComponent <UICompoundSelectAttrGrid>();
                    }
                    if (null != tempGrid)
                    {
                        tempGrid.RegisterUIEventDelegate(OnGridEventDlg);
                    }
                }
                cardArray[i] = tempGrid;
            }
        }
    }
Beispiel #4
0
        /// <summary>
        /// 消息窗口的显示,目前支持3种类型
        /// </summary>
        public void ShowMessageBox(string msg, MessageBoxType type, MsgBoxCallBack callback = null)
        {
            string     wndPath = wndResDict [WindowID.Msgbox];
            GameObject prefab  = Resources.Load <GameObject> ("UIPrefab/Msgbox");

            if (prefab != null)
            {
                GameObject clone = (GameObject)GameObject.Instantiate(prefab);
                Util.AddChildToTarget(msgBoxRoot.transform, clone.transform, Vector3.zero);
                UIMessageBox msgBox = clone.GetComponent <UIMessageBox> ();
            }
        }
    /// <summary>
    ///
    /// </summary>
    private void InitWidgets()
    {
        GameObject preObj = null;

        if (null == m_infoGrid && null != m_trans_InfoGridRoot)
        {
            Transform cloneObj = UIManager.GetObj((uint)GridID.Uiiteminfogrid);
            if (null != cloneObj)
            {
                Util.AddChildToTarget(m_trans_InfoGridRoot, cloneObj);
                m_infoGrid = cloneObj.GetComponent <UIItemInfoGrid>();
                if (null == m_infoGrid)
                {
                    m_infoGrid = cloneObj.gameObject.AddComponent <UIItemInfoGrid>();
                }
                if (null != m_infoGrid && !m_infoGrid.Visible)
                {
                    m_infoGrid.SetVisible(true);
                }
            }
        }

        mlstGrids = new List <UICompoundAttrGrid>();
        preObj    = UIManager.GetResGameObj(GridID.Uicompoundattrgrid) as GameObject;
        if (null != m_grid_AdditiveContent)
        {
            UICompoundAttrGrid mGrid = null;
            GameObject         obj   = null;
            for (EquipDefine.AttrIndex i = EquipDefine.AttrIndex.First
                 ; i <= EquipDefine.AttrIndex.Fifth; i++)
            {
                obj = NGUITools.AddChild(m_grid_AdditiveContent.gameObject, preObj);
                if (null != obj)
                {
                    obj.name = ((int)i).ToString();
                    mGrid    = obj.GetComponent <UICompoundAttrGrid>();
                    if (null == mGrid)
                    {
                        mGrid = obj.gameObject.AddComponent <UICompoundAttrGrid>();
                    }
                    mlstGrids.Add(mGrid);
                }
            }
            m_grid_AdditiveContent.Reposition();
        }

        if (null != m_label_EquipName)
        {
            m_label_EquipName.color = Color.white;
        }
    }
Beispiel #6
0
    public static Transform AddGridTransform(GridID gridID, Transform targetTrans)
    {
        Transform ts = null;

        if (null != targetTrans)
        {
            ts = UIManager.GetObj((uint)gridID);
            if (null != ts)
            {
                Util.AddChildToTarget(targetTrans, ts);
            }
        }

        return(ts);
    }
Beispiel #7
0
    private void InitCharacterGrid()
    {
        m_lstGrids   = new List <UISelectRoleGrid>();
        m_rightDesTA = m_widget_DesWidget.GetComponent <TweenAlpha>();
        m_dicProDes  = new Dictionary <enumProfession, GameObject>();

        if (null != m_trans_role_list && null != m_trans_UISelectRoleGrid)
        {
            Transform        ts       = null;
            UISelectRoleGrid roleGrid = null;
            GameObject       cloneObj = null;

            lstRoleList = DataManager.Manager <LoginDataManager>().RoleList;
            Transform tempTs = null;
            for (int i = 0, max = m_professionList.Length; i < max; i++)
            {
                ts = m_trans_role_list.Find(m_professionList[i].ToString());
                if (null != ts)
                {
                    tempTs = GameObject.Instantiate(m_trans_UISelectRoleGrid);// UIManager.GetObj(GridID.Uiselectrolegrid);
                    if (null == tempTs)
                    {
                        continue;
                    }
                    Util.AddChildToTarget(ts, tempTs);
                    cloneObj = tempTs.gameObject;
                    if (null != cloneObj)
                    {
                        roleGrid = cloneObj.GetComponent <UISelectRoleGrid>();
                        if (null == roleGrid)
                        {
                            roleGrid = cloneObj.AddComponent <UISelectRoleGrid>();
                        }
                    }
                    //roleGrid.SetData(i,GetRoleInfoByIndex(i));
                    roleGrid.RegisterUIEventDelegate(OnSelectRoleGridClick);
                    roleGrid.SetGridData(i);
                    m_lstGrids.Add(roleGrid);
                }

                ts = m_widget_DesWidget.cachedTransform.Find(m_professionList[i].ToString());
                if (null != ts)
                {
                    m_dicProDes.Add(m_professionList[i], ts.gameObject);
                }
            }
        }
    }
Beispiel #8
0
    private void InitCharacterGrid()
    {
        m_dicGrid   = new Dictionary <enumProfession, UICreateRoleGrid>();
        m_dicProDes = new Dictionary <enumProfession, GameObject>();
        if (null == m_trans_UICreateRoleGrid)
        {
            return;
        }
        Transform        ts       = null;
        UICreateRoleGrid roleGrid = null;
        GameObject       cloneObj = null;
        Transform        tempTs   = null;

        m_rightDesTA = m_widget_RightDesWiget.GetComponent <TweenAlpha>();
        for (int i = 0, max = m_professionList.Length; i < max; i++)
        {
            ts = m_trans_career_list.Find(m_professionList[i].ToString());
            if (null != ts)
            {
                tempTs = GameObject.Instantiate(m_trans_UICreateRoleGrid);// UIManager.GetObj(GridID.Uicreaterolegrid);
                if (null == tempTs)
                {
                    continue;
                }
                Util.AddChildToTarget(ts, tempTs);
                cloneObj = tempTs.gameObject;
                if (null != cloneObj)
                {
                    roleGrid = cloneObj.GetComponent <UICreateRoleGrid>();
                    if (null == roleGrid)
                    {
                        roleGrid = cloneObj.AddComponent <UICreateRoleGrid>();
                    }
                }

                roleGrid.RegisterUIEventDelegate(OnCreateRoleGridClick);
                roleGrid.SetGridInfo(m_professionList[i]);
                m_dicGrid.Add(m_professionList[i], roleGrid);
            }

            ts = m_widget_RightDesWiget.cachedTransform.Find(m_professionList[i].ToString());
            if (null != ts)
            {
                m_dicProDes.Add(m_professionList[i], ts.gameObject);
            }
        }
    }
Beispiel #9
0
 public void Init()
 {
     instance   = this;
     wndRoot    = new GameObject("WndRoot");
     msgBoxRoot = new GameObject("MsgBoxRoot");
     DialogRoot = new GameObject("DialogRoot");
     TipRoot    = new GameObject("TipRoot");
     EffectRoot = new GameObject("EffectRoot");
     root       = GameObject.FindWithTag("UIRoot");
     HubRoot    = new GameObject("HubRoot");
     Util.AddChildToTarget(root.transform, wndRoot.transform);
     Util.AddChildToTarget(root.transform, msgBoxRoot.transform);
     Util.AddChildToTarget(root.transform, DialogRoot.transform);
     Util.AddChildToTarget(root.transform, TipRoot.transform);
     Util.AddChildToTarget(root.transform, HubRoot.transform);
     //Util.AddChildToTarget (forwardRoot.transform, EffectRoot.transform);
     //初始化窗口预制体资源
     foreach (WindowID id in Enum.GetValues(typeof(WindowID)))
     {
         wndResDict.Add(id, "Panel/" + id.ToString());
     }
 }
Beispiel #10
0
    public void Init()
    {
        if (init)
        {
            return;
        }
        init = true;
        if (null == UIParent)
        {
            UIParent = transform.parent;
            m_canvas = UIParent.GetComponent <Canvas>();
        }

        //通用弹框父节点
        if (null == UINormalWindowRoot)
        {
            UINormalWindowRoot = new GameObject("UINormalWindowRoot").transform;
            Util.AddChildToTarget(UIParent, UINormalWindowRoot);
        }

        //置顶弹出的父节点
        if (UIPopUpWindowRoot == null)
        {
            UIPopUpWindowRoot = new GameObject("UIPopUpWindowRoot").transform;
            Util.AddChildToTarget(UIParent, UIPopUpWindowRoot);
        }

        //固定位置的界面父节点 类似ToolBar
        if (UIFixedWidowRoot == null)
        {
            UIFixedWidowRoot = new GameObject("UIFixedWidowRoot").transform;
            Util.AddChildToTarget(UIParent, UIFixedWidowRoot);
        }

        InitWindowControl();
    }
Beispiel #11
0
    /// <summary>
    /// 初始化
    /// </summary>
    private void InitWidgets()
    {
        if (initWidgets)
        {
            return;
        }
        initWidgets = true;

        m_mgr = DataManager.Manager <ComposeManager>();
        Transform clone = null;

        if (null != m_trans_UIIFGTarget && null == m_targetNeedGrid)
        {
            clone = m_trans_UIIFGTarget.GetChild(0);
            if (null != clone)
            {
                m_targetNeedGrid = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_targetNeedGrid)
                {
                    m_targetNeedGrid = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_targetNeedGrid.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost1 && null == m_costNeedGrid1)
        {
            clone = m_trans_UIIFGCost1.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost1, clone);
                m_costNeedGrid1 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid1)
                {
                    m_costNeedGrid1 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid1.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost2 && null == m_costNeedGrid2)
        {
            clone = m_trans_UIIFGCost2.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost2, clone);
                m_costNeedGrid2 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid2)
                {
                    m_costNeedGrid2 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid2.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost3 && null == m_costNeedGrid3)
        {
            clone = m_trans_UIIFGCost3.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost3, clone);
                m_costNeedGrid3 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid3)
                {
                    m_costNeedGrid3 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid3.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost4 && null == m_costNeedGrid4)
        {
            clone = m_trans_UIIFGCost4.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost4, clone);
                m_costNeedGrid4 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid4)
                {
                    m_costNeedGrid4 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid4.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost5 && null == m_costNeedGrid5)
        {
            clone = m_trans_UIIFGCost5.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost5, clone);
                m_costNeedGrid5 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid5)
                {
                    m_costNeedGrid5 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid5.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_SingleCompoundCurrency && null == m_composeSingleC)
        {
            m_composeSingleC = m_trans_SingleCompoundCurrency.GetComponent <UICurrencyGrid>();
            if (null == m_composeSingleC)
            {
                m_composeSingleC = m_trans_SingleCompoundCurrency.gameObject.AddComponent <UICurrencyGrid>();
            }
        }
        if (null != m_trans_CompoundAllCurrency && null == m_composeAllC)
        {
            m_composeAllC = m_trans_CompoundAllCurrency.GetComponent <UICurrencyGrid>();
            if (null == m_composeAllC)
            {
                m_composeAllC = m_trans_CompoundAllCurrency.gameObject.AddComponent <UICurrencyGrid>();
            }
        }


        //构建1级2级分类页签
        if (null != m_scrollview_TypeScrollView && null == mSecondTabCreator)
        {
            mSecondTabCreator = m_scrollview_TypeScrollView.GetComponent <UISecondTabCreatorBase>();
            if (null != mSecondTabCreator)
            {
                GameObject cloneFTemp = UIManager.GetResGameObj(GridID.Uictrtypegrid) as GameObject;
                GameObject cloneSTemp = UIManager.GetResGameObj(GridID.Uisecondtypegrid) as GameObject;
                mSecondTabCreator.Initialize <UISecondTypeGrid>(cloneFTemp, cloneSTemp
                                                                , OnGridUpdate, OnUpdateSecondTabGrid, OnGridEventDlg);
            }
        }

        if (null == mlstFirstTabIds)
        {
            mlstFirstTabIds = new List <uint>();
        }
        mlstFirstTabIds.Clear();

        List <CategoryTypeData> firstTabDatas = new List <CategoryTypeData>();

        firstTabDatas = m_mgr.GetCategoryTypeDatasByFirstType();
        if (null == firstTabDatas ||
            firstTabDatas.Count == 0)
        {
            Engine.Utility.Log.Error("ComposePanel InitWidgets Error,get cateoryTypeData null");
            return;
        }

        firstTabDatas.Sort((left, right) =>
        {
            return((int)left.m_uint_categoryId - (int)right.m_uint_categoryId);
        });
        List <int>       secondTabsNums = new List <int>();
        CategoryTypeData ctData         = null;
        int num = 0;

        for (int i = 0; i < firstTabDatas.Count; i++)
        {
            ctData = firstTabDatas[i];
            num    = (null != ctData) ? ctData.Count : 0;
            secondTabsNums.Add(num);
            if (!mlstFirstTabIds.Contains(firstTabDatas[i].m_uint_categoryId))
            {
                mlstFirstTabIds.Add(firstTabDatas[i].m_uint_categoryId);
            }
        }

        if (null != mSecondTabCreator)
        {
            mSecondTabCreator.CreateGrids(secondTabsNums);
        }

        SetSelectFirstType(0, true);
        UpdateCanComposeRedPoint();
    }
Beispiel #12
0
    /// <summary>
    /// 初始化合成组件
    /// </summary>
    void InitCompoundWidgets()
    {
        if (IsInitStatus(ForgingPanelMode.Compound))
        {
            return;
        }
        SetInitStatus(ForgingPanelMode.Compound, true);
        Transform  tempTs   = null;
        GameObject cloneObj = null;

        //組件
        if (null != m_trans_CompoundGrowShowRoot && null == m_compoundGrowShow)
        {
            tempTs = UIManager.GetObj(GridID.Uiitemgrowshowgrid);
            if (null != tempTs)
            {
                Util.AddChildToTarget(m_trans_CompoundGrowShowRoot, tempTs);
                cloneObj = tempTs.gameObject;
                if (null != cloneObj)
                {
                    m_compoundGrowShow = cloneObj.GetComponent <UIItemGrowShowGrid>();
                    if (null == m_compoundGrowShow)
                    {
                        m_compoundGrowShow = cloneObj.AddComponent <UIItemGrowShowGrid>();
                    }
                    m_compoundGrowShow.RegisterUIEventDelegate(OnUIEventCallback);
                }
            }
        }

        if (null != m_trans_CompoundMainAttrRoot)
        {
            m_compoundAttrTransData = new AttrTransData[5];
            AttrTransData tempAttrData = null;
            StringBuilder strBuilder   = new StringBuilder();
            for (int i = 0, max = m_compoundAttrTransData.Length; i < max; i++)
            {
                tempAttrData = new AttrTransData();
                strBuilder.Remove(0, strBuilder.Length);
                strBuilder.Append(i + 1);
                tempAttrData.Root = m_trans_CompoundMainAttrRoot.Find(strBuilder.ToString());
                if (null == tempAttrData.Root)
                {
                    continue;
                }
                strBuilder.Append("/Content/Grade/Grade");
                tempTs = m_trans_CompoundMainAttrRoot.Find(strBuilder.ToString());
                if (null != tempTs)
                {
                    tempAttrData.Grade = tempTs.GetComponent <UILabel>();
                }
                strBuilder.Remove(0, strBuilder.Length);
                strBuilder.Append(i + 1);
                strBuilder.Append("/Content/Des");
                tempTs = m_trans_CompoundMainAttrRoot.Find(strBuilder.ToString());
                if (null != tempTs)
                {
                    tempAttrData.Des = tempTs.GetComponent <UILabel>();
                }
                m_compoundAttrTransData[i] = tempAttrData;
            }
        }

        //祝福
        if (null != m_trans_ZFRoot && null == m_zfGrowShow)
        {
            tempTs   = m_trans_UIZFGrid;
            cloneObj = tempTs.gameObject;
            if (null != tempTs)
            {
                Util.AddChildToTarget(m_trans_ZFRoot, tempTs);
                if (null != cloneObj)
                {
                    m_zfGrowShow = cloneObj.GetComponent <UIZFGrid>();
                    if (null == m_zfGrowShow)
                    {
                        m_zfGrowShow = cloneObj.AddComponent <UIZFGrid>();
                    }
                }
                m_zfGrowShow.RegisterUIEventDelegate(OnUIEventCallback);
            }
        }


        //副武器初始化
        if (null != m_trans_CompoundDeputyContent)
        {
            m_lst_equipSelects = new List <UIEquipDeputySelectGrid>();

            UIEventDelegate dpdAction = (eventType, obj, param) =>
            {
                if (eventType == UIEventType.Click)
                {
                    UIEquipDeputySelectGrid esg = obj as UIEquipDeputySelectGrid;
                    if (null != param && param is bool)
                    {
                        UnloadCompoundDeputyEquipFill(esg.Index);
                    }
                    else
                    {
                        if (!IsCompoundDeputyEquipFill(esg.Index))
                        {
                            OnSelectCompoundDeputy(esg.Index);
                        }
                    }
                }
            };
            UIEquipDeputySelectGrid dps = null;
            string tempStr = "";
            for (int i = 0; i < 3; i++)
            {
                tempStr = string.Format("EDSG{0}", i + 1);
                tempTs  = m_trans_CompoundDeputyContent.Find(tempStr);
                if (null == tempTs)
                {
                    continue;
                }

                cloneObj = tempTs.gameObject;
                if (null != cloneObj)
                {
                    dps = cloneObj.GetComponent <UIEquipDeputySelectGrid>();
                    if (null == dps)
                    {
                        dps = cloneObj.AddComponent <UIEquipDeputySelectGrid>();
                    }
                    dps.SetIndex(i);
                    dps.RegisterUIEventDelegate(dpdAction);
                    m_lst_equipSelects.Add(dps);
                }
            }
        }

        ResetCompound();
    }
Beispiel #13
0
    /// <summary>
    /// 给目标添加Collider背景
    /// </summary>
    public void AddColliderBgToTarget(UIPanelBase target, string maskName, bool isTransparent)
    {
        // 保证添加的Collider放置在屏幕中间
        Transform mask = target.transform.Find("ColliderMask");

        if (mask == null)
        {
            mask = (new GameObject("ColliderMask")).transform;
            Util.AddChildToTarget(target.transform, mask);
        }

        Transform maskBtn = mask.Find("ColliderMaskBtn");

        if (maskBtn == null)
        {
            UIWidget widget = null;
            widget        = NGUITools.AddWidget <UIWidget>(mask.gameObject);
            widget.width  = (int)UIRootHelper.Instance.TargetFillSize.x;
            widget.height = (int)UIRootHelper.Instance.TargetFillSize.y;
            widget.gameObject.AddComponent <UIButton>();
            NGUITools.AddWidgetCollider(widget.gameObject);
            widget.name  = "ColliderMaskBtn";
            widget.depth = -5;
            maskBtn      = widget.transform;
            NGUITools.AddWidgetCollider(maskBtn.gameObject);
            UIEventListener.Get(maskBtn.gameObject).onClick += delegate
            {
                UIPanelBase targetPanelBase = target.GetComponent <UIPanelBase>();
                if (null != targetPanelBase)
                {
                    targetPanelBase.OnColliderMaskClicked();
                }
            };
        }
        //非透明,添加半透明背景
        if (!isTransparent &&
            (!IsShowPanel(PanelID.CommonBgPanel) || target.PanelType != PanelType.Normal))
        {
            Transform maskBg = mask.Find("ColliderMaskBg");
            if (null == maskBg)
            {
                UISprite sp = NGUITools.AddSprite(mask.gameObject, null, maskName);
                sp.width  = (int)UIRootHelper.Instance.TargetFillSize.x;
                sp.height = (int)UIRootHelper.Instance.TargetFillSize.y;
                sp.alpha  = 0.5f;
                sp.depth  = -6;
                sp.type   = UIBasicSprite.Type.Sliced;
                maskBg    = sp.transform;
                maskBg.gameObject.name = "ColliderMaskBg";

                CMResAsynSeedData <CMAtlas> cASD = null;
                UIManager.GetAtlasAsyn(maskName, ref cASD, () =>
                {
                    if (null != sp)
                    {
                        sp.atlas = null;
                    }
                }, sp, false);
            }
        }
    }