static void OnNetBlockOrClose() { try { //Debug.Log("OnNetBlockOrClose"); gConnectCount = 0; WorldStage.mbReConnected = true; //启动断线重连,重新发送登录消息 Game game = Game.Instance; if (game != null) { game.mGameSock.Disconnect(); game.mGameSock.InitUserSock(); ConnectStage.RegistCallback(false); LoginStage.RegistCallback(false); WorldStage.RegistCallback(false); ///第一次连接失败,添加心跳开始持续一分钟连接12次,依然没有连上认为断开 ConnectStage.ConnecToMember(mstrServer, miPort, mstrUser, mstrPsd, mstrValidateString, 2); //Debug.Log("第一次重连"); TimerManager.AddTimerRepeat("OnNetBlockTimer", 5.0f, OnNetBlockTimer); LogSystem.LogWarning("First block connect try"); //SystemWaitPanel.Start(99999999); } } catch (System.Exception ex) { LogSystem.LogError("Game::OnNetBlockOrClose:", ex.ToString()); } }
public BizSimAdminController(string loginPageUrl, string username, string password) { stage = LoginStage.START; webView = WebViewManager.Inst.CreateWebView(1, 1); webView.LoadCompleted += OnLoadCompleted; if (!Login(loginPageUrl, username, password)) { Debug.Log(" Login failed "); } }
/// <summary> /// ping值 /// </summary> public void C2S_Ping() { LoginStage stage = GameCenter.curGameStage as LoginStage; if (GameCenter.mainPlayerMng == null || stage != null) { return; } pt_ping_a10a msg = new pt_ping_a10a(); GameCenter.instance.PingStartTime = DateTime.Now.Ticks; NetMsgMng.SendMsg(msg); }
public BizSimLoginAutomator(string loginPageUrl, string username, string gameID, string simType) { if (!startNewSim) { return; } stage = LoginStage.START; webView = WebViewManager.Inst.CreateWebView(1, 1); webView.BeginLoading += OnBeginLoading; if (!Login(loginPageUrl, username, gameID, simType)) { Debug.Log(" Login failed "); } }
static void OnNetBlockTimer() { //启动断线重连,重新发送登录消息 Game game = Game.Instance; if (game != null) { game.mGameSock.Disconnect(); game.mGameSock.InitUserSock(); ConnectStage.RegistCallback(false); LoginStage.RegistCallback(false); WorldStage.RegistCallback(false); //Debug.Log("第二次重连"); ConnectStage.ConnecToMember(mstrServer, miPort, mstrUser, mstrPsd, mstrValidateString, 2); gConnectCount++; LogSystem.LogWarning(gConnectCount + ": block connect try"); if (gConnectCount > 4) { mbNeedReConnect = false; TimerManager.Destroy("OnNetBlockTimer"); ///显示网络已经断线 string strHeader = TextManager.Instance.GetString("UI00031"); string strContext = TextManager.Instance.GetString("NetClose"); if (!string.IsNullOrEmpty(strHeader) && !string.IsNullOrEmpty(strContext)) { // if (GUIManager.HasView<SystemPrompt>()) // { // GUIManager.HideView<SystemPrompt>("SystemPrompt"); // } // PromptType pt = PoolManager.PopObject<PromptType>(PoolManager.PoolKey.Object_PromptType); // pt.layer = 5; // pt.title = strHeader; // pt.content = strContext; // pt.style = PromptType.Style.OK; // pt.callback_ok = OnConnectSecondTime; // GUIManager.ShowView<SystemPrompt>(pt); } } } }
private void OnLoadCompleted(System.Object sender, System.EventArgs args) { Debug.LogError("BizSimAdminController: OnLoadCompleted"); if (!CheckWebView()) { return; } switch (stage) { case LoginStage.START: Debug.LogError("LoginStage.START: " + webView.Source.AbsolutePath); webView.ExecuteJavascript(GetBtnClickJavaScriptCmd("Login")); stage = LoginStage.LOGIN_ATTEMPTED; break; case LoginStage.LOGIN_ATTEMPTED: Debug.LogError("LoginStage.LOGIN_ATTEMPTED"); string expectedPage = "adminpanel.php"; if (webView.Source.AbsolutePath.Contains(expectedPage)) { stage = LoginStage.LOGGED_IN; } else { Debug.LogError("Admin Login Failed, redirected to " + webView.Source.PathAndQuery); stage = LoginStage.LOGIN_FAILED; } break; case LoginStage.LOGGED_IN: Debug.LogError("OnDomReady: LoginStage.LOGGED_IN"); break; case LoginStage.LOGIN_FAILED: Debug.LogError("OnDomReady: LoginStage.LOGIN_FAILED"); break; } }
private void OnBeginLoading(System.Object sender, Awesomium.Mono.BeginLoadingEventArgs args) { if (!CheckWebView()) { return; } if (!args.Url.Contains("holdinginfo.php")) { // the url is expected to redirect to holdinginfo.php, so if it hasn't, assume there was an error InfoMessageManager.Display("* We're sorry, the business simulation is unavailable at this time *"); Debug.LogError("Biz Sim Login Error: url didn't redirect: " + args.Url); return; } switch (stage) { case LoginStage.START: stage = LoginStage.IN_GAME; RaiseLoginCompleteEvent(args); break; } }
/// <summary> /// 确认退出游戏 /// </summary> /// <param name="type"></param> private static void OnSureGameOutClick() { ConnectStage.isGameOut = false; //回到登陆界面 LoginStage.GoBackLogin(); }
/// <summary> /// 初始化游戏世界控制 /// </summary> public void InitGameWord() { ConnectStage.RegistCallback(); LoginStage.RegistCallback(); WorldStage.RegistCallback(); }
public ProgramHost(LoginStage stage, ITransportAcceptor acceptor) { _stage = stage; _acceptor = acceptor; }