Esempio n. 1
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit) && hit.transform.tag == "Cell")
         {
             CellClickHandler handler = hit.transform.GetComponent <CellClickHandler>();
             if (Input.GetMouseButtonDown(0))
             {
                 handler.LeftClick();
             }
             else
             {
                 handler.RightClick();
             }
         }
     }
     if (Input.GetMouseButton(2))
     {
         Camera.main.GetComponent <CameraController>().Rotate(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));
     }
     if (Input.GetAxis("Mouse ScrollWheel") != 0f)
     {
         Camera.main.GetComponent <CameraController>().Scroll(Input.GetAxis("Mouse ScrollWheel"));
     }
 }
Esempio n. 2
0
 public override void RegisterCellClickHandler(CellClickHandler newClickHandler)
 {
     OnCellClick += newClickHandler;
 }
Esempio n. 3
0
 /// <summary>
 /// 添加选择、反选事件
 /// </summary>
 /// <param name="handler"></param>
 public void addClickEventHandler(CellClickHandler handler)
 {
     this._onCellSelected += handler;
     if ( !this._isAddedClickHander )
     {
         this._isAddedClickHander = true;
         UIEventListener.Get(this.gameObject).onClick += this.onCellClick;
     }
 }
Esempio n. 4
0
 /// <summary>
 /// 移除选择、反选事件
 /// </summary>
 /// <param name="handler"></param>
 public void removeClickEventHandler(CellClickHandler handler)
 {
     this._onCellSelected -= handler;
     if ( this._isAddedClickHander )
     {
         this._isAddedClickHander = false;
         UIEventListener.Get(this.gameObject).onClick -= this.onCellClick;
     }
 }
Esempio n. 5
0
 public abstract void RegisterCellClickHandler(CellClickHandler newClickHandler);