LoggingInScreen.as 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import flash.external.*;
  2. import gfx.controls.TextInput;
  3. import gfx.controls.Button;
  4. class Screens.LoggingInScreen extends Screen
  5. {
  6. private var loginFailureResult:Button;
  7. private var cancelFromLoggingIn:Button;
  8. public function LoggingInScreen()
  9. {
  10. ConsoleWindow.Trace("Constructing LoggingInScreen");
  11. mScreenId = ScreenID.LOGGING_IN;
  12. mScreenTabId = ScreenTab.ID_LOGIN;
  13. }
  14. public function VOnFinishedLoading():Void
  15. {
  16. loginFailureResult.visible = false;
  17. //Add click event for buttons
  18. cancelFromLoggingIn.addEventListener("click", this, "cancelFromLoggingInFunc");
  19. //Add callbacks for C++
  20. ExternalInterface.addCallback("c2f_NotifyLoginResultFailure", this, c2f_NotifyLoginResultFailure);
  21. ExternalInterface.addCallback("c2f_NotifyLoginResultSuccess", this, c2f_NotifyLoginResultSuccess);
  22. super.VOnFinishedLoading();
  23. }
  24. function cancelFromLoggingInFunc():Void
  25. {
  26. ExternalInterface.call("f2c_DisconnectFromServer");
  27. //_root.gotoAndPlay("Disconnected");
  28. LobbyInterface.Instance.ShowScreen( ScreenID.CONNECTION );
  29. }
  30. function c2f_NotifyLoginResultFailure(reasonIdentifier:String, bannedReason:String, whenBanned:String, bannedExpiration:String ):Void
  31. {
  32. switch (reasonIdentifier)
  33. {
  34. case "Client_Login_HANDLE_NOT_IN_USE_OR_BAD_SECRET_KEY":
  35. break;
  36. case "Client_Login_CANCELLED":
  37. break;
  38. case "Client_Login_CABLE_NOT_CONNECTED":
  39. break;
  40. case "Client_Login_NET_NOT_CONNECTED":
  41. break;
  42. case "Client_Login_BANNED":
  43. // banned parameters used here, not otherwise
  44. break;
  45. case "Client_Login_CDKEY_STOLEN":
  46. break;
  47. case "Client_Login_EMAIL_ADDRESS_NOT_VALIDATED":
  48. break;
  49. case "Client_Login_BAD_TITLE_OR_TITLE_SECRET_KEY":
  50. break;
  51. }
  52. loginFailureResult.visible=true;
  53. loginFailureResult.label=reasonIdentifier;
  54. }
  55. function c2f_NotifyLoginResultSuccess( ):Void
  56. {
  57. //_root.gotoAndPlay("LoggedIn");
  58. LobbyInterface.Instance.ShowScreen( ScreenID.LOGGED_IN );
  59. }
  60. }
粤ICP备19079148号