Beispiel #1
0
    //----------------------------------------------------------------------------------------------------------------
    // glean server/session status from menu fields

    void updateServer()
    {
//        Debug.Log("updateServer...");
        ctunity.clearWorlds();      // clean slate all worlds

        InputField[] fields = gameObject.GetComponentsInChildren <InputField>();
        foreach (InputField c in fields)
        {
            switch (c.name)
            {
            case "Server":
                ctunity.Server = c.text;
                if (!ctunity.Server.Contains(":"))
                {
                    ctunity.Server += ":" + defaultPort;                                                                    // default port :8000
                }
                if (!ctunity.Server.StartsWith("http://") && !ctunity.Server.StartsWith("https://"))
                {
                    ctunity.Server = "http://" + ctunity.Server;         // enforce leading http://
                }
                break;

            case "User":
                ctunity.user = c.text;
                break;

            case "Password":
                ctunity.password = c.text;
                break;
            }
        }

        // update player to current dropdown value
        ctunity.doSyncClock();                  // sync client/server clocks
        StartCoroutine("getSessionList");       // get list of current GamePlay Sessions
        StartCoroutine("getInventoryList");     // init list of "World" prefabs

//        Debug.Log("updateServer done.");
    }