示例#1
0
 internal override void Initialize()
 {
     renderer = GetComponent <Renderer>();
     rTarget  = AddComponent <RayCastTarget>();
     rTarget.OnMoveInEvent  += MoveIn;
     rTarget.OnMoveOutEvent += MoveOut;
     rTarget.OnClickEvent   += Click;
 }
示例#2
0
 /// <summary>
 /// 移除系统
 /// </summary>
 public void RemoveFromSystem(RayCastTarget UITarget, Vector2 position)
 {
     foreach (Vector2 dis in UITarget.GameObject.PosList)
     {
         Vector2 pos = position + dis;
         if (UITargets.ContainsKey(pos))
         {
             UITargets[pos].Remove(UITarget);
             if (UITargets[pos].Count == 0)
             {
                 UITargets.Remove(pos);
             }
         }
     }
 }
示例#3
0
 /// <summary>
 /// 加入系统
 /// </summary>
 public void AddToSystem(RayCastTarget UITarget, Vector2 position)
 {
     foreach (Vector2 dis in UITarget.GameObject.PosList)
     {
         Vector2 pos = position + dis;
         if (UITargets.ContainsKey(pos))
         {
             UITargets[pos].Add(UITarget);
         }
         else
         {
             UITargets.Add(pos, new List <RayCastTarget>()
             {
                 UITarget
             });
         }
     }
 }
示例#4
0
        internal override void Initialize()
        {
            listBoxCom = GameObject.Parent.GetComponent <ListBox>();

            List <Vector2> meshList = new List <Vector2>();

            for (int i = 0; i < listBoxCom.Width; i++)
            {
                meshList.Add(new Vector2(i, 0));
            }
            GameObject.InitMesh(meshList);
            //添加一个Renderer组件
            renderer = AddComponent <Renderer>();
            renderer.Init(RendererMode.UI, -1);
            //添加一个Label组件
            BackColor = Color.Yellow;

            rtarget = AddComponent <RayCastTarget>();
            rtarget.OnClickEvent += () => { listBoxCom.OnClickAction(Index); };
        }