Author Topic: about mouse(touch) events  (Read 4311 times)

Companella

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
about mouse(touch) events
« on: July 02, 2013, 10:45:32 PM »
dear any~

If my ngui button received a mousedown or touchdown event, also my game world can be receive the event too, but i won't.
so, how to do to that my game world can't receive this mousedown event ?

Please!

Companella

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: about mouse(touch) events
« Reply #1 on: July 03, 2013, 05:35:14 AM »
Please,Please~

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: about mouse(touch) events
« Reply #2 on: July 03, 2013, 05:48:55 AM »
You need to use NGUI events in both places. You can't use OnMouse* series of events, nor Input.GetXXX.

Companella

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: about mouse(touch) events
« Reply #3 on: July 03, 2013, 06:07:08 AM »
Thank you very much!
so, i need add a UICamera component to my game world camera?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: about mouse(touch) events
« Reply #4 on: July 03, 2013, 06:07:46 AM »
Yes.

SamK

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: about mouse(touch) events
« Reply #5 on: November 12, 2014, 12:56:14 AM »
Isnt there any NGUI listener or bool member.  That way we can just check that if any action on any NGUI UI item is performed.

Im facing the same problem. Im making an isometric game. When i press a button on HUD and drag(even within the bounds of that button) or any BG/button on a UI and drag the ray goes through and ISO functionalites are performed like drag or click.

Isnt there any Trigger/listener/dataMember liken when i press a button and drag the mouse/finger out the state remains pressed.
and Dragging is another case but simple click also goes through.

here is a code snippet of what im doing. If goes into this first code block but it also goes forward meaning skips this.

  1. if(iPhoneInput.touchCount > 0)
  2.         {
  3.             iPhoneTouch touch = iPhoneInput.touches[0];
  4.             ray = gState.world.nGUICamera.ScreenPointToRay(touch.position);                
  5.             if (Physics.Raycast(ray, out hit, Mathf.Infinity, LayerMask.NameToLayer("UI")) && (
  6.                 touch.phase == iPhoneTouchPhase.Ended || touch.phase == iPhoneTouchPhase.Canceled
  7.                 || touch.phase == iPhoneTouchPhase.Began))
  8.             {
  9.                 Debug.Log("IN CANCLE MODE");
  10.                 CancelTouchMode();
  11.                 return;
  12.             }
  13.         }
  14.  
  15.  
  16. and down some where in update i  do
  17. if(iPhoneInput.touchCount==1 )
  18.       {        
  19.          SingleTouchAction();
  20.       }


HOw to block this touch.
« Last Edit: November 12, 2014, 01:35:39 AM by SamK »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: about mouse(touch) events
« Reply #6 on: November 12, 2014, 07:44:06 AM »
UICamera.isOverUI