當前位置: 首頁>>代碼示例>>C#>>正文


C# ClientInfo.setNum方法代碼示例

本文整理匯總了C#中ClientInfo.setNum方法的典型用法代碼示例。如果您正苦於以下問題:C# ClientInfo.setNum方法的具體用法?C# ClientInfo.setNum怎麽用?C# ClientInfo.setNum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ClientInfo的用法示例。


在下文中一共展示了ClientInfo.setNum方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: clientInfoIsReady

    public void clientInfoIsReady(string login, ClientInfo c)
    {
        if (Network.isServer) {
            this.positionsClients[login] = this.countClients;
        }
        Debug.LogError("[NETWORK MANAGER] clientInfoIsReady: <" + login + "> was created at position <" + this.positionsClients[login] + ">");
        c.transform.Translate(this.playerSpawn);
        c.setNum(this.positionsClients[login]);

        if (WorldInfo.listOfPlayers == null) {
            Debug.LogError ("[NETWORK MANAGER] clientInfoIsReady: listOfPlayer is null, creating...");
            WorldInfo.listOfPlayers = new List<string>();
        }
        WorldInfo.listOfPlayers.Add(login);
        this.countClients++;

        int nbPlayers = this.countClients;
        Debug.LogError(WorldInfo.countNetworkConnection + " == " + nbPlayers);
        if (WorldInfo.countNetworkConnection == nbPlayers) {
            if (!Network.isServer) {
                Debug.LogError("[NETWORK MANAGER] clientInfoIsReady: PLAYERS LOGINS ARE DISPACHED, SEND TO SERVER THAT I'M READY");
                this.nV.RPC("clientIsReady", RPCMode.Server, WorldInfo.login);
                return;
            } else {
                Debug.LogError("[NETWORK MANAGER] clientInfoIsReady: SERVER IS READY, DISPATCHING TO OTHER ALL PLAYER LOGINS [SERVER]");
                //this.clients[WorldInfo.login].setState("client ready confirmed");
                string[] logins = new string[this.countClients];
                string[] positions = new string[this.countClients];
                for (int i = 0; i < this.countClients; ++i) {
                    logins[i] = WorldInfo.listOfPlayers[i];
                    positions[i] = this.positionsClients[WorldInfo.listOfPlayers[i]].ToString();
                }
                this.nV.RPC("serverIsReady", RPCMode.Others, string.Join(":", logins), string.Join(":", positions));
            }
        }
    }
開發者ID:Rominet,項目名稱:MeshLegion,代碼行數:36,代碼來源:NetworkManager.cs


注:本文中的ClientInfo.setNum方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。