示例#1
0
 public virtual void DoClick(LComponent comp)
 {
     if (!_enabled)
     {
         return;
     }
     if (_allTouch != null)
     {
         _allTouch.On(SysTouch.GetX(), SysTouch.GetY());
     }
     if (clicks != null)
     {
         for (int i = 0, size = clicks.size; i < size; i++)
         {
             ClickListener listener = clicks.Get(i);
             if (listener != null && listener != this)
             {
                 listener.DoClick(comp);
             }
         }
     }
 }
示例#2
0
 public virtual void DragClick(LComponent comp, float x, float y)
 {
     if (!_enabled)
     {
         return;
     }
     if (_dragTouch != null)
     {
         _dragTouch.On(x, y);
     }
     if (clicks != null)
     {
         for (int i = 0, size = clicks.size; i < size; i++)
         {
             ClickListener listener = clicks.Get(i);
             if (listener != null && listener != this)
             {
                 listener.DragClick(comp, x, y);
             }
         }
     }
 }
示例#3
0
    public static void AddListener(GameObject obj, LuaFunction clickFunc, LuaFunction downFunc, LuaFunction upFunc)
    {
        if (obj.GetComponent <ClickListener>() == null)
        {
            obj.AddComponent <ClickListener>();
        }

        ClickListener click = obj.GetComponent <ClickListener>();

        click.AddClickListener(() =>
        {
            clickFunc.Call();
        });


        click.AddListener(() =>
        {
            downFunc.Call();
        },
                          () =>
        {
            upFunc.Call();
        });
    }
示例#4
0
 void Start()
 {
     _clickListener = new ClickListener(ClickOn);
 }
示例#5
0
 public void SetListener(ClickListener listener)
 {
     this.listener = listener;
 }
示例#6
0
    // Use this for initialization
    private void Start()
    {
        // Add n_children initial nodes
        CreateSiblingGroup(current_node, null);

        // Initialize meshes
        const float depth = 7;

        // +1 because we don't place a node at the center
        int child_index = 0;
        for (int i = 0; i < n_children + 1; ++i) {
            //float angle = 2 * Mathf.PI * i / (float) n_children;
            //float radius = 3f;
            //Vector3 position = new Vector3(radius * Mathf.Sin(angle), radius * Mathf.Cos(angle), depth);
            const float spacing = 1.5f;
            int row_size = Mathf.CeilToInt(Mathf.Sqrt(n_children));
            float offset = -(spacing * (row_size - 1)) / 2f;
            int x = i % row_size;
            int y = i / row_size;

            if (x == row_size / 2 && y == row_size / 2) {
                continue;
            }

            Vector3 position = new Vector3(offset + spacing * x, offset + spacing * y, depth);

            GameObject child_node_instance =
                (GameObject) Instantiate(child_node_prefab, position, Quaternion.identity);
            visible_meshes[child_index] = child_node_instance.GetComponent<MeshRenderer>();
            child_listeners[child_index] = child_node_instance.GetComponent<ClickListener>();
            child_nodes[child_index] = child_node_instance;
            child_index++;
        }

        parent_node_instance = (GameObject)
            Instantiate(parent_node_prefab, new Vector3(0, 0, depth), Quaternion.identity);
        parent_listener = parent_node_instance.GetComponent<ClickListener>();

        UpdateMeshes(current_node);

        iTween.CameraFadeAdd();
    }
示例#7
0
 void Start()
 {
     _clickListener = new ClickListener(ClickOn);
 }
示例#8
0
 public void SetClick(ClickListener c)
 {
     Click = c;
 }
示例#9
0
    public static void ClearListener(Component component)
    {
        ClickListener cl = Get <ClickListener>(component);

        cl.onClick = null;
    }
示例#10
0
 public void SetClick(ClickListener c)
 {
     Click = c;
 }
示例#11
0
 public void AddClickListener(ClickListener listener)
 {
     m_clickListeners.Add(listener);
 }
示例#12
0
 public void SetListener(ClickListener listener)
 {
     this.listener = listener;
 }
示例#13
0
 /// <summary>
 /// Constructor of the <c>UserInterfaceButton</c> class.
 /// It takes two more parameters than the base constructor -
 /// an array of images containing images for non-hover and hover
 /// appearance of the button, and an implementation of
 /// <c>ClickListener</c> delegate.
 /// </summary>
 /// <param name="x">x-coordinate of the upper left corner</param>
 /// <param name="y">y-coordinate of the upper left corner</param>
 /// <param name="width">button width</param>
 /// <param name="height">button height</param>
 /// <param name="images">an array of images containing non-hover and hover
 ///                      appearance of the button</param>
 /// <param name="clicker">an implementation of the <c>ClickListener</c>
 ///                       delegate</param>
 public UserInterfaceButton(float x, float y, int width, int height, Texture2D[] images, ClickListener clicker) :
     base(x, y, width, height)
 {
     this.images  = images;
     this.clicker = clicker;
 }
示例#14
0
        public BeatmapOverlayForm(BeatmapInfo mapInfo, string rawURL, ClickListener onDownloadClick, ClickListener onBrowserClick, ClickListener onCloseClick)
        {
            InitializeComponent();

            MapInfo     = mapInfo;
            this.rawURL = rawURL;

            titleText.Text = MapInfo.Artist + " - " + MapInfo.Name;
            idText.Text    = MapInfo.SetId + "";

            this.onDownloadClick = onDownloadClick;
            this.onBrowserClick  = onBrowserClick;
            this.onCloseClick    = onCloseClick;
        }