public void Init() { LoginDataManager = new LoginDataManager(); MainDataManager = new MainDataManager(); RoomDataManager = new RoomDataManager(); UserData = new UserData(); }
public void DoPlatformPay(GameCmd.stCreatePlatOrderPropertyUserCmd_S msg , uint characterId, int characterlv, string roleName, string clanName, Pmd.ZoneInfo zoneInfo, string currencyName, float currencyRatio, table.RechargeDataBase rechargeDb) { LoginDataManager lg = DataManager.Manager <LoginDataManager>(); int payMoney = (int)rechargeDb.money; int fenPayMoney = payMoney * 100; string moneyStr = fenPayMoney.ToString(); string characterIDStr = characterId.ToString(); string gameOrder = msg.gameorder; string token = lg.LoginToken; string serverNo = lg.ServerNo; string serverName = lg.ServerName; string account = lg.Acount; string accountIDStr = lg.AccountID; string characterLvStr = characterlv.ToString(); if (Application.platform == RuntimePlatform.Android) { CommonSDKPlaform.Instance.Pay(msg, characterId, characterlv, roleName, clanName, zoneInfo, currencyName, currencyRatio, rechargeDb); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { ZqgameSDKController.Instance.Pay(moneyStr, account, characterIDStr, gameOrder, accountIDStr, token, rechargeDb.iosIAPId, serverNo, characterLvStr); } }
public override void Enter(object param) { Action callback = (Action)param; LoginDataManager ld = DataManager.Manager <LoginDataManager>(); if (ld.IsSDKLogin) { if (ld.IsLoginStateReady(LoginState.LGState_SDKReady)) { ld.DoLoginStep(LoginSteps.LGS_Platform); } else { WaitPanelShowData waitData = new WaitPanelShowData(); waitData.type = WaitPanelType.Login; waitData.cdTime = 20; waitData.des = "SDK授权中..."; waitData.timeOutDel = RequestTimeOut; waitData.useBoxMask = false; waitData.showTimer = false; DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData, panelShowAction: (pb) => { CoroutineMgr.Instance.DelayInvokeMethod(0, () => { ld.StartAuthorize(); }, true); }); } } else { ld.DoLoginStep(LoginSteps.None); } }
public MainWindowViewModel() { ChangeServerCommand = new CommandHandler(ChangeServer); ConfirmServerCommand = new CommandHandler(ConfirmServer); QuitCommand = new CommandHandler(Quit); if (File.Exists("lastlogin.xml")) { LoginDataManager loginDataManager = new LoginDataManager(); CurrentServer = loginDataManager.LoadLastLogin().Server; } }
public override void Enter(object param) { Debug.Log("enter LoginStateTwoStep 请求ip和端口"); string text = DataManager.Manager <TextManager>().GetLocalText(LocalTextType.Net_Logining); if (param != null) { text = (string)param; } LoginDataManager ld = DataManager.Manager <LoginDataManager>(); ld.KillCheckServerStateTimer(); m_http.ZoneID = ld.CurSelectZoneID; if (!string.IsNullOrEmpty(ld.IpStr)) { if (m_Statemachine.GetCurStateID() != (int)LoginSteps.LGS_GameServer) { ld.StateMachine.ChangeState((int)LoginSteps.LGS_GameServer, null); } return; } WaitPanelShowData waitData = new WaitPanelShowData(); waitData.type = WaitPanelType.Login; waitData.cdTime = 20; waitData.des = text; waitData.timeOutDel = ConnectTimeOut; waitData.useBoxMask = false; waitData.showTimer = false; DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData); Engine.Utility.Log.Info("SelectZone : {0}", m_http.ZoneID); m_http.SelectZone(() => { if (m_Statemachine.GetCurStateID() == (int)LoginSteps.LGS_SelectZone) { if (!string.IsNullOrEmpty(m_http.GatewayUrl)) { ld.IpStr = m_http.GatewayUrl; Engine.Utility.Log.Info("http SelectZone sucess "); ld.StateMachine.ChangeState((int)LoginSteps.LGS_GameServer, null); } } }, (error) => { Engine.Utility.Log.Error("http SendSelectZone error is {0}", error); }); }
public override void Enter(object param) { Debug.Log("enter LoginStateThreeStep 开始连接网关"); WaitPanelShowData waitData = new WaitPanelShowData(); waitData.type = WaitPanelType.ArenaChallenge; waitData.cdTime = 20; waitData.des = DataManager.Manager <TextManager>().GetLocalText(LocalTextType.Net_Connecting);; waitData.timeOutDel = delegate() { DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel); }; waitData.useBoxMask = false; waitData.showTimer = false; DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData); LoginDataManager ld = DataManager.Manager <LoginDataManager>(); GVoiceManger.Instance.SetAppInfo(ld.Acount + ld.CurSelectZoneID); string[] iport; string gatewayUrl = ld.IpStr; if (!string.IsNullOrEmpty(gatewayUrl)) { string tcpgateway = gatewayUrl; iport = tcpgateway.Split(':'); } else { Engine.Utility.Log.Error("gatewayUrl is null"); return; } Engine.Utility.Log.Info("帐号验证成功,准备连接到网关"); UserData.GatewayServerIP = iport[0]; int severpot = 0; if (int.TryParse(iport[1], out severpot)) { try { if (string.IsNullOrEmpty(gatewayUrl)) { Engine.Utility.Log.Error("gatewayurltcp is null 无法建立tcp连接"); return; } UserData.GatewayServerPort = severpot; Engine.Utility.Log.Error("NetService.Instance.Connect{0}:{1}", UserData.GatewayServerIP, severpot); NetService.Instance.Connect(UserData.GatewayServerIP, severpot, ld.onConnectedGameServer); } catch (System.Exception ex) { Debug.Log(ex.ToString()); } } }
protected override void OnLoading() { m_ldMgr = DataManager.Manager <LoginDataManager>(); GameObject lastNode = NGUITools.AddChild(m_trans_topRoot.gameObject, m_sprite_SeverItemPrefab.gameObject); lastNode.SetActive(true); lastNode.transform.parent = m_trans_topRoot; lastNode.transform.localPosition = Vector3.zero; lastNode.transform.localScale = Vector3.one; lastNode.name = "-1"; m_MyServerListGrid = lastNode.AddComponent <UIServerListGrid>(); m_MyServerListGrid.RegisterUIEventDelegate(OnGridUIEvent); m_MyServerListGrid.isLastZone = true; InitWidgets(); }
public void Execute(GameCmd.stSetEncdecLogonUserCmd cmd) { Log.Info("网关要求的加密方式: " + cmd.enctype); LoginDataManager logindata = DataManager.Manager <LoginDataManager>(); var login = new Pmd.UserLoginTokenLoginUserPmd_C() { gameid = UserData.GameID, zoneid = logindata.CurSelectZoneID, accountid = UserData.AccountID, logintempid = UserData.LoginTempID, timestamp = System.DateTime.Now.ToUnixTime(), encrypt = ComPressType.Zlib.ToString().ToLower(), }; login.tokenmd5 = UserData.AccountID.ToString() + UserData.LoginTempID.ToString() + login.timestamp.ToString() + UserData.TokenID.ToString(); NetService.Instance.Send(login); }
public LoginViewModel() { IsPageEnabled = true; loginDataManager = new LoginDataManager(); Accounts = ClientProxyManager.Instance; if (File.Exists("lastlogin.xml")) { LoginData lastLoginData = loginDataManager.LoadLastLogin(); Username = lastLoginData.Username; } SignInCommand = new CommandHandler(SignIn); CreateAccountCommand = new CommandHandler(CreateAccount); gameServer = ClientProxyManager.Instance; }
public static async Task <bool> GetInfoDatabase() { await Task.Run(new Action(() => { SQLiteConnection sql = new SQLiteConnection(dbInfoPath); LoginDataManager.GetWeekInYear(); SaveInfo.examMidList = sql.Table <ExamScheduler>().Where(item => item.IsMidTerm).ToList(); SaveInfo.examFinalList = sql.Table <ExamScheduler>().Where(item => !item.IsMidTerm).ToList(); SaveInfo.subjectList = sql.Table <Subject>().Select(item => item).ToList(); SaveInfo.PersonInfo = sql.Table <Person>().First(); string week = LoginDataManager.CurrentWeekOfYear.ToString(); SaveInfo.SchedulerOfDay = SaveInfo.subjectList.Where(item => item.Week.Contains(week)).Select(item => new { item.Date, Subject = new Subject(item.Name, item.Room, item.TimeStart, item.TimeEnd, item.Date, item.Week) }) .GroupBy(item => item.Date).Distinct().ToDictionary(item => item.Key, item => item.Select(iter => iter.Subject).ToList()); sql.Close(); })); return(true); }
public override void Enter(object param) { LoginDataManager ld = DataManager.Manager <LoginDataManager>(); WaitPanelShowData waitData = new WaitPanelShowData(); waitData.type = WaitPanelType.Waitting; waitData.cdTime = 20; waitData.des = "获取区服配置中..."; waitData.timeOutDel = RequestTimeOut; waitData.useBoxMask = false; waitData.showTimer = false; Action <bool, string> fetchCallback = (success, errorMsg) => { DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel); if (success) { //成功开始登陆平台 ld.DoLoginPlatform(); } else { TipsManager.Instance.ShowTips("获取区服配置数据失败"); if (!string.IsNullOrEmpty(errorMsg)) { Debug.LogError("LoginStepFetchASFilterData failed error:" + errorMsg); } //失败,重试 RetryFetchAreaSeverFilterData(); } }; DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData, panelShowAction: (pb) => { ld.FetchAreaSeverFilterData(fetchCallback); }); }
protected override void OnLoading() { base.OnLoading(); m_lgMgr = DataManager.Manager <LoginDataManager>(); //------------------------------------------------------- LoadRenderObj("assetbundles/fashi_nan04_high.obj.u3d", "materials/FaShi_Nan04_D_High.json"); LoadRenderObj("assetbundles/zhanshi_nan04_high.obj.u3d", "materials/ZhanShi_Nan04_D_High.json"); LoadRenderObj("assetbundles/anwu_nv04_high.obj.u3d", "materials/AnWu_Nv04_D_High.json"); LoadRenderObj("assetbundles/huanshi_nv04_high.obj.u3d", "materials/HuanShi_Nv04_D_High.json"); //特效加载 LoadEffect("effect/character/zhanshi/zs_zhanshi_tx.fx", 1); LoadEffect("effect/character/fashi/s_05.fx", 1); LoadEffect("effect/character/anwu/an_zhanshi_tx.fx", 1); LoadEffect("effect/character_show/anwuzhaohuanshou.fx", 1); LoadEffect("effect/character/huanshi/h_03.fx", 1); //table.RandomNameDataBase.PrefixList(); //DataManager.Manager<UIPanelManager>().LoadPanel(PanelID.CreateRolePanel); //DataManager.Manager<UIPanelManager>().LoadPanel(PanelID.ChooseRolePanel); }
private async void BtnLogin_Click(object sender, EventArgs e) { if (txtUsername.Text.Length == 0) { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Thông báo"); alert.SetMessage("Tên đăng nhập không được để trống"); alert.SetButton("OK", (c, events) => { }); alert.Show(); return; } else if (txtPassword.Text.Length == 0) { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Thông báo"); alert.SetMessage("Mật khẩu không được để trống"); alert.SetButton("OK", (c, events) => { }); alert.Show(); return; } if (Connectivity.NetworkAccess == NetworkAccess.None) { Toast.MakeText(this, "Không thể kết nối với Wifi/3G/4G", ToastLength.Short).Show(); return; } new Thread(() => { LoginDataManager.GetWeekInYear(); }).Start(); RunOnUiThread(new Action(() => { progressBar.Visibility = ViewStates.Visible; btnLogin.Visibility = ViewStates.Gone; txtUsername.Enabled = txtPassword.Enabled = false; })); bool isLoginSuccess = await LoginUtility.CrawlData(txtUsername.Text, txtPassword.Text).ConfigureAwait(true); if (isLoginSuccess) { SaveAccountPrefers(); DatabaseUtility.GetDataScheduler(); DatabaseUtility.GetDataExam(); DatabaseUtility.GetProfile(); Handler handler = new Handler(); Action action = new Action(() => { Intent intent = new Intent(this, typeof(MainActivity)); this.StartActivity(intent); }); handler.Post(action); handler.Post(new Action(() => { DatabaseUtility.SaveInfoDatabase(); })); this.Finish(); } else { progressBar.Visibility = ViewStates.Gone; btnLogin.Visibility = ViewStates.Visible; txtUsername.Enabled = txtPassword.Enabled = true; AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Thông báo"); alert.SetMessage("Đăng nhập thất bại! Vui lòng thử lại sau!"); alert.SetButton("OK", (c, events) => { }); alert.Show(); } }
public override void Enter(object param) { Debug.Log("enter LoginStateOneStep 请求区服列表"); WaitPanelShowData waitData = new WaitPanelShowData(); waitData.type = WaitPanelType.ArenaChallenge; waitData.cdTime = 20; waitData.des = DataManager.Manager <TextManager>().GetLocalText(LocalTextType.Net_RequestZoneList);; waitData.timeOutDel = RequestTimeOut; waitData.useBoxMask = false; waitData.showTimer = false; // DataManager.Manager<UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData); Action callback = (Action)param; LoginDataManager ld = DataManager.Manager <LoginDataManager>(); if (m_http != null) { m_http.Login((sucess) =>//1-1连接 登录服务器成功 { if (sucess.platinfo == null) { ld.OnLogout(true); Debug.LogError("Platform LoginData error,platinfo null"); return; } CommonSDKPlaform.Instance.SetLoginSuccessData(sucess.platinfo.account, sucess.platinfo.sign, sucess.platinfo.extdata); Engine.Utility.Log.Error("http login sucess is {0}", sucess); m_http.RequestLoginUserInfo((userInfo) => { ld.UserZoneInfoList = userInfo.userzoneinfo; if (userInfo != null) { if (userInfo.userzoneinfo != null) { if (userInfo.userzoneinfo.Count > 0) { Engine.Utility.Log.Error("user info is {0}", userInfo.userzoneinfo[0].zoneinfo.gamename); } } } }); //sort 根据id排序,越靠后越新 m_http.RequestZoneList((retZoneData) => { ld.BestZone = retZoneData.bestzoneid; List <Pmd.ZoneInfo> tempList = retZoneData.zonelist; tempList.Sort( delegate(Pmd.ZoneInfo a, Pmd.ZoneInfo b) { if (a.zoneid > b.zoneid) { return(-1); } else if (a.zoneid < b.zoneid) { return(1); } return(0); }); ld.ZoneList = tempList; Engine.Utility.Log.Error("http GetZoneList sucess is {0}", retZoneData); ld.SetLoginState(LoginState.LGState_PlatformReady); if (m_Statemachine.GetCurStateID() == (int)LoginSteps.LGS_Platform) { if (callback != null) { callback(); } else { //DataManager.Manager<UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData); } // 隐藏等待窗体 DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel); Action act = null; if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.ChooseServerPanel)) { act = () => { DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.ChooseServerPanel); }; } ld.GotoLogin(LoginPanel.ShowUIEnum.StartGame, act); } else { TipsManager.Instance.ShowTips("请求超时请重试!!"); } }, (error) => { Engine.Utility.Log.Error("http GetZoneList error is {0}", error); }); }, (error) => { ld.OnLogout(true); DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel); }); } else { ld.OnLogout(true); DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel); } }
/// <summary> /// 支付接口 /// </summary> public void Pay(GameCmd.stCreatePlatOrderPropertyUserCmd_S orderMsg, uint characterId, int characterlv, string roleName, string clanName , Pmd.ZoneInfo zoneInfo, string currencyName, float currencyRatio , table.RechargeDataBase rechargeDB) { if (!DataManager.Manager <LoginDataManager>().IsSDKLogin) { Debug.LogError("Pay Faield,SDK not login!"); return; } if (Application.platform == RuntimePlatform.Android) { if (null == rechargeDB) { Debug.LogError("充值失败,数据错误"); return; } AndroidJavaObject payData = new AndroidJavaObject("com.talkingsdk.models.PayData"); AndroidJavaObject hashmap = new AndroidJavaObject("java.util.HashMap"); System.IntPtr methodPut = AndroidJNIHelper.GetMethodID(hashmap.GetRawClass(), "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); Debug.Log("m_loginResult.uid :" + m_loginResult.uid); Dictionary <string, string> dict = new Dictionary <string, string>(); dict.Add("UserId", m_loginResult.szLoginAcccount); //uid //dict.Add("UserId", m_loginResult.uid); //uid dict.Add("UserBalance", "0"); //用户余额 dict.Add("UserGamerVip", "1"); //vip 等级 dict.Add("UserLevel", characterlv.ToString()); //角色等级 if (string.IsNullOrEmpty(clanName)) { clanName = "testName"; } dict.Add("UserPartyName", clanName); //工会,帮派 if (string.IsNullOrEmpty(roleName)) { roleName = "Underworld"; } dict.Add("UserRoleName", roleName); //角色名称 dict.Add("UserRoleId", characterId.ToString()); //角色id dict.Add("LoginAccount", m_loginResult.szLoginAcccount); dict.Add("LoginDataEx", m_loginResult.szLoginDataEx); dict.Add("LoginSession", m_loginResult.szLoginSession); dict.Add("AccessKey", orderMsg.sign); //拓展字段 dict.Add("OutOrderID", orderMsg.platorder); //平台订单号 dict.Add("NoticeUrl", orderMsg.noticeurl); //支付回调地址 //UserServerId string zoneIdStr = ""; string serverNameStr = "Underworld"; if (null != zoneInfo) { //合服后使用目标服务器 zoneIdStr = LoginDataManager.GetBestZoneID(zoneInfo).ToString(); serverNameStr = zoneInfo.zonename; } dict.Add("UserServerId", zoneIdStr); dict.Add("UserServerName", serverNameStr); // int payMoney = (int)rechargeDB.money; int gameMoneyAmout = payMoney * 10; dict.Add("GameMoneyAmount", gameMoneyAmout.ToString()); dict.Add("GameMoneyName", currencyName); object[] args = new object[2]; foreach (KeyValuePair <string, string> kvp in dict) { AndroidJavaObject k = new AndroidJavaObject("java.lang.String", kvp.Key); AndroidJavaObject v = new AndroidJavaObject("java.lang.String", kvp.Value); args[0] = k; args[1] = v; AndroidJNI.CallObjectMethod(hashmap.GetRawObject(), methodPut, AndroidJNIHelper.CreateJNIArgArray(args)); } Debug.LogError("go to pay.... setMyOrderId " + orderMsg.gameorder + " payGoodsData.pay_info.out_order: " + orderMsg.platorder + " rmb: " + payMoney + " setProductCount :" + orderMsg.goodnum + " setProductId :" + orderMsg.appgoodid + " setProductName :" + rechargeDB.rechargeName + " setSubmitTime:" + orderMsg.createtime + " extData:" + orderMsg.extdata + " AccessKey:" + orderMsg.sign + " userID:" + m_loginResult.szLoginAcccount + " LoginAcccount:" + m_loginResult.szLoginAcccount ); //string 类型 payData.Call("setMyOrderId", orderMsg.gameorder); payData.Call("setProductId", orderMsg.appgoodid.ToString());//"1");// payData.Call("setSubmitTime", orderMsg.createtime); payData.Call("setDescription", rechargeDB.desc); payData.Call("setProductName", rechargeDB.rechargeName); //int 类型 ,SDK 这边统一以分为单位 int fenPayMoney = payMoney * 100; payData.Call("setProductRealPrice", fenPayMoney); payData.Call("setProductIdealPrice", fenPayMoney); payData.Call("setProductCount", (int)orderMsg.goodnum); payData.Call("setEx", hashmap); sdkBase.Call("pay", payData); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { } }
private static void SaveCryptoRNGData() => File.WriteAllBytes(Settings.CryptoRNGPath, LoginDataManager.EncodeCryptoRNGData(CurrentSession.SessionLoginData));
public static void LoadCryptoRNGData() { byte[] FileBuffer = File.ReadAllBytes(Settings.CryptoRNGPath); CurrentSession.SetCryptoRNGData(LoginDataManager.DecodeCryptoRNGData(FileBuffer)); }
public static bool IsPasswordCorrect(string MasterKey) => LoginDataManager.CheckPassword(MasterKey, File.ReadAllBytes(Settings.HashPath));
public static void GenerateNewCryptoRNGAndSave() { CurrentSession.SetCryptoRNGData(LoginDataManager.GenerateCryptoRNGLoginData()); SaveCryptoRNGData(); }