Пример #1
0
        public override void Signal(UItrigger trigger, string signal)
        {
            base.Signal(trigger, signal);
            if (reason != Reason.TooManyMod)
            {
                return;
            }

            foreach (KeyValuePair <int, string> mod in ConfigMenu.instance.modList)
            {
                if (mod.Value == signal)
                {
                    ConfigMenu.selectedModIndex = mod.Key; break;
                }
            }

            if (ConfigMenu.selectedModIndex < ConfigMenu.scrollTop)
            {
                ConfigMenu.scrollTop = ConfigMenu.selectedModIndex; ConfigMenu.ScrollButtons();
            }
            else if (ConfigMenu.selectedModIndex > ConfigMenu.scrollTop + 12)
            {
                ConfigMenu.scrollTop = ConfigMenu.selectedModIndex - 12; ConfigMenu.ScrollButtons();
            }

            ConfigMenu.instance.ChangeSelectedMod();
        }
Пример #2
0
    public override void Signal(UItrigger trigger, string signal)
    {
        base.Signal(trigger, signal);
        switch (signal)
        {
        case "default":
            this.startBox.value   = "19";
            this.pebblesBox.value = "5";
            break;

        case "easy":
            this.startBox.value   = "35";
            this.pebblesBox.value = "10";
            break;

        case "hard":
            this.startBox.value   = "10";
            this.pebblesBox.value = "3";
            break;

        case "cure":
            this.startBox.value   = "19";
            this.pebblesBox.value = "9999";
            break;

        case "range":
            CycleMod.fixedCycle = false;
            break;

        case "fixed":
            CycleMod.fixedCycle = true;
            break;
        }
    }
Пример #3
0
 public override void Signal(UItrigger trigger, string signal)
 {
     base.Signal(trigger, signal);
     if (signal == "rainButton")
     {
         this.rainWeather.valueBool = true;
     }
     if (signal == "snowButton")
     {
         this.snowWeather.valueBool = true;
     }
 }
Пример #4
0
        public override void Signal(UItrigger trigger, string signal)
        {
            base.Signal(trigger, signal);
            if (signal != null)
            {
                CustomWorldMod.Log($"Received menu signal [{signal}]");

                // Refresh config menu list
                if (signal.Equals("refresh"))
                {
                    ConfigMenu.ResetCurrentConfig();
                }
                // Reload pack list
                else if (signal.Equals("reloadRegions"))
                {
                    CustomWorldMod.LoadCustomWorldResources();
                }
                // Downnload a pack X
                else if (signal.Contains("download") || signal.Contains("update"))
                {
                    if (CustomWorldMod.scripts.FindAll(x => x is PackDownloader).Count == 0)
                    {
                        // Process ID of Rain World
                        string ID = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
                        // Divider used
                        string divider = "<div>";
                        // Name of the pack to download
                        string packName = signal.Substring(signal.IndexOf("_") + 1);
                        string url      = "";

                        CustomWorldMod.Log($"Download / update signal from [{packName}]");

                        if (CustomWorldMod.rainDbPacks.TryGetValue(packName, out RegionPack toDownload))
                        {
                            url = toDownload.packUrl;
                        }

                        if (url != null && url != string.Empty)
                        {
                            string arguments = $"{url}{divider}\"{packName}\"{divider}{ID}{divider}" + @"\" + CustomWorldMod.resourcePath + (signal.Contains("update") ? $"{divider}update" : "");
                            CustomWorldMod.Log($"Creating pack downloader for [{arguments}]");

                            CustomWorldMod.scripts.Add(new PackDownloader(arguments, packName));
                            CRExtras.TryPlayMenuSound(SoundID.MENU_Player_Join_Game);
                        }
                        else
                        {
                            CustomWorldMod.Log($"Error loading pack [{packName}] from raindb pack list", true);
                        }
                    }
                    else
                    {
                        CustomWorldMod.Log("Pack downloader in process");
                        CRExtras.TryPlayMenuSound(SoundID.MENU_Player_Unjoin_Game);
                    }
                }
                // Close the game
                else if (signal.Equals("close_game"))
                {
                    CustomWorldMod.Log("Exiting game...");
                    Application.Quit();
                }
                // Close(hide) pop-up window
                else if (signal.Equals("close_window"))
                {
                    if (currentWindowPopUp != null)
                    {
                        OpTab tab = ConfigMenu.currentInterface.Tabs.First(x => x.name.Equals("Browse RainDB"));
                        if (tab != null)
                        {
                            foreach (UIelement item in currentWindowPopUp)
                            {
                                try
                                {
                                    item.Hide();
                                }
                                catch (Exception e) { CustomWorldMod.Log("option " + e, true); }
                            }
                        }
                    }
                }
                else
                {
                    CustomWorldMod.Log($"Unknown signal [{signal}]", true);
                }
            }
        }
Пример #5
0
 public override void Signal(UItrigger trigger, string signal)
 {
     base.Signal(trigger, signal);
     //Clicking a creature button
     if (signal != "reset" && signal != "real" && signal != "vibrant")
     {
         this.selected = signal.Remove(signal.Length - 3, 3);
         if (this.configColors[this.selected] != null)
         {
             this.colorPicker.valueColor = this.configColors[this.selected];
             if (this.vibrant)
             {
                 this.previewOld.sprite.color = BloodMod.vibrantColors[this.selected];
             }
             else
             {
                 this.previewOld.sprite.color = BloodMod.defaultColors[this.selected];
             }
         }
     }
     //Clicking reset button
     if (this.selected != "" && signal == "reset")
     {
         for (int i = 0; i < this.Tabs[0].items.Count; i++)
         {
             if (this.Tabs[0].items[i] is OpColorPicker)
             {
                 if ((this.Tabs[0].items[i] as OpColorPicker).key == this.selected)
                 {
                     (this.Tabs[0].items[i] as OpColorPicker).value = OpColorPicker.ColorToHex(BloodMod.defaultColors[this.selected]);
                 }
             }
         }
         this.configColors[this.selected] = BloodMod.defaultColors[this.selected];
         this.previewOld.sprite.color     = BloodMod.defaultColors[this.selected];
     }
     if (signal == "real")
     {
         this.vibrant                 = false;
         this.preset.value            = "false";
         this.configColors            = new Dictionary <string, Color>(BloodMod.defaultColors);
         this.previewOld.sprite.color = BloodMod.defaultColors[this.selected];
         foreach (KeyValuePair <string, Color> key in BloodMod.defaultColors)
         {
             for (int i = 0; i < this.Tabs[0].items.Count; i++)
             {
                 if (this.Tabs[0].items[i] is OpColorPicker)
                 {
                     if ((this.Tabs[0].items[i] as OpColorPicker).key == key.Key)
                     {
                         (this.Tabs[0].items[i] as OpColorPicker).value = OpColorPicker.ColorToHex(BloodMod.defaultColors[key.Key]);
                     }
                 }
             }
         }
     }
     if (signal == "vibrant")
     {
         this.vibrant                 = true;
         this.preset.value            = "true";
         this.configColors            = new Dictionary <string, Color>(BloodMod.vibrantColors);
         this.previewOld.sprite.color = BloodMod.vibrantColors[this.selected];
         foreach (KeyValuePair <string, Color> key in BloodMod.vibrantColors)
         {
             for (int i = 0; i < this.Tabs[0].items.Count; i++)
             {
                 if (this.Tabs[0].items[i] is OpColorPicker)
                 {
                     if ((this.Tabs[0].items[i] as OpColorPicker).key == key.Key)
                     {
                         (this.Tabs[0].items[i] as OpColorPicker).value = OpColorPicker.ColorToHex(BloodMod.vibrantColors[key.Key]);
                     }
                 }
             }
         }
     }
 }