void HandleLog(string logString, string stackTrace, LogType type) { if (type == LogType.Error || type == LogType.Exception) { string md5str = HashSecurity.Encrypt(logString + stackTrace); if (m_logList.Contains(md5str) == false) { string platform = "win"; #if UNITY_IPHONE platform = "ios"; #elif UNITY_ANDROID platform = "android"; #endif PluginTool pluginTools = PluginTool.SharedInstance(); string gameId = pluginTools.GetPlatformConfig(PluginTool.GAMEID_KEY, "0"); string userIdStr = PlayerPrefsEx.GetString("userId"); long userId = 0; if (!string.IsNullOrEmpty(userIdStr)) { userId = long.Parse(userIdStr); } long roleId = 0; string roleName = ""; LuaState lua = LuaInstance.instance.Get(); lua.GetGlobal("Client"); lua.GetField(-1, "RoleInfo"); if (!lua.IsNil(-1)) { lua.GetField(-1, "RoleID"); roleId = lua.ToInteger(-1); lua.Pop(1); lua.GetField(-1, "RoleName"); roleName = lua.ToString(-1); lua.Pop(1); } lua.Pop(1); lua.GetField(-1, "ClientVersion"); string version = lua.ToString(-1); lua.Pop(2); string request = string.Format("{0}?GameID={1}&PlayerID={2}&RoleId={3}&logString={4}&StackTrace={5}&LogType={6}&RoleName={7}&platform={8}&servernum={9}&gateway_id={10}&machine={11}&version={12}&GameName={13}", PluginTool.SharedInstance().logUrl, gameId, userId, roleId, System.Uri.EscapeDataString(logString), System.Uri.EscapeDataString(stackTrace), System.Uri.EscapeDataString(type.ToString()), System.Uri.EscapeDataString(roleName), platform, PlayerPrefs.GetInt("lastServerNum", 0), PlayerPrefs.GetInt("lastServerID", 0), SystemInfo.deviceModel, version, "hzmj"); PluginTool.SharedInstance().logStr = request; StartCoroutine(SendException(request, md5str)); } } }
protected static string DrawPopup(string label, string key, string value, string[] displayedOptions) { value = PlayerPrefsEx.GetString(key, value); // int intValue = System.Array.IndexOf(displayedOptions, value); if (intValue < 0) { intValue = 0; } // int newValue = EditorGUILayout.Popup(label, intValue, displayedOptions); if (newValue != intValue) { PlayerPrefsEx.SetString(key, displayedOptions[newValue]); } return(displayedOptions[newValue]); }
public static SaveData Load() { var json = PlayerPrefsEx.GetString("ingame_save_data", "{}"); return(JsonUtility.FromJson <SaveData>(json)); }