示例#1
0
    void OnGUI()
    {
        print("ONGUI!!!!!");
        print("compareinput" + compareinput);

        //mouse
        GUI.DrawTexture(new Rect(Event.current.mousePosition.x - cursorSizeX / 2, Event.current.mousePosition.y - cursorSizeY / 2, cursorSizeX, cursorSizeY), CursorTex);

        if (getConInfo == true)
        {
            GUI.Window(0, new Rect(Screen.width / 2 - 100, Screen.height / 2 - 85, 200, 150), connectWindowFunc, "Connect Infomation");
        }

        //connect to mysql
        if (tryConnect == true)
        {
            print("LoginData.constr = " + PlayerPrefs.GetString("constr"));
            LoginData.buildConnect(PlayerPrefs.GetString("constr"));
            if (LoginData.connect.State.Equals(ConnectionState.Open))
            {
                print("LoginData.connect.State.Equals(ConnectionState.Open)= " + LoginData.connect.State.Equals(ConnectionState.Open));
                LoginData.ReadUserInfo();

                /*for (int i = 0; i < LoginData.loginInfo.Count; i++)
                 * {
                 *  print("LoginData.connect.State.Equals(ConnectionState.Open)= " + LoginData.connect.State.Equals(ConnectionState.Open));
                 *  print(LoginData.loginInfo[i].uLevel);
                 *  uLevelx.Add(LoginData.loginInfo[i].uLevel);
                 *  uNamex.Add(LoginData.loginInfo[i].uName);
                 *  uPasswordx.Add(LoginData.loginInfo[i].uPassword);
                 * }*/

                print("the first userinfo: " + LoginData.loginInfo[0].uName);
                print("the first userinfo: " + LoginData.loginInfo[0].uPassword);

                compareinput = true;
                tryConnect   = false;
            }
            else
            {
                getConInfo = true;
                tryConnect = false;
            }
        }
        //print(LoginData.connect.State);

        if (compareinput)
        {
            //Repaint();
            //print("getConInfo" + getConInfo);
            //print("tryConnect" + tryConnect);
            //print("go into login window");
            //print(LoginData.loginInfo.Count);
            try
            {
                GUI.Window(0, new Rect(Screen.width / 2 - 100, Screen.height / 2 - 55, 200, 110), loginWindowFunc, "Login Window");
                //GUI.Window(0, new Rect(Screen.width / 2 - 100, Screen.height / 2 - 85, 200, 110), loginWindowFunc, "Connect Successful! Login Please");
            }
            catch (Exception ex)
            {
                Debug.Log(ex.ToString());
            }

            if (CurrentManu == "InRoom")
            {
                Application.LoadLevel("InRoomScene");
            }
            else if (CurrentManu == "LoginFail")
            {
                LoginFailGUI();
            }
        }
        else
        {
            getConInfo = true;
            tryConnect = false;
            return;
        }
    }
 void Awake()
 {
     print("ReadFig AWAKE() ^_^");
     AccessData.buildConnect(PlayerPrefs.GetString("constr"));
     AccessData.ReadUserInfo();
 }