Beispiel #1
0
 public static void SetVAlign(Object obj, AlignItem vAlign)
 {
     if (_attachedVAlign == null)
     {
         _attachedVAlign = new Dictionary <Object, AlignItem>();
     }
     AttachedHelpers.SetAttached(_attachedVAlign, obj, vAlign);
 }
Beispiel #2
0
        private List <AlignItem> SplitItems(string line)
        {
            List <AlignItem> items = new List <AlignItem>();
            //bool skipSpace = false;
            string    word = "";
            AlignItem item;

            for (int i = 0; i < line.Length; i++)
            {
                char chr = line[i];
                //if (chr == ' ' && skipSpace)
                //{
                //	continue;
                //}
                if (!DELIMITER.Contains(chr))
                {
                    word += chr;
                    //skipSpace = false;
                    continue;
                }

                // delimiter found

                if (word == "" && items.Count > 0 && items.Last().Delimiter == chr)
                {
                    if (chr != ' ')
                    {
                        items.Last().Text += chr;
                    }
                }
                else
                {
                    item = new AlignItem(word, chr);
                    items.Add(item);
                }
                word = "";
                //skipSpace = chr == ' ';
            }
            if (word != "")
            {
                item = new AlignItem(word, ' ');
                items.Add(item);
            }

            return(items);
        }
    void CreateItem(GameObject itemToInstantiate, TileInfo parent, TileInfo neighbor, bool isHorizontal)
    {
        GameObject itemGameObject = GameObject.Instantiate(itemToInstantiate);

        if (itemGameObject != null)
        {
            itemGameObject.transform.SetParent(parent.transform);
            itemGameObject.transform.localPosition = Vector3.zero;
            AlignItem alignItem = itemGameObject.GetComponent <AlignItem>();
            if (alignItem != null)
            {
                alignItem.ShouldAlignHorizontally(isHorizontal);
            }

            parent.IsEmpty   = false;
            neighbor.IsEmpty = false;
        }
    }
Beispiel #4
0
        public static String AlignSelf(this AlignItem vAlign)
        {
            switch (vAlign)
            {
            case AlignItem.Top:
            case AlignItem.Start:
                return("start");

            case AlignItem.Middle:
            case AlignItem.Center:
                return("center");

            case AlignItem.Bottom:
            case AlignItem.End:
                return("end");

            case AlignItem.Stretch:
                return("stretch");

            default:
                return(null);
            }
        }