コード例 #1
0
    public void ConnectPlayer(string nickname)
    {
        if (!SScript.IsPlayerConnected(nickname))
        {
            SScript.AddPlayer(nickname);
        }
        int id = SScript.GetPlayerId(nickname);

        FinishConnecting(id, nickname);

        /*
         * bool done = false;
         * for (int p = 0; p < SScript.NumberOfPlayers; p++) {
         *      if (SScript.Player [p].Nickname == Nickname && !done) {
         *              FinishConnecting (p, Nickname);
         *              done = true;
         *              break;
         *      }
         * }
         * for (int p = 0; p < SScript.NumberOfPlayers; p++) {
         *      if (SScript.Player [p].Connected == false && !done) {
         *              FinishConnecting (p, Nickname);
         *              done = true;
         *              break;
         *      }
         * }
         * if (!done) {
         *      RpcDebug ("Unable to connect");
         * }
         */
    }