Beispiel #1
0
    bool IsConnectByFile()
    {
        if (File.Exists("udp"))
        {
            PhotonHandler.SetUpdMode();
        }


        if (File.Exists("johnconnect.txt"))
        {
            StreamReader t_objReader = new StreamReader("johnconnect.txt");
            serverAddress = t_objReader.ReadLine();
            PhotonHandler.ShowLog(string.Format("file exits:{0}", serverAddress));
            StartCoroutine(Connect());


            return(true);
        }



        Debug.Log("file not exist");

        return(false);
    }
Beispiel #2
0
    public void OnClick()
    {
        PlayerPrefs.SetString("lblServerNameS1", lblServerName.text);
        PlayerPrefs.SetString("NumTitleS1", NumTitle);
        //TD_info.setSelectServer(this.lblServerName.text);
        if (tcp == "1")      //设置逻辑服务器连接方式
        {
            PhotonHandler.SetUpdMode();
        }
        else
        {
            PhotonHandler.SetTcpMode();
        }

        PhotonHandler.SetLogicAddr(roomIP); //设置房间服务器地址
        if (rmtcp == "1")                   //设置房间服务器连接方式
        {
            PhotonHandler.roomConnectType = ExitGames.Client.Photon.ConnectionProtocol.Udp;
        }
        else
        {
            PhotonHandler.roomConnectType = ExitGames.Client.Photon.ConnectionProtocol.Tcp;
        }
        PhotonNetwork.SetPhoton();

        BtnGameManager.roomPlayerNum = rmMaxPlayer;      //设置房间服务器房间最大人数


        //	int playerMaxNum=(int) YuanUnityPhoton.GetYuanUnityPhotonInstantiate().dicBenefitsInfo[(byte)yuan.YuanPhoton.BenefitsType.PlayerMaxNum];
        int playerMaxNum = (int)YuanUnityPhoton.dicBenefitsInfo[(byte)yuan.YuanPhoton.BenefitsType.PlayerMaxNum];

        if (serverActorNum < playerMaxNum)
        {
            if (!MainMenuManage.my.Equals(null))
            {
                MainMenuManage.my.Connect(this.applicationName, "47.92.130.102", this.applicationHost, isFastBtn, this.lblServerName.text);
            }
        }
        else
        {
            mainMenuManage.warnings.warningAllEnter.Show(StaticLoc.Loc.Get("info358"), StaticLoc.Loc.Get("info655"));
        }
    }