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

Pages: [1] 2
1
Sorry for the late response - was on vacation and internet stopped after that.

So for a quick repro case, open up "Example 0 - Control Widgets.unity" and pick one of the popup lists. When run without any changes, "Control - Colored Popup List" looks like this:

The width of the dropdown box matches that of the original button. This is the desired outcome.

I made a font size change from 20 to 15 in the UIPopupList component here:


And this is what it looks like as a result:

dropdown box width no longer matches that of the original button.

The width discrepancy between the Dropdown box and the original button only seems to happen when the font size specified isn't the same as the font's original size. Removing "dynScale" in the line of code I mentioned in my first post seems to fix it, but I'd prefer it if I didn't have to modify NGUI code (I like to keep my 3rd party libraries untouched). Is this a bug, or intended behaviour?

Thanks!

2
Thanks for the response Aren, that solves the 2nd problem. Is the solution to the first to remove dynScale from that equation?

Thanks!

3
NGUI 3 Support / UIPopupList popup isn't sizing and positioning correctly
« on: November 21, 2014, 04:44:04 AM »
I'm creating a dropdown menu following the example scene's popup list, using my own sprites and font

Problem 1: dropdown sizing
the width of the dropdown is smaller than the original button that spawned the dropdown. Digging through the code, I found this line:

  1. // The triggering widget's width should be the minimum allowed width
  2. x = Mathf.Max(x, bounds.size.x * dynScale - (bgPadding.x + padding.x) * 2f);

The problem seems to stem from dynScale being indirectly calculated to be less than 1, from its activeFontScale assignment where it's stated to be fontSize / bitmapFont.defaultSize if a bitmap font is specified. The problem doesn't appear in the example scene because the dropdown font is native sized, but I have a big font that I've scaled down a bit. I hope I don't have to create another smaller font atlas to work around this :P

Problem 2: dropdown positioning
Seems like if the list is just a bit longer (say maybe 10 values or more), the dropdown will be positioned further down and no longer adjacent to its spawning button, even if it wouldn't go beyond the bottom of the window if positioned correctly. This happens in the example project if I add more options to either one of the example popup lists.

Am I missing something, or are these actual bugs?

Thanks for any help!

4
TNet 3 Support / Re: Proper way to start and join a server?
« on: November 19, 2014, 04:18:03 AM »
Just got home today to test it again, and it works without any changes. Very peculiar.... but I won't complain. Marking this resolved for now. Thanks very much for the help!

5
TNet 3 Support / Re: Proper way to start and join a server?
« on: November 18, 2014, 12:13:17 AM »
Thanks for responding Aren!

I'm still not having luck with calling TNManager.Connect() directly after a TNServerInstance.Start(), so I may be missing something else that's important and that I failed to mention. Here's the component written for this:

  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Net;
  4. using TNet;
  5.  
  6. public class NetworkManager : MonoBehaviour {
  7.  
  8.         public string lobbyUrl = "<my lobby's public IP address here>";
  9.         public int lobbyPort = 5129;
  10.         public TNServerInstance.Type lobbyType = TNServerInstance.Type.Tcp;
  11.  
  12.         public int tcpPort = 6127;
  13.  
  14.         void Awake ()
  15.         {
  16.                 TNLobbyClient.onChange += OnListChange;
  17.         }
  18.  
  19.         void Start () {
  20.                 StartServer();
  21.         }
  22.  
  23.         /// <summary>
  24.         /// Starts a server and registers it to the remote lobby.
  25.         /// </summary>
  26.         public void StartServer()
  27.         {
  28.                 int udpPort = Random.Range(10000,40000);
  29.                 // start a server and register it to the remote lobby
  30.                 Debug.Log("Starting Server...");
  31.                 bool didServerStart = TNServerInstance.Start(tcpPort, udpPort, null, lobbyType, Tools.ResolveEndPoint(lobbyUrl, lobbyPort));
  32.  
  33.                 // connect to the local server that was just started
  34.                 if(didServerStart)
  35.                 {
  36.                         Debug.Log("Server started! Attempting to connect to server");
  37.                         TNManager.Connect("127.0.0.1", tcpPort);
  38.                 }
  39.         }
  40.  
  41.         private void OnListChange()
  42.         {
  43.                 Debug.Log("Server list change detected.");
  44.         }
  45.  
  46.         public void OnNetworkConnect(bool success, string message)
  47.         {
  48.                 Debug.Log("Was connection successful? " + success + " what's the accompanying message? " + message);
  49.         }
  50. }
  51.  

The GameObject hosting this component also has TNTcpLobbyClient and TNManager attached, so it should hit OnNetworkConnect once it connects. OnNetworkConnect doesn't seem to get hit however, according to the attached screenshot of the resulting console log. If it matters, I started the Lobby server with these parameters:

TNServer -name "My Server" -tcpLobby 5129

Am I missing something in this setup that's causing it to not invoke OnNetworkConnect?

6
TNet 3 Support / [Solved] Proper way to start and join a server?
« on: November 17, 2014, 05:47:40 AM »
Hi all,

I'm new to TNet, and relatively new to realtime networking in general (coming in from SmartFox). I'm trying to figure out how to properly execute a certain user flow in TNet.

I have a publicly accessible lobby server. Users are expected to either join an existing game server by connecting to a server found on this lobby, or host their own game servers and registering it with the lobby server. I want those that host their own game servers to automatically join their own servers upon creating them. Right now I call TNManager.Connect("127.0.0.1", tcpPort); in a coroutine after waiting a second from a TNServerInstance.Start() call. Calling TNManager.Connect() right after in the same function doesn't seem to work... or at least OnNetworkConnect() doesn't seem to be invoked when done that way.

2 immediate questions from this exercise:
  • Is calling TNManager.Connect() on 127.0.0.1 this the proper way to go about forcing a host to join his own server?
  • Having to call TNManager.Connect() after a coroutine wait feels a bit hackish... is there a more graceful way to go about this without requiring user input?

Thanks for any help!

7
NGUI 3 Support / Re: How do I make a background sprite hug a UILabel?
« on: November 01, 2013, 07:53:33 PM »
I failed to mention that circumstances beyond my control make upgrading practically impossible (team decided it was a great idea to add some custom modifications to the libraries). Regardless, sorry for wasting your time.

8
Using NGUI 2.5.0c

Hi all,

I'm trying to get a background sprite to hug a UILabel that can have a variable width up to a certain max width. I've been referencing the UITooltip code that resizes the background to the UILabel. The problem with this approach is that if I have a UILabel with a lineWidth set, the background will always enclose the full lineWidth regardless of the amount of text in the UILabel. Is there a way to make the background shrink to the text if the text takes up less space than the full line width?

Thanks!

9
NGUI 3 Support / Re: UISlider seems to have this constant offset (v 2.6)
« on: September 24, 2013, 07:59:44 PM »
I solved this by copying a later version of UISlider into the one that's currently embedded with our project. I reckon this might've simply been a bug from an earlier build of NGUI, judging by the diff.

Anyway thanks for the swift reply :)

10
NGUI 3 Support / Re: UISlider seems to have this constant offset (v 2.6)
« on: September 24, 2013, 07:42:02 PM »
I took a look at the video I think you're referring to (http://www.youtube.com/watch?v=OT0hTxjjkY4), and I think I've taken the necessary precautions.

I checked to make sure all the graphics that act as background and foreground are left-aligned, and the collider is offset accordingly. I also put the foreground back in as well. None of these fixed the issue. Is this an issue with older versions? We're not using v3 yet.

Thanks!

11
Hi all,

We're still using NGUI 2.6.x, and are having trouble with creating a UISlider that would situate the thumb properly when clicked or dragged. Attached is a video captured on the Scene and Game windows to demonstrate the problem:
http://screencast.com/t/hwcLPsNj

This was a slider created straight from the Widget wizard, with the foreground removed. Notice how the thumb seems to be offset by half the width of the slider. I made sure that the collider was offset correctly to line up with the background. Anyone know what might be going on? Let me know if more information is needed to diagnose the problem, thanks!

Jay

12
Hi everyone!

I've been trying out UIDragObject, and am wondering if there's a way to clip the dragging to the viewport? I tried to put the draggable items into a Panel that normally fills the viewport, but in order to get clipping to work properly to constrain the draggable items, I had to set the UIPanel's clipping size. Is there a way for the clipping to size based on the viewport size, or is there another way to achieve what I want to do that involves a different method?

Thanks for any help
J

13
Specifically, I'm trying to figure out a way to implement a relatively hefty tooltip that comes up over and to the left of a cell within a UIGrid within a UIDraggablePanel. Making the tooltip a child of the cell causes UIDraggablePanel to see that as extra dimension it must compensate for, and thus will shift the cells to the right to accomodate the tooltip. Is there a way to have UIDraggablePanel ignore the tooltip without having to take it out as a child of the cell? (I ask for this specific use case because there are other things we want to happen in the cells that will push its boundaries as well)

Thanks for any help!
Jay

14
NGUI 3 Support / Re: Scroll View (Clipped Panel) - Tutorial not very clear
« on: February 12, 2013, 06:52:15 PM »
So the typical setup I use would go something like this:
  • Dialog Container
    Components: can have UIPanel, but not necessary
    • Background
    • ScrollableHitZone
      Components: BoxCollider, UIDragPanelContents (draggable panel targeting ScrollablePanel below)
    • ScrollablePanel
      Components: UIPanel, UIDraggablePanel
      • Grid
        Components: UIGrid
        • UIElement
        • UIElement
        • UIElement

In your case, I think you should have a containing GameObject between Anchor and ScrollView the way I have Dialog Container, and have the background as a child of that GameObject to achieve the result you want. Hope I'm interpreting your question correctly :)

15
this worked, thanks!

Pages: [1] 2