Exemple #1
0
 void SendPlSc(int id, string data, int data2, int data3)
 {
     net_players[id]       = new NetPl();
     net_players[id].id    = (byte)id;
     net_players[id].name  = data;
     net_players[id].score = data2;
     net_players[id].ping  = data3;
     currconn++;
 }
Exemple #2
0
 void SendPlSc2(int id, string data, int data2, int data3)
 {
     if (net_players == null)
     {
         return;
     }
     net_players[id]       = new NetPl();
     net_players[id].id    = (byte)id;
     net_players[id].name  = data;
     net_players[id].score = data2;
     net_players[id].ping  = data3;
     currconn++;
     ScoreUpdate();
 }
Exemple #3
0
    public void StartScanning()
    {
        Transform tmp;

        tmp          = GameObject.Find("hud_items").transform.Find("HudScore");
        hud_score[0] = tmp.Find("HudScId").guiText;
        hud_score[1] = tmp.Find("HudScName").guiText;
        hud_score[2] = tmp.Find("HudScScore").guiText;
        hud_score[3] = tmp.Find("HudScPing").guiText;
        hud_score[0].material.color = Color.blue;
        hud_score[2].material.color = Color.red;
        hud_score[3].material.color = Color.green;
        tmp  = null;
        list = new string[4];         //ID, name, score, ping
        if (Network.isServer)
        {
            //Gamemodes
            old_school   = CFGLoader.old_school;
            instagib     = CFGLoader.instagib;
            filt_weapons = CFGLoader.filt_weapons;
            //Gamemodes end
            if (!CFGLoader.dedicated)
            {
                currconn++;
                MAX_PLAYERS          = Network.maxConnections + 1;
                net_players          = new NetPl[MAX_PLAYERS];
                net_players[0]       = new NetPl();
                net_players[0].id    = 0;
                net_players[0].name  = GetComponent <NetworkMenu>().player_name;
                net_players[0].score = 0;
                net_players[0].plid  = GetComponent <NetworkMenu>().plobj.networkView.viewID;
                net_players[0].ping  = 0;
                ScoreUpdate();
            }
            else
            {
                MAX_PLAYERS = Network.maxConnections;
                net_players = new NetPl[MAX_PLAYERS];
            }
            if (!CFGLoader.limping)
            {
                StartCoroutine(CheckPing());
            }
            else
            {
                StartCoroutine(CheckPing2());
            }
        }
    }
Exemple #4
0
 void AddPlayer(string pname, NetworkViewID id)
 {
     if (currconn > 0)
     {
         for (int i = 0; i < MAX_PLAYERS; i++)
         {
             if (net_players[i] == null)
             {
                 continue;
             }
             if (string.Compare(net_players[i].name, pname, true) == 0)
             {
                 GetComponent <NetworkMenu>().CallError(id.owner, "Egyező játékos név!");
                 GetComponent <NetworkMenu>().plobj.GetComponent <MainScript>().SendCustomMessage(RPCMode.All, pname + " ki lett rúgva. (névegyezés)");
                 return;
             }
         }
     }
     //If no problems, recheck for empty slots
     for (byte i = 0; i < MAX_PLAYERS; i++)
     {
         if (net_players[i] == null)
         {
             net_players[i]       = new NetPl();
             net_players[i].id    = i;
             net_players[i].name  = pname;
             net_players[i].score = 0;
             net_players[i].plid  = id;
             net_players[i].ping  = Network.GetLastPing(net_players[i].plid.owner);
             networkView.RPC("SendPlSc2", RPCMode.Others, (int)i, pname, 0, net_players[i].ping);
             currconn++;
             break;
         }
     }
     networkView.RPC("GetScores", id.owner, MAX_PLAYERS);
     for (int i = 0; i < MAX_PLAYERS; i++)
     {
         if (net_players[i] != null)
         {
             networkView.RPC("SendPlSc", id.owner, i, net_players[i].name,
                             net_players[i].score, net_players[i].ping);
         }
     }
     networkView.RPC("UpdateSc", id.owner);
     ScoreUpdate();
 }
Exemple #5
0
 void SendScore(int id, string data, int data2, int data3)
 {
     if (net_players[id] == null)
     {
         net_players[id]    = new NetPl();
         net_players[id].id = (byte)id;
         currconn++;
     }
     //null not supported in RPC parameters
     if (data != "")
     {
         net_players[id].name = data;
     }
     if (data2 != -1)
     {
         net_players[id].score = data2;
     }
     if (data3 != -1)
     {
         net_players[id].ping = data3;
     }
     ScoreUpdate();
 }