Skipping the connection phase in the tris example

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

User avatar
gg
Posts: 90
Joined: 19 Sep 2010, 21:16
Contact:

Skipping the connection phase in the tris example

Postby gg » 21 Oct 2014, 05:39

Hi guys,

How can I skip the first screen (the connection) in the Tris example in Android, and do it in the code automatically? I know it's for example purposes, but it doesn't make sense for the user to have to connect to a server. It should be done automatically.

I tried:
in TrisLobbyActivity.java, I added buttonLogin.performClick();
which works in that it skips the screen, but still shows it for a noticeable amount of time (almost a second). Can we do that without displaying it to the screen at all?
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Skipping the connection phase in the tris example

Postby Lapo » 21 Oct 2014, 08:28

You can remove the button completely (even the screen, if you so desire) and move the connection code at the beginning of your code.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
gg
Posts: 90
Joined: 19 Sep 2010, 21:16
Contact:

Re: Skipping the connection phase in the tris example

Postby gg » 21 Oct 2014, 14:38

I made LinearLayout1 Visibility=invisible in connector.xml and that seems to work.

But when I type in the "please enter your nick" screen, it seems to type in the main lobby chatbox. Is this a coding issue with the android example?

Hi Lapo, can you go in more details into what code to change to accomplish this? I commented out everything that says "connector" in TrisLobbyActivity.java, but now, the address, port, use bluebox, and connect button are still displayed, along with the Login:

http://imgur.com/mFJDuUp
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Skipping the connection phase in the tris example

Postby Lapo » 24 Oct 2014, 08:11

HI,
no, I am not aware of such issue. Are you sure you haven't modified the example? Out of the box the Tris game works correctly.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 16 guests