Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public BiomeSituation(BiomeSituation bs)
 {
     biome     = bs.biome;
     situation = bs.situation;
     body      = bs.body;
     listed    = bs.listed;
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
        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));
            }
        }
Esempio n. 6
0
        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();
            }
        }
Esempio n. 7
0
 private void AddToArray(BiomeSituation biome)
 {
     for (int i = 4; i > 0; i--)
     {
         historyArray[i] = historyArray[i - 1];
     }
     historyArray[0] = biome;
 }
Esempio n. 8
0
        private void AddCurrentBiomeToList(BiomeSituation bs)
        {
            string fullname = bs.GetText(true);

            if (!BiomeInList(fullname))
            {
                listIgnore.Add(fullname);
            }
        }
Esempio n. 9
0
 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;
 }
Esempio n. 10
0
        private string GetOutputString(BiomeSituation bs)
        {
            if (bs == null)
            {
                return("----");
            }

            string output = bs.GetDescription(includeAlt);

            if (BiomeInList(bs.GetText(includeAlt)))
            {
                output += " \u2713";
            }

            return(output);
        }
Esempio n. 11
0
        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();
            }
        }