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

Pages: [1] 2
1
TNet 3 Support / Re: TNManager.Connect automatically joins server level
« on: September 10, 2013, 06:34:11 PM »
Ok, it turns out that the first OnNetworkConnect function is the only one being called.  As you said that explains why the second client enters the game created by the host. 

2
TNet 3 Support / Re: TNManager.Connect automatically joins server level
« on: September 10, 2013, 05:52:31 PM »
The player who is running the server uses the OnNetworkConnect() shown above.  The other computers, who are clients joining the game hosted by the server, have the following OnNetworkConnect function.

  1. void OnNetworkConnect(bool success, string message)
  2.         {
  3.                 //if connect successful then display channel selector dragpanel
  4.                 if(success)
  5.                 {
  6.                         NGUITools.SetActive (ServerGrid.ChannelList, true);
  7.                 }
  8.         }
  9.  

Once the client connects to the server it will request a channel list on the ChannelList dialog.  The only code on the channel list is to create the packet handler and create a button for each.  The JoinChannel command would be attached to those buttons, but that doesn't exist yet.  I don't see anything in there to cause it to join the same channel.


3
TNet 3 Support / TNManager.Connect automatically joins server level
« on: September 08, 2013, 04:45:12 PM »
I am having a problem with a game using TNET.  A TNET server / lobby server is being used.  One client starts a game server, creates a channel with a level and enters the game.  The intent is for the second client to join the server, retrieve a list of channels and then enter the channel of their choice after they make a choice.  Currently when the second client joins the server they immediately enter the channel that the first client (who created the server) entered.

The first client is creating the server as follows:
  1.         void OnClick ()
  2.         {
  3.                 TNServerInstance.Start (5127, 5128, "myServer",
  4.                         TNServerInstance.Type.Udp, Tools.ResolveEndPoint("127.0.0.1", 5129));
  5.                 TNManager.Connect ("127.0.0.1:5127");
  6.                 TNManager.CreateChannel ("Game",true,2,"");
  7.         }
  8.  
  9.         void OnNetworkConnect(bool success, string message)
  10.         {
  11.                 if(success)
  12.                 {
  13.                         TNManager.JoinChannel(1, "Game");      
  14.                 }
  15.         }
  16.  

The second client uses the following code to connect to the server:

  1. TNManager.Connect ("127.0.0.1:5127");
  2.  


Any suggestions appreciated. Thanks.

4
TNet 3 Support / Re: TNServerInstance.Start creates multiple servers?
« on: April 03, 2013, 07:31:30 PM »
ArenMook, in the debugger I looked at how the list of servers was changing and found that after adding one server it remains at one server even though the console suggested additional servers were being added.  As you suggest these must be updates and the number of servers is not actually increasing.  It isn't entirely clear how the code is working yet but I am judging this based on the size of list in TNServerList.cs and mList in TNUdpLobbyServer.cs.  Both stay at 1. 

Thanks for your guidance here.

5
TNet 3 Support / TNServerInstance.Start creates multiple servers?
« on: April 02, 2013, 07:24:55 PM »
I created a lobby server on port 5129 using TNServer.exe running on the same computer that the game will run on.  After creating a new server using
  1. TNServerInstance.Start (5127, 5128, "myServer",
  2.                         TNServerInstance.Type.Udp, Tools.ResolveEndPoint("127.0.0.1", 5129));
  3.  
the new server shows up as being added.  A few seconds later another one shows up, then another, and so on.  When exiting the game one server is removed.  TNServerInstance.Start is only running once and nothing was evident in the code for TNServer.exe to explain this.

Anyone have any ideas what is going on here?

6
NGUI 3 Support / Re: Question about UI Button Label
« on: March 29, 2013, 08:50:45 AM »
broknecho, thank you for the response.  I'll give it a try!

7
NGUI 3 Support / Question about UI Button Label
« on: March 28, 2013, 08:07:34 AM »
I am dynamically creating a new UIButton for each available server in a UIGrid using the following code.  After creating the button I want to add the name of the server as the text on the button.

  1.         void Start ()
  2.         {
  3.                 GameObject grid = GameObject.Find("ChildGrid");
  4.                 List<ServerList.Entry> list = TNLobbyClient.knownServers.list;
  5.                
  6.                 for(int i = 0 ; i < list.size ; i++)
  7.                 {
  8.                         //instantiate a new button and give it the server name
  9.                         GameObject newBtn = NGUITools.AddChild(grid, btn);
  10.                         grid.GetComponent<UIGrid>().Reposition ();
  11.  
  12.                         //add server name to button
  13.  

It would seem that there should be a way to access the label directly since the button object is known.  I've tried UILabel testObj = newBtn.GetComponent<UILabel>(); but that gives an error.

Is there a way to access this directly or is it necessary to use find?

8
broknecho, thanks for the input.  I'll have to give that a try again.  I believe that what I was doing but perhaps not, so I'll give it another go.  At the moment I have the two scene structure I mentioned pretty well torn up to add a Lobby scene so between work and kids it may be a day to two before I can comment back.  Thanks for the input.

9
After doing some digging it was found that TNManager was being unloaded when the first scene was unloaded before loading the second.  No big surprise there, I suppose.  The fix was to remove TNManager from the second scene, add it to a stand alone GameObject in the first scene and add the following to a script in that GameObject:

  1.         void Awake ()
  2.         {
  3.                 DontDestroyOnLoad(transform.gameObject);
  4.         }
  5.  

TNManager becomes persistent and remains loaded regardless of which scene is active.  Here is a link to the post where I found this http://answers.unity3d.com/questions/8354/scene-connecting.html

If anyone has another solution I would be interested in hearing about it.  Thanks.

10
TNet 3 Support / Connection to TNet Server Lost When Loading New Scene
« on: March 10, 2013, 11:17:05 AM »
I currently have two scenes in my game. The first is to display the various splash screens and the main menu.  The second will be the first level of the game and is currently nothing more than a capsule player that can move around on a cube surface.  When the player clicks on the join server button located on the main menu (first scene) the connection to the server succeeds and the new scene is loaded using TNManager.JoinChannel(...) and the new scene is displayed correctly.  However, at the same time the client is disconnected from the TNet server.  The TNManager script is attached to game objects in both scenes although I've tried only on the first with the same results.

Must be missing something here.

11
TNet 3 Support / Re: TNAuto Create Missing?
« on: March 09, 2013, 03:21:53 PM »
Ok, I downloaded the newest version and the TNAuto Create was there.  Sorry for the confusion.

12
TNet 3 Support / TNAuto Create Missing?
« on: March 09, 2013, 02:36:34 PM »
In the second video tutorial on TNET the TNAuto Create script is used to instantiate the player.  It looks like a useful function but doesn't seem to be in TNET any longer.  Has this been removed?

13
Oops, sorry about that.  Overall I'm very satisfied with NGUI and very definitely appreciate both the ability to preview it and your willingness to provide some help toward that end.

You should be seeing a new order in just a few minutes.   :)

14
NGUI 3 Support / Image Button Widget as a Child of Simple Texture Widget
« on: February 24, 2013, 10:38:23 AM »
At the start of the game I'm currently creating there will be two 2D UI's which are Simple Texture widgets.  The first is a splash screen that fades in and out followed by the second which fades in and then stays.  The second will be the main menu background.  On this second screen I want to have a button.  The intent is to have this button fade in with the main menu background.  Since I don't have the full version of NGUI at the moment the code is setup to fade the object and all of its children.  An Image Button widget was created attached to the Panel since I couldn't get it to create as a child of the main menu.  The button, and its child "Background" was dragged to the main menu.  Running the game gives the desired result with the button fading in with the main menu.  However, the second time the game is run the Image Button's child (Background) moves to become a child of Panel again.  The button object remains a child of the main menu.  Now the button appears immediately and does not fade with the panels as desired.  I've tried this a couple of times with the same result.  I could simply make the button a child of the panel and add another script to fade it in and out but this seems unnecessary. 

Here is the Hierarchy with the desired structure (HostServer is the button):


Here is the Hierarchy after running once:



Any thoughts on what is going on here would be appreciated.

15
NGUI 3 Support / Re: Confused about GameObject for GUI Object
« on: February 19, 2013, 07:22:00 PM »
Thanks, that would be my guess.  After my last post I did see another post discussing this problem and AronMook suggested that it could be due to an older version of NGUI.  It isn't an issue for now, I'll do it the brute force way and check into that when I purchase the package later in the month.

Thanks again.

Pages: [1] 2