Esempio n. 1
0
        public void SetData(string condition, string stackTrace, LogType type)
        {
            if (logInfos.Count > 300)
            {
                logInfos.Clear();
            }

            logInfos.Add(new LogInfo
            {
                condition  = condition,
                stackTrace = stackTrace,
                type       = type,
                height     = -1
            });
            scroller.ReloadData(1);
        }
Esempio n. 2
0
        public void Reload(Sprite[] sprites)
        {
            // reset the data list
            _data.Clear();

            // at the sprites from the demo script to this scroller's data cells
            foreach (var slotSprite in sprites)
            {
                _data.Add(new SlotData()
                {
                    sprite = slotSprite
                });
            }

            // reload the scroller
            scroller.ReloadData();
        }
Esempio n. 3
0
    /// <summary>
    /// Sutherland-Hodgman algorithmでクリップする。
    /// </summary>
    /// <param name="list">三角形か凸な四角形</param>
    void SutherlandHodgman(ref SmallList <Vertex> list)
    {
        var    list2 = new SmallList <Vertex>();
        Vertex vertex, prev, temporary;

        list.Get(list.Count - 1, out prev);
        for (int i = 0; i < list.Count; ++i)
        {
            list.Get(i, out vertex);

            if (vertex.Position.x >= mask.x)
            {
                if (prev.Position.x < mask.x)
                {
                    var t = (mask.x - vertex.Position.x) / (prev.Position.x - vertex.Position.x);
                    Vertex.Lerp(ref vertex, ref prev, t, out temporary);
                    list2.Add(ref temporary);
                }

                list2.Add(ref vertex);
            }
            else if (prev.Position.x >= mask.x)
            {
                var t = (mask.x - vertex.Position.x) / (prev.Position.x - vertex.Position.x);
                Vertex.Lerp(ref vertex, ref prev, t, out temporary);
                list2.Add(ref temporary);
            }

            prev = vertex;
        }

        list.Clear();

        if (list2.Count <= 2)
        {
            return;
        }

        list2.Get(list2.Count - 1, out prev);
        for (int i = 0; i < list2.Count; ++i)
        {
            list2.Get(i, out vertex);

            if (vertex.Position.y >= mask.y)
            {
                if (prev.Position.y < mask.y)
                {
                    var t = (mask.y - vertex.Position.y) / (prev.Position.y - vertex.Position.y);
                    Vertex.Lerp(ref vertex, ref prev, t, out temporary);
                    list.Add(ref temporary);
                }

                list.Add(ref vertex);
            }
            else if (prev.Position.y >= mask.y)
            {
                var t = (mask.y - vertex.Position.y) / (prev.Position.y - vertex.Position.y);
                Vertex.Lerp(ref vertex, ref prev, t, out temporary);
                list.Add(ref temporary);
            }

            prev = vertex;
        }

        if (list.Count <= 2)
        {
            return;
        }

        list2.Clear();
        list.Get(list.Count - 1, out prev);
        for (int i = 0; i < list.Count; ++i)
        {
            list.Get(i, out vertex);

            if (vertex.Position.x <= mask.z)
            {
                if (prev.Position.x > mask.z)
                {
                    var t = (mask.z - vertex.Position.x) / (prev.Position.x - vertex.Position.x);
                    Vertex.Lerp(ref vertex, ref prev, t, out temporary);
                    list2.Add(ref temporary);
                }

                list2.Add(ref vertex);
            }
            else if (prev.Position.x <= mask.z)
            {
                var t = (mask.z - vertex.Position.x) / (prev.Position.x - vertex.Position.x);
                Vertex.Lerp(ref vertex, ref prev, t, out temporary);
                list2.Add(ref temporary);
            }

            prev = vertex;
        }

        list.Clear();

        if (list2.Count <= 2)
        {
            return;
        }

        list2.Get(list2.Count - 1, out prev);
        for (int i = 0; i < list2.Count; ++i)
        {
            list2.Get(i, out vertex);

            if (vertex.Position.y <= mask.w)
            {
                if (prev.Position.y > mask.w)
                {
                    var t = (mask.w - vertex.Position.y) / (prev.Position.y - vertex.Position.y);
                    Vertex.Lerp(ref vertex, ref prev, t, out temporary);
                    list.Add(ref temporary);
                }

                list.Add(ref vertex);
            }
            else if (prev.Position.y <= mask.w)
            {
                var t = (mask.w - vertex.Position.y) / (prev.Position.y - vertex.Position.y);
                Vertex.Lerp(ref vertex, ref prev, t, out temporary);
                list.Add(ref temporary);
            }

            prev = vertex;
        }
    }