示例#1
0
        public void _show(object callback, List <string> list)
        {
            NGUITools.SetActive(gameObject, true);
            List <string> tmplist = defautSpriteNameList;

            if (list != null && list.Count > 0)
            {
                tmplist = list;
            }
            if (tmplist != null && tmplist.Count > 0)
            {
                int index = NumEx.NextInt(0, tmplist.Count);
                CLUIUtl.setSpriteFit(sprite, tmplist [index]);
            }

            finishCallback = callback;
//		NGUITools.SetActive (label.gameObject, false);
            tweenAlpha.Play(true);

            CLPanelBase p = CLPanelManager.topPanel;

            panel.depth       = p == null ? 3000 : p.panel.depth + CLPanelManager.depthOffset + 100;
            panel.renderQueue = UIPanel.RenderQueue.StartAt;
            // 设置startingRenderQueue是为了可以在ui中使用粒子效果,注意在粒子中要绑定CLUIParticle角本
            panel.startingRenderQueue = CLPanelManager.Const_RenderQueue + this.panel.depth;
        }
示例#2
0
        public override GameObject _borrowObj(string name)
        {
            GameObject go = base._borrowObj(name);

            if (go != null)
            {
                CLUIUtl.resetAtlasAndFont(go.transform, false);
            }
            return(go);
        }
        public static void finishGetPanel(string pName, AssetBundle ab, object callback, object paras)
        {
            if (ab != null)
            {
                GameObject prefab = ab.mainAsset as GameObject;
                ab.Unload(false);
                ab = null;
                GameObject go = GameObject.Instantiate(prefab) as GameObject;
                go.name                    = pName;
                go.transform.parent        = self.transform;
                go.transform.localScale    = Vector3.one;
                go.transform.localPosition = Vector3.zero;

                CLPanelBase p = go.GetComponent <CLPanelBase>();
                if (p.isNeedResetAtlase)
                {
                    CLUIUtl.resetAtlasAndFont(p.transform, false);
                }
                panelBuff[pName]        = p;
                panelAssetBundle[pName] = p;

                CLSharedAssets sharedAsset = go.GetComponent <CLSharedAssets>();
                if (sharedAsset != null)
                {
                    NewList param = ObjPool.listPool.borrowObject();
                    param.Add(callback);
                    param.Add(p);
                    param.Add(paras);
                    sharedAsset.init((Callback)onGetSharedAssets, param, null);
                }
                else
                {
                    if (p != null)
                    {
                        Utl.doCallback(callback, p, paras);
                    }
                }
            }
            NGUITools.SetActive(self.mask, false);
            return;// null;
        }
示例#4
0
        void _setList(object data, object initCellCallback, object onHeadListCallback, object onEndListCallback, bool isNeedRePosition, bool isPlayTween, float tweenSpeed,
                      float twDuration, UITweener.Method twMethod, TweenType twType)
        {
            try {
                this.data               = data;
                this.list               = wrapList(data);
                this.initCellCallback   = initCellCallback;
                this.onEndListCallback  = onEndListCallback;
                this.onHeadListCallback = onHeadListCallback;
                if (!isFinishInit)
                {
                    init();
                }
                else
                {
                    for (int i = 0; i < itemList.Count; i++)
                    {
                        itemList [i].name = NumEx.nStrForLen(i, 6);
                    }
                }
                int tmpIndex = 0;
                times = 0;
//				itemList.Clear ();

                for (int i = 0; i < itemList.Count; i++)
                {
//					Transform t = cachedTransform.GetChild (i);
                    UIWidget uiw = itemList [i];
                    tmpIndex = i;
                    uiw.name = NumEx.nStrForLen(tmpIndex, 6);
                    if (tmpIndex >= 0 && tmpIndex < this.list.Count)
                    {
                        NGUITools.SetActive(uiw.gameObject, true);
                        Utl.doCallback(this.initCellCallback, uiw.GetComponent <CLCellBase> (), list [tmpIndex]);
                        NGUITools.updateAll(uiw.transform);
//						itemList.Add (uiw);
                    }
                    else
                    {
                        NGUITools.SetActive(uiw.gameObject, false);
                    }
                }
                if (isNeedRePosition)
                {
                    resetClip();
                    if (!isPlayTween || twType == TweenType.alpha || twType == TweenType.scale)
                    {
                        grid.Reposition();
//						scrollView.ResetPosition();
                    }
                    if (isPlayTween)
                    {
                        for (int i = 0; i < itemList.Count; i++)
                        {
                            CLUIUtl.resetCellTween(i, grid, itemList [i].gameObject, tweenSpeed, twDuration, twMethod, twType);
                        }
                    }
                }

                isCanCallOnEndList  = true;
                isCanCallOnHeadList = true;
            } catch (System.Exception e) {
                Debug.LogError(e);
            }
        }