Hi gang for some reason i cannot type in GUI text area to fill in my details.
NO idea why i cannot type in my text area.
Theory: type in username password, Hit login, Sends details to script the PRC’s the details to a 3rd script on my server and saves and account with those details.
script one Clientside:
using UnityEngine;
using System.Collections;
public class ClientLogin : MonoBehaviour {
public static string UsernameInputClient = "";
public static string PasswrodInputClient = "";
// Use this for initialization
void Start () {
}
// Update is called once per frame
void OnGUI () {
GUI.Box(new Rect(5, 60, 220, 170), "WelcomePilot");
UsernameInputClient = GUI.TextField(new Rect(50, 100, 160,23), "");
PasswrodInputClient = GUI.TextField(new Rect(50, 150, 160,23), "");
// Run Loggin...
if(GUI.Button(new Rect(30, 200, 65,23), "Loggin")){
SystemLoggin();
}
//Run Register...
if(GUI.Button(new Rect(130, 200, 65,23), "Register")){
SystemRegister();
}
}
public void SystemLoggin () {
SystemConnect.LogginAttemptByClient += +1;
}
public void SystemRegister() {
SystemConnect.RegisterAttemptByClient += +1;
}
}
Script 2 Client and Serverside RPC
public class SystemConnect : Photon.MonoBehaviour {
public static string Username= "";
public static string Password = "";
public static float LogginAttemptByClient = 0;
public static float RegisterAttemptByClient = 0;
//__________________________________________________________________________________________________________________
public void Start (){
PhotonNetwork.JoinRandomRoom();
}
//__________________________________________________________________________________________________________________
public void Update (){
if(RegisterAttemptByClient > 0){ // check every frame.
GetComponent<NetworkView>().RPC("RegisterAccount", RPCMode.All, null);
}
else{
Debug.Log("NO - Request");
}
}
//__________________________________________________________________________________________________________________
[PunRPC] // Send Userrname + Password to Server
public void RegisterAccount ()
{
Username = ClientLogin.UsernameInputClient;
Password = ClientLogin.PasswrodInputClient;
}
//__________________________________________________________________________________________________________________
}