Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - morgue

Pages: [1] 2
1
NGUI 3 Support / Re: Using Arrow Keys to navigate Scroll View
« on: April 10, 2015, 11:55:04 AM »
Sorry about that. The readme says it's version 3.7.8, but the file is called ReadMe - 3.6.0.

I mean, some users could try to use both, which is why I wanted to handle it like this. I guess I can disable scrollwheel, but it would be nice to have it so it works either way.

2
NGUI 3 Support / Re: Using Arrow Keys to navigate Scroll View
« on: April 07, 2015, 01:47:24 PM »
This would be the process with 2 buttons (A, and B).

Each have "print A or B" respectively.

A is selected.
Press right key on keyboard.
B is selected. Prints B.
Use mouse scroll to move to A.
A is now selected.
Press right key on keyboard.
A remains selected. But it Prints B.

I have a Game Object array with the buttons 'list' that checks the input, so if I'm on 0, right key is "cilck on 1", and so on.

Is there a way to know the exact NGUI version I'm on? I know I'm at least on 4.5.5.

3
NGUI 3 Support / Re: Using Arrow Keys to navigate Scroll View
« on: April 06, 2015, 02:38:51 PM »
Ok If I do something like:
  1. UICamera.selectedObject = GameObject.Find("World 02");
  2. print (UICamera.selectedObject.name);
  3.  

it doesn't print world 02 :o

it seems to give priority to the mouse

4
NGUI 3 Support / Using Arrow Keys to navigate Scroll View
« on: April 06, 2015, 10:14:40 AM »
Hi,

I'm trying to use arrow keys to navigate a scroll view, and it works fine, what I do is that I send a click message to the button on my left, or right, of whichever button I have currently selected, the issue is that when I use mouse scroll, and then the arrows, the button the arrows "choose" executes it's code, but the selection is left on the one the scroll chose.

I really can't tell what I'm missing. Any suggestions on how to achieve this?

Thanks.

5
NGUI 3 Support / Re: Sliding over buttons/Sticky keys question
« on: September 17, 2014, 10:37:19 AM »
Hi Aren,

Sorry if I haven't been able to communicate exactly what I want, because I don't think I have.

I already removed the "+2" on my code, as you suggested, the thing about having the buttons show as pressed when the value is > 0, is that it shows pressed even when I Drag Out of it, which is what I do not want, I want it to go to 'normal' state, when I drag out.

The issue is that while pressing it, if I don't drag out, but 'press' another button (with another finger), the button I'm still pressing goes to 'normal' state, but I have not released it. That is the issue.

6
NGUI 3 Support / Re: Sliding over buttons/Sticky keys question
« on: September 09, 2014, 03:27:46 PM »
The thing about that is that if I do it on the 'right' button for instance:
- OnPress(true) +1 (counter = 1)
- OnDragOver +1 (counter = 2)
- OnDragOut -1 (counter = 1)

Then:
  1. if (rightButtonPressValue > 0) {gameObject.GetComponent<UIButton>().state = UIButton.State.Pressed;}

The resulting value on the counter will be 1, therefore showing as pressed even when I slide to the 'left' button. Which is what I don't want.

And unless there's a bug somehwere, for me OnPress(false) doesn't execute until I've lifted my finger, even if it's elsewhere on the screen. But I thought this was the actual behaviour.

7
NGUI 3 Support / Re: Sliding over buttons/Sticky keys question
« on: September 08, 2014, 02:49:23 PM »
Sorry, I didn't understand your reply.

8
NGUI 3 Support / Re: Sliding over buttons/Sticky keys question
« on: September 05, 2014, 03:56:27 PM »
Hey Aren,

Thanks again for your response.

Do you mean something like this?

leftMovementButton (the right movement is just about the same):
  1.         void OnPress (bool pressed) {
  2.                 if (pressed) {
  3.                         InputHandler.movingLeft = true;
  4.             TouchButtonController.touchBtnLeftPressed = true;
  5.  
  6.                         leftButtonPressValue++;
  7.                 } else {
  8.                         InputHandler.movingLeft = false;
  9.                         TouchButtonController.touchBtnLeftPressed = false;
  10.  
  11.                         leftButtonPressValue--;
  12.                 }
  13.         }
  14.  
  15.         void OnDragOver() {
  16.                 InputHandler.movingLeft = true;
  17.                 TouchButtonController.touchBtnLeftPressed = true;
  18.  
  19.                 leftButtonPressValue = leftButtonPressValue + 2;
  20.         }
  21.  
  22.         void OnDragOut() {
  23.                 InputHandler.movingLeft = false;
  24.                 TouchButtonController.touchBtnLeftPressed = false;
  25.  
  26.                 leftButtonPressValue = leftButtonPressValue - 2;
  27.         }
  28.  

PressHandler:
  1.         void Update() {
  2.                 //RIGHT PRESSED
  3.                 if (rightButtonPressValue == 3) {
  4.                         btnRight.GetComponent<UIButton>().state = UIButton.State.Pressed;
  5.                 }
  6.  
  7.                 if (rightButtonPressValue == 1 && leftButtonPressValue == 0) {
  8.                         btnRight.GetComponent<UIButton>().state = UIButton.State.Pressed;
  9.                 }
  10.  
  11.                 //LEFT PRESSED
  12.                 if (leftButtonPressValue == 3) {
  13.                         btnLeft.GetComponent<UIButton>().state = UIButton.State.Pressed;
  14.                 }
  15.  
  16.                 if (leftButtonPressValue == 1 && rightButtonPressValue == 0) {
  17.                         btnLeft.GetComponent<UIButton>().state = UIButton.State.Pressed;
  18.                 }
  19.         }
  20.  

I guess I could optimize the handler, but I just want to make sure we're on the same page on what you are suggesting.

Thanks again.

9
NGUI 3 Support / Re: Sliding over buttons/Sticky keys question
« on: September 05, 2014, 11:10:36 AM »
Hey,

This is giving us the exact same issue though. Pressing a second button (for instance jump), sets the state of the first one (move left for instance) to 'normal', instead of 'pressed'. The character still moves left, but the button isn't showing so. 'Allow multitouch' is enabled on UICamera also, which was what I thought could have been the issue originally, but that wasn't it.

Any ideas?

Thaks for your help.

10
NGUI 3 Support / Re: Sliding over buttons/Sticky keys question
« on: September 04, 2014, 03:33:40 PM »
Hey Aren, thank you very much for your time.

We are not entirely sure if we understood your first message, but we tried this, is this what you mean about replacing the custom events we had? Thanks

  1.     void OnPress (bool pressed) {
  2.                 if (pressed) {
  3.                         InputHandler.movingLeft = true;
  4.             TouchButtonController.touchBtnLeftPressed = true;
  5.                 } else {
  6.                         InputHandler.movingLeft = false;
  7.                         TouchButtonController.touchBtnLeftPressed = false;
  8.                 }
  9.         }
  10.  
  11.         void OnDragOver() {
  12.                 InputHandler.movingLeft = true;
  13.                 TouchButtonController.touchBtnLeftPressed = true;
  14.         }
  15.  
  16.         void OnDragOut() {
  17.                 InputHandler.movingLeft = false;
  18.                 TouchButtonController.touchBtnLeftPressed = false;
  19.         }
  20.  

11
NGUI 3 Support / Re: Sliding over buttons/Sticky keys question
« on: September 03, 2014, 02:34:57 PM »
Cool, I'll look into that.

On a similar note, we're having an issue on which if the device lags, the pushed button loses that it's being pressed (the character stops moving), and all buttons become unresponsive for a bit. Any clue?

12
NGUI 3 Support / Sliding over buttons/Sticky keys question
« on: September 03, 2014, 11:53:57 AM »
Hi,

We have a character movement interface that includes left/right,  jump and dive buttons.

Left and Right have the particularity, that you can slide your finger from one button to the other, and that one becomes 'pressed' which makes the character moved in the desired direction, it's not a slider per se, it's just that without lifting your finger, the button you're on becomes 'pressed'. If you go back to to the previous button now this one becomes 'pressed' again, and the previous one 'unpressed'.

The issue is that when the left/right buttons are pressed, if the Jump or Dive buttons are tapped, even though the movement still works, the buttons show their normal state, i.e. as if they weren't being pressed, but the character does move.

Here's the code:

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class InputBtnLeft : MonoBehaviour {
  5.  
  6.         private GameObject btnRight;
  7.  
  8.         void Awake () {
  9.                 btnRight = GameObject.Find("btnRight");
  10.         }
  11.  
  12.         void OnPress (bool pressed) {
  13.                 if (pressed) {
  14.                         InputHandler.movingLeft = true;
  15.             TouchButtonController.touchBtnLeftPressed = true;
  16.                 } else {
  17.                         InputHandler.movingLeft = false;
  18.             TouchButtonController.touchBtnLeftPressed = false;
  19.                 }
  20.         }
  21.  
  22.         void OnDragOver(GameObject draggedObject) {
  23.                 btnRight.SendMessage("OnPress", false);
  24.                 gameObject.SendMessage("OnPress", true);
  25.         }
  26.  
  27.         void OnDragEnd() {
  28.                 btnRight.SendMessage("OnPress", false);
  29.         }
  30. }
  31.  

The Right button is pretty much the same.

The code inside OnDragEnd is what causes the button to show as unpressed when Jump or Dive are tapped, but I need it so that when the player slides to the other left or right button, it doesn't stay pressed (press here meaning that the character doesn't change direction but keeps moving in the previous direction) as I slide away from it.

We've tried out multiple things found lurking through the forum, but they don't seem to have the same requirements we have.

Is there a way to work around this? Hope you can help out. Is there something like UICamera.hoveredObject but for multitouch? Maybe that is what we need? IDK. Thanks for any help.

13
Apparently this has been fixed for Unity 4.3 (not yet available at the time of this posting).

I want it now :(

14
NGUI 3 Support / Re: UIStretch not stretching 100%
« on: February 12, 2014, 07:41:49 AM »
I believe UIStretch is now deprecated, you should be using the new anchor system for this..

Set the anchor type to unified, set the transform to the UIPanel and adjust the pivot points accordingly ( left to left, right to right.. ) and set the distance to 0, this will cause the Texture to stretch over the whole screen.

I'm using 2.7.0. and I can't find some of the options you mentioned, like anchor type. And the texture I'm stretching is a child of my UI Camera, not a UIPanel.

Haven't solved this :(

15
NGUI 3 Support / Re: UIStretch not stretching 100%
« on: February 11, 2014, 11:37:45 PM »
It's more noticable on this screenshot


Pages: [1] 2