示例#1
0
        public override void Initialize()
        {
            base.Initialize();
            Tabs    = new OpTab[1];
            Tabs[0] = new OpTab("Overseers");

            cModeBox     = new OpComboBox(new Vector2(200, 210), 150, "colourMode", Enum.GetNames(typeof(ColourMode)), "RandomStatic");
            cPickerLabel = new OpLabel(150, 160, "Custom colour selector");
            cPicker      = new OpColorPicker(new Vector2(200, 7), "customColour", "A369E0");

            Tabs[0].AddItems(
                new OpLabel(new Vector2(100, 550), new Vector2(400, 40), rwMod.ModID, bigText: true),
                new OpLabel(new Vector2(150, 500), new Vector2(150, 30), $"v{rwMod.Version}"),
                new OpLabel(new Vector2(300, 500), new Vector2(150, 30), $"by {rwMod.author}"),

                new OpLabel(150, 400, "Minimum overseer count per region"),
                new OpSlider(new Vector2(200, 360), "min", new IntVector2(5, 100), 200, false, defaultMin),

                new OpLabel(150, 320, "Maximum overseer count per region"),
                new OpSlider(new Vector2(200, 280), "max", new IntVector2(5, 100), 200, false, defaultMax),

                new OpLabel(150, 240, "Colour mode"),
                cModeBox,

                cPickerLabel, cPicker
                );
        }
        public void MainTabRedux(int tab)
        {
            // MOD DESCRIPTION
            OpLabel labelID = new OpLabel(new Vector2(50, 560), new Vector2(500, 40f), mod.ModID.ToUpper(), FLabelAlignment.Center, true);

            Tabs[tab].AddItems(labelID);
            OpLabel labelDsc = new OpLabel(new Vector2(100f, 545), new Vector2(400f, 20f), "Support for custom regions.", FLabelAlignment.Center, false);

            Tabs[tab].AddItems(labelDsc);

            // VERSION AND AUTHOR
            OpLabel labelVersion = new OpLabel(new Vector2(50, 530), new Vector2(200f, 20f), "Version: pre-release" /*+ mod.Version*/, FLabelAlignment.Left, false);

            Tabs[tab].AddItems(labelVersion);
            OpLabel labelAuthor = new OpLabel(new Vector2(430, 560), new Vector2(60, 20f), "by Garrakx", FLabelAlignment.Right, false);

            Tabs[tab].AddItems(labelAuthor);

            Tabs[tab].AddItems(new OpSimpleButton(new Vector2(525, 550), new Vector2(60, 30), "reloadRegions", "Reload"));

            OpLabelLong errorLabel = new OpLabelLong(new Vector2(25, 1), new Vector2(500, 15), "", true, FLabelAlignment.Center)
            {
                text = "Any changes made (load order, activating/deactivating) will corrupt the save"
            };

            Tabs[tab].AddItems(errorLabel);
            CreateRegionPackList(Tabs[tab], CustomWorldMod.installedPacks, CustomWorldMod.downloadedThumbnails, false);
        }
示例#3
0
    public override void Initialize()
    {
        //Tabs
        this.Tabs      = new OpTab[1];
        this.Tabs[0]   = new OpTab("Config");
        this.cycleRect = new OpRect(new Vector2(50f, 325f), new Vector2(500f, 250f), 0.3f);
        //Labels
        Vector2 rectPos = new Vector2(this.cycleRect.GetPos().x - 10f, this.cycleRect.GetPos().y - 5f);

        this.hunterCycles             = new OpLabel(rectPos + new Vector2(23f, this.cycleRect.size.y - 25f), new Vector2(0f, 0f), "HUNTER CYCLES", FLabelAlignment.Left, true);
        this.startCycles              = new OpLabel(new Vector2(rectPos.x + (this.cycleRect.size.x / 2 - 80f), rectPos.y + this.cycleRect.size.y - 180f), new Vector2(0f, 0f), "Starting Cycles", FLabelAlignment.Center, false);
        this.pebblesCycles            = new OpLabel(new Vector2(rectPos.x + (this.cycleRect.size.x / 2 + 80f), rectPos.y + this.cycleRect.size.y - 180f), new Vector2(0f, 0f), "Pebbles Cycles", FLabelAlignment.Center, false);
        this.hunterToggle             = new OpCheckBox(rectPos + new Vector2(this.cycleRect.size.x - 25f, this.cycleRect.size.y - 30f), "hunterToggle", true);
        this.hunterToggle.description = "Toggle custom Hunter cycles";
        this.Tabs[0].AddItems(this.cycleRect, this.hunterCycles, this.startCycles, this.pebblesCycles, this.hunterToggle);
        //Textboxes
        this.startBox   = new OpTextBox(startCycles.GetPos() + new Vector2(-30f, -25f), 80f, "startCycle", "19", OpTextBox.Accept.Int);
        this.pebblesBox = new OpTextBox(pebblesCycles.GetPos() + new Vector2(-30f, -25f), 80f, "pebblesCycle", "5", OpTextBox.Accept.Int);
        this.Tabs[0].AddItems(this.startBox, this.pebblesBox);
        //Presets
        Vector2 presetPos = new Vector2(rectPos.x + 55f, rectPos.y + 90f);

        this.presetDescription         = new OpLabel(rectPos + new Vector2(this.cycleRect.size.x / 2, this.cycleRect.size.y - 74f), new Vector2(0f, 0f), "Choose a preset below or type in the desired cycle count.", FLabelAlignment.Center, false);
        this.presetDefault             = new OpSimpleButton(presetPos + new Vector2(30f, 30f), new Vector2(80f, 30f), "default", "DEFAULT");
        this.presetDefault.description = "Reset cycle numbers to their defaults";
        this.presetEasy             = new OpSimpleButton(presetPos + new Vector2(120f, 30f), new Vector2(80f, 30f), "easy", "EASY");
        this.presetEasy.description = "Start with more cycles, and recieve more from Five Pebbles";
        this.presetHard             = new OpSimpleButton(presetPos + new Vector2(210f, 30f), new Vector2(80f, 30f), "hard", "HARD");
        this.presetHard.description = "Start with less cycles, and recieve less from Five Pebbles";
        this.presetCure             = new OpSimpleButton(presetPos + new Vector2(300f, 30f), new Vector2(80f, 30f), "cure", "CURE");
        this.presetCure.description = "Start with the default number of cycles, but visiting Five Pebbles will essentially cure Hunter's illness";
        //Credits
        this.Tabs[0].AddItems(this.presetDescription, this.presetDefault, this.presetEasy, this.presetHard, this.presetCure);

        //Cycle Length
        this.lengthRect = new OpRect(new Vector2(50f, 30f), new Vector2(500f, 270f), 0.3f);
        Vector2 rect2Pos = new Vector2(this.lengthRect.GetPos().x - 10f, this.lengthRect.GetPos().y - 5f);

        this.cycleLength = new OpLabel(rect2Pos + new Vector2(23f, this.lengthRect.size.y - 25f), new Vector2(0f, 0f), "CYCLE LENGTH", FLabelAlignment.Left, true);

        this.minCycleSlider             = new OpSlider(rect2Pos + new Vector2(50f, this.lengthRect.size.y - 170f), "minLength", new IntVector2(2, 60), 7f, false, 12);
        this.minCycleSlider.colorEdge   = new Color(0f, 1f, 0f);
        this.maxCycleSlider             = new OpSlider(rect2Pos + new Vector2(50f, this.lengthRect.size.y - 210f), "maxLength", new IntVector2(2, 60), 7f, false, 26);
        this.maxCycleSlider.colorEdge   = new Color(1f, 0f, 0f);
        this.fixedCycleSlider           = new OpSlider(rect2Pos + new Vector2(50f, this.lengthRect.size.y - 185f), "fixedLength", new IntVector2(2, 61), 7f, false, 20);
        this.fixedCycleSlider.colorEdge = new Color(0.1f, 0.1f, 1f);

        this.rangeButton              = new OpSimpleButton(rect2Pos + new Vector2(50f, this.lengthRect.size.y - 115f), new Vector2(70f, 30f), "range", "RANGE");
        this.fixedButton              = new OpSimpleButton(rect2Pos + new Vector2(130f, this.lengthRect.size.y - 115f), new Vector2(70f, 30f), "fixed", "FIXED");
        this.timeLabel                = new OpLabel(rect2Pos + new Vector2(this.lengthRect.size.x / 2, this.lengthRect.size.y - 245f), new Vector2(0f, 0f), "X MINUTES", FLabelAlignment.Center, true);
        this.lengthToggle             = new OpCheckBox(rect2Pos + new Vector2(this.lengthRect.size.x - 25f, this.lengthRect.size.y - 30f), "lengthToggle", true);
        this.lengthToggle.description = "Toggle custom cycle length";
        this.lengthDescription        = new OpLabel(rect2Pos + new Vector2(50f, this.lengthRect.size.y - 70f), new Vector2(0f, 0f), "Adjust the possible length a cycle can be or set a fixed length.", FLabelAlignment.Left, false);
        this.fixedLength              = new OpCheckBox(new Vector2(0f, -1000f), "fixedCycle", false);

        this.Tabs[0].AddItems(this.lengthRect, this.cycleLength, this.fixedLength, this.minCycleSlider, this.maxCycleSlider, this.timeLabel, this.rangeButton, this.lengthToggle, this.fixedButton, this.fixedCycleSlider, this.lengthDescription);
    }
示例#4
0
        private void InitChangeLog()
        {
            List <UIelement> newElems = new List <UIelement>();

            this.lblTitle = new OpLabel(new Vector2(200f, 560f), new Vector2(200f, 30f), InternalTranslator.Translate("Config Machine ChangeLog"), bigText: true);
            this.lblVer   = new OpLabel(new Vector2(50f, 540f), new Vector2(200f, 20f), GetCMVersion(), FLabelAlignment.Left);
            this.lblTrans = new OpLabel(new Vector2(350f, 540f), new Vector2(200f, 20f), GetTranslator(), FLabelAlignment.Right);
            this.AddItems(this.lblTitle, this.lblVer, this.lblTrans);
            newElems.Add(this.lblTitle); newElems.Add(this.lblVer); newElems.Add(this.lblTrans);

            if (rawLog == null)
            {
                ReadTXT();
            }
            int len = Math.Min(rawLog.Length - 1, 16);

            this.box = new OpScrollBox(new Vector2(20f, 10f), new Vector2(560f, 520f), len * 560f, true, true, false)
            {
                redrawFlags = OpScrollBox.RedrawEvents.OnHover, doesBackBump = false
            };
            this.AddItems(this.box); this.box.Lock(true);
            newElems.Add(this.box);
            this.vers = new string[len];
            for (int i = 0; i < len; i++)
            {
                string[] split = Regex.Split(rawLog[i + 1], "#!#");
                this.vers[i] = split[0];
                OpLabel     ver = new OpLabel(new Vector2(130f + i * 560f, 470f), new Vector2(300f, 30f), split[0], bigText: true);
                OpLabelLong log = new OpLabelLong(new Vector2(20f + i * 560f, 20f), new Vector2(520f, 420f), "placeholder")
                {
                    allowOverflow = false
                };
                log.text = split[2].Trim();
                if (!string.IsNullOrEmpty(split[1]))
                {
                    ver.description = ConvertDate(split[1].Trim()); ver.bumpBehav = new BumpBehaviour(ver);
                }
                this.box.AddItems(ver, log);
                newElems.Add(ver); newElems.Add(log);
            }

            sbRight = new ScrollButton(new Vector2(460f, 470f), true);
            sbLeft  = new ScrollButton(new Vector2(90f, 470f), false);
            this.AddItems(sbRight, sbLeft); sbLeft.Hide(); curVer = 0;
            newElems.Add(sbRight); newElems.Add(sbLeft);

            foreach (UIelement element in newElems)
            {
                foreach (MenuObject obj in element.subObjects)
                {
                    OptionScript.configMenu.pages[0].subObjects.Add(obj);
                }
                OptionScript.configMenu.pages[0].Container.AddChild(element.myContainer);
            }

            _initLog = true;
        }
        public void BigTextTab(OpTab[] TabList, int tabNum, string txt, FLabelAlignment alignment = FLabelAlignment.Left)
        {
            OpRect  TextBoxContainer = new OpRect(new Vector2(65f, 37f), new Vector2(475f, 450f));
            OpLabel TextBoxID        = new OpLabel(new Vector2(90f, 60f), new Vector2(424f, 402f), txt, alignment, false)
            {
                autoWrap = true
            };

            TabList[tabNum].AddItems(TextBoxContainer);
            TabList[tabNum].AddItems(TextBoxID);
        }
示例#6
0
        public void TutoInit()
        {
            labelID = new OpLabel(new Vector2(100f, 500f), new Vector2(400f, 50f), "No Mod can be configured", FLabelAlignment.Center, true);

            labelVersion = new OpLabel(new Vector2(100f, 440f), new Vector2(200f, 20f), string.Concat("Config Machine (CompletelyOptional) by topicular"), FLabelAlignment.Left);
            labelAuthor  = new OpLabel(new Vector2(300f, 410f), new Vector2(200f, 20f), string.Concat("also shoutout to RW Discord for helping me out"), FLabelAlignment.Right);

            labelSluggo0 = new OpLabel(new Vector2(100f, 300f), new Vector2(400f, 20f), "checkout pinned tutorial in modding-support");
            labelSluggo1 = new OpLabel(new Vector2(100f, 260f), new Vector2(400f, 20f), "and create your own config screen!");
            Tabs[0].AddItems(labelID, labelVersion, labelAuthor, labelSluggo0, labelSluggo1);
        }
示例#7
0
        public override void Initialize()
        {
            // hopefully all of the 'magic numbers' can be forgiven
            songKeyBindings = new KeyCode[4];

            base.Initialize();
            Tabs    = new OpTab[1];
            Tabs[0] = new OpTab("FMTTM");

            // metadata start
            string modName = FMTTMMod.Instance.Info.Metadata.Name;
            string modVrsn = FMTTMMod.Instance.Info.Metadata.Version.ToString();
            string modAuth = FMTTMMod.Instance.Info.Metadata.GUID.Split('.')[0];

            Tabs[0].AddItems(new UIelement[]
            {
                new OpLabel(new Vector2(50, 550), new Vector2(150, 40), modName, FLabelAlignment.Left, true),
                new OpLabel(new Vector2(228, 552), new Vector2(100, 30), $"by {modAuth}", FLabelAlignment.Left),
                new OpLabel(new Vector2(58, 535), new Vector2(100, 15), $"v{modVrsn}", FLabelAlignment.Left),
                new OpLabel(new Vector2(40, 500), new Vector2(250, 15), "Configure song hotkey for each player below!", FLabelAlignment.Left)
            });
            // metadata end

            // player control config start
            Vector2 rectSize = new Vector2(245, 59);

            int[,] controlConfigBoxCoords = new int[, ]
            {
                { 50, 400 }, { 305, 400 },
                { 50, 330 }, { 305, 330 }
            };

            for (int i = 0; i < controlConfigBoxCoords.GetLength(0); i++)
            {
                // rect's position coords (bottom-left corner)
                Vector2 bl = new Vector2(controlConfigBoxCoords[i, 0], controlConfigBoxCoords[i, 1]);

                OpRect  rect  = new OpRect(bl, rectSize);
                OpLabel label = new OpLabel(
                    new Vector2(bl.x + 5, bl.y + 20),
                    new Vector2(100, 15), $"Player {i + 1}");

                string      keyCodeString = (i == 0) ? KeyCode.C.ToString() : KeyCode.None.ToString();
                OpKeyBinder keyBinder     = new OpKeyBinder(
                    new Vector2(bl.x + 98, bl.y + 7),
                    new Vector2(140, 45), modID: FMTTMMod.Instance.Info.Metadata.GUID, $"player{i + 1}_key",
                    keyCodeString, false, OpKeyBinder.BindController.AnyController);

                Tabs[0].AddItems(new UIelement[] { rect, label, keyBinder });
            }
            // player control config end
        }
        public void AddHeader(OpTab[] TabList, int tabNum, string headerTxt)
        {
            OpLabel headerID         = new OpLabel(new Vector2(62.5f, 530f), new Vector2(475f, 50f), "Primitive Armory".ToUpper(), FLabelAlignment.Center, true);
            OpLabel headerDescID     = new OpLabel(new Vector2(62.5f, 520f), new Vector2(475f, 25f), headerTxt, FLabelAlignment.Center, false);
            OpLabel versionID        = new OpLabel(new Vector2(62.5f, 525f), new Vector2(225f, 40f), "Version: " + Main.instance.Version, FLabelAlignment.Left, false);
            OpLabel authorID         = new OpLabel(new Vector2(312.5f, 525f), new Vector2(225f, 40f), "Author: " + Main.instance.author, FLabelAlignment.Right, false);
            OpRect  optionsContainer = new OpRect(new Vector2(40f, 12f), new Vector2(525f, 500f));
            OpRect  headerContainer  = new OpRect(new Vector2(40f, 512f), new Vector2(525f, 65f));

            TabList[tabNum].AddItems(headerID);
            TabList[tabNum].AddItems(headerDescID);
            TabList[tabNum].AddItems(versionID);
            TabList[tabNum].AddItems(authorID);
            TabList[tabNum].AddItems(optionsContainer);
            TabList[tabNum].AddItems(headerContainer);
        }
        private void PackBrowser(int tab)
        {
            // Header
            OpLabel labelID = new OpLabel(new Vector2(100f, 560), new Vector2(400f, 40f), $"Browse RainDB".ToUpper(), FLabelAlignment.Center, true);

            Tabs[tab].AddItems(labelID);

            OpLabel labelDsc = new OpLabel(new Vector2(100f, 540), new Vector2(400f, 20f), $"Download region packs from RainDB", FLabelAlignment.Center, false);

            Tabs[tab].AddItems(labelDsc);

            Tabs[tab].AddItems(new OpSimpleButton(new Vector2(525, 550), new Vector2(60, 30), "reloadRegions", "Refresh"));

            // Create pack list
            CreateRegionPackList(Tabs[tab], CustomWorldMod.rainDbPacks, CustomWorldMod.downloadedThumbnails, true);
        }
示例#10
0
    public override void Initialize()
    {
        //Tabs
        this.Tabs    = new OpTab[1];
        this.Tabs[0] = new OpTab("Config");
        //Rect
        OpLabel title  = new OpLabel(240f, 475f, "SCAVSOUT!", true);
        OpLabel author = new OpLabel(167f, 455f, "Created by: LeeMoriya | Idea by: ThreeFingerG", false);
        OpRect  rect   = new OpRect(new UnityEngine.Vector2(140f, 302f), new UnityEngine.Vector2(310f, 140f), 0.3f);

        //Checkboxes
        this.shelterAccess = new OpCheckBox(new UnityEngine.Vector2(160f, 400f), "shelter", true);
        OpLabel shelter = new OpLabel(190f, 402f, "Scavengers are not allowed in shelters", false);

        this.itemPickup = new OpCheckBox(new UnityEngine.Vector2(160f, 360f), "pickup", true);
        OpLabel pickup = new OpLabel(190f, 362f, "Scavengers cannot pick up items in shelters", false);

        this.fleeShelter = new OpCheckBox(new UnityEngine.Vector2(160f, 320f), "flee", true);
        OpLabel flee = new OpLabel(190f, 322f, "Scavengers flee shelters if injured", false);

        this.Tabs[0].AddItems(title, author, rect, this.shelterAccess, this.itemPickup, this.fleeShelter, shelter, pickup, flee);
    }
示例#11
0
 private void SetUp(OpLabel op, SpirvInstructionTreeBuilder treeBuilder)
 {
     SetUpDecorations(op, treeBuilder);
 }
示例#12
0
#pragma warning restore IDE0060
#pragma warning restore CA1822

        public override void Initialize()
        {
            if (this.reason == Reason.TooManyMod)
            {
                ListMods();
                return;
            }

            Tabs    = new OpTab[1];
            Tabs[0] = new OpTab();

            if (this.reason == Reason.NoMod)
            {
                TutoInit();
                return;
            }

            GeneratedOI.AddBasicProfile(Tabs[0], rwMod);

            switch (this.reason)
            {
            case Reason.NoInterface:
                if (rwMod.description != RainWorldMod.authorNull)
                {
                    Tabs[0].AddItems(new OpLabelLong(new Vector2(50f, 200f), new Vector2(500f, 250f), rwMod.description, alignment: FLabelAlignment.Center));
                    labelSluggo0 = new OpLabel(new Vector2(100f, 150f), new Vector2(400f, 20f),
                                               InternalTranslator.Translate(rwMod.type == RainWorldMod.Type.PartialityMod ? "This Partiality Mod has no Option Interface." : "This BepInEx Plugin has no Option Interface."));
                }
                else
                {
                    labelSluggo0 = new OpLabel(new Vector2(100f, 350f), new Vector2(400f, 20f),
                                               InternalTranslator.Translate(rwMod.type == RainWorldMod.Type.PartialityMod ? "This Partiality Mod has no Option Interface." : "This BepInEx Plugin has no Option Interface."));
                }

                Tabs[0].AddItems(labelSluggo0);

                break;

            case Reason.InitError:
                blue = new OpRect(new Vector2(30f, 20f), new Vector2(540f, 420f))
                {
                    alpha = 0.7f, colorFill = new Color(0.121568627f, 0.40392156862f, 0.69411764705f, 1f)
                };

                Color white = Menu.Menu.MenuRGB(Menu.Menu.MenuColors.White);
                oof = new OpLabel(new Vector2(100f, 380f), new Vector2(30f, 40f), ":(", FLabelAlignment.Left, true)
                {
                    color = white
                };
                labelSluggo0 = new OpLabel(new Vector2(150f, 390f), new Vector2(300f, 20f), InternalTranslator.Translate("There was an issue initializing OptionInterface."))
                {
                    color = white
                };
                labelSluggo1 = new OpLabelLong(new Vector2(50f, 40f), new Vector2(500f, 320f), exception)
                {
                    color = white, allowOverflow = false
                };
                labelVersion = new OpLabel(new Vector2(50f, 480f), new Vector2(100f, 20f), string.Concat(Environment.NewLine, "Config Machine ", MenuTab.GetCMVersion()), FLabelAlignment.Left);

                Tabs[0].AddItems(blue, oof, labelSluggo0, labelSluggo1, labelVersion);

                break;
            }
        }
        private void NewsTab(int tab)
        {
            // Header
            OpLabel labelID = new OpLabel(new Vector2(100f, 560), new Vector2(400f, 40f), $"News Feed".ToUpper(), FLabelAlignment.Center, true);

            Tabs[tab].AddItems(labelID);

            OpLabel labelDsc = new OpLabel(new Vector2(100f, 540), new Vector2(400f, 20f), $"Latest news for CRS", FLabelAlignment.Center, false);

            Tabs[tab].AddItems(labelDsc);

            List <UIelement> news = new List <UIelement>();

            if (File.Exists(Custom.RootFolderDirectory() + "customNewsLog.txt"))
            {
                DateTime current = DateTime.UtcNow.Date;
                CustomWorldMod.Log($"Reading news feed, current time [{current.ToString("dd/MM/yyyy")}]");
                string[] lines = File.ReadAllLines(Custom.RootFolderDirectory() + "customNewsLog.txt");
                for (int i = 0; i < lines.Length; i++)
                {
                    if (lines[i].Contains(News.IGNORE) || lines[i].Equals(string.Empty))
                    {
                        continue;
                    }
                    bool     bigText    = false;
                    string   lastUpdate = string.Empty;
                    TimeSpan diff;
                    if (lines[i].Contains(News.DATE))
                    {
                        if (!updatedNews)
                        {
                            try
                            {
                                DateTime newsDate = DateTime.ParseExact(lines[i].Replace(News.DATE, ""), "dd/MM/yyyy", null);
                                diff       = current - newsDate;
                                lastUpdate = newsDate.ToShortDateString();
                                CustomWorldMod.Log($"News date [{lastUpdate}], difference [{diff.TotalDays}]");
                                if (Math.Abs(diff.TotalDays) < 7)
                                {
                                    updatedNews = true;
                                }
                            }
                            catch (Exception e) { CustomWorldMod.Log($"Error reading the date time in news feed [{lines[i].Replace(News.DATE, "")}] - [{e}]", true); }
                        }
                        continue;
                    }
                    if (lines[i].Contains(News.BIGTEXT))
                    {
                        bigText = true; lines[i] = lines[i].Replace(News.BIGTEXT, "");
                    }

                    if (bigText)
                    {
                        news.Add(new OpLabel(default(Vector2), default(Vector2), lines[i], FLabelAlignment.Center, true));
                    }
                    else
                    {
                        news.Add(new OpLabelLong(default(Vector2), default(Vector2), lines[i], true, FLabelAlignment.Left));
                    }
                }

                //How Many Options
                int numberOfNews = news.Count;

                if (numberOfNews < 1)
                {
                    OpLabel label2 = new OpLabel(new Vector2(100f, 350), new Vector2(400f, 20f), "No news found.", FLabelAlignment.Center, false);
                    Tabs[tab].AddItems(label2);
                    return;
                }
                int spacing = 25;

                Vector2     rectSize   = new Vector2(500 - spacing, 30);
                OpScrollBox mainScroll = new OpScrollBox(new Vector2(25, 25), new Vector2(550, 500), (int)(spacing + ((rectSize.y + spacing) * numberOfNews)));
                Vector2     rectPos    = new Vector2(spacing / 2, mainScroll.contentSize - rectSize.y - spacing);
                Vector2     labelSize  = new Vector2(rectSize.x - spacing, rectSize.y - 2 * spacing);
                Tabs[tab].AddItems(mainScroll);

                for (int i = 0; i < numberOfNews; i++)
                {
                    UIelement label = news[i];
                    label.pos  = rectPos + new Vector2(spacing, spacing);
                    label.size = labelSize;

                    mainScroll.AddItems(label);
                    rectPos.y -= rectSize.y + spacing;
                }
            }
        }
示例#14
0
    public override void Initialize()
    {
        regionList = RegionFinder.Generate().ToArray();

        //Tabs
        this.Tabs    = new OpTab[1];
        this.Tabs[0] = new OpTab("Weather");

        //Weather Type
        this.logo             = new OpImage(new Vector2(270f, 540f), "logo");
        this.logo2            = new OpImage(new Vector2(270f, 540f), "logo2");
        this.weatherType      = new OpRadioButtonGroup("Type", 0);
        this.weatherTypeLabel = new OpLabel(new Vector2(30f, 570f), new Vector2(400f, 40f), "Weather Type", FLabelAlignment.Left, true);
        this.rainWeather      = new OpRadioButton(new Vector2(0f, 800f));
        this.rainButton       = new OpSimpleButton(new Vector2(30f, 540f), new Vector2(70f, 25f), "rainButton", "Rain");
        this.snowWeather      = new OpRadioButton(new Vector2(0f, 800f));
        this.snowButton       = new OpSimpleButton(new Vector2(130f, 540f), new Vector2(70f, 25f), "snowButton", "Snow");
        this.weatherType.SetButtons(new OpRadioButton[] { rainWeather, snowWeather });
        //this.weatherType.valueInt = 1;
        this.versionNumber     = new OpLabel(new Vector2(10f, -5f), new Vector2(0f, 0f), "Version: " + Downpour.mod.Version, FLabelAlignment.Left, false);
        this.snowWarning       = new OpLabel(305f, 525f, "Snow is experimental, use at your own risk!", false);
        this.snowWarning.color = new Color(0.85f, 0f, 0f);
        this.Tabs[0].AddItems(rainButton, rainWeather, snowWeather, snowButton, weatherType, weatherTypeLabel, versionNumber, snowWarning);

        //Weather Sliders
        this.rainIntensity                = new OpLabel(new Vector2(topAnchor.x, topAnchor.y), new Vector2(400f, 40f), "Rain Settings", FLabelAlignment.Left, true);
        this.intensitySliderLabel         = new OpLabel(new Vector2(topAnchor.x + 40f, topAnchor.y - 83f), new Vector2(400f, 40f), "Weather Progression", FLabelAlignment.Left, false);
        this.weatherIntensity             = new OpSlider(new Vector2(topAnchor.x + 25, topAnchor.y - 60f), "weatherIntensity", new IntVector2(0, 3), 50f, false, 0);
        this.rainSettingsDescription      = new OpLabel(new Vector2(topAnchor.x, topAnchor.y - 20f), new Vector2(400f, 40f), "Enable or disable rain specific settings:", FLabelAlignment.Left, false);
        this.directionSliderLabel         = new OpLabel(new Vector2(topAnchor.x + 47f, topAnchor.y - 143f), new Vector2(400f, 40f), "Weather Direction", FLabelAlignment.Left, false);
        this.weatherDirection             = new OpSlider(new Vector2(topAnchor.x + 25, topAnchor.y - 120f), "weatherDirection", new IntVector2(0, 3), 50f, false, 0);
        this.rainChanceLabel              = new OpLabel(new Vector2(topAnchor.x + 47f, topAnchor.y - 203f), new Vector2(400f, 40f), "Weather Chance", FLabelAlignment.Left, false);
        this.rainChanceSlider             = new OpSlider(new Vector2(topAnchor.x + 25, topAnchor.y - 180f), "weatherChance", new IntVector2(0, 100), 1.5f, false, 100);
        this.weatherIntensity.description = "Configure whether the intensity of the chosen weather increases as the cycle progresses or fix it to a certain intensity.";
        this.weatherDirection.description = "Configure whether rain should fall towards a random or chosen direction.";
        this.rainChanceSlider.description = "Configure whether the chosen weather will occur during a cycle.";
        this.topRect = new OpRect(new Vector2(15f, 250f), new Vector2(570f, 270f), 0.1f);
        this.Tabs[0].AddItems(rainIntensity, weatherIntensity, intensitySliderLabel, directionSliderLabel, weatherDirection, topRect, logo, logo2, rainChanceSlider, rainChanceLabel);

        //Checkboxes
        this.lightningCheck             = new OpCheckBox(new Vector2(checkAnchor.x, checkAnchor.y - 30f), "Lightning", false);
        this.lightningLabel             = new OpLabel(new Vector2(checkAnchor.x + 30f, checkAnchor.y - 36f), new Vector2(400f, 40f), "Lightning", FLabelAlignment.Left, false);
        this.paletteCheck               = new OpCheckBox(new Vector2(checkAnchor.x, checkAnchor.y + 10), "Palette", true);
        this.paletteLabel               = new OpLabel(new Vector2(checkAnchor.x + 30f, checkAnchor.y + 4f), new Vector2(400f, 40f), "Palette changes", FLabelAlignment.Left, false);
        this.muteCheck                  = new OpCheckBox(new Vector2(checkAnchor.x + 150f, checkAnchor.y + 10), "Mute", false);
        this.muteLabel                  = new OpLabel(new Vector2(checkAnchor.x + 180f, checkAnchor.y + 4f), new Vector2(400f, 40f), "Mute interiors", FLabelAlignment.Left, false);
        this.waterCheck                 = new OpCheckBox(new Vector2(checkAnchor.x + 150f, checkAnchor.y - 30f), "Water", false);
        this.waterLabel                 = new OpLabel(new Vector2(checkAnchor.x + 180f, checkAnchor.y - 36f), new Vector2(400f, 40f), "Water ripples", FLabelAlignment.Left, false);
        this.strikeCheck                = new OpCheckBox(new Vector2(checkAnchor.x, checkAnchor.y - 70f), "Strike", true);
        this.strikeLabel                = new OpLabel(new Vector2(checkAnchor.x + 30f, checkAnchor.y - 76f), new Vector2(400f, 40f), "Lightning Strikes", FLabelAlignment.Left, false);
        this.strikeDamage               = new OpSliderSubtle(new Vector2(checkAnchor.x + 10f, checkAnchor.y - 105f), "Damage", new IntVector2(0, 2), 110, false, 1);
        this.damageLabel                = new OpLabel(new Vector2(checkAnchor.x + 10f, checkAnchor.y - 123f), new Vector2(), "Damage Type: ", FLabelAlignment.Left, false);
        this.bgOn                       = new OpCheckBox(new Vector2(checkAnchor.x + 150f, checkAnchor.y - 70f), "Background", true);
        this.bgLabel                    = new OpLabel(new Vector2(checkAnchor.x + 180f, checkAnchor.y - 76f), new Vector2(400f, 40f), "Background", FLabelAlignment.Left, false);
        this.decalCheck                 = new OpCheckBox(new Vector2(checkAnchor.x + 150f, checkAnchor.y - 30f), "Decals", true);
        this.decalLabel                 = new OpLabel(new Vector2(checkAnchor.x + 180f, checkAnchor.y - 36f), new Vector2(400f, 40f), "Surface decals", FLabelAlignment.Left, false);
        this.dustCheck                  = new OpCheckBox(new Vector2(checkAnchor.x + 150f, checkAnchor.y - 70f), "Dust", true);
        this.dustLabel                  = new OpLabel(new Vector2(checkAnchor.x + 180f, checkAnchor.y - 76f), new Vector2(400f, 40f), "Snow dust", FLabelAlignment.Left, false);
        this.blizzardCheck              = new OpCheckBox(new Vector2(checkAnchor.x + 150f, checkAnchor.y - 110f), "Blizzard", true);
        this.blizzardLabel              = new OpLabel(new Vector2(checkAnchor.x + 180f, checkAnchor.y - 116f), new Vector2(400f, 40f), "Blizzard", FLabelAlignment.Left, false);
        this.effectCheck                = new OpCheckBox(new Vector2(checkAnchor.x + 150f, checkAnchor.y + 10), "Effect", true);
        this.effectLabel                = new OpLabel(new Vector2(checkAnchor.x + 180f, checkAnchor.y + 4f), new Vector2(400f, 40f), "Effect Colors", FLabelAlignment.Left, false);
        this.dustCheck.description      = "Puffs of snow appear when landing on the ground.";
        this.decalCheck.description     = "Adds snowy decals to surfaces.";
        this.lightningCheck.description = "Lightning will appear at higher weather intensities.";
        this.paletteCheck.description   = "The region will become darker with higher rain intensity.";
        this.muteCheck.description      = "Mute the sound effect added to interiors when its raining outside.";
        this.waterCheck.description     = "Rain drops can interact with water surfaces and cause ripples, may impact performance.";
        this.bgOn.description           = "Enable or disable collision with background elements, may impact performance.";
        this.strikeDamage.description   = "Adjust the damage type of Lightning Strikes";
        this.strikeCheck.description    = "When weather intensity is high enough, lightning strikes can occur.";
        this.effectCheck.description    = "Whitens things like plants and signs so they better match the snowy palette, can ruin some custom props";
        this.blizzardCheck.description  = "Replaces the end-of-cycle rain with a roaring blizzard and affects normal gameplay";
        this.Tabs[0].AddItems(lightningLabel, lightningCheck, strikeCheck, strikeLabel, strikeDamage, damageLabel, rainSettingsDescription, paletteCheck, muteCheck, waterCheck, bgOn, paletteLabel, muteLabel, waterLabel, bgLabel, dustCheck, dustLabel, decalCheck, decalLabel, effectCheck, effectLabel, blizzardCheck, blizzardLabel);

        //Particle Limit
        this.rainOption = new OpLabel(new Vector2(topAnchor.x + 366f, topAnchor.y - 223f), new Vector2(400f, 40f), "Particle Limit", FLabelAlignment.Left, false);
        this.rainSlider = new OpSlider(new Vector2(topAnchor.x + 275f, topAnchor.y - 200f), "rainAmount", new IntVector2(10, 80), 3.3f, false, 50);
        this.Tabs[0].AddItems(rainSlider, rainOption);

        //Regions
        if (regionList != null)
        {
            this.regionLabelList   = new OpLabel[regionList.Length];
            this.regionChecks      = new OpCheckBox[regionList.Length];
            this.regionLabel       = new OpLabel(new Vector2(30f, 200f), new Vector2(400f, 40f), "Region Settings", FLabelAlignment.Left, true);
            this.regionDescription = new OpLabel(new Vector2(30f, 175f), new Vector2(400f, 40f), "Enable and Disable weather on a per-region basis.", FLabelAlignment.Left, false);
            this.Tabs[0].AddItems(regionLabel, regionDescription);
            for (int i = 0; i < regionList.Length; i++)
            {
                if (i < 10)
                {
                    regionChecks[i]    = new OpCheckBox(new Vector2(30f + (55f * i), 150f), regionList[i], true);
                    regionLabelList[i] = new OpLabel(new Vector2(60f + (55f * i), 142f), new Vector2(400f, 40f), regionList[i], FLabelAlignment.Left, false);
                }
                else if (i >= 10 && i < 20)
                {
                    regionChecks[i]    = new OpCheckBox(new Vector2(-520f + (55f * i), 105f), regionList[i], true);
                    regionLabelList[i] = new OpLabel(new Vector2(-490f + (55f * i), 97f), new Vector2(400f, 40f), regionList[i], FLabelAlignment.Left, false);
                }
                else if (i >= 20 && i < 30)
                {
                    regionChecks[i]    = new OpCheckBox(new Vector2(-1070f + (55f * i), 60f), regionList[i], true);
                    regionLabelList[i] = new OpLabel(new Vector2(-1040f + (55f * i), 52f), new Vector2(400f, 40f), regionList[i], FLabelAlignment.Left, false);
                }
                else if (i >= 30)
                {
                    regionChecks[i]    = new OpCheckBox(new Vector2(-1650f + (55f * i), 15f), regionList[i], true);
                    regionLabelList[i] = new OpLabel(new Vector2(-1620f + (55f * i), 7f), new Vector2(400f, 40f), regionList[i], FLabelAlignment.Left, false);
                }
                this.Tabs[0].AddItems(regionLabelList[i], regionChecks[i]);
                if (regionList[i] == "SS")
                {
                    regionChecks[i].valueBool = false;
                }
            }
        }
        Downpour.configLoaded = true;
    }
示例#15
0
    public override void Initialize()
    {
        //Create a copy of the creature color dictionary that will be modified by the config screen
        this.configColors = new Dictionary <string, Color>(BloodMod.creatureColors);
        this.Tabs         = new OpTab[1];
        int num  = 0;
        int num2 = 0;
        int num3 = 0;
        int num4 = 0;

        this.Tabs[0]                  = new OpTab("Options");
        this.creatureLabel            = new OpLabel(new Vector2(490f, 375f), new Vector2(0f, 0f), "None Selected", FLabelAlignment.Center, true);
        this.colorPicker              = new OpColorPicker(new Vector2(250f, 250f), "bloodColor");
        this.previewOld               = new OpImage(new Vector2(250f, 150f), "Futile_White");
        this.previewOld.sprite.scaleX = 10f;
        this.previewOld.sprite.scaleY = 4f;
        this.oldLabel                 = new OpLabel(new Vector2(250f, 220f), new Vector2(0f, 0f), "Default", FLabelAlignment.Left, true);
        this.previewNew               = new OpImage(new Vector2(420f, 150f), "Futile_White");
        this.previewNew.sprite.scaleX = 10f;
        this.previewNew.sprite.scaleY = 4f;
        this.newLabel                 = new OpLabel(new Vector2(420f, 220f), new Vector2(0f, 0f), "Modified", FLabelAlignment.Left, true);
        this.resetButton              = new OpSimpleButton(new Vector2(425f, 305f), new Vector2(150f, 45f), "reset", "Reset to Default");
        this.resetButton.description  = "Reset this creature's blood color to the mod's default.";
        this.modName                  = new OpLabel(new Vector2(400f, 552f), new Vector2(0f, 0f), "BLOOD MOD", FLabelAlignment.Center, true);
        this.modCredit                = new OpLabel(new Vector2(400f, 532f), new Vector2(0f, 0f), "Created by LeeMoriya", FLabelAlignment.Center, false);
        this.modVersion               = new OpLabel(new Vector2(400f, 518f), new Vector2(0f, 0f), "Version: 1.01", FLabelAlignment.Center, false);
        this.rect                        = new OpRect(new Vector2(230f, 130f), new Vector2(370f, 360f), 0f);
        this.guide                       = new OpLabel(new Vector2(405f, 462f), new Vector2(0f, 0f), "Select creatures on the left and adjust their blood color using", FLabelAlignment.Center, false);
        this.guide2                      = new OpLabel(new Vector2(405f, 442f), new Vector2(0f, 0f), "the color picker below. Finalize changes by clicking 'Apply'", FLabelAlignment.Center, false);
        this.bloodPreview                = new OpCheckBox(new Vector2(30f, 2f), "_prev", false);
        this.bloodPreviewLabel           = new OpLabel(new Vector2(66f, 5f), new Vector2(0f, 0f), "Preview all blood colors", FLabelAlignment.Left, false);
        this.selectedSprite              = new OpImage(new Vector2(0f, 0f), "Futile_White");
        this.selectedSprite.sprite.scale = 17f;
        this.selectedSprite.sprite.alpha = 0.05f;
        this.selectedSprite.description  = "?";
        this.selectedSprite.sprite.SetAnchor(new Vector2(0.5f, 0.5f));
        this.realisticPreset             = new OpSimpleButton(new Vector2(265f, 85f), new Vector2(130f, 31f), "real", "Realistic Preset");
        this.vibrantPreset               = new OpSimpleButton(new Vector2(435f, 85f), new Vector2(130f, 31f), "vibrant", "Vibrant Preset");
        this.realisticPreset.description = "Blood colors will be more realistic.";
        this.vibrantPreset.description   = "Blood colors will more closely match the creature's color.";
        this.bloodlust             = new OpCheckBox(new Vector2(265f, 45f), "gore", false);
        this.bloodlust.description = "Blood effects are increased dramatically";
        this.bloodlustLabel        = new OpLabel(new Vector2(295f, 48f), new Vector2(), "Bloodlust Mode", FLabelAlignment.Left, false);
        this.compat             = new OpCheckBox(new Vector2(265f, 12f), "wash", false);
        this.compat.description = "Rainfall from the mod Downpour will wash away blood.";
        this.compatLabel        = new OpLabel(new Vector2(295f, 15f), new Vector2(), "Downpour Compatibility", FLabelAlignment.Left, false);
        this.preset             = new OpCheckBox(new Vector2(), "preset", false);
        foreach (PartialityMod mod in PartialityManager.Instance.modManager.loadedMods)
        {
            if (mod.ModID == "Downpour")
            {
                this.Tabs[0].AddItems(this.compat, this.compatLabel);
            }
        }
        this.Tabs[0].AddItems(this.selectedSprite, this.colorPicker, this.creatureLabel, this.previewOld, this.previewNew, this.oldLabel, this.newLabel, this.resetButton, this.bloodPreviewLabel, this.modName, this.modCredit, this.rect, this.guide, this.guide2, this.modVersion, this.bloodPreview, this.realisticPreset, this.vibrantPreset, this.bloodlust, this.bloodlustLabel, this.preset);
        //Create individual buttons/sprites/color pickers for each creature
        foreach (KeyValuePair <string, Color> creature in this.configColors)
        {
            if (creature.Key != "Overseer")
            {
                if (num < 11)
                {
                    OpColorPicker  picker = new OpColorPicker(new Vector2(250f, 270f), creature.Key, OpColorPicker.ColorToHex(BloodMod.defaultColors[creature.Key]));
                    OpSimpleButton button = new OpSimpleButton(new Vector2(21f, 548f) + (buttonOffset * num), new Vector2(40f, 40f), creature.Key + "but", "");
                    OpImage        sprite = new OpImage(new Vector2(21f, 548f) + (buttonOffset * num) + spriteOffset, BloodColor.GetCreatureSprite(creature.Key));
                    sprite.color = BloodColor.GetCreatureSpriteColor(creature.Key);
                    sprite.sprite.SetAnchor(new Vector2(0.5f, 0.5f));
                    sprite.description = creature.Key;
                    button.description = creature.Key;
                    this.Tabs[0].AddItems(button, sprite, picker);
                    num++;
                }
                else if (num2 < 11)
                {
                    OpColorPicker  picker = new OpColorPicker(new Vector2(250f, 270f), creature.Key, OpColorPicker.ColorToHex(BloodMod.defaultColors[creature.Key]));
                    OpSimpleButton button = new OpSimpleButton(new Vector2(21f, 548f) + (buttonOffset * num2) + buttonOffset2, new Vector2(40f, 40f), creature.Key + "but", "");
                    OpImage        sprite = new OpImage(new Vector2(21f, 548f) + (buttonOffset * num2) + buttonOffset2 + spriteOffset, BloodColor.GetCreatureSprite(creature.Key));
                    sprite.color = BloodColor.GetCreatureSpriteColor(creature.Key);
                    sprite.sprite.SetAnchor(new Vector2(0.5f, 0.5f));
                    sprite.description = creature.Key;
                    button.description = creature.Key;
                    this.Tabs[0].AddItems(button, sprite, picker);
                    num2++;
                }
                else if (num3 < 11)
                {
                    OpColorPicker  picker = new OpColorPicker(new Vector2(250f, 270f), creature.Key, OpColorPicker.ColorToHex(BloodMod.defaultColors[creature.Key]));
                    OpSimpleButton button = new OpSimpleButton(new Vector2(21f, 548f) + (buttonOffset * num3) + (buttonOffset2 * 2), new Vector2(40f, 40f), creature.Key + "but", "");
                    OpImage        sprite = new OpImage(new Vector2(21f, 548f) + (buttonOffset * num3) + (buttonOffset2 * 2) + spriteOffset, BloodColor.GetCreatureSprite(creature.Key));
                    sprite.color = BloodColor.GetCreatureSpriteColor(creature.Key);
                    sprite.sprite.SetAnchor(new Vector2(0.5f, 0.5f));
                    sprite.description = creature.Key;
                    button.description = creature.Key;
                    this.Tabs[0].AddItems(button, sprite, picker);
                    num3++;
                }
                else
                {
                    OpColorPicker  picker = new OpColorPicker(new Vector2(250f, 270f), creature.Key, OpColorPicker.ColorToHex(BloodMod.defaultColors[creature.Key]));
                    OpSimpleButton button = new OpSimpleButton(new Vector2(21f, 548f) + (buttonOffset * num4) + (buttonOffset2 * 3), new Vector2(40f, 40f), creature.Key + "but", "");
                    OpImage        sprite = new OpImage(new Vector2(21f, 548f) + (buttonOffset * num4) + (buttonOffset2 * 3) + spriteOffset, BloodColor.GetCreatureSprite(creature.Key));
                    sprite.color = BloodColor.GetCreatureSpriteColor(creature.Key);
                    sprite.sprite.SetAnchor(new Vector2(0.5f, 0.5f));
                    sprite.description = creature.Key;
                    button.description = creature.Key;
                    this.Tabs[0].AddItems(button, sprite, picker);
                    num4++;
                }
            }
            this.selected = "Slugcat";
        }
    }
示例#16
0
        public override void Initialize()
        {
            base.Initialize();

            Tabs = new OpTab[] { new OpTab("Config") };

            const string desc =
                "Mod behavior\n" +
                "\n+ When bit by a lizard, instead of randomly killing the player, the player takes damage." +
                "\n+ Too much damage equals death." +
                "\n+ Some time after being released, or after the start of a cycle, damage is reset.";
            const string vanillaDesc =
                "Vanilla behavior\n" +
                "\n+ When not killed by a bite, slugcat is only grabbed, so you can still escape with your life if your captor drops you before reaching a den." +
                "\n+ The creature will drop you if it is stunned." +
                "\n+ After a moment, it will paralyze slugcat, so hit it with a rock or spear quickly!";

            var labelAuthor  = new OpLabel(20, 600 - 30, "by Dual", true);
            var labelVersion = new OpLabel(20, 600 - 30 - 40, "github.com/Dual-Iron/");
            var labelNote    = new OpLabel(200, 600 - 30 - 20, "Testing the waters with this mod. It's been pleasant so far.");

            var size            = new Vector2(300 - 20, 150);
            var pos             = new Vector2(10, 200 - size.y / 2);
            var rectDescription = new OpRect(pos, size)
            {
                description = "Mod mechanics"
            };
            var labelDescription = new OpLabelLong(pos + new Vector2(10, 0), rectDescription.size - Vector2.one * 20, desc, true, FLabelAlignment.Left);

            pos.x = 310;
            var rectVanillaDescription = new OpRect(pos, size)
            {
                description = "Tips on creatures grabbing slugcat"
            };
            var labelVanillaDescription = new OpLabelLong(pos + new Vector2(10, 0), rectDescription.size - Vector2.one * 20, vanillaDesc, true, FLabelAlignment.Left);

            var top           = 200;
            var labelDmgMul   = new OpLabel(20, 600 - top, "Lizard damage multiplier");
            var labelDecimal  = new OpLabel(326, 600 - top + 2, "x 0.1");
            var draggerDmgMul = new OpDragger(new Vector2(300, 600 - top), "D1", 10)
            {
                description = "Makes you take more/less damage per lizard bite. By default (x1.0), a 1/n chance for lizards to kill makes them kill in n bites.",
                min         = 0,
                max         = 50,
                colorEdge   = Color.clear,
                colorText   = new Color(122, 216, 255)
            };

            var labelDmgRegen   = new OpLabel(20, 600 - top - 30, "Lizard damage reset cooldown");
            var labelSeconds    = new OpLabel(326, 600 - top - 30 + 2, "seconds");
            var draggerDmgRegen = new OpDragger(new Vector2(300, 600 - top - 30), "D2", -1)
            {
                description = "The time it takes to reset damage after being released from a grab. Value -1 means damage is only reset at the start of a cycle.",
                min         = -1,
                max         = 60,
                colorEdge   = Color.clear,
                colorText   = new Color(122, 216, 255)
            };

            Tabs[0].AddItems(
                rectVanillaDescription,
                labelVanillaDescription,
                rectDescription,
                labelDescription,
                labelAuthor,
                labelVersion,
                labelNote,
                labelDmgMul,
                labelDecimal,
                draggerDmgMul,
                labelDmgRegen,
                labelSeconds,
                draggerDmgRegen
                );
        }
示例#17
0
        public override void Initialize()
        {
            Tabs    = new OpTab[1];
            Tabs[0] = new OpTab();

            if (this.reason == Reason.NoMod)
            {
                TutoInit();
                return;
            }

            //Futile.atlasManager.LogAllElementNames();

            labelID      = new OpLabel(new Vector2(100f, 500f), new Vector2(400f, 50f), mod.ModID, FLabelAlignment.Center, true);
            labelVersion = new OpLabel(new Vector2(100f, 450f), new Vector2(100f, 20f), string.Concat("Version: ", mod.Version), FLabelAlignment.Left);
            Tabs[0].AddItems(labelID, labelVersion);
            if (mod.author != "NULL")
            {
                labelAuthor = new OpLabel(new Vector2(350f, 450f), new Vector2(200f, 20f), string.Concat("Author: ", mod.author), FLabelAlignment.Right);
                Tabs[0].AddItems(labelAuthor);
                labelAuthor.autoWrap = true;
            }

            /*
             * if (mod.coauthor != "NULL")
             * {
             *  labelCoauthor = new OpLabel(new Vector2(100f, 420f), new Vector2(300f, 20f), string.Concat("Coautor: ", mod.coauthor));
             *  Tabs[0].AddItem(labelCoauthor);
             *  labelCoauthor.autoWrap = true;
             * }
             * if(mod.description != "NULL")
             * {
             *  labelDesc = new OpLabel(new Vector2(80f, 350f), new Vector2(340f, 20f), mod.description, FLabelAlignment.Left);
             *  Tabs[0].AddItem(labelDesc);
             *  labelDesc.autoWrap = true;
             * }*/


            switch (this.reason)
            {
            case Reason.NoInterface:
                labelSluggo0 = new OpLabel(new Vector2(100f, 200f), new Vector2(400f, 20f), "This Partiality Mod/Patch cannot be configured.");
                Tabs[0].AddItems(labelSluggo0);

                break;

            case Reason.InitError:
                blue = new OpRect(new Vector2(40f, 40f), new Vector2(520f, 340f))
                {
                    alpha = 0.7f
                };
                if (OptionScript.init)
                {
                    for (int j = 0; j < 9; j++)
                    {
                        blue.rect.sprites[j].color = new Color(0.121568627f, 0.40392156862f, 0.69411764705f, 1f);
                    }
                }
                Color white = Menu.Menu.MenuRGB(Menu.Menu.MenuColors.White);
                oof = new OpLabel(new Vector2(100f, 320f), new Vector2(30f, 40f), ":(", FLabelAlignment.Left, true)
                {
                    color = white
                };
                labelSluggo0 = new OpLabel(new Vector2(100f, 320f), new Vector2(400f, 20f), "There was an issue initializing OptionInterface.")
                {
                    color = white
                };
                labelSluggo1 = new OpLabel(new Vector2(100f, 80f), new Vector2(400f, 240f), exception, FLabelAlignment.Left)
                {
                    autoWrap = true,
                    color    = white
                };
                labelSluggo1.OnChange();

                Tabs[0].AddItems(blue, oof, labelSluggo0, labelSluggo1);

                break;
            }
        }
        private void CreateRegionPackList(OpTab tab, Dictionary <string, RegionPack> packs, Dictionary <string, byte[]> thumbnails, bool raindb)
        {
            //How Many Options
            int numberOfOptions = packs.Count;

            if (numberOfOptions < 1)
            {
                OpLabel label2 = new OpLabel(new Vector2(100f, 450), new Vector2(400f, 20f), "No regions available.", FLabelAlignment.Center, false);
                if (raindb && CustomWorldMod.OfflineMode)
                {
                    label2.text = "Browsing RainDB is not available in offline mode";
                }
                tab.AddItems(label2);
                return;
            }

            int spacing = 25;

            // SIZES AND POSITIONS OF ALL ELEMENTS //
            Vector2     rectSize           = new Vector2(475, 175);
            Vector2     thumbSize          = new Vector2(225, 156);
            Vector2     buttonDownloadSize = new Vector2(80, 30);
            Vector2     labelSize          = new Vector2(rectSize.x - thumbSize.x - 1.5f * spacing, 25);
            Vector2     descripSize        = new Vector2(rectSize.x - thumbSize.x - 1.5f * spacing, rectSize.y - labelSize.y - buttonDownloadSize.y);
            OpScrollBox mainScroll         = new OpScrollBox(new Vector2(25, 25), new Vector2(550, 500), (int)(spacing + ((rectSize.y + spacing) * numberOfOptions)));
            Vector2     rectPos            = new Vector2(spacing, mainScroll.contentSize - rectSize.y - spacing);

            // ---------------------------------- //

            tab.AddItems(mainScroll);

            for (int i = 0; i < numberOfOptions; i++)
            {
                RegionPack pack      = packs.ElementAt(i).Value;
                bool       activated = pack.activated;
                bool       update    = false;
                try
                {
                    update = raindb && !activated && pack.checksum != null && pack.checksum != string.Empty && !pack.checksum.Equals(CustomWorldMod.installedPacks[pack.name].checksum);
                }
                catch { CustomWorldMod.Log("Error checking the checksum for updates"); }
                Color colorEdge    = activated ? Color.white : new Color((108f / 255f), 0.001f, 0.001f);
                Color colorInverse = Color.white;

                /*
                 * if (raindb)
                 * {
                 *  colorEdge = Color.white;
                 *  try
                 *  {
                 *      // Online checksum is different from local, needs to be updated.
                 *      if (!activated && pack.checksum != null && pack.checksum != string.Empty)
                 *      {
                 *          update = !pack.checksum.Equals(CustomWorldMod.installedPacks[pack.name].checksum);
                 *      }
                 *  }
                 *  catch { CustomWorldMod.Log("Error checking the checksum for updates"); }
                 * }
                 */

                // RECTANGLE
                OpRect rectOption = new OpRect(rectPos, rectSize, 0.2f)
                {
                    doesBump = activated && !pack.packUrl.Equals(string.Empty)
                };
                mainScroll.AddItems(rectOption);
                // ---------------------------------- //


                // REGION NAME LABEL
                string nameText = pack.name;
                if (!pack.author.Equals(string.Empty))
                {
                    nameText += " [by " + pack.author.ToUpper() + "]";
                }
                OpLabel labelRegionName = new OpLabel(rectPos + new Vector2(thumbSize.x + spacing, 140), labelSize, "", FLabelAlignment.Left)
                {
                    description = nameText
                };

                // Add load order number if local pack
                if (!raindb)
                {
                    nameText = (i + 1).ToString() + "] " + nameText;
                }
                // Trim in case of overflow
                CRExtras.TrimString(ref nameText, labelSize.x, "...");
                labelRegionName.text = nameText;
                mainScroll.AddItems(labelRegionName);
                // ---------------------------------- //


                // DESCRIPTION LABEL
                OpLabelLong labelDesc = new OpLabelLong(rectPos + new Vector2(spacing + thumbSize.x, (rectSize.y - descripSize.y - labelSize.y - 0.5f * spacing)), descripSize, "", true, FLabelAlignment.Left)
                {
                    text = pack.description,
                    verticalAlignment = OpLabel.LabelVAlignment.Top,
                    allowOverflow     = false
                };
                mainScroll.AddItems(labelDesc);
                // ---------------------------------- //

                if (thumbnails.TryGetValue(pack.name, out byte[] fileData) && fileData.Length > 0)