public void ResetSession() { gameToken = null; cipherDataDic = new Dictionary <CipherType, Cipher>(); hmacDataDic = new Dictionary <string, string>(); NMGPlayerPrefs.SetChannelKey(NMGChannel.EveryNetmarble, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Facebook, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Kakao, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Google, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.GameCenter, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Naver, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Twitter, null); NMGPlayerPrefs.SetRegion(null); if (Configuration.GetUseFixedPlayerID()) { // TODO FixedPlayerID } else { playerId = Guid.NewGuid().ToString().Replace("-", "").ToUpper(); NMGPlayerPrefs.SetPlayerId(playerId); Log.Debug("[NMGPlayMode.SessionManager] Save new PlayerID : " + playerId); deviceKey = Guid.NewGuid().ToString().Replace("-", "").ToUpper(); NMGPlayerPrefs.SetDeviceKey(deviceKey); Log.Debug("[NMGPlayMode.SessionManager] Save new deviceKey : " + deviceKey); InitTalkKit(); } }
private WWW SignIn(SignInDelegate callback, Session.SignInDelegate handler) { if (GMC2ServiceManager.Instance.GetConstantCount() == 0) { if (callback != null && callback is SignInDelegate) { Result result = new Result(Result.NETMARBLES_DOMAIN, Result.SERVICE, "GMC2 is fail"); Log.Debug("[NMGPlayMode.SessionManager] SignIn Fail (" + result + ")"); callback(result, handler); } return(null); } deviceKey = NMGPlayerPrefs.GetDeviceKey(); if (string.IsNullOrEmpty(deviceKey)) { deviceKey = Guid.NewGuid().ToString().Replace("-", "").ToUpper(); NMGPlayerPrefs.SetDeviceKey(deviceKey); Log.Debug("[NMGPlayMode.SessionManager] Save new deviceKey : " + deviceKey); } // UNDONE nmDeviceKey // string nmDeviceKey = null; // androidid, uuid WWWForm wwwForm = new WWWForm(); wwwForm.AddField("gameCode", ConfigurationManager.Instance.GameCode); wwwForm.AddField("deviceKey", deviceKey); wwwForm.AddField("playerId", playerId); wwwForm.AddField("countryCode", countryCode); Dictionary <string, string> headerDic = new Dictionary <string, string>(); headerDic["Content-Type"] = "application/x-www-form-urlencoded"; headerDic["Accept"] = "application/json"; string authUrl = GMC2ServiceManager.Instance.GetConstantValue("authUrl"); if (authUrl != null) { authUrl = authUrl.Replace("http://", "https://"); } authUrl += NMGConstants.SIGN_IN; WWW www = new WWW(authUrl, wwwForm.data, headerDic); CallbackManager.NetmarbleGameObject.StartCoroutine(WaitForSignIn(www, callback, handler)); return(www); }
public static void DeleteAll() { NMGPlayerPrefs.SetPlayerId(null); NMGPlayerPrefs.SetDeviceKey(null); NMGPlayerPrefs.SetRegion(null); NMGPlayerPrefs.SetChannelKey(NMGChannel.EveryNetmarble, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Facebook, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Kakao, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Google, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.GameCenter, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Naver, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Twitter, null); NMGPlayerPrefs.SetCountryCode(null); NMGPlayerPrefs.SetLanguage(null); NMGPlayerPrefs.SetJoinedCountryCode(null); NMGPlayerPrefs.SetIPAddress(null); }
public void SelectChannelConnectOption(ChannelConnectOption option, Session.SelectChannelConnectOptionDelegate handler) { ChannelConnectOptionType type = option.Type; NMGChannel channel = (NMGChannel)option.ChannelCode; string playerID = option.PlayerID; string channelID = option.ChannelID; string region = option.Region; if (type == ChannelConnectOptionType.Cancel) { NMGPlayerPrefs.SetChannelKey(channel, null); Result result = new Result(Result.NETMARBLES_DOMAIN, Result.SUCCESS, "Success"); Log.Debug("[NMGPlayMode.SessionManager] SelectChannelConnectOption OK (" + result + ")"); if (handler != null) { handler(result); } } else if (type == ChannelConnectOptionType.CreateChannelConnection) { playerId = Guid.NewGuid().ToString().Replace("-", "").ToUpper(); NMGPlayerPrefs.SetPlayerId(playerId); Log.Debug("[NMGPlayMode.SessionManager] Save new PlayerID : " + playerId); deviceKey = Guid.NewGuid().ToString().Replace("-", "").ToUpper(); NMGPlayerPrefs.SetDeviceKey(deviceKey); Log.Debug("[NMGPlayMode.SessionManager] Save new deviceKey : " + deviceKey); testData.SetChannelConnectionData(playerId, deviceKey); ChannelConnectionData savedData = testData.GetChannelConnectionData(playerId); savedData.SetChannelKeyByChannel(channel, channelID); NMGPlayerPrefs.SetChannelKey(NMGChannel.EveryNetmarble, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Facebook, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Kakao, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Google, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.GameCenter, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Naver, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Twitter, null); NMGPlayerPrefs.SetChannelKey(channel, channelID); NMGPlayerPrefs.SetRegion(region); selectChannelConnectOptionHandler = handler; SignIn(OnChannelOptionSignIn, null); UpdateTalkKit(); } else if (type == ChannelConnectOptionType.LoadChannelConnection) { ChannelConnectionData savedData = testData.GetChannelConnectionData(playerID); NMGPlayerPrefs.SetPlayerId(playerID); NMGPlayerPrefs.SetDeviceKey(savedData.DeviceKey); NMGPlayerPrefs.SetRegion(region); NMGPlayerPrefs.SetChannelKey(NMGChannel.EveryNetmarble, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Facebook, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Kakao, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Google, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.GameCenter, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Naver, null); NMGPlayerPrefs.SetChannelKey(NMGChannel.Twitter, null); NMGPlayerPrefs.SetChannelKey(channel, channelID); playerId = playerID; selectChannelConnectOptionHandler = handler; SignIn(OnChannelOptionSignIn, null); UpdateTalkKit(); } /* else if (type == ChannelConnectOptionType.UpdateChannelConnection) * { * NMPlayModeChannelConnectionData savedData = testData.GetChannelConnectionData(playerID); * NMPlayModeChannelConnectionData savedChannelData = testData.GetChannelConnectionData(channel, channelID); * * if (savedChannelData != null) * { * savedChannelData.SetChannelKeyByChannel(channel, null); * } * * savedData.SetChannelKeyByChannel(channel, channelID); * NMPlayModePlayerPrefs.SetChannelKey(channel, channelID); * * Result result = new Result(Result.NETMARBLES_DOMAIN, Result.SUCCESS, "Success"); * Log.Debug("[NMGPlayMode.SessionManager] SelectChannelConnectOption OK (" + result + ")"); * * if (handler != null) * handler(result); * }*/ }