示例#1
0
        public bool CheckContains(hgRect x)
        {
            var tmp = new hgRect(this);

            tmp.Sample(x);
            return(CheckEqual(tmp));
        }
示例#2
0
        //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);
            }
        }
示例#3
0
            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);
            }
示例#4
0
            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);
            }
示例#5
0
        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);
        }