예제 #1
0
 void OnGUI()
 {
     if (!Network.isClient && !Network.isServer)
     {
         if (GUI.Button(new Rect(100, 100, 250, 100), "Start Server"))
         {
             StartServer();
         }
         if (GUI.Button(new Rect(100, 250, 250, 100), "Refresh Hosts"))
         {
             RefreshHostList();
         }
         if (hostList != null)
         {
             for (int i = 0; i < hostList.Length; i++)
             {
                 if (GUI.Button(new Rect(400, 100 + (110 * i), 300, 100), hostList [i].gameName))
                 {
                     JoinServer(hostList [i]);
                 }
             }
         }
         if (GUI.Button(new Rect(400, 250, 250, 100), "Connect"))
         {
             if (!BtConnector.isBluetoothEnabled())
             {
                 BtConnector.askEnableBluetooth();
             }
             else
             {
                 BtConnector.connect();
             }
             BtConnector.stopListen();
         }
     }
 }