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

Pages: [1]
1
NGUI 3 Support / Re: Real screen size to NGUI virtual screen size
« on: November 14, 2016, 07:05:04 PM »
The only one solution I found is to add a new NGUI root, but with ortographic projection. Then I attached the cursor on this root, and now I can set the Input.mousePosition as it is. The 2D root has its own layer, else NGUI makes strange things ;) The 2D root UI camera just shows the 2D UI layer (Camera culling mask is UI2D not the default UI).
I hope the performance for the additionally added camera is nearly nothing, because it just shows up the own layer.

2
NGUI 3 Support / Re: Real screen size to NGUI virtual screen size
« on: November 14, 2016, 05:29:04 PM »
Hello again,

I don't know why my test script worked before. After the real implementation it doesn't work anymore. Everything looks good, the UIPanel on root has exactly the size of the screen. Would be perfect for the mouse position. I don't know how to get a scale factor to fix the 10-20% difference between mousePosition and position of the UITexture.

If I change the height of the screen (of the visible running scene/game screen), then this difference will be higher/lower and can be also exact, if I change it to the one correct height. Somehow the height/width ratio changes the exactness of the screen position for my UITexture... I don't know how to get this factor, the UIRoot and UIPanel don't know this factor. Even if I change it in the editor mode, I see that the coordinates cannot be correct.

I would like to do not change the z value of UITexture position, because that would scale the texture.

Any suggestion, maybe a new NGUI root with 2D settings? OnGUI worked fine, but I would like to remove all the OnGUI methods.

3
NGUI 3 Support / Re: Real screen size to NGUI virtual screen size
« on: November 14, 2016, 07:38:00 AM »
Thank you!

Finaly the solution is:

  1. public UITexture TestCursor;
  2. Camera uiCamera; // setting in Awake by NGUITools.FindCameraForLayer(gameObject.layer);
  3. ...
  4.  
  5. Vector3 v = Input.mousePosition;
  6. v.z = uiCamera.WorldToScreenPoint(TestCursor.transform.position).z;
  7. v = uiCamera.ScreenToWorldPoint(v);
  8.  
  9. TestCursor.transform.position = v;
  10.  

4
NGUI 3 Support / Re: Real screen size to NGUI virtual screen size
« on: November 14, 2016, 06:55:52 AM »
If I change the UI camera transform.z value, then the virtual screen size changes... In my case, setting the camera range to the to -595 instead of -700 then match the real screen size in which the Input.mousePosition is. But if I do this, by the way it looks like a very hacky solution, then some of the UI components are outside the screen, or changes the position in the running sceeen view.

Is there a good way to handle this? I need the 3D (perpective) UI.

5
NGUI 3 Support / Real screen size to NGUI virtual screen size
« on: November 14, 2016, 06:17:04 AM »
Hello,

similar questions asked a lot of time, but I failed with all the solutions. My problem is to map the Input.mousePosition to the NGUI virtual screen size. The screen is pixel perfect, which has no impact to this problem. UI camera ia perspective. The only one issue is, that Input.mousePosition has a screen width e.g. 1400 but NGUI has a virtual screen width of 1600. The height scaled with the same factor. I'am trying to place a UITexture to the mouse position, the cursor image at hovering over 3D objects. What am I ask for the virtual NGUI size, is there a method for the conversion? It seems to be that it is just a scaling issue, but where can I read the scaling value?

Thanks in advance for your help.

6
NGUI 3 Support / Re: UIPopupList with sprite/texture
« on: July 15, 2016, 06:02:04 AM »
I found a quick hack, streching the 'l', or similar to a rectangle works as color selection. The text can be colorized with [99ff00]l[-]. The UIPopupList should somehow manage UIPanels instead of just a text. That would be a much more valuable component, so we could decide what we put on the panel.
I'm making a strategy game, game creation panel where at least an icon (because it is a game, not an application for office) and text is needed. I need a popop menu at selecting the AI/Human, at selecting the race, the group and the color.

7
NGUI 3 Support / UIPopupList with sprite/texture
« on: July 14, 2016, 04:00:48 PM »
Hello,

the UIPopupList supports UILabels (and an object, for whatever it is), but not sprites or textures. Is there is simple solution to make a player color selection popup list (or somehow a color selection UI component)? I just want to select one of 8 predefined colors, which should be presented as a texture and not as text. The UIPopupList is pretty long for what it does, and patching that file would be my last option.

Thanks in advance for help!

8
NGUI 3 Support / Re: Tween Position doesn't work correctly
« on: December 22, 2014, 08:21:30 AM »
Tween position works with fixed values, and moves widgets by adjusting the position of the item. Anchors also adjust the position. If you use one, don't use the other.

Thanks for your answer!

I try to move from the right side a window in the screen, if i select a building and reverse it (hide it), if i do not select anymore the building. The rotating tween works correctly because the pivot point doesn't change. I believe that what i want to do is quite simple, i just don't know how can i solve it in a good way. How would you do it? (Probably an invisible widget on the top of the widget without collider, just for anchoring. And then i just move the content on the widget - without anchoring - outside of the screen?)

9
NGUI 3 Support / Tween Position doesn't work correctly
« on: November 24, 2014, 07:35:07 AM »
NGUI version: 3.7.6p2

UIRoot:
  scaling style: Constrained
  content width: 1920, not fit
  content heigh: 1080, fit

UICamera:
  event type: 3D UI
  event mask: everything (i guess this is not important in this case)
  events go to...: Rigidbodies

Camera:
  projection: perspective

Tween Position on a game object, which has an UIWidget and Box Collider.

(Probably a dump settings options would be nice, when we report our problems.)

Hello,

first at all, thank you for this GUI solution, it works and it is stable in comparism of lot of another assets in the asset store. However, i have a problem with the Twenn Position. The widget (directly under the root) itself i move has an Unified Anchor, which is moved right side out of the view. After reversing the Tween Position tween, the base position of my widget is somewhere else. It depends on the resolution where the widget position is after reversing the tween. I control the tween with a button with the UIPlay Tween script, which is in toggle mode.

Thanks in advance

Pages: [1]