tl;dr : I can't think of logic to send my already working login/register system between client/server.
Alright, so its 6:40AM here. Forgive me if I don't make sense or if I ask a stupid question. I figure there's a chance I'll wake up tomorrow and the someone will have a brilliant answer out of the kindness in their hearts. Ok, so here's the problem:
I'm running short on the logic here. I have a login system. It allows you to create a username and password with the click of the register button and stores it in an XML on my computer. It allows logging in, doesn't allow overwriting(from normal users), doesn't allow wrong passwords, etc. :D sweet. The only thing I can't wrap my head around is how would I send the password and username that someone types in on a client to my server through RPC.
For clarification, I have two scripts. One is the connect/username and password text fields. They are on two different game objects for the sake of finding them rather easily. I could easily attach them to the same object. Ok back to the problem.
I thought that it would be pretty easy to simply set the username and password = _username and _password for simplicity's sake. But now that I think about it, I think I will probably need arrays that +1 every time a new player connects. But then again, if the fields reset after a player sends the information, what does it matter?
I guess I'm asking for a run through on logic, here. I'm thinking of running an if(server) then set username and password to _username and _password, and if(client) then send username and password to server. I'm not exactly sure how to do that per say. Any suggestions/code examples would be great. Another thing I'm considering is programming a client separate from the server. I'm not sure how well that will work, but my logic right now(lack of sleep logic) tells me it would be awesome! (I haven't gone about doing it yet, though). Any help/suggestions/"here you go stupid" I eagerly await! I shall continue "mucking" with this code until my face hits the keyboard. :)
EDIT: (changed name to be more specific)
Ok, so after some sleep and a day of thought I am still having a bit of trouble. I have a client/server in one at this point in time and I plan on hosting it on a dedicated desktop that is relatively powerful. I plan on separating the script to two distinct projects, but thats currently irrelevant. I think I could have some sort of "listener" that trips whenever a client connects.
I could trip the onPlayerConnect() function and run code on the client side so that is sends the variable name and password across the connection and have the server store it in a variable thats created only during the function call. Well I'm going to read up a bit more on Unity's listeners. I'm not too familiar with them. I'll try using the above logic if I don't find any listeners that will do what I want.