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.


Topics - pretender

Pages: [1] 2 3 4
1
TNet 3 Support / Join Channel without loading a scene
« on: November 04, 2016, 01:19:39 PM »
I see that in TNManager is the JoinChannel method that loads a scene, what if i have a game that doesn't load any scenes but generates levels...i don't like scene stuff in unity and for simple games i generate levels and usually have only one scene

2
TNet 3 Support / Where to install TNServer?
« on: October 29, 2016, 04:21:39 AM »
I have trouble registering on Amazon EC2 (it hangs with identifying me over phone) :( is there any other server where I can install TNETServer.exe?

3
NGUI 3 Support / NGUI update?
« on: July 15, 2016, 10:47:49 AM »
is there going to be major NGUI update soon, I am not saying that this version is not good but you could suprise us just as with version 3.0 :D
great tool i am using it for around 4 years and it's great! Thank you!

4
Hi! I am trying to use pools of ui prefab elements to avoid constant instantiation and destroy of objects. Everything works fine,
i am spawning elements to table which is under scrollview, i also modified NGUITools.AddChild method (rather made another one) that
doesn't create gameobject but uses one that is passed (spawned beforehand).

here is the modified method:

  1. static public GameObject AddChild(this GameObject parent, GameObject prefab)
  2.         {
  3.             if (prefab != null && parent != null)
  4.             {
  5.                 var t = prefab.transform;
  6.                 t.parent = parent.transform;
  7.                 t.localPosition = Vector3.zero;
  8.                 t.localRotation = Quaternion.identity;
  9.                 t.localScale = Vector3.one;
  10.                 prefab.layer = parent.layer;
  11.             }
  12.             return prefab;
  13.         }

not much going on here.

here is the method i am using to spawn elements to table:
  1. ...
  2. for (var i = 0; i < weaponConfigs.Length; i++)
  3.         {
  4.             var pooledWeaponItem = Game.Pools.GetPool(PoolType.UI).Spawn(Item.transform, Vector3.zero, Quaternion.identity);
  5.            
  6.             var item = UIExtensions.AddChild(_table.gameObject, pooledWeaponItem.gameObject);
  7.  
  8.             var controller = item.GetComponent<WeaponItem>();
  9. ....
  10. }
  11.  

and everything works fine but the problem is when element that was in the pool and need to be reused is spawned to table but is not visible (this happens
depending on how much elements are in the pool...it happens earlier if there is less elements in the pool)

I figured out when i disable and enable again sprite it appears visible and then when i disable and enable gameobject of the spawned item itself it appears
in the table and starts working.

i tried
  1.         _scroll.panel.SetDirty();
  2.         _scroll.panel.RebuildAllDrawCalls();
  3.  

but it doesn't work, also i tried
different combinations of
NGUITools.SetActive for spawned element but it doesn't work...what seems to be the problem? Any ideas?

thanks!

5
NGUI 3 Support / how do you use nguitools.draw?
« on: January 01, 2016, 03:18:52 PM »
I wanted to display simple info and label shows in hierarchy but nothing is drawn, font is miising...do you need to setup ui that you want to show with nguitools.draw beforehand? And if so how it is exactly done?

6
NGUI 3 Support / Filled Sprite -> Circle with thumb
« on: October 18, 2015, 06:31:15 AM »
Hi! Any ideas how to add thumb, or other sprite to the position where filled sprite is currently?

7
NGUI 3 Support / Offscreen object indicator [Almost solved]
« on: October 01, 2015, 06:48:20 AM »
Hi I am trying to get offscreen object indicators to work...I know how to position them on the edge of the screen but I am not able to figure out how to rotate the indicator so it is both placed on the edge of the screen and at the same time points in the direction of the object that is offscreen.

Here is what I have:

Update loop


  1. //Converting to viewport point because it's easier to find point on the edge of the screen
  2. var worldToViewportPoint = _gameCamera.WorldToViewportPoint(Target.position);
  3. //Convert player position to screen point (this is constant because player is always centered, it is linked to game camera)
  4. var playerWorldToScreenPoint = _gameCamera.WorldToScreenPoint(GameController.Instance.Player.CharacterTransform.position);
  5.  
  6. //Clamp the target position to edge of the screen (take GetPixelSizeAdjustment  into account since i am not using pixel perfect)
  7. var screenPosClamped = new Vector3(Mathf.Clamp(worldToViewportPoint.x, 0f, 1f),Mathf.Clamp(worldToViewportPoint.y, 0f, 1f), 0);
  8. var position = new Vector3((screenPosClamped.x * Screen.width - HalfScreenWidth) * UIRoot.GetPixelSizeAdjustment(_indicator.gameObject),
  9.                                         (screenPosClamped.y * Screen.height - HalfScreenHeight) * UIRoot.GetPixelSizeAdjustment(_indicator.gameObject), 0);
  10.  
  11. //This gives me for one point something like this: (427.0, 191.6, 8.7) (-455.1, 360.0, 0.0)
  12. //So I suspect this is something that is causing trouble
  13. Debug.Log(playerWorldToScreenPoint.ToString() + " " + position.ToString());
  14.  
  15. //Set indicator prefab position at the edge of the screen (THIS IS WORKING CORRECTLY
  16. _indicator.localPosition = position;
  17.  

My question is what I need to do so that indicator rotates towards the player? I tried all kinds of combinations looking at the direction from those two points and
using LookAt and Slerp but no solution gives me good result. What is the proper way of doing this?

Thanks!


8
NGUI 3 Support / Lots of UIPanels in the scene proble
« on: July 19, 2015, 05:56:43 AM »
Hi!

I have a lot of UIPanels in the scene which all gets disabled in runtime, and only one that is needed is visible and that is fine, but editing panels in editor is somewhat slow. Is there any trick or editor script that will enable UIPanel when gizmo or icon in the scene view is clicked or something like that?

Thanks!

9
NGUI 3 Support / Two ScrollView questions
« on: February 04, 2015, 07:39:02 AM »
Hi!

I am more than happy user of NGUI and I use scrollview component a lot, but I frequently encounter two things with it that I would like to resolve finally.
1.) I usually have structure like this:

UIScrollView
   UITable
    (dynamically created items -> for example UISPrite)

so if I at one point have enough items to make table scrollable it scrolls fine but next time when there isn't enough items in the scrollview/table that will cause to scroll it will scroll (even if "Cancel drag if it fits" is set to true)...this happens if I use drag before clicking on the scrollview...I tried everything that I could to reset position,clipping, to reposition table,etc....but no luck. Question is what is the proper way to reseting the scrollview after populating dynamically contents?

2.) When I slide scrollview, for example from left to center of the screen, elements in the scrollview appear to slide more than scrollview and then snap back to proper place. Also when scaling scrollview from 0.1 to 1 for example, for visual effect, often elements in the scroll view doesn't properly position themselves, they snap back when scrollview is clicked/dragged. Is there any workaround for this?

Thanks a lot!

10
NGUI 3 Support / UIEventListener subscribe/unsubscribe
« on: January 29, 2015, 04:37:58 AM »
I was wondering if it is needed to unsubscribe onClick event for example that is subscribe to with UIEventListener?

here is what i am doing

  1. UIEventListener.Get(Button).onClick += go =>
  2.                     {
  3.                         Debug.Log(go.name);
  4.                     };
  5.  
  6. ...
  7.  
  8. UIEventListener.Get(Button).onClick -= go =>
  9.                     {
  10.                         Debug.Log(go.name);
  11.                     };
  12.  

Unsubscribe part gives me warning in Visual Studio...what is the proper way of doing this? Thanks!

11
NGUI 3 Support / Using widget rect to be used in OnGUI?
« on: December 23, 2014, 05:14:52 AM »
Hi! I am using plugin that displays web pages in OnGUI loop and requires Rect to be defined. I want to position a ngui widget (or sprite it doesn't matter) so that I can
render OnGUI content on that widget's rect. I have trouble converting ngui's left-top-right-bottom to rect... it should be fairly simple...furthermore, on non pixel perfect setups is it needed to be used UIRoot.GetPixelAdjustments?

Thanks!!

12
Hi!

i have scrollview with table that positions bunch of buttons horizontaly and i want clipping to work from left to right edge of the screen for every resolution and it should fairly easy to setup...I am a bit frustrated with this since i couldn't manage to make it right. currently i have setup for lowest resolution and let it work that way on higher resolutions (it doesn't stretch to the edge of the screen entirely)

i tried anchoring the scroll view but clipping region is wrong.

checkout the photo and please help, it seems that i am missing something...thanks!

13
NGUI 3 Support / controling sprite tiling?
« on: December 04, 2014, 08:27:11 AM »
How it is done?

14
NGUI 3 Support / Font data in 0,1 map form?
« on: October 18, 2014, 09:30:15 AM »
Not really a NGUI question but maybe somebody knows. I am making some effects for splash and intro screens which will have some nice effects with text. In order to do what I have imagined I need font data in this form (or similiar), for example letter "I", this was easiest to pressent

000011110000
000001100000
000001100000
000001100000
000001100000
000001100000
000001100000
000011110000

I could then do all kind of effects on 12x8 sprite map, color,animation etc...anybody have ideas how to get font data in this form?

Thanks!

15
NGUI 3 Support / NGUI with MVC pattern, example inside
« on: October 03, 2014, 04:33:58 AM »
I recently found about this article http://engineering.socialpoint.es/MVC-pattern-unity3d-ui.html where MVC pattern is used to implement UI (in this case NGUI is used).

It seems like an overkill, but it could be good learning example. Take a look and comment if possible is it a good practice?
Thanks!

Pages: [1] 2 3 4