Beispiel #1
0
 public static void DeleteObjectFromStore(iObject mObject)
 {
     if (dataStore.Contains(mObject))
     {
         dataStore.Remove(mObject);
     }
 }
Beispiel #2
0
        public void RelativePosition(iRelativePosition relative, iWindow mWindow, float space = 8)
        {
            iObject obj = new iObject();

            obj.size = mWindow.maxSize;
            RelativePosition(relative, obj, space);
        }
Beispiel #3
0
        public void RelativePosition(iRelativePosition relative, Rect rect, float space = 8)
        {
            iObject obj = new iObject();

            obj.size     = rect.size;
            obj.position = rect.position;
            RelativePosition(relative, obj, space);
        }
Beispiel #4
0
 // Data Store
 public static void SaveObjectToStore(iObject mObject)
 {
     if (dataStore.Contains(mObject))
     {
         return;
     }
     dataStore.Add(mObject);
 }
Beispiel #5
0
 public void AddChild(iObject mObject)
 {
     if (children.Contains(mObject))
     {
         return;
     }
     mObject.parent = this;
     children.Add(mObject);
 }
Beispiel #6
0
 public void AddChild(iObject child)
 {
 }
Beispiel #7
0
        public void RelativePosition(iRelativePosition relative, iObject mObject, float space = 8)
        {
            switch (relative)
            {
            case iRelativePosition.RIGHT_OF:
            {
                position = new Vector2()
                {
                    x = mObject.position.x + mObject.size.x + space,
                    y = position.y
                };

                break;
            }

            case iRelativePosition.LEFT_OF:
            {
                position = new Vector2()
                {
                    x = mObject.position.x - size.x - space,
                    y = position.y
                };
                break;
            }

            case iRelativePosition.TOP_OF:
            {
                position = new Vector2()
                {
                    x = position.x,
                    y = mObject.position.y - size.y - space
                };
                break;
            }

            case iRelativePosition.BOTTOM_OF:
            {
                position = new Vector2()
                {
                    x = position.x,
                    y = mObject.position.y + mObject.size.y + space
                };
                break;
            }

            case iRelativePosition.LEFT_IN:
            {
                position = new Vector2()
                {
                    x = mObject.position.x + space,
                    y = position.y
                };
                break;
            }

            case iRelativePosition.RIGHT_IN:
            {
                position = new Vector2()
                {
                    x = mObject.position.x + mObject.size.x - size.x - space,
                    y = position.y
                };
                break;
            }

            case iRelativePosition.TOP_IN:
            {
                position = new Vector2()
                {
                    x = position.x,
                    y = mObject.position.y + space
                };
                break;
            }

            case iRelativePosition.BOTTOM_IN:
            {
                position = new Vector2()
                {
                    x = position.x,
                    y = mObject.position.y + mObject.size.y - size.y - space
                };
                break;
            }

            case iRelativePosition.CENTER_Y_OF:
            {
                position = new Vector2()
                {
                    x = position.x,
                    y = mObject.position.y + mObject.size.y / 2f - size.y / 2f
                };
                break;
            }

            case iRelativePosition.CENTER_X_OF:
            {
                position = new Vector2()
                {
                    x = mObject.position.x + mObject.size.x / 2f - size.x / 2f,
                    y = position.y
                };
                break;
            }
            }
        }
Beispiel #8
0
        public override void Render()
        {
            if (children.Count == 0)
            {
                return;
            }
            if (!active)
            {
                return;
            }

            float count           = children.Count;
            float currentPosition = position.y + padding.top;

            float maxHorizontal = 0;
            float maxVertical   = 0;

            // Sorting Object
            for (int i = 0; i < count; ++i)
            {
                iObject obj = children[i];
                if (!obj.active)
                {
                    continue;
                }
                currentPosition += (i == 0 ? 0 : padding.space);

                switch (autoSizeMode)
                {
                case iScrollViewAutoSize.HORIZONTAL:
                {
                    obj.size.x = size.x - padding.left - padding.right;
                    break;
                }

                case iScrollViewAutoSize.VERTICAL:
                {
                    obj.size.y = size.y - padding.top - padding.bottom;
                    break;
                }
                }

                switch (direction)
                {
                case iScrollViewDirection.VERTICAL:
                {
                    obj.position.x   = position.x + padding.left;
                    obj.position.y   = currentPosition;
                    currentPosition += obj.size.y;

                    break;
                }

                case iScrollViewDirection.HORIZONTAL:
                {
                    obj.position.x   = currentPosition;
                    obj.position.y   = position.y + padding.top;
                    currentPosition += obj.size.x;
                    break;
                }
                }

                if (obj.right > maxHorizontal)
                {
                    maxHorizontal = obj.right;
                }

                if (obj.bottom > maxVertical)
                {
                    maxVertical = obj.bottom;
                }
            }

            containSize        = new Rect();
            containSize.x      = position.x;
            containSize.y      = position.y;
            containSize.width  = maxHorizontal;
            containSize.height = maxVertical;

            GUI.enabled    = enabled;
            scrollPosition = GUI.BeginScrollView(rect, scrollPosition, containSize);
            for (int i = 0; i < children.Count; ++i)
            {
                children[i].Render();
            }
            GUI.EndScrollView();
            GUI.enabled = true;
        }
Beispiel #9
0
 public void RemoveChild(iObject mObject)
 {
     children.Remove(mObject);
 }
Beispiel #10
0
 public void RemoveChild(iObject obj)
 {
     objects.Remove(obj);
 }
Beispiel #11
0
 public void AddChild(iObject obj)
 {
     objects.Add(obj);
 }