void OnClickLvBtnItm(LvItm itm) { if (null != OnClick) { OnClick(itm, this); } }
public override void OnDrawLvItm(float cx, ref float cy, float fw, bool bEnable, OnClickLvBtn func) { if (mLvAry.Count <= 0) { cy += mGrpH; return; } float fy = cy; bool bVal = mEnable && bEnable; switch (mTye) { case LvAlign.LIA_LEFT: { foreach (LvItm itm in mLvAry) { fy = cy; itm.OnDrawLvItm(cx, ref fy, itm.mWidth, bVal, func); cx += itm.mWidth; } break; } case LvAlign.LIA_CENTER: { float fnw = fw / mLvAry.Count; foreach (LvItm itm in mLvAry) { fy = cy; itm.OnDrawLvItm(cx, ref fy, fnw, bVal, func); cx += fnw; } break; } case LvAlign.LIA_RIGHT: { cx = fw; for (int i = mLvAry.Count - 1; i >= 0; --i) { fy = cy; LvItm itm = mLvAry[i]; cx -= itm.mWidth; itm.OnDrawLvItm(cx, ref fy, itm.mWidth, bVal, func); } break; } } cy += mGrpH; }
//-------------------------------------------------------------------------------------------- // szName 带路径但 不需要扩展名 static public void TestLoadScene(LvItm itm, UIListViewCtrl frm) { bool bLoad = false; LvItmBtnEx itx = itm as LvItmBtnEx; if (itx != null) { ResPackge pck = itx.mRefPck; if (pck != null) { string szName = Path.GetFileNameWithoutExtension(pck.mFile); GameResMng pMng = GetResMng(); if (null != pMng) { bLoad = pMng.NtfLoadScene(szName); } if (!bLoad) // 也许没有打包或用Unity打包 { string szNm = Path.GetFileNameWithoutExtension(szName); Application.LoadLevel(szNm.ToLower()); } } } }
void AddReToViewCtrl() { #if (MY_DEBUG) // 显示出来 UIListViewCtrl LvCtrl = m_lvCtrl; if (LvCtrl == null) { return; } LvCtrl.ClearLvItems(); LvItm lvHdr = LvCtrl.AddLvLabel(@"调试信息", Color.red); lvHdr.mfont = 24; lvHdr.mAnchor = TextAnchor.MiddleCenter; LvColGrp iGrp = LvCtrl.AddLvColGrp(); //LvColGrp iGrp0 = iGrp.AddLvColGrp(0); string szVer = @"游戏版本:" + GameResMng.mGmVer; iGrp.AddLvLabel(szVer, 200, Color.green); szVer = @"资源版本:" + GameResMng.mReVer; iGrp.AddLvLabel(szVer, 200, Color.blue); //LvColGrp iGrp1 = iGrp.AddLvColGrp(2); //lvHdr = iGrp1.AddLvBtn(@"网络资源", 80, Color.blue); //lvHdr.mAnchor = TextAnchor.MiddleCenter; //lvHdr = iGrp1.AddLvBtn(@"本地资源", 80, Color.blue); //lvHdr.mAnchor = TextAnchor.MiddleCenter; iGrp.UpdateDrawH(); LvCtrl.AddLvEmpty(5); LvCtrl.AddLvLabel(@"运行信息:", Color.green); LvItmGrp itmGrp = LvCtrl.AddLvItmGrp(@"搜索到的资源包:", Color.green); //itmGrp.AddLvLabel("asdf", 0, Color.white); //itmGrp.AddLvLabel("234234asdf", 0, Color.white); if (null != mPackDic) { foreach (ResPackge pck in mPackDic.Values) { Debug.Log("pck.mType = " + pck.mType.ToString()); if (pck.mType == 0) { itmGrp.AddLvLabelEx(pck); } } } itmGrp = LvCtrl.AddLvItmGrp(@"搜索到的场景:", Color.green); //itmGrp.AddLvLabel("asdf", 0, Color.white); //itmGrp.AddLvLabel("234234asdf", 0, Color.white); if (null != mPackDic) { Dictionary <string, ResPackItm> vDic = GetSceneItms(); foreach (ResPackItm itm in vDic.Values) { ResPackge pck = GetPackge(itm.mPack); string sf = Path.GetFileNameWithoutExtension(itm.mFile); itmGrp.AddLvBtnEx(@"Load " + sf, pck); } } #endif }
virtual protected void PushToAry(LvItm itm) { }
//------------------------------------------------------------------------------------------------- public void AddLvItem(LvItm itm) { mItmAry.Add(itm); }
protected override void PushToAry(LvItm itm) { mLvAry.Add(itm); }