public async Task <IEnumerable <LogEntry> > GetEntries(eEventLevel level = eEventLevel.All) { var urls = new Dictionary <eEventLevel, string> { { eEventLevel.All, "items" }, { eEventLevel.Error, "top/100/Error" }, { eEventLevel.Warning, "top/100/Warning" }, { eEventLevel.Information, "top/100/Information" }, { eEventLevel.Critical, "top/100/Critical" } }; try { var response = await _client.GetAsync(_baseUrl + urls[level]); if (response.IsSuccessStatusCode) { var json = await response.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <IEnumerable <LogEntry> >(json)); } } catch (Exception) {; } return(new List <LogEntry>()); }
public static void CreateNewStellarEvent(string civID, string locationName, string systemLocationID, string planetLocationID, eEventType eType, eEventLevel eLevel, eEventScope eScope, int Value1, string Label1) { GlobalGameData gDataRef = GameObject.Find("GameManager").GetComponent <GlobalGameData>(); string origDesc = DataManager.Descriptions[eType]; string newDesc = origDesc; GameEvent newEvent = new GameEvent(); newEvent.Type = eType; newEvent.Level = eLevel; newEvent.Scope = eScope; newEvent.CivID = civID; newEvent.SystemLocationID = systemLocationID; newEvent.PlanetLocationID = planetLocationID; newEvent.EventIsNew = true; newEvent.Date = gDataRef.GameDate; // set the date newEvent.Description = DataManager.Descriptions[eType]; if (origDesc.Contains("[VALUE]")) { string valueReplace; valueReplace = origDesc.Replace("[VALUE]", Mathf.Abs(Value1).ToString("N0")); newDesc = valueReplace; newEvent.Description = newDesc; } if (origDesc.Contains("[PLANET]")) { string planetReplace; planetReplace = newDesc.Replace("[PLANET]", locationName); newDesc = planetReplace; newEvent.Description = newDesc; } HelperFunctions.DataRetrivalFunctions.GetCivilization(civID).LastTurnEvents.Add(newEvent); // add the event to the correct civ list }