コード例 #1
0
    IEnumerator Request(string path, System.Action <string> OnComplete)
    {
//		Debug.Log("KeFu :  path ==  "+path);
        WWW www       = new WWW(path);
        int serlizeID = (int)NetMsgMng.CreateNewSerializeID();

        GameCenter.msgLoackingMng.UpdateSerializeList(serlizeID, true);
        yield return(www);

        if (www.isDone)
        {
//			Debug.Log("Url   +++  " + www.url);
            if (!string.IsNullOrEmpty(www.error))
            {
                Debug.LogError("下载客服数据失败www.error :" + www.error);
                OnComplete(string.Empty);
            }
            else
            {
                GameCenter.msgLoackingMng.UpdateSerializeList(serlizeID, false);

                if (!string.IsNullOrEmpty(www.text))
                {
                    string content = www.text;
                    OnComplete(content);
                }
                else
                {
                    Debug.LogError("下载客服数据的内容不对www.text为 :" + www.text);
                    OnComplete(string.Empty);
                }
            }
        }
//		www.Dispose();
    }
コード例 #2
0
ファイル: LoginMng.cs プロジェクト: atom-chen/tianyu
    /// <summary>
    /// 询问队列信息
    /// </summary>
    /// <param name="_loginPID"></param>
    public void C2S_AskQueue(uint _loginPID)
    {
        CurSelectPlayerID = _loginPID;
        pt_req_net_a003 msg = new pt_req_net_a003();

        msg.uid = _loginPID;
        msg.seq = NetMsgMng.CreateNewSerializeID();
        NetMsgMng.SendMsg(msg);
    }
コード例 #3
0
ファイル: LoginMng.cs プロジェクト: atom-chen/tianyu
    /// <summary>
    /// 向服务端发送登录的请求   by吴江
    /// </summary>
    public void C2S_Login()
    {
        pt_login_a001 msg = new pt_login_a001();

        msg.seq      = NetMsgMng.CreateNewSerializeID();
        msg.account  = Login_Name;
        msg.password = Login_Word;
        msg.platform = (byte)(GameCenter.instance.isPlatform?1:0);        //这里的平台标识,只是与后台的约定。与SDK的平台类型无关 By邓成
        NetMsgMng.SendMsg(msg);
    }
コード例 #4
0
ファイル: SelectServerWnd.cs プロジェクト: atom-chen/tianyu
    IEnumerator GetServer(int _page)
    {
        string sourceId = "201";
        string version  = "1.4.1";

        if (GameCenter.instance.isPlatform)
        {
            sourceId = LynSdkManager.Instance.GetSourceId();
            version  = LynSdkManager.Instance.GetAppVersion();
        }
        if (sourceId == "")
        {
            sourceId = "0";
        }
        long   dateTime   = DateTime.Now.Ticks / 10000;
        string sign       = string.Format(SystemSettingMng.PAGE_SERVER_HTTP_ADDRESS_PARAMETER, _page, sourceId, dateTime, version);
        string signResult = GameHelper.SignString(sign);
        //Debug.Log("PAGE_SERVER signResult:" + signResult);
        string wwwText = string.Empty;

        if (GameCenter.instance.isInsideTest)
        {
            wwwText = string.Format(SystemSettingMng.PAGE_SERVER_HTTP_ADDRESS, _page, sourceId, dateTime, version, signResult);
        }
        else
        {
            wwwText = string.Format(SystemSettingMng.PAGE_SERVER_HTTP_ADDRESS, _page, sourceId, dateTime, version, signResult);
        }
        //NGUIDebug.Log("wwwText" + wwwText);
        WWW www       = new WWW(wwwText);
        int serlizeID = (int)NetMsgMng.CreateNewSerializeID();

        GameCenter.msgLoackingMng.UpdateSerializeList(serlizeID, true);
        yield return(www);

        if (www.isDone)
        {
            Debug.Log("www.text:" + www.text);
            //NGUIDebug.Log("-isDone--www" + www.text);
            if (!www.text.Contains("state"))
            {
                //NGUIDebug.Log("-result-11-");
            }
            else
            {
                //NGUIDebug.Log("-result-222-");
                GameCenter.msgLoackingMng.UpdateSerializeList(serlizeID, false);
                GameCenter.loginMng.ShowServerList(www.text);
            }
        }
    }
コード例 #5
0
ファイル: LoginMng.cs プロジェクト: atom-chen/tianyu
    public void S2C_OnGetQueueEnd(Pt _info)
    {
        pt_net_info_a105 pt = _info as pt_net_info_a105;

        if (pt != null)
        {
            Login_IP              = pt.ip;
            Login_port            = (int)pt.port;
            CurQueueKey           = pt.key;
            isActiveDisconnection = true;
            NetMsgMng.ConectClose();
            LoginInSerlizeID = NetMsgMng.CreateNewSerializeID();
        }
    }
コード例 #6
0
    /// <summary>
    /// 进副本
    /// </summary>
    public void C2S_ToCopyItem(int id, int type)
    {
        if (CopyType == CopysType.ONESCOPY)
        {
            againCopyID  = id;
            againSceneID = type;
        }
        pt_req_fly_single_many_copy_d456 info = new pt_req_fly_single_many_copy_d456();

        info.seq        = NetMsgMng.CreateNewSerializeID();
        info.copy_id    = id;
        info.scene_type = type;
        NetMsgMng.SendMsg(info);
    }
コード例 #7
0
ファイル: SelectServerWnd.cs プロジェクト: atom-chen/tianyu
    /// <summary>
    /// 获取玩家登陆过的服务器列表
    /// </summary>
    IEnumerator GetMyServer()
    {
        string sourceId = "201";
        string version  = "3.6.5";

        if (GameCenter.instance.isPlatform)
        {
            sourceId = LynSdkManager.Instance.GetSourceId();
            version  = LynSdkManager.Instance.GetAppVersion();
        }
        if (sourceId == "")
        {
            sourceId = "0";
        }
        long   dateTime   = DateTime.Now.Ticks / 10000;
        string lastID     = GameCenter.loginMng.SDKUserID;
        string sign       = string.Format(SystemSettingMng.MY_SERVER_HTTP_ADDRESS_PARAMETER, sourceId, dateTime, lastID, version);
        string signResult = GameHelper.SignString(sign);
        //Debug.Log("MY_SERVER signResult:" + signResult);
        string wwwText = string.Empty;

        if (GameCenter.instance.isInsideTest)
        {
            wwwText = string.Format(SystemSettingMng.MY_SERVER_HTTP_ADDRESS, sourceId, dateTime, lastID, version, signResult);
        }
        else
        {
            wwwText = string.Format(SystemSettingMng.MY_SERVER_HTTP_ADDRESS, sourceId, dateTime, lastID, version, signResult);
        }
        WWW www       = new WWW(wwwText);
        int serlizeID = (int)NetMsgMng.CreateNewSerializeID();

        GameCenter.msgLoackingMng.UpdateSerializeList(serlizeID, true);
        yield return(www);

        if (www.isDone)
        {
            Debug.Log("www.text:" + www.text);
            if (!www.text.Contains("state"))
            {
            }
            else
            {
                GameCenter.msgLoackingMng.UpdateSerializeList(serlizeID, false);
                SetMyServerInfo(www.text);
            }
        }
    }
コード例 #8
0
ファイル: LoginStage.cs プロジェクト: atom-chen/tianyu
 protected void EnterPassWordState(fsm.State _from, fsm.State _to, fsm.Event _event)
 {
     GameCenter.cameraMng.BlackCoverAll(false);
     GameCenter.curGameStage = this;
     Regist();
     CurLoginState = EventType.PASS_WORD;
     if (GameCenter.instance.IsConnected)
     {
         NetMsgMng.ConectClose();
     }
     if (GameCenter.instance.isPlatform && !GameCenter.instance.isSwitchAccount)//此方法从GameCenter放到此处,解决SDK登陆框导致UI放大问题  By邓成
     {
         LynSdkManager.Instance.UsrLogin(GameCenter.instance.gameObject.name, "OnLoginResult");
         GameCenter.instance.platformLoginSeralizeID = (int)NetMsgMng.CreateNewSerializeID();
         GameCenter.msgLoackingMng.UpdateSerializeList(GameCenter.instance.platformLoginSeralizeID, true);
     }
 }
コード例 #9
0
ファイル: LoginMng.cs プロジェクト: atom-chen/tianyu
    /// <summary>
    /// 请求建立角色
    /// </summary>
    /// <param name="_prof"></param>
    public void C2S_ReqCreateChar(int _prof, string _name)
    {
        if (_name.Contains(" "))
        {
            GameCenter.messageMng.AddClientMsg(399);
            return;
        }
        if (!CheckBadWord(_name))
        {
            return;
        }

        pt_req_create_usr_a006 msg = new pt_req_create_usr_a006();

        msg.seq  = NetMsgMng.CreateNewSerializeID();
        msg.prof = (uint)_prof;
        msg.name = _name;
        NetMsgMng.SendMsg(msg);
    }
コード例 #10
0
ファイル: LoginStage.cs プロジェクト: atom-chen/tianyu
    IEnumerator GetServer(int _page)
    {
        string sourceId = "201";
        string version  = "1.4.1";

        if (GameCenter.instance.isPlatform)
        {
            sourceId = LynSdkManager.Instance.GetSourceId();
            version  = LynSdkManager.Instance.GetAppVersion();
            //NGUIDebug.Log("version11111111:" + version);
            //NGUIDebug.Log("sourceId:" + sourceId);
        }
        if (sourceId == "")
        {
            sourceId = "0";
        }
        long   dateTime   = DateTime.Now.Ticks / 10000;
        string signString = "GetServerInfo" + sourceId + dateTime + "LynSDK";
        int    lastID     = 0;

        if (PlayerPrefs.HasKey("LastID"))
        {
            //lastID = GameCenter.loginMng.Login_ID;
        }
        string wwwText = string.Empty;

        if (GameCenter.instance.isPlatform)
        {
            if (GameCenter.instance.isInsideTest)
            {
                wwwText = string.Format("http://192.168.1.249:8080/game_gm/rpc/chooseServer?act=GetServerInfo&sourceId={0}&time={1}&pg={2}&sign={3}&svrid={4}&versions={5}", sourceId, dateTime, _page, StrToMD5(signString), lastID, version);
            }
            else
            {
                wwwText = string.Format("http://gm.lynlzqy.com:8080/game_gm/rpc/chooseServer?act=GetServerInfo&sourceId={0}&time={1}&pg={2}&sign={3}&svrid={4}&versions={5}", sourceId, dateTime, _page, StrToMD5(signString), lastID, version);
            }
        }
        else//电脑不传版本号
        {
            if (GameCenter.instance.isInsideTest)
            {
                wwwText = string.Format("http://192.168.1.249:8080/game_gm/rpc/chooseServer?act=GetServerInfo&sourceId={0}&time={1}&pg={2}&sign={3}&svrid={4}", sourceId, dateTime, _page, StrToMD5(signString), lastID);
            }
            else
            {
                wwwText = string.Format("http://gm.lynlzqy.com:8080/game_gm/rpc/chooseServer?act=GetServerInfo&sourceId={0}&time={1}&pg={2}&sign={3}&svrid={4}", sourceId, dateTime, _page, StrToMD5(signString), lastID);
            }
        }
        //NGUIDebug.Log("wwwText" + wwwText);
        WWW www = new WWW(wwwText);

        startGetServerTime     = Time.time;
        GetServerInfoSerlizeID = (int)NetMsgMng.CreateNewSerializeID();
        GameCenter.msgLoackingMng.UpdateSerializeList(GetServerInfoSerlizeID, true);
        yield return(www);

        if (www.isDone)
        {
            //NGUIDebug.Log("-isDone--www" + www.text);
            firstAsk = true;
            if (!www.text.Contains("result"))
            {
                //NGUIDebug.Log("-result-11-");
            }
            else
            {
                //NGUIDebug.Log("-result-222-");
                GameCenter.msgLoackingMng.UpdateSerializeList(GetServerInfoSerlizeID, false);
                GetServerInfoSerlizeID = 0;
                GameCenter.loginMng.ShowServerList(www.text);
            }
        }
    }
コード例 #11
0
ファイル: SelectServerWnd.cs プロジェクト: atom-chen/tianyu
    IEnumerator CheckWhiteList()
    {
        string sourceId = "0";

        dateTime = DateTime.Now.Ticks / 10000;
        if (GameCenter.instance.isPlatform)
        {
            sourceId = LynSdkManager.Instance.GetSourceId();
        }
        int    serverID   = int.Parse(GameCenter.loginMng.LoginServerID);
        string userID     = GameCenter.loginMng.SDKUserID;
        string sign       = string.Format(SystemSettingMng.WHITE_LIST_HTTP_ADDRESS_PARAMETER, sourceId, serverID, dateTime);
        string signResult = GameHelper.SignString(sign);
        //Debug.Log("WHITE_LIST signResult:" + signResult);
        string wwwText = string.Empty;

        if (GameCenter.instance.isInsideTest)
        {
            wwwText = string.Format(SystemSettingMng.WHITE_LIST_HTTP_ADDRESS, sourceId, serverID, dateTime, signResult);
        }
        else
        {
            wwwText = string.Format(SystemSettingMng.WHITE_LIST_HTTP_ADDRESS, sourceId, serverID, dateTime, signResult);
        }
        WWW www = new WWW(wwwText);

        loginSeralizedID = (int)NetMsgMng.CreateNewSerializeID();
        GameCenter.msgLoackingMng.UpdateSerializeList(loginSeralizedID, true);
        yield return(www);

        GameCenter.msgLoackingMng.UpdateSerializeList(loginSeralizedID, false);
        Debug.Log("www.text:" + www.text);
        LitJson.JsonData jsonData = LitJson.JsonMapper.ToObject(www.text);
        if (www.text.Contains("state"))
        {
            if ((int)jsonData["state"] == 1)
            {
                GameCenter.loginMng.Login_ID   = (jsonData["data"]["svrID"]).ToString();
                GameCenter.loginMng.Quaue_IP   = (string)jsonData["data"]["ip"];
                GameCenter.loginMng.Quaue_port = int.Parse((string)jsonData["data"]["port"]);
                if (GameCenter.instance.IsConnected)
                {
                    GameCenter.loginMng.C2S_Login();
                }
                else
                {
                    GameCenter.loginMng.C2S_ConectQueueServer(GameCenter.loginMng.Quaue_IP, GameCenter.loginMng.Quaue_port);
                }
            }
            else
            {
                GameCenter.messageMng.AddClientMsg(358);//验证不成功就提示维护中

                /*
                 *              switch ((LoginBackType)((int)jsonData["state"]))
                 *              {
                 *              case LoginBackType.MAINTAIN:
                 *                      GameCenter.messageMng.AddClientMsg(358);
                 *                      break;
                 *              case LoginBackType.SIGNERROR:
                 *                      GameCenter.messageMng.AddClientMsg(359);
                 *                      break;
                 *              case LoginBackType.MISSING:
                 *                      GameCenter.messageMng.AddClientMsg(359);
                 *                      break;
                 *              case LoginBackType.NOSERVERID:
                 *                      GameCenter.messageMng.AddClientMsg(359);
                 *                      break;
                 *              }
                 */
            }
        }
    }