Библиотеки

список библиотек s&box

RichText Razor Panels

carsonk.richtextpanels

Adds a <RichText/> element which can parse text into custom Razor Panels

Описание

What is this?

This adds a custom <RichText Text=""/> UI element which can be given text which will be parsed into custom UI panels. You can define as many custom panel types as you want and they can be as simple as adding asterisks for italics or as complex as URLs automatically becoming an embedded WebPanel.

How do I use it?

First you need to create your own razor panel that includes the [RichTextPanel] attribute. It can take either a single regex pattern as an argument, or the start and end strings which it will use to form a proper regex pattern.

@attribute [RichTextPanel("**", "**")]

<root>
</root>

<style>
    label {
        font-weight: 800;
    }
</style>

The text will be added to this panel as a child Label, so you can style it however you want from here, and even pre-include children in the root.

However, if you find yourself wanting more control than just styling the text, you can implement IRichTextPanel and it's ParseRichText() function.
Here's an example that allows you to do <i>item_resource_name<i> in RichText and have it display an item's icon and name

@attribute [RichTextPanel( @"<i>(.+?)</i>" )]
@implements IRichTextPanel

<root>
	@if ( Item is null ) return;
	<img [email protected] />
	<label>@Item.Name</label>
</root>

@code
{
	ItemResource Item;
	public void ParseRichText ( string text )
	{
		Item = ResourceLibrary.GetAll<ItemResource>().FirstOrDefault(x => x.ResourceName == text);
	}

	protected override int BuildHash () => Item.GetHashCode();
}

Then when you're ready to use the RichText element itself, you just do the following:

<RichText Text="**You have unlocked** the <i>wooden_sword</i>!" />

How do I get the examples from the picture???

You can find the example project here!

Медиа

01
Миниатюра MediaHelpers
MediaHelpers carsonk.mediahelpers

A library used to retrieve video stream urls for use with the VideoPlayer class.

+0 24 ч
15избранное
10положительные оценки
79%Terry Score
02
Миниатюра Razor Panel Tooltips
Razor Panel Tooltips carsonk.razor_tooltips

A custom tooltip system that lets you use razor panels instead of a string

+0 24 ч
6избранное
6положительные оценки
55%Terry Score
03
Миниатюра Editor All Chat
Editor All Chat carsonk.editor_all_chat

A global chat that lets you talk with anyone else using the library who's currently in the Editor.

+0 24 ч
2избранное
6положительные оценки
69%Terry Score
04
Миниатюра TikTokTTS
TikTokTTS carsonk.tiktoktts

No summary provided.

+0 24 ч
1избранное
4положительные оценки
60%Terry Score
05
Миниатюра SFXR
SFXR carsonk.sfxr

No summary provided.

+0 24 ч
1избранное
2положительные оценки
43%Terry Score
06
Миниатюра Granular Pitch Audio Processor
Granular Pitch Audio Processor carsonk.granularpitchprocessor

A basic audio processor that lets you change the pitch of a sound live without changing its speed.

+0 24 ч
1избранное
0положительные оценки
--Terry Score