private static void ProcessCityBuildingError(eErrorCode eErr) { // 错误信息 switch (eErr) { case eErrorCode.SOME_SOLIDER_IS_UPGRADING: // 升级士兵队列 只能唯一 UIUtil.ShowErrMsgFormat("MSG_CITY_TRAIN_SOLDIER_BUSY"); break; case eErrorCode.SOLIDER_LEVEL_REACH_MAX: // 士兵等级以达到最大值 UIUtil.ShowErrMsgFormat("UI_CITY_BUILDING_TRAIN_MAX"); break; case eErrorCode.NO_ENOUGH_WOOD: // 没有足够的木材 UIUtil.ShowErrMsgFormat("MSG_CITY_BUILDING_WOOD_LIMIT"); break; case eErrorCode.NO_ENOUGH_STONE: // 石材不够 UIUtil.ShowErrMsgFormat("MSG_CITY_BUILDING_STONE_LIMIT"); break; case eErrorCode.RESOURCE_BYOND_MAX_CAPACITY: // 资源已满 UIUtil.ShowMsgFormat("MSG_CITY_BUILDING_FULL"); break; } }
protected override void Reset() { m_eErrorCode = eErrorCode.Error; m_strToken = string.Empty; m_strIP = string.Empty; m_nPort = 0; }
public void Start() { this.lastErr = eErrorCode.LOADING; UnityEngine.Debug.Log("starting...."); this.m_timer.Start(); this.Act(new PlayerExecutable(this.CreateLogin)); GameController.LogToScreen("Client create login"); }
public void LoginWeb() { this.InnerPwd = this.GrenateInnerPassword(); string s = this.m_account + "," + Md5(this.Password) + "," + this.InnerPwd + "," + this.NickName; MemoryStream output = new MemoryStream(); string requestUriString = ""; using (BinaryWriter writer = new BinaryWriter(output)) { writer.Write((short)DateTime.UtcNow.Year); writer.Write((byte)DateTime.UtcNow.Month); writer.Write((byte)DateTime.UtcNow.Date.Day); writer.Write((byte)DateTime.UtcNow.Hour); writer.Write((byte)DateTime.UtcNow.Minute); writer.Write((byte)DateTime.UtcNow.Second); writer.Write(Encoding.UTF8.GetBytes(s)); // Debug.Log(Encoding.UTF8.GetString(output.ToArray(), 7, output.ToArray().Length - 7)); byte[] inArray = Rsa(output.ToArray()); requestUriString = string.Format("{0}?p={1}&v=0", ConfigMgr.LoginUrl, HttpUtility.UrlEncode(Convert.ToBase64String(inArray))); Debug.Log(requestUriString); } string str3 = ""; using (WebResponse response = WebRequest.Create(requestUriString).GetResponse()) { using (StreamReader reader = new StreamReader(response.GetResponseStream())) { str3 = reader.ReadLine(); } } if (str3.IndexOf("true") > 0) { Console.WriteLine("{0} web login success....", this.m_account); this.m_state = ePlayerState.WebLogined; if (!base.Connect()) { this.lastErr = eErrorCode.SERVER_FAILED; Console.WriteLine("{0} connect to server failed...", this.m_account); this.m_state = ePlayerState.Stopped; this.LastError = "Kh\x00f4ng thể kết nối tới server."; } else { Console.WriteLine("{0} socket connected....", this.m_account); if (this.m_state == ePlayerState.WebLogined) { // this.LoginSocket(); this.Act(new PlayerExecutable(this.LoginSocket)); } } } else { this.lastErr = eErrorCode.USER_FAILED; this.m_state = ePlayerState.Stopped; this.LastError = "Lỗi dữ liệu User"; } }
protected override void Reset() { m_eErrorCode = eErrorCode.Error; if (null != m_gameconst) { using (m_gameconst) { } m_gameconst = null; } }
protected override void Reset() { m_eErrorCode = eErrorCode.Error; if (null != m_list) { m_list.Clear(); m_list = null; } }
public override void Process() { // 프로토콜 RQ using (var recvfmProtocol = new PT_CG_Lord_CreateLord_RQ()) { // 프로토콜 Read recvfmProtocol.Deserialize(m_recvPacket); // 프로토콜 RS using (var sendfmProtocol = new PT_CG_Lord_CreateLord_RS()) { eErrorCode err = eErrorCode.Success; long accid = 0; // db get token using (var db = new urq_GetToken(eRedis.Token)) { db.i_strToken = recvfmProtocol.m_strToken; err = db.Execute(); accid = db.o_biAccID; if (eErrorCode.Success != err) { sendfmProtocol.m_eErrorCode = err; m_session.SendPacket(sendfmProtocol); return; } } string recvName = recvfmProtocol.m_strName.Trim(); err = CheckName(recvName); if (eErrorCode.Success != err) { sendfmProtocol.m_eErrorCode = err; m_session.SendPacket(sendfmProtocol); return; } // 영주 생성 using (var db = new urq_CreateLord(eRedis.Game)) { db.i_strName = recvName; db.i_biAccID = accid; err = db.Execute(); if (eErrorCode.Success == err) { SyncMainRoute.Instance.Push(new Msg_Delegate_CreateLord_RQ(m_server, m_session, db.o_lord)); } else { sendfmProtocol.m_eErrorCode = err; m_session.SendPacket(sendfmProtocol); } } } } }
public void CreateLogin() { this.lastErr = eErrorCode.LOADING; UnityEngine.Debug.Log("Create Login"); //string str = DateTime.Now.ToFileTime().ToString(); string str = "132178654824148372"; string requestUriString = string.Format("{0}?content={1}", ConfigMgr.CreateLoginUrl, HttpUtility.UrlEncode(this.m_account + "|" + this.Password + "|" + str + "|" + Md5(this.m_account + this.Password + str + ConfigMgr.Md5Key))); string str3 = ""; using (WebResponse response = WebRequest.Create(requestUriString).GetResponse()) { using (StreamReader reader = new StreamReader(response.GetResponseStream())) { str3 = reader.ReadLine(); } } if (str3 == "0") { this.m_state = ePlayerState.CreateLogined; string xml = ""; using (WebResponse response2 = WebRequest.Create(string.Format("{0}?username={1}", ConfigMgr.LoginSelectList, this.m_account)).GetResponse()) { using (StreamReader reader2 = new StreamReader(response2.GetResponseStream())) { xml = reader2.ReadToEnd(); } } UnityEngine.Debug.Log("XXX" + xml); GameController.LogToScreen("XXX" + xml); if (xml.IndexOf("NickName") > 0) { XmlDocument document = new XmlDocument(); document.LoadXml(xml); XmlNodeList elementsByTagName = document.GetElementsByTagName("Item"); for (int i = 0; i < elementsByTagName.Count; i++) { this.NickName = elementsByTagName[i].Attributes["NickName"].Value; } } this.LoginWeb(); if (lastErr == eErrorCode.LOADING) { lastErr = eErrorCode.DONE; } //this.Act(new PlayerExecutable(this.LoginWeb)); } else { this.m_state = ePlayerState.Stopped; lastErr = eErrorCode.LOGIN_FAILED; this.LastError = "CreateLogin Failed!"; GameController.LogToScreen("CreateLogin Failed"); } }
public override void Deserialize(Packet p) { base.Deserialize(p); m_eErrorCode = (eErrorCode)p.ReadInt(); if (eErrorCode.Success != m_eErrorCode) { return; } }
private static ResponseData GetNoResponseDataModel(eErrorCode code) { return(new ResponseData() { errorCode = new ErrorCode() { errorCode = (int)code }, userDataList = { } }); }
public override void Deserialize(Packet p) { base.Deserialize(p); m_eErrorCode = (eErrorCode)p.ReadInt(); if (eErrorCode.Success != m_eErrorCode) { return; } m_rdItems = new List <rdItem>(); m_rdItems.Read(ref p); }
public override void Deserialize(Packet p) { base.Deserialize(p); m_eErrorCode = (eErrorCode)p.ReadInt(); if (m_eErrorCode != eErrorCode.Success) { return; } m_nMyRank = p.ReadLong(); m_list = new List <fmRanker>(); m_list.Read(ref p); }
public override void Deserialize(Packet p) { base.Deserialize(p); m_eErrorCode = (eErrorCode)p.ReadInt(); if (eErrorCode.Success != m_eErrorCode) { return; } m_strToken = p.ReadString(); m_strIP = p.ReadString(); m_nPort = p.ReadInt(); }
public override void Deserialize(Packet p) { base.Deserialize(p); m_eErrorCode = (eErrorCode)p.ReadInt(); if (m_eErrorCode != eErrorCode.Success) { return; } m_gameconst = new fmGameConst(); m_gameconst.Read(ref p); }
private static void ProcessLoginError(eErrorCode eErr) { switch (eErr) { // 账号登录 case eErrorCode.USERNAME_REPEAT: // 账号名重复 UIUtil.ShowErrMsgFormat("MSG_LOGIN_ACCOUNT_REPEAT"); break; case eErrorCode.USER_NAME_NO_EXIST: UIUtil.ShowErrMsgFormat("MSG_LOGIN_USER_NAME_NOT_EXIST"); break; } }
private static void ProcessCommonError(eErrorCode eErr) { // 错误信息 switch (eErr) { case eErrorCode.NO_ENOUGH_GOLD: // 没有足够的黄金 UIUtil.ShowErrMsgFormat("MSG_CITY_BUILDING_MONEY_LIMIT"); break; case eErrorCode.NO_ENOUGH_DIAMOND: // 没有足够的钻石 UIUtil.ShowErrMsgFormat("MSG_CITY_BUILDING_GOLD_LIMIT"); break; } }
public eErrorCode Equip(int selectSlot, int lordLv) { eErrorCode err = CheckSlot(selectSlot); if (eErrorCode.Success != err) { return(err); } rdItem selectItem = m_rdItems.Find(x => x.Slot == selectSlot); if (null == selectItem) { Logger.Error("ItemInventory Equip: item == null Slot {0}", selectSlot); return(eErrorCode.Auth_PleaseLogin); } if (lordLv < selectItem.Lv) { return(eErrorCode.Item_NotEnouhgLv); } if (false == m_dicEquip.ContainsKey(selectItem.Parts)) { m_dicEquip.Add(selectItem.Parts, selectSlot); } else { int oldSlot = m_dicEquip[selectItem.Parts]; rdItem oldItem = m_rdItems.Find(x => x.Slot == oldSlot); if (null == oldItem) { Logger.Error("ItemInventory Equip: oldItem == null Slot {0}", selectSlot); return(eErrorCode.Auth_PleaseLogin); } oldItem.Equip = false; m_dicEquip[selectItem.Parts] = selectSlot; } //return eErrorCode.Item_FailToEquip; selectItem.Equip = true; m_bNewEquip = true; return(eErrorCode.Success); }
public override void Deserialize(Packet p) { base.Deserialize(p); m_eErrorCode = (eErrorCode)p.ReadInt(); if (eErrorCode.Success != m_eErrorCode) { return; } if (null == m_list) { m_list = new List <fmWorld>(); } m_list.Read(ref p); }
public static bool CheckErrorCode(int err, eCommand eCMD) { eErrorCode eErr = (eErrorCode)err; // 调试信息 if (err == 0) { Log.Info("{0} {1}", eCMD.ToString(), "成功"); return(true); } Log.Info("{0} {1} ({2}){3}", eCMD.ToString(), "失败", err, eErr.ToString()); ProcessLoginError(eErr); ProcessCityBuildingError(eErr); ProcessCommonError(eErr); return(false); }
public override void Deserialize(Packet p) { base.Deserialize(p); m_eErrorCode = (eErrorCode)p.ReadInt(); if (m_eErrorCode != eErrorCode.Success) { return; } Lv = p.ReadInt(); if (null == Items) { Items = new List <rdItem>(); } Items.Read(ref p); }
public ClientConnector(string account, string password, int interval, string ip, int port, ConnectorManager cManager) : base(ip, port, false, new byte[0x2000], new byte[0x2000]) { this.m_account = account; this.Password = password; this.m_isHost = false; this.m_timer = new System.Timers.Timer((double)interval); this.m_timer.Elapsed += new ElapsedEventHandler(this.m_timer_Elapsed); this.m_queue = new Queue <PlayerExecutable>(); this.m_state = ePlayerState.Init; this.m_lastSentTick = TickHelper.GetTickCount(); this.m_actionInterval = 0L; this.m_recvCount = 0; this.m_sentCount = 0; base.Strict = true; base.Encryted = true; this.connectorManager = cManager; this.SetHostIp(ip); this.lastErr = eErrorCode.DONE; //this.m_log = new StreamWriter(System.IO.File.Create(string.Format("./logs/{0}.log", account))); }
public override void Deserialize(Packet p) { base.Deserialize(p); m_eErrorCode = (eErrorCode)p.ReadInt(); if (eErrorCode.Success != m_eErrorCode) { return; } m_rdLordInfo = new rdLordInfo(); m_rdStat = new rdStat(); m_rdMission = new List <rdMission>(); m_rdMaps = new List <rdMap>(); m_missionBase = new rdMissionBase(); m_rdInDuns = new List <rdInDun>(); m_rdLordInfo.Read(ref p); m_rdStat.Read(ref p); m_rdMission.Read(ref p); m_rdMaps.Read(ref p); m_missionBase.Read(ref p); m_rdInDuns.Read(ref p); }
public PT_Server_ReadyToStart_RS() { m_eProtocolType = eProtocolType.PT_Server_ReadyToStart_RS; m_eErrorCode = eErrorCode.Error; }
// 错误消息提示 public static void KMS_MessageBox(eErrorCode err) { switch (err) { case eErrorCode.EStateErrorDBInstallFail: DevExpress.XtraEditors.XtraMessageBox.Show("初始化数据库失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorDBConnect: DevExpress.XtraEditors.XtraMessageBox.Show("连接数据库失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorDBBackup: DevExpress.XtraEditors.XtraMessageBox.Show("备份数据库失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorDBRestore: DevExpress.XtraEditors.XtraMessageBox.Show("恢复数据库失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorDBNotExist: DevExpress.XtraEditors.XtraMessageBox.Show("数据库出错!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorDBExist: DevExpress.XtraEditors.XtraMessageBox.Show("数据库已经存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorDBUserOrPin: DevExpress.XtraEditors.XtraMessageBox.Show("错误的用户名或密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorAddUser: DevExpress.XtraEditors.XtraMessageBox.Show("新增用户失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorUpdateUser: DevExpress.XtraEditors.XtraMessageBox.Show("修改用户失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorUserNotExist: DevExpress.XtraEditors.XtraMessageBox.Show("相应的用户不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorQueryUser: DevExpress.XtraEditors.XtraMessageBox.Show("查询户失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorInvalidArg: // 非法参数 DevExpress.XtraEditors.XtraMessageBox.Show("非法参数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.EStateErrorMemLittle: // 内存不足 DevExpress.XtraEditors.XtraMessageBox.Show("内存不足!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.SAR_INVALIDPARAMERR: //无效的参数 DevExpress.XtraEditors.XtraMessageBox.Show("SKF无效的参数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.SAR_APPLICATION_EXISTS: //应用已经存在 DevExpress.XtraEditors.XtraMessageBox.Show("SKF应用已经存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.OPE_ERR_DEV_NUMBER_ERR: DevExpress.XtraEditors.XtraMessageBox.Show("设备个数不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.OPE_ERR_DEV_NUMBER_ZERO: DevExpress.XtraEditors.XtraMessageBox.Show("未插入设备!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case eErrorCode.SAR_PIN_LEN_RANGE: DevExpress.XtraEditors.XtraMessageBox.Show("PIN码长度错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; default: DevExpress.XtraEditors.XtraMessageBox.Show("操作失败!错误码:" + err + "。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } }
public override void Deserialize(Packet p) { base.Deserialize(p); m_eErrorCode = (eErrorCode)p.ReadInt(); }
protected override void Reset() { m_eErrorCode = eErrorCode.Success; }
public PT_AC_Server_GetWorldList_RS() { m_eProtocolType = eProtocolType.PT_AC_Server_GetWorldList_RS; m_eErrorCode = eErrorCode.Error; }
public PT_Server_RegisterAtCenter_RS() { m_eProtocolType = eProtocolType.PT_Server_RegisterAtCenter_RS; m_eErrorCode = eErrorCode.Error; }
protected override void Reset() { m_eErrorCode = eErrorCode.Error; }
protected override void Reset() { m_eErrorCode = eErrorCode.Error; m_strContents = string.Empty; }
public override void Process() { using (var recvfmProtocol = new PT_CA_Auth_Login_RQ()) { // 임시 코드 try { recvfmProtocol.Deserialize(m_recvPacket); } catch (Exception ex) { string str = ex.ToString(); using (var sendfmProtocol = new PT_CA_Auth_Login_RS()) { sendfmProtocol.m_eErrorCode = eErrorCode.Auth_cVerError; m_session.SendPacket(sendfmProtocol); } } using (var sendfmProtocol = new PT_CA_Auth_Login_RS()) { // 1. 클라 버전 체크 if (false == m_server.CheckCver(int.Parse(recvfmProtocol.m_strCver))) { sendfmProtocol.m_eErrorCode = eErrorCode.Auth_cVerError; m_session.SendPacket(sendfmProtocol); return; } // 2. 서버 버전 체크 if (false == m_server.CheckSver(recvfmProtocol.m_strSver)) { sendfmProtocol.m_eErrorCode = eErrorCode.Auth_sVerError; m_session.SendPacket(sendfmProtocol); return; } AuthServer authsvr = m_server as AuthServer; fmWorld gameWolrd = authsvr.m_managerWorld.Clone(); if (null == gameWolrd) { sendfmProtocol.m_eErrorCode = eErrorCode.Auth_CheckingServer; m_session.SendPacket(sendfmProtocol); return; } // 3. 로그인 using (var db = new usp_Login(m_server.dbAcc())) { db.i_strUniqueKey = recvfmProtocol.m_strUniqueKey; if (false == db.Execute()) { sendfmProtocol.m_eErrorCode = eErrorCode.Query_Fail; m_session.SendPacket(sendfmProtocol); return; } eErrorCode err = (eErrorCode)db.o_nResult; long accid = db.o_biAccID; string token = string.Empty; if (eErrorCode.Success == err) { token = m_server.GetToken(); using (var reidsQuery = new urq_UpdateAuthToken(eRedis.Token)) { reidsQuery.i_biAccID = accid; reidsQuery.i_gameServer = gameWolrd.m_nSequence; reidsQuery.i_strToken = token; err = reidsQuery.Execute(); } } // 4. output sendfmProtocol.m_eErrorCode = err; sendfmProtocol.m_strToken = token; sendfmProtocol.m_strIP = gameWolrd.m_strIP; sendfmProtocol.m_nPort = gameWolrd.m_nPort; m_session.SendPacket(sendfmProtocol); } } } }