Skip to content

Commit

Permalink
add widget bot, add level
Browse files Browse the repository at this point in the history
  • Loading branch information
LucHeart committed May 4, 2024
1 parent 59b72b4 commit 5d3c2cb
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 22 deletions.
2 changes: 1 addition & 1 deletion ShockOsc/Backend/BackendHubManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private async Task RemoteActivateShocker(ControlLogSender sender, ControlLog log
log.Type, log.Shocker.Name, log.Intensity, inSeconds, sender.CustomName, sender.Name);

var template = _configManager.Config.Chatbox.Types[log.Type];
if (_configManager.Config.Osc.Chatbox &&
if (_configManager.Config.Chatbox.Enabled &&
_configManager.Config.Chatbox.DisplayRemoteControl && template.Enabled)
{
// Chatbox message remote
Expand Down
1 change: 1 addition & 0 deletions ShockOsc/Config/ChatboxConf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace OpenShock.ShockOsc.Config;

public sealed class ChatboxConf
{
public bool Enabled { get; set; } = true;
public string Prefix { get; set; } = "[ShockOsc] ";
public bool DisplayRemoteControl { get; set; } = true;

Expand Down
1 change: 0 additions & 1 deletion ShockOsc/Config/OscConf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

public sealed class OscConf
{
public bool Chatbox { get; set; } = true;
public bool Hoscy { get; set; } = false;
public ushort HoscySendPort { get; set; } = 9001;
public bool QuestSupport { get; set; } = false;
Expand Down
1 change: 1 addition & 0 deletions ShockOsc/Services/OscClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public ValueTask SendGameMessage(string address, params object?[]?arguments)

public ValueTask SendChatboxMessage(string message)
{
if(!_configManager.Config.Chatbox.Enabled) return ValueTask.CompletedTask;
if (_configManager.Config.Osc.Hoscy) return _hoscySenderChannel.Writer.WriteAsync(new OscMessage("/hoscy/message", message));

return _gameSenderChannel.Writer.WriteAsync(new OscMessage("/chatbox/input", message, true));
Expand Down
2 changes: 1 addition & 1 deletion ShockOsc/Services/ShockOsc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ private async Task InstantShock(ProgramGroup programGroup, uint duration, byte i

await _backendHubManager.ControlGroup(programGroup.Id, duration, intensity, ControlType.Shock, exclusive);

if (!_configManager.Config.Osc.Chatbox) return;
if (!_configManager.Config.Chatbox.Enabled) return;
// Chatbox message local
var dat = new
{
Expand Down
2 changes: 1 addition & 1 deletion ShockOsc/Ui/Pages/Dash/Tabs/ChatboxTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<MudPaper Outlined="true" Class="rounded-lg mud-paper-padding">
<MudText>Chatbox Options</MudText>
<MudDivider/>
<MudCheckBox Class="option-width option-checkbox-height" @bind-Value="ConfigManager.Config.Osc.Chatbox" Label="Chatbox" @bind-Value:after="OnSettingsValueChange"/>
<MudCheckBox Class="option-width option-checkbox-height" @bind-Value="ConfigManager.Config.Chatbox.Enabled" Label="Chatbox" @bind-Value:after="OnSettingsValueChange"/>
<MudCheckBox Class="option-width option-checkbox-height" @bind-Value="ConfigManager.Config.Chatbox.DisplayRemoteControl" Label="Display Remote Control" @bind-Value:after="OnSettingsValueChange"/>
<br/>
<br/>
Expand Down
20 changes: 2 additions & 18 deletions ShockOsc/Ui/Pages/Dash/Tabs/DashboardTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,8 @@
</div>
</MudPaper>

@* <MudPaper Outlined="true" Elevation="1" Class="rounded-lg mud-paper-padding item" Style="text-align: center"> *@
@* <MudText Typo="Typo.h6">Discord</MudText> *@
@* <iframe src="https://e.widgetbot.io/channels/383670897724358657/515696193851097109" allow="clipboard-write; fullscreen" height="600" width="800"></iframe> *@
@* *@
@* </MudPaper> *@

<MudPaper Outlined="true" Elevation="1" Class="rounded-lg mud-paper-padding item discord" Style="padding: 0">
<iframe src="https://discord.com/widget?id=1078124408775901204&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0"></iframe>
<iframe src="https://e.widgetbot.io/channels/1078124408775901204/1236453005746896898" allowtransparency="true"></iframe>

</MudPaper>

Expand All @@ -74,16 +68,6 @@
</MudPaper>


<MudPaper Outlined="true" Elevation="1" Class="rounded-lg mud-paper-padding item" Style="text-align: center">
<MudText Typo="Typo.h6">Placeholder</MudText>
<MudText Typo="Typo.body2">Duo no lorem aliquyam dolor voluptua minim dolor diam sed dolores accusam est dolore voluptua takimata vel ullamcorper erat takimata erat at consectetuer amet magna</MudText>
</MudPaper>

<MudPaper Outlined="true" Elevation="1" Class="rounded-lg mud-paper-padding item" Style="text-align: center">
<MudText Typo="Typo.h6">Placeholder</MudText>
<MudText Typo="Typo.body2">Duo no lorem aliquyam dolor voluptua minim dolor diam sed dolores accusam est dolore voluptua takimata vel ullamcorper erat takimata erat at consectetuer amet magna</MudText>
</MudPaper>

<MudPaper Outlined="true" Elevation="1" Class="rounded-lg mud-paper-padding item" Style="text-align: center">
<MudText Typo="Typo.h6">Placeholder</MudText>
<MudText Typo="Typo.body2">Duo no lorem aliquyam dolor voluptua minim dolor diam sed dolores accusam est dolore voluptua takimata vel ullamcorper erat takimata erat at consectetuer amet magna</MudText>
Expand Down Expand Up @@ -118,7 +102,7 @@
}
.dashboard-box .discord {
grid-area: 1 / 3 / 3 / 3;
grid-area: 2 / 2 / 4 / 4;
}
.dashboard-box .item:hover {
Expand Down
2 changes: 2 additions & 0 deletions ShockOsc/Ui/Pages/Dash/Tabs/LogsTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
<MudTable T="LogStore.LogEntry" RowClass="cursor-pointer" RowClassFunc="RowClassFunc" Items="LogStore.Logs.OrderByDescending(x => x.Time)" OnRowClick="LogRowClick" Breakpoint="Breakpoint.Sm" Hover="true" Dense="true" Height="100%">
<HeaderContent>
<MudTh>Time</MudTh>
<MudTh>Level</MudTh>
<MudTh>Source</MudTh>
<MudTh>Message</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>@context.Time.ToString("HH:mm:ss")</MudTd>
<MudTd>@context.Level.ToString()</MudTd>
<MudTd>@context.SourceContextShort</MudTd>
<MudTd>@context.Message.TruncateAtChar(120)</MudTd>
</RowTemplate>
Expand Down

0 comments on commit 5d3c2cb

Please sign in to comment.