public bool IsSameAs(BiomeSituation bs, bool useSituation, bool useVessel) { if (useVessel) { if (this.vesselGUID != bs.vesselGUID) { return(false); } } if (this.body.CompareTo(bs.body) != 0) { return(false); } if (this.biome.CompareTo(bs.biome) != 0) { return(false); } if (useSituation && this.situation.CompareTo(bs.situation) != 0) { return(false); } return(true); }
public BiomeSituation(BiomeSituation bs) { biome = bs.biome; situation = bs.situation; body = bs.body; listed = bs.listed; }
private void RemoveCurrentBiomeFromList(BiomeSituation bs) { try { while (true) { bool removed = false; foreach (string s in listIgnore) { if (s.Contains(bs.Biome) && s.Contains(bs.Body) && (!includeAlt || s.Contains(bs.Situation))) { listIgnore.Remove(s); removed = true; break; } } if (!removed) { break; } } } catch (Exception ex) { //print("###" + ex.Message); } }
private void DisplayLine(BiomeSituation bs) { GUILayout.BeginHorizontal(GUILayout.Width(fixedwidth - margin)); if (isPowered) { styleTextArea.normal.textColor = Color.green; string text = GetOutputString(bs); GUILayout.Label(text, styleTextArea); styleButton.normal.textColor = (text.Contains("\u2713") ? Color.red : Color.green); if (GUILayout.Button(".", styleButton, GUILayout.ExpandWidth(true))) { if (text.Contains("\u2713")) { RemoveCurrentBiomeFromList(bs); } else { AddCurrentBiomeToList(bs); } } styleButton.normal.textColor = styleButton.hover.textColor = styleButton.focused.textColor = styleButton.active.textColor = Color.white; styleButton.active.textColor = Color.green; } else { styleTextArea.normal.textColor = Color.grey; GUILayout.Label("----unpowered----", styleTextArea); } GUILayout.EndHorizontal(); }
private void RemoveCurrentBiomeFromList(BiomeSituation bs) { try { while (true) { bool removed = false; foreach (var s in from string s in listIgnore where s.Contains(bs.Biome) && s.Contains(bs.Body) && (!includeAlt || s.Contains(bs.Situation)) && (!perVessel || s.Contains(bs.VesselGUID.ToString())) select s) { listIgnore.Remove(s); removed = true; break; } if (!removed) { break; } } } catch (Exception ex) { //print("Biomatic - RemoveCurrentBiomeFromList(): " + ex.Message); Log.Info(String.Format("RemoveCurrentBiomeFromList(): {0} ", ex.Message)); } }
private void DoBiomaticContent() { if (Event.current.type == EventType.repaint && ConditionalShow) { isPowered = IsPowered(); if (isPowered != wasPowered) { sizechange = true; wasPowered = isPowered; } if (isPowered) { skip--; if (skip <= 0) { skip = 10; biome = GetBiomeSituation(); if (!prevBiome.IsSameAs(biome, includeAlt)) { //print("DIFFERENT: " + prevBiome.GetText(includeAlt) + " : " + biome.GetText(includeAlt)); prevBiome = biome; if (!BiomeInList(biome.GetText(includeAlt))) { if (deWarp) { TimeWarp.SetRate(0, false); } } AddToArray(biome); } else { //print("SAME: " + prevBiome.GetText(includeAlt) + " : " + biome.GetText(includeAlt)); } } } else { showDescription = false; showHistory = false; } } prevEventType = Event.current.type; ShowGraphicalIndicator(); if (isPowered) { ShowSettings(); } }
private void AddToArray(BiomeSituation biome) { for (int i = 4; i > 0; i--) { historyArray[i] = historyArray[i - 1]; } historyArray[0] = biome; }
private void AddCurrentBiomeToList(BiomeSituation bs) { string fullname = bs.GetText(true); if (!BiomeInList(fullname)) { listIgnore.Add(fullname); } }
private void AddToArray(BiomeSituation biome) { for (int i = 4; i > 0; i--) { if (historyArray[i] == null) { sizechange = true; } historyArray[i] = historyArray[i - 1]; } historyArray[0] = biome; }
private string GetOutputString(BiomeSituation bs) { if (bs == null) { return("----"); } string output = bs.GetDescription(includeAlt); if (BiomeInList(bs.GetText(includeAlt))) { output += " \u2713"; } return(output); }
private void DoBiomaticContent() { if (ConditionalShow) { isPowered = IsPowered; if (isPowered != wasPowered) { sizechange = true; wasPowered = isPowered; } if (isPowered && BiomaticIsEnabled) { biome = BiomeSituation; if (!prevBiome.IsSameAs(biome, includeAlt, perVessel)) { prevBiome = biome; if (soundType == 2) { DoSound(); } if (!BiomeInList(biome.GetText(includeAlt, perVessel))) { if (soundType == 1) { DoSound(); } if (deWarp) { TimeWarp.SetRate(0, instantDewarp); } } AddToArray(biome); } } } if (!HideUI) { ShowGraphicalIndicator(); ShowSettings(); } }