public void InitLoginUI() { if (_ui == null) { return; } string account_name = ""; if (LoginIDManager.GetFirstLoginState()) //第一次登录 { } else //第二次登录 { account_name = LoginIDManager.GetAccount(); #if IOS_SDK || ANDROID_SDK string userName = LoginIDManager.GetUserName(); // if (userName == "") // { //userName = CommonFunction.GetConstString("STR_TOURIST"); // userName = _ui.lblText.text; // } // _ui.lblText.text = userName; SetAccountName(userName); #else SetAccountName(account_name); #endif } _ui.lblServerLabel.text = LoginIDManager.GetPlatServerName(); //_ui.goServerList.SetActive(false); SetDisplayServerLabel(LoginIDManager.GetPlatDisplayServerID(), LoginIDManager.GetPlatServerName()); //UIEventListener.Get(_ui.goBg).onClick = onBgClick; UIEventListener.Get(_ui.lblText.gameObject).onClick = onInputClick; UIEventListener.Get(_ui.goServer).onClick = onChangeServer; }
//CDKey验证请求 public bool VerifyCDKeyReq() { Debug.Log("-------------VerifyCDKeyReq"); uint ID = LoginIDManager.GetPlatServerID(); VerifyCDKey verifyCDKey = new VerifyCDKey(); #if IOS_SDK || ANDROID_SDK if (string.IsNullOrEmpty(cdKey)) { // 如果cdKey 为null时候,不处理 return(false); } verifyCDKey.authorization_code = cdKey; #else verifyCDKey.authorization_code = authorizationCode; #endif verifyCDKey.server_id = ID; verifyCDKey.game_ver = GlobalConst.GAME_VERSION; verifyCDKey.res_ver = GlobalConst.RES_VERSION; verifyCDKey.mac_add = SystemInfo.deviceUniqueIdentifier; GameSystem.Instance.mNetworkManager.m_loginConn.SendPack <VerifyCDKey>(0, verifyCDKey, MsgID.VerifyCDKeyID); return(true); }
public void OnChooseServer(GameObject go) { if (go) { ServerListInfo infos; foreach (var item in eachGroupList.Values) { infos = item.Find((ServerListInfo info) => { return(info.server_name == go.transform.name); }); if (infos != null) { LoginIDManager.SetPlatServerID(infos.server_id); LoginIDManager.SetPlatDisplayServerID(infos.display_server_id); LoginIDManager.SetPlatServerName(infos.server_name); LoginIDManager.SetLastLevel(infos.level); //LoginIDManager.SetServerState(infos.load); _ui.lblServerLabel.text = infos.server_name; //NGUITools.SetActive(loginServerPopup.gameObject, false); //NGUITools.Destroy(loginServerPopup.gameObject); SetDisplayServerLabel(infos.display_server_id, infos.server_name); popupAnimator.enabled = true; popupAnimator.SetBool("Close", true); } } } }
static int SetAccount(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); string arg0 = LuaScriptMgr.GetLuaString(L, 1); LoginIDManager.SetAccount(arg0); return(0); }
public void SetAccount(string account) { Debug.Log("UILoginControl SetAccount account =" + account); Account = account; LoginIDManager.SetAccount(Account); LoginIDManager.SetFirstLoginState(1); }
static int GetPassword(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 0); string o = LoginIDManager.GetPassword(); LuaScriptMgr.Push(L, o); return(1); }
static int GetPlatDisplayServerID(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 0); uint o = LoginIDManager.GetPlatDisplayServerID(); LuaScriptMgr.Push(L, o); return(1); }
static int SetAnnouceVersion(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); float arg0 = (float)LuaScriptMgr.GetNumber(L, 1); LoginIDManager.SetAnnouceVersion(arg0); return(0); }
static int GetAnnounceVersion(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 0); float o = LoginIDManager.GetAnnounceVersion(); LuaScriptMgr.Push(L, o); return(1); }
static int SetLastLevel(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 1); LoginIDManager.SetLastLevel(arg0); return(0); }
static int GetLastLevel(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 0); uint o = LoginIDManager.GetLastLevel(); LuaScriptMgr.Push(L, o); return(1); }
static int GetFristGuid(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 0); int o = LoginIDManager.GetFristGuid(); LuaScriptMgr.Push(L, o); return(1); }
static int GetPlatServerName(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 0); string o = LoginIDManager.GetPlatServerName(); LuaScriptMgr.Push(L, o); return(1); }
static int SetPlatDisplayServerID(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 1); LoginIDManager.SetPlatDisplayServerID(arg0); return(0); }
static int SetFirstLoginState(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); int arg0 = (int)LuaScriptMgr.GetNumber(L, 1); LoginIDManager.SetFirstLoginState(arg0); return(0); }
static int GetFirstLoginState(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 0); bool o = LoginIDManager.GetFirstLoginState(); LuaScriptMgr.Push(L, o); return(1); }
static int GetFirstPractice(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 1); uint o = LoginIDManager.GetFirstPractice(arg0); LuaScriptMgr.Push(L, o); return(1); }
void OnNameInputOK() { _isInput = false; #if IOS_SDK || ANDROID_SDK #else Account = _ui.InputAccount.value; LoginIDManager.SetAccount(Account); LoginNetwork.Instance.authorizationCode = Account; SetAccountName(Account); _ui.goInput.SetActive(false); #endif }
public void SetLastLoginInfo(List <ServerListInfo> serverLis) { uint lastServerId = LoginIDManager.GetPlatServerID(); string lastServer = LoginIDManager.GetPlatServerName(); uint lastServerLevel = LoginIDManager.GetLastLevel(); //uint lastServerLoad = LoginIDManager.GetServerState(); Debug.Log("lastServerId = " + lastServerId); Debug.Log("lastServer = " + lastServer); Debug.Log("lastServerLevel = " + lastServerLevel); if (lastServerId > 0) { ServerListInfo lastInfo = serverLis.Find((ServerListInfo info) => { return(info.server_id == lastServerId); }); if (lastInfo != null) { lastServerArea.text = string.Format(CommonFunction.GetConstString("LOGIN_SEVER_AREA"), lastInfo.display_server_id); } } else { NGUITools.SetActive(lastServerArea.gameObject, false); NGUITools.SetActive(lastServerName.gameObject, false); NGUITools.SetActive(lastLevel.gameObject, false); NGUITools.SetActive(lastLoad.gameObject, false); } if (lastServer != null && lastServer != "") { lastServerName.text = lastServer; } if (lastServerLevel > 0) { lastLevel.text = CommonFunction.GetConstString("UI_HALL_LEVEL_1") + lastServerLevel.ToString(); } //if (currentLoadState == (uint)ServerState.SS_BUSY) //{ // lastLoad.spriteName = "login_login_Orange"; //} //else if (currentLoadState == (uint)ServerState.SS_CLOSE) //{ // lastLoad.spriteName = "login_login_Gray"; //} //else if (currentLoadState == (uint)ServerState.SS_FULL) //{ // lastLoad.spriteName = "login_login_Red"; //} //else if (currentLoadState == (uint)ServerState.SS_IDLE) //{ // lastLoad.spriteName = "login_login_Green"; //} //else // NGUITools.SetActive(lastLoad.gameObject, false); }
static int _CreateLoginIDManager(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { LoginIDManager obj = new LoginIDManager(); LuaScriptMgr.PushObject(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: LoginIDManager.New"); } return(0); }
public void SetUserName(string userName) { _isInput = false; if (_ui != null) { // _ui.lblText.text = userName; SetAccountName(userName); #if ANDROID_SDK || IOS_SDK #else if (_ui.InputAccount != null) { _ui.InputAccount.value = userName; } #endif } LoginIDManager.SetUserName(userName); }
public void ConnectLoginServer() { if (!isConnect) { #if IOS_SDK || ANDROID_SDK #else // Account = _ui.lblText.text; LoginIDManager.SetAccount(Account); LoginNetwork.Instance.authorizationCode = Account; #endif LoginIDManager.SetFirstLoginState(1); //LoginIDManager.SetServerIP(GameSystem.Instance.serverIP); LoginNetwork.Instance.ConnectToLS(); isConnect = true; } }
/// <summary> /// 每帧更新 /// </summary> public void Update() { if (GameSystem.Instance.canLoadConfig) { GameSystem.Instance.canLoadConfig = false; GameSystem.Instance.LoadConfig(); GameSystem.Instance.mClient.mUIManager.LoginCtrl.thread1.Start(); GameSystem.Instance.mClient.mUIManager.LoginCtrl.thread2.Start(); } _time -= Time.deltaTime; if (_time < 0) { Scheduler.Instance.RemoveUpdator(Update); #if IOS_SDK || ANDROID_SDK LoginNetwork.Instance.DoConnectToLS(); #endif //_ui.ButtonOK.GetComponent<UIButton>().enabled = true; //NGUITools.SetActive(_ui.ButtonOK.gameObject, true); } if (oncelogined == 1 && GameSystem.Instance.AnnouncementConfigData != null && GameSystem.Instance.AnnouncementConfigData.GetOpenItem() != null && !string.IsNullOrEmpty(DynamicStringManager.Instance.NoticePopupString) ) { //如果本地version和公告version不一致,弹出公告界面 AnnouncementItem anc = GameSystem.Instance.AnnouncementConfigData.GetOpenItem(); if (anc != null && LoginIDManager.GetAnnounceVersion() != anc.version) { showAnnounce(); LoginIDManager.SetAnnouceVersion(anc.version); } oncelogined = 2; } }
public void OnCancle(GameObject go) { _isInput = false; Debug.Log("1927 c# OnCancle is called"); #if ANDROID_SDK AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity"); jo.Call("Logout"); Debug.Log("1927 c# called Logout"); #endif _ui.ButtonSwitch.gameObject.SetActive(false); _ui.ButtonCancle.gameObject.SetActive(false); LoginIDManager.SetUserName(""); LoginIDManager.SetAccount(""); // _ui.lblText.text = ""; SetAccountName(""); MainPlayer.Instance.SDKLogin = false; LoginNetwork.Instance.isVerifySDK = true; OnSwitch(go); }
public void SetDefaultServer(List <ServerListInfo> infos, uint last_server_id) { Debug.Log("DefaultServer -------------"); if (infos == null) { Debug.LogError("info is null"); } if (infos.Count <= 0) { return; } ServerListInfo defaultServer = null; ServerListInfo curServer = null; foreach (var server in infos) { Debug.Log("Server name:" + server.name + " default:" + server.default_server); if (server.server_id == last_server_id) { curServer = server; break; } if (server.default_server == 1) { defaultServer = server; } } if (curServer == null) { curServer = defaultServer; } LoginIDManager.SetPlatServerID(curServer.server_id); LoginIDManager.SetPlatDisplayServerID(curServer.display_server_id); LoginIDManager.SetPlatServerName(curServer.server_name); LoginIDManager.SetLastLevel(curServer.level); _ui.lblServerLabel.text = curServer.server_name; SetDisplayServerLabel(curServer.display_server_id, curServer.server_name); }
//CDKeyÑéÖ¤»Ø¸´ÏûÏ¢´¦Àí void VerifyCDKeyRespHandle(Pack pack) { Debug.Log("---------------------VerifyCDKeyRespHandle"); VerifyCDKeyResp resp = Serializer.Deserialize <VerifyCDKeyResp>(new MemoryStream(pack.buffer)); if (resp.result != 0) { Debug.Log("Error -- VerifyCDKeyResp returns error: " + resp.result); GameSystem.Instance.mNetworkManager.StopAutoReconn(); if (resp.result == (uint)ErrorID.LOGIN_SERVER_CLOSED) { CommonFunction.ShowPopupMsg(DynamicStringManager.Instance.LoginServerClosedString, null, GameSystem.Instance.mNetworkManager.ReturnToLogin); } else { CommonFunction.ShowErrorMsg((ErrorID)resp.result, null, GameSystem.Instance.mNetworkManager.ReturnToLogin); } return; } //¹Ø±ÕLoginNetµÄÁ¬½Ó GameSystem.Instance.mNetworkManager.CloseLoginConn(); //¼Ç¼µÇ¼ÐÅÏ¢ PlatNetwork.Instance.SaveCDKeyRespResult(resp); //½¨Á¢PlatServerÁ¬½Ó string platIP = resp.ip; uint platPort = resp.port; if (platIP != null && platIP != "") { PlatNetwork.Instance.ConnectToPS(platIP, platPort); LoginIDManager.SetServerIP(platIP); } }
public void OnEvent(NetworkConn.NetworkEvent nEvent, NetworkConn sender) { Debug.Log("Network Event -- sender.m_type: " + sender.m_type + " nEvent: " + nEvent); switch (sender.m_type) { case NetworkConn.Type.eLoginServer: { if (nEvent == NetworkConn.NetworkEvent.disconnected) { if (connLogin) { connLogin = false; } UIWait.StopWait(); } else if (nEvent == NetworkConn.NetworkEvent.connected) { if (connLogin == false) { connLogin = true; if (onServerConnected != null) { onServerConnected(NetworkConn.Type.eLoginServer); } #if IOS_SDK || ANDROID_SDK Debug.Log("IsReconnecting: " + isReconnecting); Debug.Log("MainPlayer.Instance.SDkLogin +" + MainPlayer.Instance.SDKLogin); Debug.Log("LoginNetwork.Instance.isVerifySDK =" + LoginNetwork.Instance.isVerifySDK); if (isReconnecting) { LoginNetwork.Instance.VerifyCDKeyReq(); } else if (MainPlayer.Instance.SDKLogin && !LoginNetwork.Instance.isVerifySDK) { Debug.Log("VerifySDK in NetworkManger"); LoginNetwork.Instance.isVerifySDK = true; LoginNetwork.Instance.VerifySDKReq(); } #else if (GameSystem.Instance.mClient.mUIManager.LoginCtrl.isGetServerList || LoginIDManager.GetPlatServerID() == 0) { LoginNetwork.Instance.ServerInfoReq(); GameSystem.Instance.mClient.mUIManager.LoginCtrl.isGetServerList = false; } else if (GameSystem.Instance.mClient.mUIManager.LoginCtrl.isSetLastServer) { LoginNetwork.Instance.ServerInfoReq(); GameSystem.Instance.mClient.mUIManager.LoginCtrl.isSetLastServer = false; } else { LoginNetwork.Instance.VerifyCDKeyReq(); } #endif } } else if (nEvent == NetworkConn.NetworkEvent.connectFail) { connLogin = false; OnConnectFailed(sender); if (GameSystem.Instance.mClient.mUIManager.LoginCtrl != null) { GameSystem.Instance.mClient.mUIManager.LoginCtrl.OnLoginFailed(); } } } break; case NetworkConn.Type.ePlatformServer: { UIWait.StopWait(); Debug.Log("connPlat:" + connPlat); if (nEvent == NetworkConn.NetworkEvent.disconnected) { if (connPlat) { connPlat = false; OnDisconnected(sender); if (PlatNetwork.Instance.onDisconnected != null) { PlatNetwork.Instance.onDisconnected(); } } } else if (nEvent == NetworkConn.NetworkEvent.connected) { if (connPlat == false) { connPlat = true; if (onServerConnected != null) { onServerConnected(NetworkConn.Type.ePlatformServer); } PlatNetwork.Instance.EnterPlatReq(); } else { Debug.Log("Warning: Platform server already connected."); } } else if (nEvent == NetworkConn.NetworkEvent.connectFail) { connPlat = false; OnConnectFailed(sender); } } break; case NetworkConn.Type.eVirtualServer: case NetworkConn.Type.eGameServer: { UIWait.StopWait(); Debug.Log("connGS:" + connGS); if (nEvent == NetworkConn.NetworkEvent.disconnected) { if (connGS) { connGS = false; } } else if (nEvent == NetworkConn.NetworkEvent.connected) { if (connGS == false) { connGS = true; if (onServerConnected != null) { onServerConnected(NetworkConn.Type.eGameServer); } } else { Debug.Log("Warning: GameServer server already connected."); } } else if (nEvent == NetworkConn.NetworkEvent.connectFail) { connGS = false; } } break; } }
private void PostCreateUI() { _ui_practise = GameObject.FindGameObjectWithTag("UIPractise"); if (_ui_practise) { _ui_signal = _ui_practise.transform.FindChild("Signal").GetComponent <UIWidget>(); _ui_signal_grid = _ui_signal.transform.FindChild("Grid").GetComponent <UIGrid>(); _ui_title = _ui_practise.transform.FindChild("Title/Label").GetComponent <UILabel>(); _ui_tip_pane = _ui_practise.transform.FindChild("Tip").gameObject; NGUITools.SetActive(_ui_tip_pane, false); UITweener[] tweens = _ui_tip_pane.GetComponents <UITweener>(); _tip_open_tweens[0] = tweens[0]; _tip_open_tweens[1] = tweens[1]; _tip_close_tweens[0] = tweens[2]; _tip_close_tweens[1] = tweens[3]; _ui_tip = _ui_practise.transform.FindChild("Tip/Text").GetComponent <UILabel>(); _ui_tip_arrow = _ui_practise.transform.FindChild("Tip/Arrow").gameObject; ui_tutorial = _ui_practise.transform.FindChild("Tutorial").gameObject; if (GameSystem.Instance.PractiseConfig.GetConfig(practise.ID).is_activity == 1 && LoginIDManager.GetFirstPractice(practise.ID) == 1) { GameObject prefab = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/ButtonBack") as GameObject; Transform buttonParent = _ui_practise.transform.FindChild("ButtonBack"); _ui_back_button = CommonFunction.InstantiateObject(prefab, buttonParent); UIEventListener.Get(_ui_back_button).onClick = OnBack; } HideTipArrow(); _ui_title.text = practise.title; } }
public void RefreshServerList(GameObject go) { GameObject childGo = null; for (int i = 0; i < leftGrid.transform.childCount; i++) { childGo = leftGrid.transform.GetChild(i).gameObject; if (go == childGo) { childGo.transform.FindChild("Sele").GetComponent <UISprite>().spriteName = "login_yellow5"; while (rightGrid.transform.childCount > 0) { NGUITools.Destroy(rightGrid.transform.GetChild(0).gameObject); } for (int j = 0; j < eachGroupList[i].Count; j++) { GameObject serverItem = CommonFunction.InstantiateObject("Prefab/GUI/ServerItem", rightGrid.transform); GameObject level = serverItem.transform.FindChild("Level").gameObject; MultiLabel levelText = level.transform.FindChild("Text").GetComponent <MultiLabel>(); MultiLabel serverID = serverItem.transform.FindChild("Server").GetComponent <MultiLabel>(); MultiLabel serverName = serverItem.transform.FindChild("Name").GetComponent <MultiLabel>(); UISprite serverIcon = serverItem.transform.FindChild("Icon").GetComponent <UISprite>(); UISprite backShade = serverItem.transform.FindChild("BackShade").GetComponent <UISprite>(); serverItem.name = eachGroupList[i][j].server_name; serverID.SetText(string.Format(CommonFunction.GetConstString("LOGIN_SEVER_AREA"), eachGroupList[i][j].display_server_id)); serverName.SetText(eachGroupList[i][j].server_name); if (eachGroupList[i][j].name == null || eachGroupList[i][j].name == "") { NGUITools.SetActive(level, false); } else { levelText.SetText(CommonFunction.GetConstString("UI_HALL_LEVEL_1") + eachGroupList[i][j].level.ToString()); if (eachGroupList[i][j].server_name == LoginIDManager.GetPlatServerName()) { NGUITools.SetActive(backShade.gameObject, true); if (eachGroupList[i][j].level != LoginIDManager.GetLastLevel()) { lastLevel.text = CommonFunction.GetConstString("UI_HALL_LEVEL_1") + eachGroupList[i][j].level.ToString(); } } } uint state = eachGroupList[i][j].load; if (state == (uint)ServerState.SS_BUSY) { serverIcon.spriteName = "login_login_Orange"; } else if (state == (uint)ServerState.SS_CLOSE) { serverIcon.spriteName = "login_login_Gray"; } else if (state == (uint)ServerState.SS_FULL) { serverIcon.spriteName = "login_login_Red"; } else if (state == (uint)ServerState.SS_IDLE) { serverIcon.spriteName = "login_login_Green"; } if (eachGroupList[i][j].server_name == LoginIDManager.GetPlatServerName()) { lastLoad.spriteName = serverIcon.spriteName; } UIEventListener.Get(serverItem).onClick = OnChooseServer; } } } rightGrid.repositionNow = true; rightGrid.Reposition(); }