Пример #1
0
        //TODO:GetUINode未全部实现
        IEnumerable GetUINode(IUINode node, RoutingStrategy strategy)
        {
            switch (strategy)
            {
            case RoutingStrategy.Bubble:
                yield return(node);

                //if (node.Parent != null)
                //{
                //    foreach (IRoutedNode parentRoot in GetUINode(node.Parent as IRoutedNode, RoutedStrategy.Bubble))
                //    {
                //        yield return parentRoot;
                //    }
                //}
                break;

            case RoutingStrategy.Tunnel:
                break;

            case RoutingStrategy.ReverseBubble:
                break;

            case RoutingStrategy.ReverseTunnel:
                break;

            case RoutingStrategy.BottonToTop:
                break;

            case RoutingStrategy.TopToBottom:
                break;
            }
        }
Пример #2
0
        public override void Layout(Point pos, Size space)
        {
            Size  myPreferredSize = PreferredSize;
            int   pad             = (int)(space.Height - myPreferredSize.Height) / Children.Count;
            float xAcc            = 0;

            foreach (var tuple in Children)
            {
                IUINode comp      = tuple.Item1;
                Size    compISize = comp.PreferredSize;
                float   w         = compISize.Width;
                float   h         = compISize.Height;

                if (ExpandChildenHorizontally)
                {
                    w += pad;
                }

                if (ExpandChildrenVertically)
                {
                    h = myPreferredSize.Height;
                }

                comp.Layout(new Point(xAcc, 0),
                            new Size(w, h));
                xAcc += comp.Size.Width;
            }
        }
Пример #3
0
        public override void Layout(Point pos, Size space)
        {
            Size  myPreferredSize = PreferredSize;
            int   pad             = (int)(space.Height - myPreferredSize.Height) / Children.Count;
            float yAcc            = 0;

            foreach (var tuple in Children)
            {
                IUINode comp      = tuple.Item1;
                Size    compISize = comp.PreferredSize;
                ProteusContext.Log(comp.GetType().ToString() + " " + compISize.ToString());
                float w = compISize.Width;
                float h = compISize.Height;

                if (ExpandChildenHorizontally)
                {
                    w = myPreferredSize.Width;
                }

                if (ExpandChildrenVertically)
                {
                    h += pad;
                }
                ProteusContext.Log(comp.GetType().ToString() + " " + compISize.ToString());
                comp.Layout(new Point(0, yAcc),
                            new Size(w, h));
                yAcc += comp.Size.Height;
            }
        }
Пример #4
0
 public virtual void Remove(IUINode child)
 {
     foreach (var tuple in Children)
     {
         if (tuple.Item1 == child)
         {
             Children.Remove(tuple);
             return;
         }
     }
 }
Пример #5
0
        public void Initialization(IInitializedObject initializedObject)
        {
            MonoBehaviour targetObject = (MonoBehaviour)initializedObject;

            foreach (GameObject g in targetObject.gameObject.GetInsideUI())
            {
                IUINode uiNode = g.GetComponent <IUINode>();
                if (uiNode != null)
                {
                    UIBindingComponent[] components = g.GetComponents <UIBindingComponent>();
                    foreach (UIBehaviour ui in g.GetComponents <UIBehaviour>())
                    {
                        UIBindingComponent[] targetBindingComponent = components.Where(p => p.targetComponent == ui.GetType().Name).ToArray();
                        if (targetBindingComponent.Length > 0)
                        {
                            GetBinder(ui.GetType().Name).Binding(ui, targetBindingComponent.First(), targetObject as IUILogicalNode);
                        }
                    }
                }
            }
        }
Пример #6
0
 public virtual void Add(IUINode child, TInfo layoutInfo = default(TInfo))
 {
     Children.Add(new Tuple <IUINode, TInfo>(child, layoutInfo));
 }