Example #1
0
    //以下函数为,外部调用Unity函数
    void Load(string info)
    {
        GlobalDebug.Addline("APP2Unity ReceiveInfo:" + info);
        Debug.Log("APP2Unity ReceiveInfo:" + info);

        appProjectInfo = JsonUtility.FromJson <AppProjectInfo>(info);
        serverProjectInfo.LoadServerProjectInfo(appProjectInfo.dataServer, appProjectInfo.dataServer, appProjectInfo.projectID, appProjectInfo.sceneLoadMode);
    }
Example #2
0
    //添加验证环节(IOS版SDK使用)
    void LoadUnity(string info)
    {
        appProjectInfo = JsonUtility.FromJson <AppProjectInfo>(info);

        if (EncodeDateKEY(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day) == appProjectInfo.checkKey)
        {
            Load(info);
        }
        else
        {
            Debug.Log("CheckKey 校验不一致!");
        }
    }
Example #3
0
    //以下函数为,外部调用Unity函数
    void Load(string info)
    {
        GlobalDebug.Addline("APP2Unity ReceiveInfo:" + info);
        Debug.Log("APP2Unity ReceiveInfo:" + info);

        appProjectInfo = JsonUtility.FromJson <AppProjectInfo>(info);

        string[] ipS = appProjectInfo.remoteServer.Split('.');
        if (ipS.Length == 4)
        {
            byte[] ipBytes = new byte[] { (byte)int.Parse(ipS[0]), (byte)int.Parse(ipS[1]), (byte)int.Parse(ipS[2]), (byte)int.Parse(ipS[3]) };
            MFQTcpClient.remoteIPAddress = new System.Net.IPAddress(ipBytes);
        }
        else
        {
            Debug.LogError("RemoteServerIPAdressError!");
        }

        int remoteUserIDLength = appProjectInfo.remoteUserID.Length;
        int userIDLenght       = appProjectInfo.userID.Length;

        //必须使用10位长度,才能正确建立房间
        if (remoteUserIDLength > 10)
        {
            appProjectInfo.remoteUserID = appProjectInfo.remoteUserID.Substring(remoteUserIDLength - 10, 10);
        }

        if (userIDLenght > 10)
        {
            appProjectInfo.userID = appProjectInfo.userID.Substring(userIDLenght - 10, 10);
        }

        if (remoteUserIDLength < 10)
        {
            //Debug.Log(remoteUserIDLength);
            appProjectInfo.remoteUserID = appProjectInfo.remoteUserID.PadLeft(10, '0');
        }

        if (userIDLenght < 10)
        {
            //Debug.Log(remoteUserIDLength);
            appProjectInfo.userID = appProjectInfo.userID.PadLeft(10, '0');
        }

        appProjectInfo.userID = appProjectInfo.userID.Remove(0, 1).PadLeft(10, '0');

        if (appProjectInfo.userType == "1")
        {
            remoteManger.runAtType      = RemoteManger.RunAtType.Master;
            appProjectInfo.remoteUserID = appProjectInfo.userID.Substring(4, 6).PadLeft(10, '0');
        }
        else if (appProjectInfo.userType == "2")
        {
            remoteManger.runAtType      = RemoteManger.RunAtType.Slave;
            appProjectInfo.remoteUserID = appProjectInfo.remoteUserID.Substring(4, 6).PadLeft(10, '0');
        }
        remoteManger.userID   = appProjectInfo.userID;
        remoteManger.remoteID = appProjectInfo.remoteUserID;

        serverProjectInfo.LoadServerProjectInfo(appProjectInfo.dataServer, appProjectInfo.dataServer, appProjectInfo.projectID, appProjectInfo.sceneLoadMode);
    }