コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (SceneManager.GetActiveScene().buildIndex == (int)SceneManagerHelper.SceneManagerEnum.LANGame &&
            game == null &&
            isLocalPlayer &&
            isServer)
        {
            RpcClearAllVariable();

            SpawnGame();
            string[] idPlayers = new string[lenght];
            string[] nickNames = new string[lenght];
            for (int i = 0; i < idPlayers.Length; i++)
            {
                if (LANPPH.GetLANPlayerArrayElement(i) != null)
                {
                    idPlayers[i] = LANPPH.GetLANPlayerArrayElement(i).GetIdPlayer();
                    nickNames[i] = LANPPH.GetLANPlayerArrayElement(i).GetNickName();
                    string pathToAvatar = Application.dataPath + @"/Resources/TempImages/" + idPlayers[i] + ".png";
                    RpcInitializeFrame(i, pathToAvatar, nickNames[i]);
                }
            }
            RpcSetSizeCamera(NM.numPlayers);
            game.StartGame(NM.numPlayers, idPlayers);
        }

        if (SceneManager.GetActiveScene().buildIndex == (int)SceneManagerHelper.SceneManagerEnum.LANGame &&
            isLocalPlayer)
        {
            CheckInputKey();
        }
    }
コード例 #2
0
    public void ResendAllImage()
    {
        for (int i = 0; i < LANPlayerPrefabHelper.ArrayLenght; i++)
        {
            if (LANPPH.GetLANPlayerArrayElement(i) != null)
            {
                if (File.Exists(Application.dataPath + PathToSaveTempAvatar + LANPPH.GetLANPlayerArrayElement(i).GetIdPlayer() + ".png"))
                {
                    Debug.Log(DateTime.Now.ToString("hh:mm:ss:ffff") + ": Отправка файла всем игрокам: " + Application.dataPath + PathToSaveTempAvatar + LANPPH.GetLANPlayerArrayElement(i).GetIdPlayer() + ".png");

                    LANPPH.GetLANPlayerArrayElement(i).LANPPL.SendImage(LANPPH.GetLANPlayerArrayElement(i).GetIdPlayer(),
                                                                        Application.dataPath + PathToSaveTempAvatar + LANPPH.GetLANPlayerArrayElement(i).GetIdPlayer() + ".png");
                }
            }
        }
    }