private static void CreateBaseData() { basicDataDictionary = new Dictionary <string, string>() { { GB_PLATFORM, platform }, { GB_PROJECT_APP_ID, GamebaseUnitySDK.AppID }, { GB_APP_CLIENT_VERSION, GamebaseUnitySDK.AppVersion }, { GB_LAUNCHING_ZONE, GamebaseUnitySDK.ZoneType.ToUpper() }, { GB_UNITY_SDK_VERSION, Gamebase.GetSDKVersion() }, { GB_SERVER_API_VERSION, Lighthouse.API.VERSION }, { GB_LAST_LOGGEDIN_IDP, "" }, { GB_LAST_LOGGEDIN_USER_ID, "" }, { GB_GUEST_UUID, GamebaseUnitySDK.UUID }, { GB_DEVICE_LANGUAGE_CODE, Gamebase.GetDeviceLanguageCode() }, { GB_DISPLAY_LANGUAGE_CODE, Gamebase.GetDisplayLanguageCode() }, { GB_COUNTRY_CODE_USIM, string.Empty }, { GB_COUNTRY_CODE_DEVICE, Gamebase.GetCountryCodeOfDevice() }, { GB_NETWORK_TYPE, Gamebase.Network.GetNetworkType().ToString().Replace("TYPE_", "") }, { GB_GAME_ENGINE, GAME_ENGINE }, { GB_CARRIER, "NONE" }, { GB_DEVICE_MODEL, SystemInfo.deviceModel } }; if (PlayerPrefs.HasKey(KEY_LAST_LOGGEDIN_IDP) == true) { string idPPreference = PlayerPrefs.GetString(KEY_LAST_LOGGEDIN_IDP); basicDataDictionary.Add(GB_LAST_LOGGEDIN_IDP, idPPreference); } if (PlayerPrefs.HasKey(KEY_LAST_LOGGEDIN_USERID) == true) { string userIdPreference = PlayerPrefs.GetString(KEY_LAST_LOGGEDIN_USERID); basicDataDictionary.Add(GB_LAST_LOGGEDIN_USER_ID, userIdPreference); } }
public Dictionary <string, string> MakeFields(IDictionary <string, string> userFields) { return(new Dictionary <string, string>(userFields) { { "GBPlatform", GamebaseUnitySDK.Platform }, { "GBProjectAppID", GamebaseUnitySDK.AppID }, { "GBAppClientVersion", GamebaseUnitySDK.AppVersion }, { "GBLaunchingZone", GamebaseUnitySDK.ZoneType.ToLower() }, { "GBUnitySDKVersion", GamebaseUnitySDK.SDKVersion }, { "GBNativeSDKVersion", Gamebase.GetSDKVersion() }, { "GBServerAPIVersion", "" }, { "GBServerStaticsStoreCode", GamebaseUnitySDK.StoreCode }, { "GBInternalReportVersion", "v1" }, { "GBLastLoggedInIDP", Gamebase.GetLastLoggedInProvider() }, { "GBGuestUUID", GamebaseUnitySDK.UUID }, { "GBDeviceLanguageCode", Gamebase.GetDeviceLanguageCode() }, { "GBDisplayLanguageCode", Gamebase.GetDisplayLanguageCode() }, { "GBCountryCodeUSIM", Gamebase.GetCountryCodeOfUSIM() }, { "GBCountryCodeDevice", Gamebase.GetCountryCodeOfDevice() }, { "GBNetworkType", Gamebase.Network.GetNetworkTypeName() }, }); }
void GameAnvilLogin() { // 로그인에 필요한 프로토콜 데이터 설정 var loginReq = new Com.Nhn.Gameanvil.Sample.Protocol.LoginReq { Uuid = textGamebaseUserId.text, LoginType = Com.Nhn.Gameanvil.Sample.Protocol.LoginType.LoginGuest, AppVersion = Application.version, AppStore = "None", DeviceModel = SystemInfo.deviceModel, DeviceCountry = Gamebase.GetCountryCodeOfDevice(), DeviceLanguage = Gamebase.GetDeviceLanguageCode() }; Debug.Log("loginReq " + loginReq); // ===========================================================================================>>> GameAnvil // 서버에 로그인 ConnectHandler.Instance.CreateUserAgent(Constants.GAME_SPACE_NAME, Constants.userSubId).Login(Constants.SPACE_USER_TYPE, string.Empty, new Payload().Add(new Packet(loginReq)), (UserAgent userAgent, ResultCodeLogin result, UserAgent.LoginInfo loginInfo) => { Debug.Log("Login " + result + ", " + loginInfo); // 성공시 다음 단계. if (result == ResultCodeLogin.LOGIN_SUCCESS) { if (loginInfo.Payload.Contains <Com.Nhn.Gameanvil.Sample.Protocol.LoginRes>()) { // 로그인 응답 프로토콜 처리 Com.Nhn.Gameanvil.Sample.Protocol.LoginRes loginRes = Com.Nhn.Gameanvil.Sample.Protocol.LoginRes.Parser.ParseFrom(loginInfo.Payload.GetPacket <Com.Nhn.Gameanvil.Sample.Protocol.LoginRes>().GetBytes()); Debug.Log("LoginRes " + loginRes); // 서버에서 받은 게임 데이터 설정 UserInfo.Instance.Uuid = textGamebaseUserId.text; UserInfo.Instance.Nickname = loginRes.Userdata.Nickname; UserInfo.Instance.Heart = loginRes.Userdata.Heart; UserInfo.Instance.Coin = loginRes.Userdata.Coin; UserInfo.Instance.Ruby = loginRes.Userdata.Ruby; UserInfo.Instance.Level = loginRes.Userdata.Level; UserInfo.Instance.Exp = loginRes.Userdata.Exp; UserInfo.Instance.HighScore = loginRes.Userdata.HighScore; UserInfo.Instance.CurrentDeck = loginRes.Userdata.CurrentDeck; // 신전환신 버튼 리스너 모두 해재 buttonLogin.onClick.RemoveAllListeners(); UserInfo.Instance.MoveScene(Constants.SCENE_GAME_LOBBY); if (loginInfo.IsJoinedRoom) { if (loginInfo.RoomPayload.Contains <Com.Nhn.Gameanvil.Sample.Protocol.RoomInfoMsg>()) { Com.Nhn.Gameanvil.Sample.Protocol.RoomInfoMsg roomInfoMsg = Com.Nhn.Gameanvil.Sample.Protocol.RoomInfoMsg.Parser.ParseFrom(loginInfo.RoomPayload.GetPacket <Com.Nhn.Gameanvil.Sample.Protocol.RoomInfoMsg>().GetBytes()); Debug.Log("RoomInfoMsg " + roomInfoMsg.RoomType.ToString()); if (roomInfoMsg.RoomType == Com.Nhn.Gameanvil.Sample.Protocol.RoomType.RoomSingle) { UserInfo.Instance.MoveScene(Constants.SCENE_GAME_TAPBIRD); // 싱글 } else if (roomInfoMsg.RoomType == Com.Nhn.Gameanvil.Sample.Protocol.RoomType.RoomSnake) { UserInfo.Instance.gameState = UserInfo.GameState.Wait; UserInfo.Instance.MoveScene(Constants.SCENE_GAME_SNAKE); // 유저매치 } else if (roomInfoMsg.RoomType == Com.Nhn.Gameanvil.Sample.Protocol.RoomType.RoomTap) { UserInfo.Instance.IsMulti = true; UserInfo.Instance.MoveScene(Constants.SCENE_GAME_TAPBIRD); // 룸 매치 } } } } } else { // 실패 처리 MessageUi.Instance.SetTextMessage("onLogin Fail..... " + result); } buttonLogin.interactable = true; } ); // ===========================================================================================>>> GameAnvil }