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 - eormo

Pages: [1]
1
NGUI 3 Support / Onclick URL to a sprite in a scrollview
« on: March 28, 2016, 11:46:36 AM »
Hi,

I have a UI2D sprite in my scrollview that needs to open an URL once triggered with an onclick. Below is the code I generally use but it doesn't seemed to work with NGUI :

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class URL : MonoBehaviour {
  5.  
  6.         void OnMouseDown () {
  7.                 Application.OpenURL("http://mywebsite.com");
  8.         }
  9. }

I've found another topic about this issue on the forum but the solution provided did not work for me...

Thanks for reading!

EDIT : I got it working through the UIButton component :)

2
NGUI 3 Support / Re: Scroll view page bullets?
« on: February 19, 2016, 02:09:47 PM »
Sorry for the confusion! That's what I was trying to do but with a 2DUI sprite, a gameobject basically, instead of a button.

I've modified your code and so now it's working perfectly, thank you so much for your help!

3
NGUI 3 Support / Re: Scroll view page bullets?
« on: February 18, 2016, 02:11:38 PM »
I have managed to change the sprite of the buttons but on click only, so when I swipe it doesn't change, obviously.

I am not a programmer at all, and I've certainly achieved the effect the wrong way, but below is the script I am using (3 different scripts, one for each button) I got it working with one script only, following devomage's script :

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class B1 : MonoBehaviour {
  5.  
  6.         public GameObject bullet1;
  7.         public GameObject bullet2;
  8.         public GameObject bullet3;
  9.  
  10.         // Use this for initialization
  11.         void Start () {
  12.                 NGUITools.SetActive(bullet1, true);
  13.                 NGUITools.SetActive(bullet2, false);
  14.                 NGUITools.SetActive(bullet3, false);
  15.         }
  16.        
  17.         // Update is called once per frame
  18.         public void OnClick_button1 () {
  19.                 NGUITools.SetActive(bullet1, true);
  20.                 NGUITools.SetActive(bullet2, false);
  21.                 NGUITools.SetActive(bullet3, false);
  22.         }
  23.  
  24.         public void OnClick_button2 () {
  25.                 NGUITools.SetActive(bullet1, false);
  26.                 NGUITools.SetActive(bullet2, true);
  27.                 NGUITools.SetActive(bullet3, false);
  28.         }
  29.  
  30.         public void OnClick_button3 () {
  31.                 NGUITools.SetActive(bullet1, false);
  32.                 NGUITools.SetActive(bullet2, false);
  33.                 NGUITools.SetActive(bullet3, true);
  34.         }
  35. }

I get that I need to call the springpanel.target.x distance from a button to the scroll view instead of an onclick but I failed at changing my code to do so...

Thanks!

4
NGUI 3 Support / Re: Scroll view page bullets?
« on: February 16, 2016, 08:34:34 AM »
Thank you so so much devomage for the working example and script! My scroll view and buttons are now perfectly linked :)

I just have one slight issue now : I am using 2D sprite as buttons and attached the button script to them so now I am able to change the sprite on hover, pressed, etc... but how can I change it depending on the "page" I am currently on, like an indicator?

5
NGUI 3 Support / Re: Scroll view page bullets?
« on: February 13, 2016, 05:46:33 AM »
Thank you very much for your reply!

Unfortunately, this is not what I am looking for but that must be my fault as I am french, I'll try to explain better, sorry!

Basically, I have three child in my scroll view which swipe from right to left with the touch screen. I've managed to center them by adding the class UICenterOnChild and it is working perfectly.

Now I want to add three bullets, not necessarily clickable, underneath to show the user where he is in the scroll view. For example, when the scroll view show the first child, the first button is black and the others are white, etc...

Thanks again for reading and replied to me!

EDIT After hours of research, I found this : http://befool.co.jp/blog/ayumegu/unity-study-ngui-ScrollBanner/ and the script seems to do the thing with the bullets. Problem is that, from what I understand, the children are scrolling automatically, like a slideshow...

6
NGUI 3 Support / Scroll view page bullets?
« on: February 09, 2016, 06:42:35 AM »
Hi,

I have been following this tutorial https://www.youtube.com/watch?v=UK3aMHRfgcw to create a scroll view and I was wondering if it could be possible to add page bullets, just like in the picture below?



I've managed, thanks to this tutorial https://www.youtube.com/watch?v=OsnyJNbqYXo, to create bullets over the scroll view but there is a lag as they are not directly linked to each other.

Thank you!

Pages: [1]