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; }
/// <summary> /// Adds Basic Profile on top of <see cref="OpScrollBox"/> /// </summary> /// <param name="box"><see cref="OpScrollBox"/> which will contain the profile</param> /// <param name="mod"><see cref="RainWorldMod"/> that has basic information of the mod</param> public static void AddBasicProfile(OpScrollBox box, RainWorldMod mod) { box.AddItems(new OpLabel(new Vector2(100f, box.GetContentSize() - 600f + 550f), new Vector2(400f, 50f), mod.ModID, FLabelAlignment.Center, true)); box.AddItems(new OpLabel(new Vector2(50f, box.GetContentSize() - 600f + 500f), new Vector2(100f, 20f), InternalTranslator.Translate("Version: <ModVersion>").Replace("<ModVersion>", mod.Version), FLabelAlignment.Left)); if (mod.author != RainWorldMod.authorNull) { box.AddItems(new OpLabel(new Vector2(350f, box.GetContentSize() - 600f + 500f), new Vector2(200f, 20f), InternalTranslator.Translate("Author: <ModAuthor>").Replace("<ModAuthor>", mod.author), FLabelAlignment.Right) { autoWrap = true }); } }
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; } } }
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)
public override void Initialize() { base.Initialize(); if (mode == GenMode.BepInExConfig) { ICollection <ConfigDefinition> keys = bepConfig.Keys; List <string> sections = new List <string>(); foreach (ConfigDefinition k in keys) { // Debug.Log($"{rwMod.ModID}) {k.Section}: {k.Key}"); if (!sections.Contains(k.Section)) { sections.Add(k.Section); } } sections.Sort(); bool hasUnsupported = false, hasFirstScroll = false; OpScrollBox firstScroll = null; Tabs = new OpTab[Mathf.Min(20, sections.Count)]; for (int t = 0; t < Tabs.Length; t++) { Tabs[t] = new OpTab(sections[t]); float h = t != 0 ? 50f : 150f; List <ConfigDefinition> cds = new List <ConfigDefinition>(); foreach (ConfigDefinition k in keys) { if (k.Section == sections[t]) { cds.Add(k); } } cds.Sort(CompareCDkey); List <UIelement> elms = new List <UIelement>(); for (int e = 0; e < cds.Count; e++) { if (TryGetBase(bepConfig, cds[e], out ConfigEntryBase entryBase)) { string desc = entryBase.Description.Description; // LoremIpsum.Generate(3, 4); switch (entryBase.SettingType.Name.ToLower()) { case "bool": // OpCheckBox case "boolean": if (bepConfig.TryGetEntry(cds[e], out ConfigEntry <bool> eBool)) { elms.Add(new OpCheckBox(new Vector2(30f, 600f - h - 40f), GenerateKey(cds[e]), (bool)eBool.DefaultValue) { description = GetFirstSentence(desc) }); elms.Add(new OpLabel(new Vector2(20f, 600f - h - 15f), new Vector2(70f, 15f), cds[e].Key) { alignment = FLabelAlignment.Left, description = GetFirstSentence(desc), bumpBehav = (elms[elms.Count - 1] as UIconfig).bumpBehav }); if (!string.IsNullOrEmpty(desc)) { elms.Add(new OpLabelLong(new Vector2(80f, 600f - h - 80f), new Vector2(500f, 45f), desc)); } h += 60f; } else { continue; } break; case "byte": //OpSliderSubtle if (bepConfig.TryGetEntry(cds[e], out ConfigEntry <byte> eByte)) { elms.Add(new OpSliderSubtle(new Vector2(30f, 600f - h - 45f), GenerateKey(cds[e]), new IntVector2(0, 20), 240, false, Mathf.Clamp((byte)eByte.DefaultValue, 0, 20)) { description = GetFirstSentence(desc) }); elms.Add(new OpLabel(new Vector2(20f, 600f - h - 15f), new Vector2(120f, 15f), cds[e].Key) { alignment = FLabelAlignment.Left, description = GetFirstSentence(desc), bumpBehav = (elms[elms.Count - 1] as UIconfig).bumpBehav }); if (!string.IsNullOrEmpty(desc)) { elms.Add(new OpLabelLong(new Vector2(80f, 600f - h - 90f), new Vector2(500f, 45f), desc)); } h += 90f; } else { continue; } break; case "uint": //OpSlider case "uint32": if (bepConfig.TryGetEntry(cds[e], out ConfigEntry <uint> eUint)) { elms.Add(new OpSlider(new Vector2(30f, 600f - h - 45f), GenerateKey(cds[e]), new IntVector2(0, 100), 400, false, Mathf.Clamp(Convert.ToInt32((uint)eUint.DefaultValue), 0, 100)) { description = GetFirstSentence(desc) }); elms.Add(new OpLabel(new Vector2(20f, 600f - h - 15f), new Vector2(120f, 15f), cds[e].Key) { alignment = FLabelAlignment.Left, description = GetFirstSentence(desc), bumpBehav = (elms[elms.Count - 1] as UIconfig).bumpBehav }); if (!string.IsNullOrEmpty(desc)) { elms.Add(new OpLabelLong(new Vector2(80f, 600f - h - 90f), new Vector2(500f, 45f), desc)); } h += 90f; } else { continue; } break; case "int": //OpUpdown case "int32": if (bepConfig.TryGetEntry(cds[e], out ConfigEntry <int> eInt)) { elms.Add(new OpUpdown(new Vector2(30f, 600f - h - 45f), 110f, GenerateKey(cds[e]), (int)eInt.DefaultValue) { description = GetFirstSentence(desc), allowSpace = true }); elms.Add(new OpLabel(new Vector2(20f, 600f - h - 15f), new Vector2(120f, 15f), cds[e].Key) { alignment = FLabelAlignment.Left, description = GetFirstSentence(desc), bumpBehav = (elms[elms.Count - 1] as UIconfig).bumpBehav }); if (!string.IsNullOrEmpty(desc)) { elms.Add(new OpLabelLong(new Vector2(160f, 600f - h - 60f), new Vector2(420f, 45f), desc)); } h += 60f; } else { continue; } break; case "float": //OpUpdown case "single": if (bepConfig.TryGetEntry(cds[e], out ConfigEntry <float> eFloat)) { elms.Add(new OpUpdown(new Vector2(30f, 600f - h - 45f), 110f, GenerateKey(cds[e]), (float)eFloat.DefaultValue, 2) { description = GetFirstSentence(desc), allowSpace = true }); elms.Add(new OpLabel(new Vector2(20f, 600f - h - 15f), new Vector2(120f, 15f), cds[e].Key) { alignment = FLabelAlignment.Left, description = GetFirstSentence(desc), bumpBehav = (elms[elms.Count - 1] as UIconfig).bumpBehav }); if (!string.IsNullOrEmpty(desc)) { elms.Add(new OpLabelLong(new Vector2(160f, 600f - h - 60f), new Vector2(420f, 45f), desc)); } h += 60f; } else { continue; } break; case "string": //OpTextBox or OpColorPicker if (bepConfig.TryGetEntry(cds[e], out ConfigEntry <string> eString)) { string defaultString = (string)eString.DefaultValue; if (OpColorPicker.IsStringHexColor(defaultString)) { //OpColorPicker elms.Add(new OpColorPicker(new Vector2(30f, 600f - h - 170f), GenerateKey(cds[e]), defaultString)); elms.Add(new OpLabel(new Vector2(20f, 600f - h - 15f), new Vector2(120f, 15f), cds[e].Key) { alignment = FLabelAlignment.Left, description = GetFirstSentence(desc), bumpBehav = (elms[elms.Count - 1] as UIconfig).bumpBehav }); if (!string.IsNullOrEmpty(desc)) { elms.Add(new OpLabelLong(new Vector2(200f, 600f - h - 170f), new Vector2(380f, 135f), desc)); } h += 170f; } else { elms.Add(new OpTextBox(new Vector2(30f, 600f - h - 45f), 110f, GenerateKey(cds[e]), defaultString, OpTextBox.Accept.StringASCII) { description = GetFirstSentence(desc) }); elms.Add(new OpLabel(new Vector2(20f, 600f - h - 15f), new Vector2(120f, 15f), cds[e].Key) { alignment = FLabelAlignment.Left, description = GetFirstSentence(desc), bumpBehav = (elms[elms.Count - 1] as UIconfig).bumpBehav }); if (!string.IsNullOrEmpty(desc)) { elms.Add(new OpLabelLong(new Vector2(160f, 600f - h - 60f), new Vector2(420f, 45f), desc)); } h += 60f; } } else { continue; } break; case "keycode": //OpKeyBinder if (bepConfig.TryGetEntry(cds[e], out ConfigEntry <KeyCode> eKeyCode)) { elms.Add(new OpKeyBinder(new Vector2(30f, 600f - h - 50f), new Vector2(150f, 30f), rwMod.ModID, GenerateKey(cds[e]), ((KeyCode)eKeyCode.DefaultValue).ToString(), false)); elms.Add(new OpLabel(new Vector2(20f, 600f - h - 15f), new Vector2(120f, 15f), cds[e].Key) { alignment = FLabelAlignment.Left, description = GetFirstSentence(desc), bumpBehav = (elms[elms.Count - 1] as UIconfig).bumpBehav }); if (!string.IsNullOrEmpty(desc)) { elms.Add(new OpLabelLong(new Vector2(200f, 600f - h - 90f), new Vector2(380f, 75f), desc)); } h += 100f; } else { continue; } break; default: // if type is enum => OpComboBox if (entryBase.SettingType.IsEnum) { elms.Add(new OpResourceSelector(new Vector2(30f, 600f - h - 45f), 120f, GenerateKey(cds[e]), entryBase.SettingType, entryBase.DefaultValue.ToString())); elms.Add(new OpLabel(new Vector2(20f, 600f - h - 15f), new Vector2(120f, 15f), cds[e].Key) { alignment = FLabelAlignment.Left, description = GetFirstSentence(desc), bumpBehav = (elms[elms.Count - 1] as UIconfig).bumpBehav }); if (!string.IsNullOrEmpty(desc)) { elms.Add(new OpLabelLong(new Vector2(160f, 600f - h - 60f), new Vector2(420f, 45f), desc)); } h += 60f; break; } if (TryAcceptableValueList(entryBase.Description.AcceptableValues, out var valueType, out var values)) { var items = new List <ListItem>(); for (var i = 0; i < values.Length; i++) { var value = values[i]; var name = TomlTypeConverter.ConvertToString(value, valueType); var item = new ListItem(name, i) { displayName = value.ToString() }; items.Add(item); } elms.Add(new OpComboBox(new Vector2(30f, 600f - h - 45f), 120f, GenerateKey(cds[e]), items, TomlTypeConverter.ConvertToString(entryBase.DefaultValue, valueType))); elms.Add(new OpLabel(new Vector2(20f, 600f - h - 15f), new Vector2(120f, 15f), cds[e].Key) { alignment = FLabelAlignment.Left, description = GetFirstSentence(desc), bumpBehav = (elms[elms.Count - 1] as UIconfig).bumpBehav }); if (!string.IsNullOrEmpty(desc)) { elms.Add(new OpLabelLong(new Vector2(160f, 600f - h - 60f), new Vector2(420f, 45f), desc)); } h += 60f; break; } Debug.Log($"{rwMod.ModID} has unsupported ConfigEntry: {cds[e].Key}({entryBase.SettingType.Name})"); hasUnsupported = true; continue; // Not supported } h += 20f; // between gap } } if (h <= 600f) { if (t == 0) { AddBasicProfile(Tabs[0], rwMod); hasFirstScroll = false; } Tabs[t].AddItems(elms.ToArray()); } else { OpScrollBox box = new OpScrollBox(Tabs[t], h); if (t == 0) { AddBasicProfile(box, rwMod); hasFirstScroll = true; firstScroll = box; } foreach (UIelement elm in elms) { elm.pos = new Vector2(elm.GetPos().x, elm.GetPos().y - 600f + h); } box.AddItems(elms.ToArray()); } } if (hasUnsupported) { string warn = InternalTranslator.Translate("This Plugin contains types of settings that are not supported by Config Machine:") + Environment.NewLine + InternalTranslator.Translate("Go to [BepInEx]-[config] folder and use Notepad to edit those settings."); if (hasFirstScroll) { firstScroll.AddItems(new OpLabel(new Vector2(50f, firstScroll.GetContentSize() - 600f + 525f), new Vector2(500f, 30f), warn)); } else { Tabs[0].AddItems(new OpLabel(new Vector2(50f, 525f), new Vector2(500f, 20f), warn)); } } } else { Tabs = new OpTab[1]; Tabs[0] = new OpTab(); AddBasicProfile(Tabs[0], rwMod); if (!string.IsNullOrEmpty(modDescription)) { Tabs[0].AddItems(new OpLabelLong(new Vector2(50f, 200f), new Vector2(500f, 250f), modDescription, alignment: FLabelAlignment.Center)); } } }
public override void Initialize() { #region init base.Initialize(); this.Tabs = new OpTab[3]; this.Tabs[0] = new OpTab("TEST0"); this.Tabs[1] = new OpTab("TEST1"); this.Tabs[2] = new OpTab("TESTSCROLL"); Tabs[0].AddItems(new OpLabel(new Vector2(100f, 540f), new Vector2(400f, 50f), "ConfigMachine Internal Test", FLabelAlignment.Center, true), new OpLabel(new Vector2(420f, 510f), new Vector2(100f, 20f), MenuTab.GetCMVersion(), FLabelAlignment.Right)); Tabs[1].AddItems(new OpLabel(new Vector2(100f, 540f), new Vector2(400f, 50f), "ConfigMachine Internal Test", FLabelAlignment.Center, true), new OpLabel(new Vector2(420f, 510f), new Vector2(100f, 20f), MenuTab.GetCMVersion(), FLabelAlignment.Right)); #endregion init //OpColorPicker cpk = new OpColorPicker(new Vector2(100f, 100f), "_TEST", "CCCCCC") { colorEdge = Color.yellow }; //Tabs[0].AddItems(cpk, new OpLabel(new Vector2(100f, 260f), new Vector2(150f, 20f), "OpColorPicker Test") { bumpBehav = cpk.bumpBehav }); Texture2D t = new Texture2D(64, 64); Color[] n = new Color[64 * 64]; int y = 0; while (y < 64) { int x = 0; while (x < 64) { float s = Mathf.PerlinNoise(x * 0.1f, y * 0.1f); //float s = UnityEngine.Random.value; n[y * 64 + x] = s > 0.5f ? Color.white : Color.clear; x++; } y++; } t.SetPixels(n); t.Apply(); //Tabs[0].AddItems(new OpSpriteEditor(new Vector2(300f, 100f), new Vector2(100f, 100f), "_TEST", t)); OpScrollBox scb = new OpScrollBox(new Vector2(100f, 100f), new Vector2(240f, 150f), 400f); Tabs[0].AddItems(scb); scb.AddItems(new OpLabelLong(new Vector2(20f, 20f), new Vector2(120f, 200f)), new OpSlider(new Vector2(160f, 30f), "_", new IntVector2(-20, 20), length: 180, true, 10)); OpCheckBox chk = new OpCheckBox(new Vector2(100f, 420f), "_", true); Tabs[1].AddItems(chk, new OpLabel(new Vector2(100f, 470f), new Vector2(50f, 15f), "CheckBox") { bumpBehav = chk.bumpBehav }); OpUpdown ud = new OpUpdown(new Vector2(20f, 220f), 150f, "_", 10); ud.SetRange(-10000000, 10000000); Tabs[1].AddItems(ud); ud = new OpUpdown(new Vector2(220f, 220f), 150f, "_", 20.5f, 2); ud.SetRange(-10000f, 10000f); Tabs[1].AddItems(ud); Tabs[1].AddItems(new OpTextBox(new Vector2(420f, 220f), 150f, "_", "30", OpTextBox.Accept.Int)); // For canvas-sized ScrollBox OpScrollBox sb = new OpScrollBox(Tabs[2], 2400f, false); // Use OpScrollBox.AddItems instead of OpTab.AddItems. sb.AddItems(new OpLabel(new Vector2(100f, 540f + 1800f), new Vector2(400f, 50f), "ConfigMachine Internal Test", FLabelAlignment.Center, true), new OpLabel(new Vector2(420f, 510f + 1800f), new Vector2(100f, 20f), MenuTab.GetCMVersion(), FLabelAlignment.Right)); sb.AddItems(new OpImage(new Vector2(420f, 50f), t)); //sb.AddItems(new OpImage(new Vector2(420f, 120f), "gateSymbol0")); //Tabs[2].AddItems(new OpImage(new Vector2(420f, 120f), "gateSymbol0")); OpColorPicker cpk0 = new OpColorPicker(new Vector2(100f, 100f), "_TEST", "CCCCCC") { colorEdge = Color.red }; sb.AddItems(cpk0, new OpLabel(new Vector2(300f, 100f), new Vector2(100f, 20f), "Red Colorpicker") { bumpBehav = cpk0.bumpBehav, color = Color.red }); OpColorPicker cpk1 = new OpColorPicker(new Vector2(100f, 2000f), "_TEST", "AAAAAA") { colorEdge = Color.blue }; sb.AddItems(cpk1, new OpLabel(new Vector2(300f, 2000f), new Vector2(100f, 20f), "Blue Colorpicker") { bumpBehav = cpk1.bumpBehav, color = Color.blue }); sb.AddItems(new OpSlider(new Vector2(100f, 1800f), "", new IntVector2(0, 100), 300)); sb.AddItems(new OpSlider(new Vector2(500f, 1700f), "", new IntVector2(0, 100), 300, true)); sb.AddItems(new OpSliderSubtle(new Vector2(100f, 1400f), "", new IntVector2(0, 20), 200)); sb.AddItems(new OpSliderSubtle(new Vector2(500f, 1300f), "", new IntVector2(0, 20), 200, true)); /* * sb.AddItems(new OpRect(new Vector2(25f, 1000f), new Vector2(150f, 150f))); * sb.AddItems(new OpRect(new Vector2(225f, 1000f), new Vector2(150f, 150f))); * sb.AddItems(new OpRect(new Vector2(425f, 1000f), new Vector2(150f, 150f))); * sb.AddItems(new OpLabel(new Vector2(25f, 1000f), new Vector2(150f, 150f), bigText: true) { verticalAlignment = OpLabel.LabelVAlignment.Top }); * sb.AddItems(new OpLabel(new Vector2(225f, 1000f), new Vector2(150f, 150f), bigText: true) { verticalAlignment = OpLabel.LabelVAlignment.Center }); * sb.AddItems(new OpLabel(new Vector2(425f, 1000f), new Vector2(150f, 150f), bigText: true) { verticalAlignment = OpLabel.LabelVAlignment.Bottom }); * sb.AddItems(new OpRect(new Vector2(25f, 800f), new Vector2(150f, 150f))); * sb.AddItems(new OpRect(new Vector2(225f, 800f), new Vector2(150f, 150f))); * sb.AddItems(new OpRect(new Vector2(425f, 800f), new Vector2(150f, 150f))); * sb.AddItems(new OpLabel(new Vector2(25f, 800f), new Vector2(150f, 150f)) { verticalAlignment = OpLabel.LabelVAlignment.Top }); * sb.AddItems(new OpLabel(new Vector2(225f, 800f), new Vector2(150f, 150f)) { verticalAlignment = OpLabel.LabelVAlignment.Center }); * sb.AddItems(new OpLabel(new Vector2(425f, 800f), new Vector2(150f, 150f)) { verticalAlignment = OpLabel.LabelVAlignment.Bottom }); * sb.AddItems(new OpRect(new Vector2(25f, 600f), new Vector2(150f, 150f))); * sb.AddItems(new OpRect(new Vector2(225f, 600f), new Vector2(150f, 150f))); * sb.AddItems(new OpRect(new Vector2(425f, 600f), new Vector2(150f, 150f))); * sb.AddItems(new OpLabelLong(new Vector2(25f, 600f), new Vector2(150f, 150f)) { verticalAlignment = OpLabel.LabelVAlignment.Top }); * sb.AddItems(new OpLabelLong(new Vector2(225f, 600f), new Vector2(150f, 150f)) { verticalAlignment = OpLabel.LabelVAlignment.Center }); * sb.AddItems(new OpLabelLong(new Vector2(425f, 600f), new Vector2(150f, 150f)) { verticalAlignment = OpLabel.LabelVAlignment.Bottom }); */ OpComboBox cb = new OpComboBox(new Vector2(100f, 1000f), 150f, "", new List <ListItem>() { new ListItem("Slugcat"), new ListItem("Is"), new ListItem("HalfSlug"), new ListItem("And"), new ListItem("HalfBunny"), new ListItem("Creature") }, "Slugcat"); sb.AddItems(cb, new OpLabel(100f, 1050f, "AutoSort") { bumpBehav = cb.bumpBehav }); cb = new OpComboBox(new Vector2(350f, 1000f), 150f, "", new List <ListItem>() { new ListItem("The0", 0), new ListItem("quick1", 1), new ListItem("brown2", 2), new ListItem("fox3", 3), new ListItem("jumps4", 4), new ListItem("over5", 5), new ListItem("the6", 6), new ListItem("lazy7", 7), new ListItem("dog8", 8) }, "brown2"); sb.AddItems(cb, new OpLabel(350f, 1050f, "DefinedOrder") { bumpBehav = cb.bumpBehav }); sb.AddItems(new OpResourceList(new Vector2(70f, 600f), 200f, "", typeof(CreatureTemplate.Type), OpListBox.GetLineCountFromHeight(300f))); // sb.AddItems(new OpResourceList(new Vector2(330f, 600f), 200f, "", typeof(AbstractPhysicalObject.AbstractObjectType), 10, downward: false)); sb.AddItems(new OpListBox(new Vector2(330f, 600f), 200f, "", new List <ListItem>() { new ListItem("The Survivor", 0), new ListItem("The Monk", 1), new ListItem("The Hunter", 2), new ListItem("The Sporecat", 3), new ListItem("The Electric Cat", 4), new ListItem("The Programmer Cat", 5) }, OpListBox.GetLineCountFromHeight(200f))); sb.AddItems(new OpLabel(330f, 780f, "Player 2 plays as", true)); // Use OpScrollBox.AddItems instead of OpTab.AddItems. /* * OpResourceSelector rs = new OpResourceSelector(new Vector2(100f, 1600f), new Vector2(200f, 30f), "", typeof(CreatureTemplate.Type)); * sb.AddItems(rs, new OpLabel(100f, 1630f, "CreatureTemplate.Type") { bumpBehav = rs.bumpBehav }); * rs = new OpResourceSelector(new Vector2(100f, 1500f), new Vector2(200f, 30f), "", OpResourceSelector.SpecialEnum.Decals); * sb.AddItems(rs, new OpLabel(100f, 1530f, "Decals") { bumpBehav = rs.bumpBehav }); * rs = new OpResourceSelector(new Vector2(100f, 1400f), new Vector2(200f, 30f), "", OpResourceSelector.SpecialEnum.Illustrations); * sb.AddItems(rs, new OpLabel(100f, 1430f, "Illustrations") { bumpBehav = rs.bumpBehav }); * rs = new OpResourceSelector(new Vector2(100f, 1300f), new Vector2(200f, 30f), "", OpResourceSelector.SpecialEnum.Palettes); * sb.AddItems(rs, new OpLabel(100f, 1330f, "Palettes") { bumpBehav = rs.bumpBehav }); * rs = new OpResourceSelector(new Vector2(100f, 1200f), new Vector2(200f, 30f), "", OpResourceSelector.SpecialEnum.Regions); * sb.AddItems(rs, new OpLabel(100f, 1230f, "Regions") { bumpBehav = rs.bumpBehav }); * rs = new OpResourceSelector(new Vector2(100f, 1100f), new Vector2(200f, 30f), "", OpResourceSelector.SpecialEnum.Shaders); * sb.AddItems(rs, new OpLabel(100f, 1130f, "Shaders") { bumpBehav = rs.bumpBehav }); * rs = new OpResourceSelector(new Vector2(100f, 1000f), new Vector2(200f, 30f), "", OpResourceSelector.SpecialEnum.Songs); * sb.AddItems(rs, new OpLabel(100f, 1030f, "Songs") { bumpBehav = rs.bumpBehav });*/ }