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

Pages: 1 2 [3] 4
31
NGUI 3 Support / Re: Dimension with UI and Icon blocked by finger
« on: March 31, 2014, 11:23:24 PM »
1. Not sure what you mean by the Dimension problem, but I assume you need Atlas Switching (SD, HD, UD). Look http://www.tasharen.com/forum/index.php?topic=832 or http://www.tasharen.com/forum/index.php?topic=8575.0

2. In OnDragStart() offset the sprite to wherever you like.

3. Use UICamera.hoveredObject in OnDrag(Vector2 delta)/OnDragEnd() to see if it intersects with a valid container and change the icon accordingly.

I wonder that how could I check the intersection occured and so change the icon. I've tried to Debug.Log(UICamera.hoveredObject) in dragging icons but it always not identify the icon dragged. Is there any some or other variables I need to use in this case?

32
NGUI 3 Support / Re: Dimension with UI and Icon blocked by finger
« on: March 26, 2014, 09:35:44 PM »
Okay, I would like to try the above things on myself.

A little question is that I want to , what you gave me, to set the offset of the sprite. So I change some coding in UIdragdropItem script.

  1. public Vector3 Offset = new Vector3(0,10,0);

and

  1. protected virtual void OnDragDropStart ()
  2.         {
  3.                 ...
  4.                 Vector3 pos = mTrans.localPosition;
  5.                 pos = pos + Offset;
  6.                 pos.z = 0f;
  7.                 mTrans.localPosition = pos;
  8.                 ...
  9.         }
  10.  

However, it was nothing to change. Did I do something wrong?

Updated:
i discover that if I enlarge the number of offset , it worked!

33
NGUI 3 Support / Re: Dimension with UI and Icon blocked by finger
« on: March 26, 2014, 10:26:52 AM »
Thanks for your help!

Although I've tried to understand what you said, I still cannot understand enough because I'm not good at scripting for now.

So, I would be happy if you would tell me more in detail on what I actually need to do, for the above three things. 

Thank you very much . Please forgive my stupidity.

34
NGUI 3 Support / Dimension with UI and Icon blocked by finger
« on: March 26, 2014, 06:25:36 AM »
1. About the Dimension problem, it is realised that I cannot control the dimension of the UISprite and UITexture based on the screen resolution( Based on both width and height to decide the dimension). So they could be more clear on tablet and enough clear on mobile. Could it be done?

2. About the Icon blocked by finger : When I drag an item using my finger, it seems that the icon I am dragging is totally blocked by my finger and so I cannot see the icon clearly. I suggest putting the icon always above the finger position when dragging. Could it be done too?

3, I also suggest that when I drag the items on screen, if I cannot drop them on certain surface, some changes or notices would appear ,let say, a cross on the icon to remind the user not available to drop the items on that point. Could it be done as well?

Thanks for the help for above few things!

35
NGUI 3 Support / Re: Drag and Drop objects probelms
« on: March 25, 2014, 03:31:27 AM »
I've tried to use Physics.OverlapSphere to prevent overlap items dropped but unforuately failed.

Could you tell me that how it should be done in detail, or what would you do if you want to do this?

What should do in scripting as also?

Thanks!

36
NGUI 3 Support / Drag and Drop objects probelms
« on: March 20, 2014, 10:31:38 PM »
How to solve a probelm that if I drag and drop item on the surface and avoid overlapping the other GameObjects ,or especially the walls and the other items dropped before, even that the gameobjects identified by myself that should not overlapping ?

Could this new functionality be updated and added into NGUI?

Also how it should be done?

Thanks!

37
NGUI 3 Support / NGUI Slider can not be controlled
« on: March 20, 2014, 07:50:32 AM »
I want to use the slider to control a varaible _Energy in script and this variable also self-reduce in Update function...
  1. void Update()
  2. {
  3.        _Energy -= 10* Time.deltaTime;
  4. }
  5.  

This variable would be self_reduced and I can through changing the slider value to change it too.
However, I can't control the slider value when running, even the slider value follows the _Energy variable.
  1. public UISlider xx;
  2.  
  3. xx.value = _Energy/2.0f;
  4.  

How should it be fixed?

It seems that because it doesn't return a value so this situation happen.

However I actually did it...

Am I right?

Thanks!

38
NGUI 3 Support / Tween position with use of UISprite
« on: March 19, 2014, 08:31:56 AM »
For the different resolution of the devices, if I want to use Tween position to play tween of the UISprite,

there is a problem that it would tween to wrong position.

How can fix it that the Tween Position would be tiled with the screen resolution?

Thanks!

39
NGUI 3 Support / A question on Button Function by NGUI
« on: March 19, 2014, 04:45:52 AM »
Here is my problem.

There is a Button message script(Legacy) in NGUI and it seems that Event trigger trys to replace it. This is what I have known.

However, do I need to write a script on my own to make a button to control a boolean from another script?

Which means, one boolean is turn true when I click on the button and turn false when click it again. It is a toggle as well.

It is because I doubt that  Event trigger script would really help me to do the above things , or I don't know how to use it or another way provided in NGUI that really could help me to do the above things.

So I need guideline in detail here to solve my concerns.

Thanks!

40
Sorry, I don't understand enough . Do you mean that I should change or add these coding on one(??) script?

Something like that, if I need to use UILabel to link with the HP of the player, and the HP variable is stored in "Player.cs" script,

If I just write on my own, I would use GUI.label on "Player.cs" to output the HP on screen.

If I want to use UILabel provided in NGUI,

What should I do in detail?

41
Hello!

Here is my problem.

The script "ExampleDragDropSurface" has a boolean "rotatePlacedObject".

I want to know is that is it worked because I can't find any control to do this way?

And I need to use some control ways to rotate Placed Object like long press,double tap,short tap...

Is it directly possible to do the above actions for now?

Thanks!

42
NGUI 3 Support / How can linked between UILabel and a float variable?
« on: March 13, 2014, 01:36:18 AM »
How can linked between UILabel and a integer variable?

That means, due to the fact that I need to use a UILabel to show my health in the game,
 
how can I suppose to do it?

Is it possible?

Thanks.

43
NGUI 3 Support / UIPlayTween and Tween Scripts Problem
« on: March 12, 2014, 11:05:25 PM »
Hello, everyone.
Something we may know that we can use UIPlayTween to control the Tween script to play.
But how about if one gameobject has more that one Tween scripts that need to be control, which means, such as I want play Tween Alpha in this time and play Tween Position in that time...How can I suppose to do it? It is because I can't select what Tween script I want to play in UIPlayTween.

Thanks!

44
Thanks. It seems that it works.
It seems that I need to learn a lot futher.
Anyway, great job and I like NGUI!

45
I have known that how the "Instantiate(projectile, transform.position, transform.rotation)" coding works already in the last few weeks.
Just I do not know how I should write on the "transform.position" this part.
Moreover, the codes right after in that script also set up the transform of the item instantiated, so I do not know how to change these so that it can do what I want.

This is my difficulties to let you know and I hope that you can help me.
Thanks.

Pages: 1 2 [3] 4