public bool CheckContains(hgRect x) { var tmp = new hgRect(this); tmp.Sample(x); return(CheckEqual(tmp)); }
//public class BLOCKDATA //{ // public List<hglHtmlRender.BASE> //} public static void CreateAnchor(List <CDDATA> list) { foreach (var d in list) { hgRect r = new hgRect(); if (d.clamp.Count == 0) { continue; } var rcd = d.clamp[0]; string nm = "BC."; foreach (var cd in d.clamp) { r.Sample(cd.outer_v); nm += cd.ToString(); } GameObject o = new GameObject(nm); var bc = o.AddComponent <BoxCollider>(); o.transform.parent = rcd.xe.FindBone(); if (rcd is hgMesh.CD_IMAGE) { o.transform.localPosition = Vector3.zero; } else { o.transform.localPosition = r.center; } bc.center = Vector3.zero; bc.size = new Vector2(r.width, r.height); var button = o.AddComponent <hglButtonLink>(); button.Init(rcd.xe); } }
public static hgRect CalcRect(List <CD> list) { hgRect r = new hgRect(); for (int i = 0; i < list.Count; i++) { r.Sample(list[i].outer_v); } return(r); }
public static hgRect CalcRectwScan(List <CD> list, CD add, Vector3 ileftBase) //for wordwrap { hgRect r = new hgRect(); Vector3 leftBase = ileftBase; for (int i = 0; i < list.Count; i++) { CD.GetNextRightVertexUV(list, i, null, ref leftBase, -1); r.Sample(list[i].outer_v); } if (add != null) { List <CD> tlist = new List <CD>(); tlist.Add(add); CD.GetNextRightVertexUV(tlist, 0, null, ref leftBase, -1); r.Sample(add.outer_v); } return(r); }
public static bool CheckCollision(hgRect frame, List <hgRect> list) //Chack last one only. { var last = list[list.Count - 1]; hgRect tr = new hgRect(frame); tr.Sample(last); if (!tr.CheckEqual(last)) { return(true); } if (list.Count > 1) { for (int i = 0; i < list.Count - 1; i++) { if (CheckCollision(last, list[i])) { return(true); } } } return(false); }