public override void Update(GameTime gameTime) { if (storedVar.storedBool) { booleanSetting.SetText("True"); booleanSetting.BackgroundColor = UIColour.darkBackgroundColour; } else { booleanSetting.SetText("False"); booleanSetting.BackgroundColor = _defaultBackground; } if (booleanSetting.IsMouseHovering) { booleanSetting.BorderColor = UIColour.lightborderColour; } else { booleanSetting.BorderColor = _defaultBorder; } if (storedVar.InMultiplayer) { BackgroundColor = UIColour.darkBackgroundColour; } else { BackgroundColor = _defaultBackground; } }
public override void OnActivate() { _myPublishedMods.Clear(); string text = Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", Language.GetTextValue("tModLoader.MBUnknown")); TextPanel.SetText(text, 0.8f, true); string response = string.Empty; try { ServicePointManager.Expect100Continue = false; string url = "http://javid.ddns.net/tModLoader/listmymods.php"; var values = new NameValueCollection { { "steamid64", ModLoader.SteamID64 }, { "modloaderversion", BuildInfo.versionedName }, { "passphrase", ModLoader.modBrowserPassphrase }, }; byte[] result = IO.UploadFile.UploadFiles(url, null, values); response = Encoding.UTF8.GetString(result); } catch (WebException e) { if (e.Status == WebExceptionStatus.Timeout) { TextPanel.SetText(Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", Language.GetTextValue("tModLoader.MBBusy")), 0.8f, true); return; } TextPanel.SetText(Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", ""), 0.8f, true); return; } catch (Exception e) { UIModBrowser.LogModBrowserException(e); return; } try { JArray a; try { a = JArray.Parse(response); } catch (Exception e) { throw new Exception($"Manage Published Error Response: {response}", e); } foreach (JObject o in a.Children <JObject>()) { var modItem = new UIModManageItem( (string)o["displayname"], (string)o["name"], (string)o["version"], (string)o["author"], (int)o["downloads"], (int)o["downloadsversion"], (string)o["modloaderversion"] ); _myPublishedMods.Add(modItem); } } catch (Exception e) { UIModBrowser.LogModBrowserException(e); } }
public override void OnActivate() { myPublishedMods.Clear(); uITextPanel.SetText("My Published Mods", 0.8f, true); string response = ""; try { System.Net.ServicePointManager.Expect100Continue = false; string url = "http://javid.ddns.net/tModLoader/listmymods.php"; IO.UploadFile[] files = new IO.UploadFile[0]; var values = new NameValueCollection { { "steamid64", ModLoader.SteamID64 }, { "modloaderversion", ModLoader.versionedName }, { "passphrase", ModLoader.modBrowserPassphrase }, }; byte[] result = IO.UploadFile.UploadFiles(url, files, values); response = System.Text.Encoding.UTF8.GetString(result); } catch (WebException e) { if (e.Status == WebExceptionStatus.Timeout) { uITextPanel.SetText("Mod Browser OFFLINE (Busy)", 0.8f, true); return; } uITextPanel.SetText("Mod Browser OFFLINE.", 0.8f, true); return; } catch (Exception e) { ErrorLogger.LogModBrowserException(e); return; } try { JArray a = JArray.Parse(response); foreach (JObject o in a.Children <JObject>()) { UIModManageItem modItem = new UIModManageItem( (string)o["displayname"], (string)o["name"], (string)o["version"], (string)o["author"], (string)o["downloads"], (string)o["downloadsversion"], (string)o["modloaderversion"] ); myPublishedMods.Add(modItem); } } catch (Exception e) { ErrorLogger.LogModBrowserException(e); return; } }
public override void OnActivate() { base.OnActivate(); modName.SetText(""); modDiplayName.SetText(""); modAuthor.SetText(""); messagePanel.SetText(""); }
public override void OnActivate() { myPublishedMods.Clear(); uITextPanel.SetText("My Published Mods", 0.8f, true); String xmlText = ""; try { System.Net.ServicePointManager.Expect100Continue = false; string url = "http://javid.ddns.net/tModLoader/listmymods.php"; IO.UploadFile[] files = new IO.UploadFile[0]; var values = new NameValueCollection { { "steamid64", Steamworks.SteamUser.GetSteamID().ToString() }, { "modloaderversion", ModLoader.versionedName }, { "passphrase", ModLoader.modBrowserPassphrase }, }; byte[] result = IO.UploadFile.UploadFiles(url, files, values); xmlText = System.Text.Encoding.UTF8.GetString(result, 0, result.Length); } catch (WebException e) { if (e.Status == WebExceptionStatus.Timeout) { uITextPanel.SetText("Mod Browser OFFLINE (Busy)", 0.8f, true); return; } uITextPanel.SetText("Mod Browser OFFLINE.", 0.8f, true); return; } catch (Exception e) { ErrorLogger.LogModBrowserException(e); return; } try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlText); foreach (XmlNode xmlNode in xmlDoc.DocumentElement) { string displayname = xmlNode.SelectSingleNode("displayname").InnerText; string name = xmlNode.SelectSingleNode("name").InnerText; string version = xmlNode.SelectSingleNode("version").InnerText; string author = xmlNode.SelectSingleNode("author").InnerText; string downloads = xmlNode.SelectSingleNode("downloads").InnerText; string downloadsversion = xmlNode.SelectSingleNode("downloadsversion").InnerText; string modloaderversion = xmlNode.SelectSingleNode("modloaderversion").InnerText; UIModManageItem modItem = new UIModManageItem(displayname, name, version, author, downloads, downloadsversion, modloaderversion); myPublishedMods.Add(modItem); } } catch (Exception e) { ErrorLogger.LogModBrowserException(e); return; } }
private void PopulateModBrowser() { loading = true; SpecialModPackFilter = null; SpecialModPackFilterTitle = null; reloadButton.SetText("Getting data..."); SetHeading("Mod Browser"); if (!uIPanel.HasChild(uILoader)) { uIPanel.Append(uILoader); } modList.Clear(); modListAll.Clear(); modList.Deactivate(); try { ServicePointManager.Expect100Continue = false; string url = "http://javid.ddns.net/tModLoader/listmods.php"; var values = new NameValueCollection { { "modloaderversion", ModLoader.versionedName }, { "platform", ModLoader.compressedPlatformRepresentation }, }; using (WebClient client = new WebClient()) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return(true); }); client.UploadValuesCompleted += new UploadValuesCompletedEventHandler(UploadComplete); client.UploadValuesAsync(new Uri(url), "POST", values); } } catch (WebException e) { if (e.Status == WebExceptionStatus.Timeout) { SetHeading("Mod Browser OFFLINE (Busy)"); return; } if (e.Status == WebExceptionStatus.ProtocolError) { var resp = (HttpWebResponse)e.Response; if (resp.StatusCode == HttpStatusCode.NotFound) { SetHeading("Mod Browser OFFLINE (404)"); return; } SetHeading("Mod Browser OFFLINE.."); return; } } catch (Exception e) { ErrorLogger.LogModBrowserException(e); return; } }
private void PopulateModBrowser() { loading = true; SpecialModPackFilter = null; SpecialModPackFilterTitle = null; reloadButton.SetText(Language.GetTextValue("tModLoader.MBGettingData")); SetHeading(Language.GetTextValue("tModLoader.MenuModBrowser")); uIPanel.Append(uILoader); modList.Clear(); items.Clear(); modList.Deactivate(); try { ServicePointManager.Expect100Continue = false; string url = "http://javid.ddns.net/tModLoader/listmods.php"; var values = new NameValueCollection { { "modloaderversion", ModLoader.versionedName }, { "platform", ModLoader.compressedPlatformRepresentation }, }; using (WebClient client = new WebClient()) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return(true); }); client.UploadValuesCompleted += new UploadValuesCompletedEventHandler(UploadComplete); client.UploadValuesAsync(new Uri(url), "POST", values); } } catch (WebException e) { ShowOfflineTroubleshootingMessage(); if (e.Status == WebExceptionStatus.Timeout) { SetHeading(Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", Language.GetTextValue("tModLoader.MBBusy"))); return; } if (e.Status == WebExceptionStatus.ProtocolError) { var resp = (HttpWebResponse)e.Response; if (resp.StatusCode == HttpStatusCode.NotFound) { SetHeading(Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", resp.StatusCode)); return; } SetHeading(Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", resp.StatusCode)); return; } } catch (Exception e) { UIModBrowser.LogModBrowserException(e); return; } }
private void ReloadList(UIMouseEvent evt, UIElement listeningElement) { if (loading) { return; } Main.PlaySound(SoundID.MenuOpen); specialModPackFilter = null; reloadButton.SetText("Reloading..."); PopulateModBrowser(); }
internal void ToggleEnabled(UIMouseEvent evt, UIElement listeningElement) { Main.PlaySound(12, -1, -1, 1); this.enabled = !this.enabled; button2.SetText(this.enabled ? "Click to Disable" : "Click to Enable", 1f, false); ModLoader.SetModActive(this.mod, this.enabled); }
public OverlayState() : base() { _editCameraIcon.Recalculate(); _editCameraIcon.VAlign = 1; _editCameraIcon.Left.Pixels = 20; _editCameraIcon.Top.Pixels = -20; _editCameraIcon.OnClick += (evt, listener) => InputTerraria3D.CameraControlsEnabled = !InputTerraria3D.CameraControlsEnabled; _controlsPanel.VAlign = 1; _controlsPanel.Left.Pixels = 20; _controlsPanel.Top.Pixels = -100; _editCameraHoverTip.VAlign = 1; _editCameraHoverTip.Left.Pixels = 20; _editCameraHoverTip.Top.Pixels = -70; _toggleControlsPanelButton.VAlign = 1; _toggleControlsPanelButton.Left.Pixels = 80; _toggleControlsPanelButton.Top.Pixels = -15; _toggleControlsPanelButton.OnClick += (evt, listener) => { if (InputTerraria3D.CameraControlsEnabled) { _controlsPanel.Visible = !_controlsPanel.Visible; _toggleControlsPanelButton.SetText(_controlsPanel.Visible ? "Hide Controls" : "ShowControls"); } }; Append(_controlsPanel); Append(_editCameraIcon); Append(_editCameraHoverTip); Append(_toggleControlsPanelButton); }
internal void ToggleEnabled(UIMouseEvent evt, UIElement listeningElement) { Main.PlaySound(12, -1, -1, 1); this.enabled = !this.enabled; button2.SetText(this.enabled ? Language.GetTextValue("tModLoader.ModsDisable") : Language.GetTextValue("tModLoader.ModsEnable"), 1f, false); ModLoader.SetModActive(this.mod, this.enabled); }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (lockScreenBtn != null) { lockScreenBtn.SetState(Camera.Locked); } Camera.speed = speed.Data * 100; playButton.SetText(text: Camera.Playing ? "Stop" : "Play"); if (placing != null) { PlaceTracker((TrackerID)placing); } // Eraser if (erasing) { EraseTracker(); } // Tracker Mover if (moving) { MoveTracker(); } }
public override void Update(GameTime gameTime) { base.Update(gameTime); evilText.SetText(_evilBiomeNames[_listIndex].Item2); Vector2 textPanelBarOffset = new Vector2(5, 124 + 5); Vector2 mainPanelPosition = mainPanelContent.GetInnerDimensions().Position(); Vector2 mainPanelDimension = new Vector2(mainPanelContent.GetInnerDimensions().Width, mainPanelContent.GetInnerDimensions().Height); leftArrow.Left.Set(textPanelBarOffset.X, 0); leftArrow.Top.Set(textPanelBarOffset.Y, 0); rightArrow.Left.Set(textPanelBarOffset.X + 40 + 380 + 4, 0); rightArrow.Top.Set(textPanelBarOffset.Y, 0); evilText.Left.Set(textPanelBarOffset.X + 40 + 2, 0); evilText.Top.Set(textPanelBarOffset.Y, 0); _worldEvilPickText.Top.Set(-130f, 0); _selectButton.Top.Set(mainPanelPosition.Y + mainPanelDimension.Y + 15, 0); _selectButton.Left.Set(mainPanelPosition.X + mainPanelDimension.X - _selectButton.GetInnerDimensions().Width - 12, 0); _backButton.Top.Set(mainPanelPosition.Y + mainPanelDimension.Y + 15, 0); _backButton.Left.Set(mainPanelPosition.X - 12, 0); Recalculate(); }
public override void Update(GameTime gameTime) { base.Update(gameTime); evilText.SetText(evilName[listIndex]); Vector2 textPanelBarOffset = new Vector2(5, 124 + 5); Vector2 mainPanelPosition = mainPanelContent.GetInnerDimensions().Position(); Vector2 mainPanelDimension = new Vector2(mainPanelContent.GetInnerDimensions().Width, mainPanelContent.GetInnerDimensions().Height); leftArrow.Left.Set(textPanelBarOffset.X, 0); leftArrow.Top.Set(textPanelBarOffset.Y, 0); rightArrow.Left.Set(textPanelBarOffset.X + 40 + 380 + 4, 0); rightArrow.Top.Set(textPanelBarOffset.Y, 0); evilText.Left.Set(textPanelBarOffset.X + 40 + 2, 0); evilText.Top.Set(textPanelBarOffset.Y, 0); worldEvilPickText.Top.Set(-130f, 0); selectButton.Top.Set(mainPanelPosition.Y + mainPanelDimension.Y + selectButton.Height.Pixels + 3, 0); selectButton.Left.Set(mainPanelPosition.X + mainPanelDimension.X - selectButton.Width.Pixels, 0); backButton.Top.Set(mainPanelPosition.Y + mainPanelDimension.Y + backButton.Height.Pixels + 3, 0); backButton.Left.Set(mainPanelPosition.X, 0); }
public override void OnInitialize() { DragableUIPanel Menu = new DragableUIPanel("Play Sound", 500, 220); Menu.VAlign = 0.6f; Menu.HAlign = 0.2f; Menu.OnCloseBtnClicked += () => ModContent.GetInstance <Creativetools>().UserInterface.SetState(new MainUI()); Append(Menu); //////////////////Sound///////////////////// var SoundSlider = MakeSlider(new UIIntRangedDataValue("", 0, 0, 42), out ID, Menu, top: 50, left: -10); SliderButtons("Play Sound", SoundSlider, button => button.OnClick += (evt, elm) => Main.PlaySound(ID.Data), false); SoundName = new UIText("") { HAlign = 0.6f, MarginTop = 20 }; SoundSlider.Append(SoundName); /////////////////LegacySound///////////// var LegacySlider = MakeSlider(new UIIntRangedDataValue("", 0, 0, 334), out LegacySound, Menu, top: 100, left: -10); SliderButtons("Play Legacy", LegacySlider, button => button.OnClick += (evt, elm) => { var soundlist = new List <LegacySoundStyle> { SoundID.NPCHit1, SoundID.NPCHit2, SoundID.NPCHit3, SoundID.NPCHit4, SoundID.NPCHit5, SoundID.NPCHit6, SoundID.NPCHit7, SoundID.NPCHit8, SoundID.NPCHit9, SoundID.NPCHit10, SoundID.NPCHit11, SoundID.NPCHit12, SoundID.NPCHit13, SoundID.NPCHit14, SoundID.NPCHit15, SoundID.NPCHit16, SoundID.NPCHit17, SoundID.NPCHit18, SoundID.NPCHit19, SoundID.NPCHit20, SoundID.NPCHit21, SoundID.NPCHit22, SoundID.NPCHit23, SoundID.NPCHit24, SoundID.NPCHit25, SoundID.NPCHit26, SoundID.NPCHit27, SoundID.NPCHit28, SoundID.NPCHit29, SoundID.NPCHit30, SoundID.NPCHit31, SoundID.NPCHit32, SoundID.NPCHit33, SoundID.NPCHit34, SoundID.NPCHit35, SoundID.NPCHit36, SoundID.NPCHit37, SoundID.NPCHit38, SoundID.NPCHit39, SoundID.NPCHit40, SoundID.NPCHit41, SoundID.NPCHit42, SoundID.NPCHit43, SoundID.NPCHit44, SoundID.NPCHit45, SoundID.NPCHit46, SoundID.NPCHit47, SoundID.NPCHit48, SoundID.NPCHit49, SoundID.NPCHit50, SoundID.NPCHit51, SoundID.NPCHit52, SoundID.NPCHit53, SoundID.NPCHit54, SoundID.NPCHit55, SoundID.NPCHit56, SoundID.NPCHit57, SoundID.NPCDeath1, SoundID.NPCDeath2, SoundID.NPCDeath3, SoundID.NPCDeath4, SoundID.NPCDeath5, SoundID.NPCDeath6, SoundID.NPCDeath7, SoundID.NPCDeath8, SoundID.NPCDeath9, SoundID.NPCDeath10, SoundID.NPCDeath11, SoundID.NPCDeath12, SoundID.NPCDeath13, SoundID.NPCDeath14, SoundID.NPCDeath15, SoundID.NPCDeath16, SoundID.NPCDeath17, SoundID.NPCDeath18, SoundID.NPCDeath19, SoundID.NPCDeath20, SoundID.NPCDeath21, SoundID.NPCDeath22, SoundID.NPCDeath23, SoundID.NPCDeath24, SoundID.NPCDeath25, SoundID.NPCDeath26, SoundID.NPCDeath27, SoundID.NPCDeath28, SoundID.NPCDeath29, SoundID.NPCDeath30, SoundID.NPCDeath31, SoundID.NPCDeath32, SoundID.NPCDeath33, SoundID.NPCDeath34, SoundID.NPCDeath35, SoundID.NPCDeath36, SoundID.NPCDeath37, SoundID.NPCDeath38, SoundID.NPCDeath39, SoundID.NPCDeath40, SoundID.NPCDeath41, SoundID.NPCDeath42, SoundID.NPCDeath43, SoundID.NPCDeath44, SoundID.NPCDeath45, SoundID.NPCDeath46, SoundID.NPCDeath47, SoundID.NPCDeath48, SoundID.NPCDeath49, SoundID.NPCDeath50, SoundID.NPCDeath51, SoundID.NPCDeath52, SoundID.NPCDeath53, SoundID.NPCDeath54, SoundID.NPCDeath55, SoundID.NPCDeath56, SoundID.NPCDeath57, SoundID.NPCDeath58, SoundID.NPCDeath59, SoundID.NPCDeath60, SoundID.NPCDeath61, SoundID.NPCDeath62, SoundID.Item1, SoundID.Item2, SoundID.Item3, SoundID.Item4, SoundID.Item5, SoundID.Item6, SoundID.Item7, SoundID.Item8, SoundID.Item9, SoundID.Item10, SoundID.Item11, SoundID.Item12, SoundID.Item13, SoundID.Item14, SoundID.Item15, SoundID.Item16, SoundID.Item17, SoundID.Item18, SoundID.Item19, SoundID.Item20, SoundID.Item21, SoundID.Item22, SoundID.Item23, SoundID.Item24, SoundID.Item25, SoundID.Item26, SoundID.Item27, SoundID.Item28, SoundID.Item29, SoundID.Item30, SoundID.Item31, SoundID.Item32, SoundID.Item33, SoundID.Item34, SoundID.Item35, SoundID.Item36, SoundID.Item37, SoundID.Item38, SoundID.Item39, SoundID.Item40, SoundID.Item41, SoundID.Item42, SoundID.Item43, SoundID.Item44, SoundID.Item45, SoundID.Item46, SoundID.Item47, SoundID.Item48, SoundID.Item49, SoundID.Item50, SoundID.Item51, SoundID.Item52, SoundID.Item53, SoundID.Item54, SoundID.Item55, SoundID.Item56, SoundID.Item57, SoundID.Item58, SoundID.Item59, SoundID.Item60, SoundID.Item61, SoundID.Item62, SoundID.Item63, SoundID.Item64, SoundID.Item65, SoundID.Item66, SoundID.Item67, SoundID.Item68, SoundID.Item69, SoundID.Item70, SoundID.Item71, SoundID.Item72, SoundID.Item73, SoundID.Item74, SoundID.Item75, SoundID.Item76, SoundID.Item77, SoundID.Item78, SoundID.Item79, SoundID.Item80, SoundID.Item81, SoundID.Item82, SoundID.Item83, SoundID.Item84, SoundID.Item85, SoundID.Item86, SoundID.Item87, SoundID.Item88, SoundID.Item89, SoundID.Item90, SoundID.Item91, SoundID.Item92, SoundID.Item93, SoundID.Item94, SoundID.Item95, SoundID.Item96, SoundID.Item97, SoundID.Item98, SoundID.Item99, SoundID.Item100, SoundID.Item101, SoundID.Item102, SoundID.Item103, SoundID.Item104, SoundID.Item105, SoundID.Item106, SoundID.Item107, SoundID.Item108, SoundID.Item109, SoundID.Item110, SoundID.Item111, SoundID.Item112, SoundID.Item113, SoundID.Item114, SoundID.Item115, SoundID.Item116, SoundID.Item117, SoundID.Item118, SoundID.Item119, SoundID.Item120, SoundID.Item121, SoundID.Item122, SoundID.Item123, SoundID.Item124, SoundID.Item125, SoundID.DD2_GoblinBomb, SoundID.BlizzardInsideBuildingLoop, SoundID.BlizzardStrongLoop, SoundID.LiquidsHoneyWater, SoundID.LiquidsHoneyLava, SoundID.LiquidsWaterLava, SoundID.DD2_BallistaTowerShot, SoundID.DD2_ExplosiveTrapExplode, SoundID.DD2_FlameburstTowerShot, SoundID.DD2_LightningAuraZap, SoundID.DD2_DefenseTowerSpawn, SoundID.DD2_BetsyDeath, SoundID.DD2_BetsyFireballShot, SoundID.DD2_BetsyFireballImpact, SoundID.DD2_BetsyFlameBreath, SoundID.DD2_BetsyFlyingCircleAttack, SoundID.DD2_BetsyHurt, SoundID.DD2_BetsyScream, SoundID.DD2_BetsySummon, SoundID.DD2_BetsyWindAttack, SoundID.DD2_DarkMageAttack, SoundID.DD2_DarkMageCastHeal, SoundID.DD2_DarkMageDeath, SoundID.DD2_DarkMageHealImpact, SoundID.DD2_DarkMageHurt, SoundID.DD2_DarkMageSummonSkeleton, SoundID.DD2_DrakinBreathIn, SoundID.DD2_DrakinDeath, SoundID.DD2_DrakinHurt, SoundID.DD2_DrakinShot, SoundID.DD2_GoblinDeath, SoundID.DD2_GoblinHurt, SoundID.DD2_GoblinScream, SoundID.DD2_GoblinBomberDeath, SoundID.DD2_GoblinBomberHurt, SoundID.DD2_GoblinBomberScream, SoundID.DD2_GoblinBomberThrow, SoundID.DD2_JavelinThrowersAttack, SoundID.DD2_JavelinThrowersDeath, SoundID.DD2_JavelinThrowersHurt, SoundID.DD2_JavelinThrowersTaunt, SoundID.DD2_KoboldDeath, SoundID.DD2_KoboldExplosion, SoundID.DD2_KoboldHurt, SoundID.DD2_KoboldIgnite, SoundID.DD2_KoboldIgniteLoop, SoundID.DD2_KoboldScreamChargeLoop, SoundID.DD2_KoboldFlyerChargeScream, SoundID.DD2_KoboldFlyerDeath, SoundID.DD2_KoboldFlyerHurt, SoundID.DD2_LightningBugDeath, SoundID.DD2_LightningBugHurt, SoundID.DD2_LightningBugZap, SoundID.DD2_OgreAttack, SoundID.DD2_OgreDeath, SoundID.DD2_OgreGroundPound, SoundID.DD2_OgreHurt, SoundID.DD2_OgreRoar, SoundID.DD2_OgreSpit, SoundID.DD2_SkeletonDeath, SoundID.DD2_SkeletonHurt, SoundID.DD2_SkeletonSummoned, SoundID.DD2_WitherBeastAuraPulse, SoundID.DD2_WitherBeastCrystalImpact, SoundID.DD2_WitherBeastDeath, SoundID.DD2_WitherBeastHurt, SoundID.DD2_WyvernDeath, SoundID.DD2_WyvernHurt, SoundID.DD2_WyvernScream, SoundID.DD2_WyvernDiveDown, SoundID.DD2_EtherianPortalDryadTouch, SoundID.DD2_EtherianPortalIdleLoop, SoundID.DD2_EtherianPortalOpen, SoundID.DD2_EtherianPortalSpawnEnemy, SoundID.DD2_CrystalCartImpact, SoundID.DD2_DefeatScene, SoundID.DD2_WinScene, SoundID.DD2_BetsysWrathShot, SoundID.DD2_BetsysWrathImpact, SoundID.DD2_BookStaffCast, SoundID.DD2_BookStaffTwisterLoop, SoundID.DD2_GhastlyGlaiveImpactGhost, SoundID.DD2_GhastlyGlaivePierce, SoundID.DD2_MonkStaffGroundImpact, SoundID.DD2_MonkStaffGroundMiss, SoundID.DD2_MonkStaffSwing, SoundID.DD2_PhantomPhoenixShot, SoundID.DD2_SonicBoomBladeSlash, SoundID.DD2_SkyDragonsFuryCircle, SoundID.DD2_SkyDragonsFuryShot, SoundID.DD2_SkyDragonsFurySwing }; Main.PlaySound(soundlist[LegacySound.Data]); }, false); LegacyName = new UIText("") { HAlign = 0.6f, MarginTop = 20 }; LegacySlider.Append(LegacyName); /////////////////Music//////////////////// var MusicSlider = MakeSlider(new UIIntRangedDataValue("", 0, 0, 41), out MusicSound, Menu, top: 150, left: -10); UITextPanel <string> PlayMusic = new UITextPanel <string>(text: playmusic ? "Stop Music" : "Play Music"); PlayMusic.SetPadding(4); PlayMusic.MarginLeft = 20; PlayMusic.Width.Set(10, 0f); PlayMusic.OnClick += (evt, element) => { playmusic = !playmusic; PlayMusic.SetText(text: playmusic ? "Stop Music" : "Play Music"); }; MusicSlider.Append(PlayMusic); MusicName = new UIText("") { HAlign = 0.6f, MarginTop = 20 }; MusicSlider.Append(MusicName); }
public override void OnActivate() { messageBox.SetText(message); buttonAlt.SetText(altText); bool showAlt = !string.IsNullOrEmpty(altText); button.Left.Percent = showAlt ? 0 : .25f; area.AddOrRemoveChild(buttonAlt, showAlt); }
public void SetMessage(string text, Color color) { message.TextScale = 1f; message.SetText("Notification: " + text); float width = Main.fontMouseText.MeasureString(text).X; if (width > 400) { message.TextScale = 400 / width; message.Recalculate(); } message.TextColor = color; }
public override void OnActivate() { uITextPanel.SetText("Mod Info: " + modDisplayName, 0.8f, true); modInfo.SetText(info); if (url.Equals("")) { modHomepageButton.Remove(); } else { uIElement.Append(modHomepageButton); } }
public override void OnActivate() { Netplay.disconnect = true; var continueKey = gotoMenu < 0 ? "Exit" : showRetry ? "Retry" : "Continue"; continueButton.SetText(Language.GetTextValue("tModLoader." + continueKey)); continueButton.TextColor = gotoMenu >= 0 ? Color.White : Color.Red; area.AddOrRemoveChild(webHelpButton, string.IsNullOrEmpty(webHelpURL)); area.AddOrRemoveChild(skipLoadButton, showSkip); area.AddOrRemoveChild(exitAndDisableAllButton, gotoMenu < 0); }
private void UpdatePlaygroundChildren() { playgroundPanel.RemoveAllChildren(); if (playgroundTextCheckbox.Selected) { playgroundPanel.Append(playgroundText); } if (playgroundTextPanelCheckbox.Selected) { playgroundPanel.Append(playgroundTextPanel); } if (playgroundImageButtonCheckbox.Selected) { playgroundPanel.Append(playgroundImageButton); } playgroundPanel.SetPadding(panelPaddingData.Data); playgroundText.HAlign = textHAlign.Data; playgroundText.VAlign = textVAlign.Data; playgroundText.Left.Set(textLeftPixels.Data, textLeftPercent.Data); playgroundText.Top.Set(textTopPixels.Data, textTopPercent.Data); // if changed only? playgroundTextPanel.SetText(textPanelTextInput.Text, textPanelTextScale.Data, false); playgroundTextPanel.SetPadding(textPanelPadding.Data); playgroundTextPanel.HAlign = textPanelHAlign.Data; playgroundTextPanel.VAlign = textPanelVAlign.Data; playgroundTextPanel.Left.Set(textPanelLeftPixels.Data, textPanelLeftPercent.Data); playgroundTextPanel.Top.Set(textPanelTopPixels.Data, textPanelTopPercent.Data); playgroundTextPanel.Width.Set(textPanelWidthPixels.Data, textPanelWidthPercent.Data); playgroundTextPanel.Height.Set(textPanelHeightPixels.Data, textPanelHeightPercent.Data); textPanelMinWidthHeightDisplay.SetText($"MinWidth: {playgroundTextPanel.MinWidth.Pixels}, MinHeight: {playgroundTextPanel.MinHeight.Pixels}"); //playgroundTextPanel.MinWidth.Set(textPanelMinWidthPixels.Data, textPanelMinWidthPercent.Data); //playgroundTextPanel.MinHeight.Set(textPanelMinHeightPixels.Data, textPanelMinHeightPercent.Data); // Margin playgroundImageButton.HAlign = imageButtonHAlign.Data; playgroundImageButton.VAlign = imageButtonVAlign.Data; playgroundImageButton.Left.Set(imageButtonLeftPixels.Data, imageButtonLeftPercent.Data); playgroundImageButton.Top.Set(imageButtonTopPixels.Data, imageButtonTopPercent.Data); //playgroundImageButton.Width.Set(imageButtonWidthPixels.Data, imageButtonWidthPercent.Data); //playgroundImageButton.Width.Set(imageButtonWidthPixels.Data, imageButtonWidthPercent.Data); playgroundPanel.Recalculate(); // recalculate? }
private void OKClick(UIMouseEvent evt, UIElement listeningElement) { string modNameTrimmed = internalNamePanel.currentText.Trim(); string sourceFolder = Path.Combine(ModSourcePath, modNameTrimmed); CodeDomProvider provider = CodeDomProvider.CreateProvider("C#"); if (Directory.Exists(sourceFolder)) { infoTextPanel.SetText("A mod with the same Internal Name already exists"); } else if (!provider.IsValidIdentifier(modNameTrimmed)) { infoTextPanel.SetText("Internal Name is an invalid C# identifier. Remove spaces"); } else if (string.IsNullOrWhiteSpace(displayNamePanel.currentText)) { infoTextPanel.SetText("Display Name can't be empty"); } else if (string.IsNullOrWhiteSpace(authorsPanel.currentText)) { infoTextPanel.SetText("Author(s) can't be empty"); } else if (string.IsNullOrWhiteSpace(authorsPanel.currentText)) { infoTextPanel.SetText("Author(s) can't be empty"); } else { infoTextPanel.SetText("Creating mod..."); Directory.CreateDirectory(sourceFolder); // TODO: verbatim line endings, localization. File.WriteAllText(Path.Combine(sourceFolder, "build.txt"), GetModBuild()); File.WriteAllText(Path.Combine(sourceFolder, "description.txt"), GetModDescription()); File.WriteAllText(Path.Combine(sourceFolder, $"{modNameTrimmed}.cs"), GetModClass(modNameTrimmed)); File.WriteAllText(Path.Combine(sourceFolder, $"{modNameTrimmed}.csproj"), GetModCsproj(modNameTrimmed)); string propertiesFolder = Path.Combine(sourceFolder, "Properties"); Directory.CreateDirectory(propertiesFolder); File.WriteAllText(Path.Combine(propertiesFolder, $"launchSettings.json"), GetLaunchSettings()); infoTextPanel.SetText("Mod created! Opening folder"); Process.Start(sourceFolder); } }
public override void Update(GameTime gameTime) { if (!_loading && _ready) { _uITextPanel.SetText(Language.GetTextValue("tModLoader.ModInfoHeader") + _modDisplayName, 0.8f, true); _uITextPanel.Recalculate(); _modInfo.SetText(_info); if (!string.IsNullOrEmpty(_url)) { _uIElement.Append(_modHomepageButton); } if (_localMod != null) { _uIElement.AddOrRemoveChild(_deleteButton, ModLoader.Mods.All(x => x.Name != _localMod.Name)); _uIElement.Append(_extractButton); Recalculate(); } } }
public override void OnActivate() { uITextPanel.SetText(Language.GetTextValue("tModLoader.ModInfoHeader") + modDisplayName, 0.8f, true); modInfo.SetText(info); if (url.Equals("")) { modHomepageButton.Remove(); } else { uIElement.Append(modHomepageButton); } if (localMod != null) { uIElement.Append(deleteButton); uIElement.Append(extractButton); } else { deleteButton.Remove(); extractButton.Remove(); } }
public override void OnActivate() { _modInfo.SetText(_info); _uITextPanel.SetText(Language.GetTextValue("tModLoader.ModInfoHeader") + _modDisplayName, 0.8f, true); if (_loadFromWeb) { _modInfo.Append(_loaderElement); _loading = true; _ready = false; _cts = new CancellationTokenSource(); Task.Factory.StartNew(() => { try { ServicePointManager.Expect100Continue = false; const string url = "http://javid.ddns.net/tModLoader/moddescription.php"; var values = new NameValueCollection { { "modname", _modName } }; using (WebClient client = new WebClient()) { ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, policyErrors) => policyErrors == SslPolicyErrors.None; client.UploadValuesCompleted += ReceiveModInfo; client.UploadValuesAsync(new Uri(url), "POST", values); } } catch (Exception e) { UIModBrowser.LogModBrowserException(e); } }, _cts.Token); } else { _loading = false; _ready = true; } }
private void SetHeading(string heading) { uITextPanel.SetText(heading, 0.8f, true); uITextPanel.Recalculate(); }
public static void PopulateModBrowser(CustomMMHooker.orig_populatebrowser orig, object instance) { Object modBrowserInstance = ReflManager <Type> .GetItem("TMain").Assembly.GetType("Terraria.ModLoader.Interface") .GetField("modBrowser", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); ErrorLogger.Log(modBrowserInstance); ReflManager <Type> .GetItem("TMain").Assembly.GetType("Terraria.ModLoader.UI.UIModBrowser").GetField("loading").SetValue(modBrowserInstance, true); ReflManager <Type> .GetItem("TMain").Assembly.GetType("Terraria.ModLoader.UI.UIModBrowser").GetField("_specialModPackFilterTitle", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(modBrowserInstance, ""); //StaticManager<Type>.GetItem("TMain").Assembly.GetType("Terraria.ModLoader.UI.UIModBrowser").GetField("_specialModPackFilterTitle", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(modBrowserInstance, null ); UITextPanel <String> reloadButton = (UITextPanel <String>) ReflManager <Type> .GetItem("TMain").Assembly.GetType("Terraria.ModLoader.UI.UIModBrowser") .GetField("reloadButton", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(modBrowserInstance); reloadButton.SetText(Language.GetTextValue("tModLoader.MBGettingData")); MethodInfo SetHeading = ReflManager <Type> .GetItem("TMain").Assembly.GetType("Terraria.ModLoader.UI.UIModBrowser") .GetMethod("SetHeading", BindingFlags.Instance | BindingFlags.NonPublic); SetHeading.Invoke(modBrowserInstance, new object[] { Language.GetTextValue("tModLoader.MenuModBrowser") }); UIPanel uiPanel = (UIPanel)ReflManager <Type> .GetItem("TMain").Assembly.GetType("Terraria.ModLoader.UI.UIModBrowser") .GetField("uIPanel", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(modBrowserInstance); uiPanel.Append((UIElement)ReflManager <Type> .GetItem("TMain").Assembly.GetType("Terraria.ModLoader.UI.UIModBrowser") .GetField("uILoader", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(modBrowserInstance)); /*uIPanel.Append(uILoader);*/ UIList modList = (UIList)ReflManager <Type> .GetItem("TMain").Assembly.GetType("Terraria.ModLoader.UI.UIModBrowser") .GetField("modList").GetValue(modBrowserInstance); IList items = (IList)ReflManager <Type> .GetItem("TMain").Assembly.GetType("Terraria.ModLoader.UI.UIModBrowser") .GetField("items", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly).GetValue(modBrowserInstance); items.Clear(); modList.Deactivate(); try { ServicePointManager.Expect100Continue = false; string url = "http://javid.ddns.net/tModLoader/listmods.php"; var values = new NameValueCollection { { "modloaderversion", TUA.tModLoaderVersion2 }, { "platform", ModLoader.compressedPlatformRepresentation }, }; using (WebClient client = new WebClient()) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return(true); }); Type eventType = typeof(WebClient); EventInfo UploadCompleteValue = eventType.GetEvent("UploadValuesCompleted"); Type eventHandler = UploadCompleteValue.EventHandlerType; MethodInfo methodToMakeDelegate = ReflManager <Type> .GetItem("TMain").Assembly .GetType("Terraria.ModLoader.UI.UIModBrowser").GetMethod("UploadComplete", BindingFlags.Public | BindingFlags.Instance); ErrorLogger.Log("EventHandler : " + UploadCompleteValue); ErrorLogger.Log("Method to add : " + methodToMakeDelegate); Delegate d = Delegate.CreateDelegate(eventHandler, modBrowserInstance, methodToMakeDelegate); MethodInfo addHandler = UploadCompleteValue.GetAddMethod(); Object[] addHandlerArgs = { d }; addHandler.Invoke(client, addHandlerArgs); //client.UploadValuesCompleted += new UploadValuesCompletedEventHandler(d); client.UploadValuesAsync(new Uri(url), "POST", values); } } catch (WebException e) { if (e.Status == WebExceptionStatus.Timeout) { SetHeading.Invoke(modBrowserInstance, new object[] { Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", Language.GetTextValue("tModLoader.MBBusy")) }); return; } if (e.Status == WebExceptionStatus.ProtocolError) { var resp = (HttpWebResponse)e.Response; if (resp.StatusCode == HttpStatusCode.NotFound) { SetHeading.Invoke(modBrowserInstance, new object[] { Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", resp.StatusCode) }); return; } SetHeading.Invoke(modBrowserInstance, new object[] { Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", resp.StatusCode) }); return; } } catch (Exception e) { Object[] obj = new object[] { e }; typeof(ErrorLogger) .GetMethod("LogModBrowserException", BindingFlags.NonPublic | BindingFlags.Static) .Invoke(null, obj); return; } }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (!_updateRequired) { return; } _updateRequired = false; _backPanel.RemoveAllChildren(); int i = 0; UIMessageBox AddMessageBox(string text) { var msgBox = new UIMessageBox(text) { Width = { Percent = 1f }, Height = { Percent = .2f }, Top = { Percent = (i++) / 4f + 0.05f }, }.WithPadding(6); _backPanel.Append(msgBox); msgBox.Activate(); return(msgBox); } void AddButton(UIElement elem, string text, Action clickAction) { var button = new UITextPanel <string>(text) { Top = { Pixels = -2 }, Left = { Pixels = -2 }, HAlign = 1, VAlign = 1 }.WithFadedMouseOver(); button.OnClick += (evt, _) => clickAction(); button.Activate(); elem.Append(button); } bool frameworkCheck = ModCompile.RoslynCompatibleFrameworkCheck(out var dotNetMsg); if (monoStartScriptsUpdated) { dotNetMsg = Language.GetTextValue("tModLoader.DMScriptsRequireRestart"); } var dotNetMsgBox = AddMessageBox(dotNetMsg); if (!frameworkCheck && !monoStartScriptsUpdated) { if (ModCompile.systemMonoSuitable) { AddButton(dotNetMsgBox, Language.GetTextValue("tModLoader.DMUpdateScripts"), UpdateMonoStartScripts); } else if (FrameworkVersion.Framework == Framework.Mono) { AddButton(dotNetMsgBox, Language.GetTextValue("tModLoader.MBDownload"), DownloadMono); } else { AddButton(dotNetMsgBox, Language.GetTextValue("tModLoader.MBDownload"), DownloadDotNet); } } bool modCompileCheck = ModCompile.ModCompileVersionCheck(out var modCompileMsg); if (!modCompileCheck && !ModBrowser.UIModBrowser.PlatformSupportsTls12) { modCompileMsg = "tModLoader.DMUpdateMonoToDownloadModCompile"; } var modCompileMsgBox = AddMessageBox(Language.GetTextValue(modCompileMsg)); #if !DEBUG if (!modCompileCheck && ModBrowser.UIModBrowser.PlatformSupportsTls12) { AddButton(modCompileMsgBox, Language.GetTextValue("tModLoader.MBDownload"), DownloadModCompile); } #endif bool refAssemCheck = ModCompile.ReferenceAssembliesCheck(out var refAssemMsg); var refAssemMsgBox = AddMessageBox(refAssemMsg); if (!refAssemCheck) { if (ModCompile.PlatformSupportsVisualStudio) { AddButton(refAssemMsgBox, Language.GetTextValue("tModLoader.DMVisualStudio"), DevelopingWithVisualStudio); } var icon = UICommon.ButtonExclamationTexture; _refAssemDirectDlButton = new UIHoverImage(icon, Language.GetTextValue("tModLoader.DMReferenceAssembliesDownload")) { Left = { Pixels = -1 }, Top = { Pixels = -1 }, VAlign = 1, }; _refAssemDirectDlButton.OnClick += (evt, _) => DirectDownloadRefAssemblies(); refAssemMsgBox.Append(_refAssemDirectDlButton); } var tutorialMsgBox = AddMessageBox(Language.GetTextValue("tModLoader.DMTutorialWelcome")); AddButton(tutorialMsgBox, Language.GetTextValue("tModLoader.DMTutorial"), OpenTutorial); _allChecksSatisfied = frameworkCheck && modCompileCheck && refAssemCheck; _bottomButton.SetText(_allChecksSatisfied ? Language.GetTextValue("tModLoader.Continue") : Language.GetTextValue("UI.Back")); }
public override void OnInitialize() { TabPanel Menu = new TabPanel(450, 500, new Tab("Custom NPC", this), new Tab(" Custom Item", new CustomItemUI())); Menu.VAlign = 0.6f; Menu.HAlign = 0.2f; Menu.OnCloseBtnClicked += () => GetInstance <Creativetools>().UserInterface.SetState(new MainUI()); Append(Menu); UITextPanel <string> CreateButton = new UITextPanel <string>(Language.GetTextValue("Create NPC")); CreateButton.SetPadding(4); CreateButton.HAlign = 0.05f; CreateButton.MarginTop = 460; CreateButton.OnClick += CreateButtonButtonClicked; Menu.Append(CreateButton); UITextPanel <string> CodeButton = new UITextPanel <string>(Language.GetTextValue("Copy Code")); CodeButton.SetPadding(4); CodeButton.HAlign = 0.5f; CodeButton.MarginTop = 460; CodeButton.OnClick += CodeButtonClicked; Menu.Append(CodeButton); UITextPanel <string> FileButton = new UITextPanel <string>(Language.GetTextValue("Select Texture")); FileButton.SetPadding(4); FileButton.HAlign = 0.9f; FileButton.MarginTop = 460; FileButton.OnClick += FileButtonClicked; Menu.Append(FileButton); nametext = new NewUITextBox("Enter name here"); nametext.HAlign = 0.5f; nametext.MarginTop = 50; nametext.Width.Set(-40f, 1f); Menu.Append(nametext); MakeSlider(new UIIntRangedDataValue("Life: ", 0, 0, 999), out LifeDataProperty, Menu, top: 100); MakeSlider(new UIIntRangedDataValue("Damage: ", 0, 0, 999), out DamageDataProperty, Menu, top: 150); MakeSlider(new UIIntRangedDataValue("Defense: ", 0, 0, 999), out DefenseDataProperty, Menu, top: 200); MakeSlider(new UIIntRangedDataValue("AiStyle: ", 1, 0, 111), out AiSyleDataProperty, Menu, top: 250); MakeSlider(new UIFloatRangedDataValue("Knockback resist: ", 0, 0, 1), out KnockbackDataProperty, Menu, 300); MakeSlider(new UIFloatRangedDataValue("Scale: ", 1, 0, 10), out ScaleDataProperty, Menu, top: 350); FrameDataProperty = new UIIntRangedDataValue("", 1, 1, 20); UIElement FrameSlider = new UIRange <int>(FrameDataProperty) { MarginTop = 410, HAlign = 0.35f }; FrameSlider.Width.Set(0, 0.4f); FrameSlider.Append(new UIText("Frame count:") { HAlign = 0.9f, MarginTop = -15 }); Menu.Append(FrameSlider); UITextPanel <string> NoCollideButton = new UITextPanel <string>("Collision: true") { HAlign = 0.05f, MarginTop = 400 }; NoCollideButton.OnClick += (evt, elm) => { CustomNPC.cNoCollide = !CustomNPC.cNoCollide; NoCollideButton.SetText("Collision: " + !CustomNPC.cNoCollide); }; Menu.Append(NoCollideButton); UITextPanel <string> ImmortalButton = new UITextPanel <string>("Immortal: false") { HAlign = 0.95f, MarginTop = 400 }; ImmortalButton.OnClick += (evt, elm) => { CustomNPC.cImmortal = !CustomNPC.cImmortal; ImmortalButton.SetText("Immortal: " + CustomNPC.cImmortal); }; Menu.Append(ImmortalButton); }
public override void OnActivate() { filterTextField.SetText(""); updateNeeded = false; SetMessage("", Color.White); string configDisplayName = ((LabelAttribute)Attribute.GetCustomAttribute(modConfig.GetType(), typeof(LabelAttribute)))?.Label ?? modConfig.Name; headerTextPanel.SetText(string.IsNullOrEmpty(configDisplayName) ? modConfig.mod.DisplayName : modConfig.mod.DisplayName + ": " + configDisplayName); pendingConfig = ConfigManager.GeneratePopulatedClone(modConfig); pendingChanges = pendingRevertDefaults; if (pendingRevertDefaults) { pendingRevertDefaults = false; ConfigManager.Reset(pendingConfig); pendingChangesUIUpdate = true; } int index = modConfigs.IndexOf(modConfig); int count = modConfigs.Count; //pendingChanges = false; backButton.BackgroundColor = UICommon.DefaultUIBlueMouseOver; uIElement.RemoveChild(saveConfigButton); uIElement.RemoveChild(revertConfigButton); uIElement.RemoveChild(previousConfigButton); uIElement.RemoveChild(nextConfigButton); if (index + 1 < count) { uIElement.Append(nextConfigButton); } if (index - 1 >= 0) { uIElement.Append(previousConfigButton); } uIElement.RemoveChild(configPanelStack.Peek()); uIElement.Append(uIPanel); mainConfigItems.Clear(); mainConfigList.Clear(); configPanelStack.Clear(); configPanelStack.Push(uIPanel); subPageStack.Clear(); //currentConfigList = mainConfigList; int top = 0; // load all mod config options into UIList // TODO: Inheritance with ModConfig? DeclaredOnly? uIPanel.BackgroundColor = UICommon.MainPanelBackground; var backgroundColorAttribute = (BackgroundColorAttribute)Attribute.GetCustomAttribute(pendingConfig.GetType(), typeof(BackgroundColorAttribute)); if (backgroundColorAttribute != null) { uIPanel.BackgroundColor = backgroundColorAttribute.color; } int order = 0; foreach (PropertyFieldWrapper variable in ConfigManager.GetFieldsAndProperties(pendingConfig)) { if (variable.isProperty && variable.Name == "Mode") { continue; } if (Attribute.IsDefined(variable.MemberInfo, typeof(JsonIgnoreAttribute)) && !Attribute.IsDefined(variable.MemberInfo, typeof(LabelAttribute))) // TODO, appropriately named attribute { continue; } HeaderAttribute header = ConfigManager.GetCustomAttribute <HeaderAttribute>(variable, null, null); if (header != null) { var wrapper = new PropertyFieldWrapper(typeof(HeaderAttribute).GetProperty(nameof(HeaderAttribute.Header))); WrapIt(mainConfigList, ref top, wrapper, header, order++); } WrapIt(mainConfigList, ref top, variable, pendingConfig, order++); } }
public override void OnActivate() { button2.SetText(button2Text); }