Пример #1
0
    void Awake()
    {
        if (GameMovieCtrl.GetInstance() != null &&
            GameMovieCtrl.GetInstance().GameLinkSt == GameMovieCtrl.GameLinkEnum.NO_LINK)
        {
            return;
        }

        if (!pcvr.bIsHardWare)
        {
            MasterServerIp = HandleJson.GetInstance().ReadFromFilePathXml(MasterServerIpFile, "MasterServerIp");
            if (MasterServerIp == null || MasterServerIp == "")
            {
                MasterServerIp = "192.168.0.2";
                HandleJson.GetInstance().WriteToFilePathXml(MasterServerIpFile, "MasterServerIp", MasterServerIp);
            }
        }
        Debug.Log("MasterServerIp " + MasterServerIp);

        if (MasterServerIp == Network.player.ipAddress)
        {
            XKMasterServerCtrl.CheckMasterServerIP();
        }

        MasterServer.ipAddress   = MasterServerIp;
        Network.natFacilitatorIP = MasterServerIp;
    }
Пример #2
0
    /// <summary>
    /// 初始化.
    /// </summary>
    void Init()
    {
        if (!pcvr.bIsHardWare)
        {
            MasterServerIp = HandleJson.GetInstance().ReadFromFilePathXml(MasterServerIpFile, "MasterServerIp");
            if (MasterServerIp == null || MasterServerIp == "")
            {
                MasterServerIp = "192.168.0.2";
                HandleJson.GetInstance().WriteToFilePathXml(MasterServerIpFile, "MasterServerIp", MasterServerIp);
            }
        }
        Debug.Log("MasterServerIp " + MasterServerIp);

        if (MasterServerIp == Network.player.ipAddress)
        {
            XKMasterServerCtrl.CheckMasterServerIP();
        }

        //初始化MasterServer.
        MasterServer.ipAddress   = MasterServerIp;
        Network.natFacilitatorIP = MasterServerIp;

        if (mRequestMasterServer != null)
        {
            mRequestMasterServer.Init();
        }
    }
Пример #3
0
    void Start()
    {
        FreeModeCtrl.CheckIsHavePlayerIp();
        if (FreeModeCtrl.IsServer)
        {
            bIsLinkServer = true;
        }

        if (pcvr.bIsHardWare && !pcvr.IsTestGetInput)
        {
            if (ip != ServerPortIP)
            {
                ip = ServerPortIP;
            }
            //ip = "192.168.0.53"; //test.
        }
        else
        {
            ip = HandleJson.GetInstance().ReadFromFilePathXml(IpFile, "SERVER_IP");
            if (ip == null)
            {
                ip = "192.168.0.2";
                HandleJson.GetInstance().WriteToFilePathXml(IpFile, "SERVER_IP", ip);
            }
        }
        //ScreenLog.Log("serverIP is " + ip);

        //Debug.Log("ip "+ip+", ipAddress "+Network.player.ipAddress+", IsServer "+FreeModeCtrl.IsServer);
        if (FreeModeCtrl.IsHavePlayerIp && FreeModeCtrl.IsServer && ip == Network.player.ipAddress)
        {
            XKMasterServerCtrl.CheckMasterServerIP();
        }
        MasterServer.ipAddress   = ip;
        Network.natFacilitatorIP = ip;
    }
Пример #4
0
    void Awake()
    {
        if (pcvr.bIsHardWare)
        {
            ip = ServerPortIP;
        }
        else
        {
            ip = HandleJson.GetInstance().ReadFromFilePathXml(IpFile, "SERVER_IP");
            if (ip == null)
            {
                ip = "192.168.0.2";
                HandleJson.GetInstance().WriteToFilePathXml(IpFile, "SERVER_IP", ip);
            }
        }

        if (ip == Network.player.ipAddress &&
            GameTypeCtrl.AppTypeStatic == AppGameType.LianJiServer)
        {
            XKMasterServerCtrl.CheckMasterServerIP();
        }
        MasterServer.ipAddress   = ip;
        Network.natFacilitatorIP = ip;

        NpcObjList = new List <GameObject>();
    }
    void Awake()
    {
        Instance       = this;
        IsTankVRStatic = IsTankVR;
        if (pcvr.bIsHardWare)
        {
            ServerIp = NetworkServerNet.ServerPortIP;
        }
        else
        {
            ServerIp = HandleJson.GetInstance().ReadFromFilePathXml(NetworkServerNet.IpFile, "SERVER_IP");
            if (ServerIp == null)
            {
                ServerIp = "192.168.0.2";
                HandleJson.GetInstance().WriteToFilePathXml(NetworkServerNet.IpFile, "SERVER_IP", ServerIp);
            }
        }

        if (ServerIp == Network.player.ipAddress)
        {
            //server port -> 1P.
            if (IsTestWorkNet)
            {
                if (IsTestClientPort)
                {
                    PlayerPCState = PlayerEnum.PlayerTwo;
                }
                else
                {
                    PlayerPCState = PlayerEnum.PlayerOne;
                }
            }
            else
            {
                PlayerPCState = PlayerEnum.PlayerOne;
            }
            XKMasterServerCtrl.CheckMasterServerIP();
        }
        else
        {
            //client port -> 2P.
            PlayerPCState = PlayerEnum.PlayerTwo;
        }
        SetAppTypeVal(AppGameType.LianJiServer);

        if (AppTypeStatic == AppGameType.LianJiServer)
        {
            //IsServer = true;
            DelayCheckServerIP();
        }
    }