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

Pages: 1 [2]
16
TNet 3 Support / Re: Creating Lan-Only Server
« on: November 22, 2014, 02:28:31 PM »
No, that enum is for the type of the lobby server you are expected to connect to. TNet doesn't offer a way to limit traffic only to your LAN. The most obvious method of limiting it is to not distribute your IP, and/or not opening the port via UPnP. Only if you tell someone your IP, and open the port via UPnP (or manually) will the actually be able to connect to you from outside of your LAN.

3. Yes, that's perfectly valid. I do that myself in Starlink.

Great, thanks for the answer!

How about question #2? Is it possible for a server to not support UDP connection? If that is the case, should I check "TNManager.canUseUDP" everytime I send a tno.SendQuickly and if it's not supported do a Send instead? Is it guaranteed a TCP-only action game would have lagging movement sync & other problems?

17
TNet 3 Support / Creating Lan-Only Server
« on: November 21, 2014, 11:01:14 PM »
In my game I want the player to be able to start a server either lan-only or on the internet. I see that TNServerInstance.Start has an overloaded version which accepts an enum parameter named "Type" which happens to contain "Lan, Udp, Tcp". This overloaded version of the method also forces me to indicate a lobby port and a filename to save the server to :(.

So I have some questions regarding the above.

1) I consider if I set the server type to Type.Lan, it will only use the local ip address and won't be connectable through the external address. Am I correct about this assumption?
2) When it comes to choosing the server type between Udp and Tcp what is the determinant factor? What are the main differences and is it possible for one of them to be incompatible with the user's connection setup?
3) Since it's possible for a server to be either Udp or Tcp what is the best way to setup the TN Lobby Client components/scripts. I read that I shouldn't keep both Udp and Tcp lobby client active at the same time. Should I keep them both on my network manager gameobject and toggle them based on the type of the started server?

Any and all answers are much appreciated!

18
NGUI 3 Support / Re: Changing the "value" of a disabled UIToggle problems
« on: September 18, 2014, 03:30:09 PM »
You need to update your NGUI...

Haha yeah, the updates are so frequent, it's hard to keep a track of them! (No complaints here)

I'm currently using 3.7.1 in this project, just a single update away from the latest.

The problem with updating it is I have a variety of additions and changes made on it and I don't want to go through comparing and merging code files and I don't have my changes noted somewhere.

I'm also not sure if you would be willing to take a look at my changes if I compile them in an email as they come up. I think it would be good to see what other people need and couldn't accomplish without playing with the codebase.

19
NGUI 3 Support / Re: Changing the "value" of a disabled UIToggle problems
« on: September 17, 2014, 01:43:07 PM »
Disabled object would certanly do it. You need to interact with enabled and active components, not disabled ones. Enable the game object, then change the state of its components.

Calling it on the first item of the scroll view's OnEnable and it still doesn't produce the desired result.

EDIT: More specifically, OnValueChanged of the UIToggle is not getting invoked when I change it's "value" to "true" via scripting.
EDIT2: If I call the below code right after I set the value to true in OnEnable, it works, why would this be?

  1. if(EventDelegate.IsValid(GetComponent<UIToggle>().onChange)) EventDelegate.Execute(GetComponent<UIToggle>().onChange);

EDIT3: I changed a code block in the UIToggle to fix this. I changed this to

  1. if (current == null)
  2. {
  3.         current = this;
  4.  
  5.         if (EventDelegate.IsValid(onChange))
  6.         {
  7.                 EventDelegate.Execute(onChange);
  8.         }
  9.         else if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
  10.         {
  11.                 // Legacy functionality support (for backwards compatibility)
  12.                 eventReceiver.SendMessage(functionName, mIsActive, SendMessageOptions.DontRequireReceiver);
  13.         }
  14.         current = null;
  15. }
  16.  

this

  1. if (current == null) current = this;
  2.  
  3. if (EventDelegate.IsValid(onChange)) EventDelegate.Execute(onChange);
  4. else if (eventReceiver != null && !string.IsNullOrEmpty(functionName)) {
  5.         // Legacy functionality support (for backwards compatibility)
  6.         eventReceiver.SendMessage(functionName, mIsActive, SendMessageOptions.DontRequireReceiver);
  7. }
  8.  
  9. current = null;
  10.  

20
NGUI 3 Support / Re: Changing the "value" of a disabled UIToggle problems
« on: September 17, 2014, 09:32:11 AM »
Upon further testing, if I call a coroutine to activate the first item in the activated scroll list with a little delay it works correctly. So I'm sure it happens because the scroll list or the items beneath it are disabled at the time of calling this method. Any elegant solutions?

21
NGUI 3 Support / Changing the "value" of a disabled UIToggle problems
« on: September 17, 2014, 07:55:43 AM »
Hey,

I have a tabbed interface for an in-game market. There are 4 tabs (UIToggle with same group index) each activating their respective UIScrollView. These scroll views contain their own set of UIToggle 's for the items being sold in the game. This works great with no problems.

What I want to do is; I want to select the first item of the related scroll view when the market tab changes. I want to set it's value to true. I tried two ways, both didn't work completely.

1. I programmed a method which finds the first item of the given category and set it's value to true. I invoked this method through the each category UIToggle's OnValueChange by hooking it through it's inspector. Upon testing it I realized the first item is accepted as the "activated" one after doing this because I can't select it anymore unless I select something else first. But it's animation doesn't play (The animation it should play when it's the activated UIToggle in the group). And it's own OnValueChange is never called.

2. I added a bool to the UIScrollView called "activateFirstItemOnEnable". I've also added it to the UIScrollViewEditor so I can see this bool in the inspector. What it does is, it calls my above mentioned method of finding and activating the first item in the UIScrollView 's OnEnable() if activateFirstItemOnEnable is true. This way the animation of the first item 's UIToggle plays nicely. But if I have selected -for example- item5, changed category, and came back to this category, item5 's dismiss animation doesn't play, it just stays with the "active" animation so it looks like both item1 and item5 are active at the same time. Also the item1 's OnValueChange is not called this way either (I want it because I refresh some labels containing the details of the selected item).

TL;DR So how can I make it so that when I enable a scroll view with a button, it's first UIToggle item get's selected, plays it's animation smoothly, invokes it's OnValueChanged method and disbles all other UIToggle's in the same group under this scroll view.

Hope it makes sense, thanks in advance for all the help!

Pages: 1 [2]