void SplitGroup() { grplist.Clear(); bool oneshoot = false; string strleft = txt; string savedstring = ""; string wtype = ""; for (int i = 0; i < strleft.Length; i++) { if (oneshoot == false) { if (strleft.Substring(i, 1) == keyword) { // GroupStr grp_str = new GroupStr(); grp_str.txt_info = savedstring; grplist.Add(grp_str); savedstring = ""; oneshoot = true; //检查下一个字符,判断下一组是啥类型 i++; wtype = strleft.Substring(i, 1); } else { savedstring += strleft.Substring(i, 1); } } else { //等待结束符 if (strleft.Substring(i, 1) == keyword) { // if (wtype == "P") { GroupIco grp_ico = new GroupIco(); grp_ico.txt_info = savedstring; grplist.Add(grp_ico); } else if (wtype == "L") { //wtype = (int)ENUM_TPMIX_GROUPTYPE.GROUP_LINK; GroupLink grp_ico = new GroupLink(); grplist.Add(grp_ico); } savedstring = ""; oneshoot = false; } else { savedstring += strleft.Substring(i, 1); } } } }
void SplitSingle() { int refx = 0;// (int) winrect.x; int refz = 30; foreach (BaseGroup gb in grplist) { gb.Split(); if (gb.type == (int)ENUM_TPMIX_GROUPTYPE.GROUP_TEXT) { GroupStr gptxt = (GroupStr)gb; for (int i = 0; i < gptxt.txt_info.Length; i++) { BaseChar p = new BaseChar(); p.txt = gptxt.txt_info.Substring(i, 1); guitxt.text = p.txt; int fw = (int)guitxt.GetScreenRect().width; int fz = (int)guitxt.GetScreenRect().height + row * 2; //refz += fz; p.pr = new Rect(refx, refz, fw, fz); gptxt.objlist.Add(p); if (refx + fw >= winrect.x + winrect.width - 5) { refx = 0; refz += Mathf.Max(fz, linehei); } else { refx += fw; } } } else if (gb.type == (int)ENUM_TPMIX_GROUPTYPE.GROUP_PIC) { GroupIco gico = (GroupIco)gb; BasePicture p = new BasePicture(); gb.objlist.Add(p); string imgidx = gico.txt_info.Substring(1, gico.txt_info.Length - 2); p.ico = image[int.Parse(imgidx) % image.Length]; int fw = p.ico.width; int fz = p.ico.height; p.pr = new Rect(refx, refz, fw, fz); if (refx + fw >= winrect.x + winrect.width - 5) { refx = 0; refz += Mathf.Max(fz, linehei); } else { refx += fw; } } } }
void DoMyWindow(int wid) { foreach (BaseGroup gb in grplist) { if (gb.type == (int)ENUM_TPMIX_GROUPTYPE.GROUP_TEXT) { GroupStr gptxt = (GroupStr)gb; for (int i = 0; i < gptxt.objlist.Count; i++) { PrintChar((BaseChar)gptxt.objlist[i]); } } if (gb.type == (int)ENUM_TPMIX_GROUPTYPE.GROUP_PIC) { GroupIco gpico = (GroupIco)gb; for (int i = 0; i < gpico.objlist.Count; i++) { PrintPicture((BasePicture)gpico.objlist[i]); } } } }