Skip to content

Commit 256e0dd

Browse files
feat: 設定の追加
1 parent e7f8465 commit 256e0dd

3 files changed

Lines changed: 363 additions & 0 deletions

File tree

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
using System.ComponentModel;
2+
using System.Runtime.CompilerServices;
3+
using YukkuriMovieMaker.Plugin;
4+
5+
namespace YmmRPC.Settings;
6+
7+
public class YmmRpcSettings : SettingsBase<YmmRpcSettings>, INotifyPropertyChanged
8+
{
9+
public override SettingsCategory Category => SettingsCategory.None;
10+
public override string Name => "YMM4 Discord RPC";
11+
public override bool HasSettingView => true;
12+
public override object SettingView => new YmmRpcSettingsView();
13+
14+
public new event PropertyChangedEventHandler? PropertyChanged;
15+
16+
public bool IsEnabled
17+
{
18+
get;
19+
set => SetField(ref field, value);
20+
} = true;
21+
22+
public bool CustomRpcEnabled
23+
{
24+
get;
25+
set => SetField(ref field, value);
26+
}
27+
28+
public string CustomRpcDetails
29+
{
30+
get;
31+
set => SetField(ref field, value);
32+
} = string.Empty;
33+
34+
public string CustomRpcState
35+
{
36+
get;
37+
set => SetField(ref field, value);
38+
} = string.Empty;
39+
40+
public string CustomRpcLargeImageKey
41+
{
42+
get;
43+
set => SetField(ref field, value);
44+
} = string.Empty;
45+
46+
public string CustomRpcLargeImageText
47+
{
48+
get;
49+
set => SetField(ref field, value);
50+
} = string.Empty;
51+
52+
public string CustomRpcSmallImageKey
53+
{
54+
get;
55+
set => SetField(ref field, value);
56+
} = string.Empty;
57+
58+
public string CustomRpcSmallImageText
59+
{
60+
get;
61+
set => SetField(ref field, value);
62+
} = string.Empty;
63+
64+
public bool CustomRpcEnableButtons
65+
{
66+
get;
67+
set => SetField(ref field, value);
68+
}
69+
70+
public string CustomRpcButton1Label
71+
{
72+
get;
73+
set => SetField(ref field, value);
74+
} = string.Empty;
75+
76+
public string CustomRpcButton1Url
77+
{
78+
get;
79+
set => SetField(ref field, value);
80+
} = string.Empty;
81+
82+
public string CustomRpcButton2Label
83+
{
84+
get;
85+
set => SetField(ref field, value);
86+
} = string.Empty;
87+
88+
public string CustomRpcButton2Url
89+
{
90+
get;
91+
set => SetField(ref field, value);
92+
} = string.Empty;
93+
94+
public override void Initialize()
95+
{
96+
}
97+
98+
private void SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
99+
{
100+
if (EqualityComparer<T>.Default.Equals(field, value)) return;
101+
field = value;
102+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
103+
YmmRpcPlugin.RequestUpdate();
104+
}
105+
}
Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
<UserControl x:Class="YmmRPC.Settings.YmmRpcSettingsView"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:c="clr-namespace:YukkuriMovieMaker.Controls;assembly=YukkuriMovieMaker.Controls"
7+
xmlns:local="clr-namespace:YmmRPC.Settings"
8+
mc:Ignorable="d">
9+
10+
<ScrollViewer
11+
HorizontalAlignment="Stretch"
12+
VerticalAlignment="Stretch"
13+
HorizontalScrollBarVisibility="Disabled"
14+
VerticalScrollBarVisibility="Auto">
15+
<StackPanel>
16+
17+
<Expander Header="全般" IsExpanded="True">
18+
<StackPanel>
19+
20+
<Grid>
21+
<Grid.ColumnDefinitions>
22+
<ColumnDefinition Width="200"/>
23+
<ColumnDefinition Width="*"/>
24+
</Grid.ColumnDefinitions>
25+
<Label Content="プラグインを有効化"/>
26+
<c:ToggleSlider Grid.Column="1"
27+
HorizontalAlignment="Right"
28+
Value="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=IsEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
29+
</Grid>
30+
31+
<!-- <Grid> -->
32+
<!-- <Grid.ColumnDefinitions> -->
33+
<!-- <ColumnDefinition Width="200"/> -->
34+
<!-- <ColumnDefinition Width="*"/> -->
35+
<!-- </Grid.ColumnDefinitions> -->
36+
<!-- <Label Content="プロジェクト名を表示"/> -->
37+
<!-- <c:ToggleSlider Grid.Column="1" -->
38+
<!-- HorizontalAlignment="Right" -->
39+
<!-- Value="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=IsShowProject, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> -->
40+
<!-- </Grid> -->
41+
42+
<Grid>
43+
<GroupBox Header="YMM RPC プラグインについて" HorizontalAlignment="Stretch" Margin="8">
44+
<StackPanel>
45+
<TextBlock Margin="2" TextWrapping="Wrap">ゆっくりMovieMaker4 を Discord の Rich Presence に表示するプラグインです。</TextBlock>
46+
<TextBlock Margin="2" TextWrapping="Wrap">本プラグインに関する不具合は Discord や YMM4 本体の開発者ではなく、なまけもの(namakemono-san)までご連絡ください。</TextBlock>
47+
<TextBlock Margin="2">Ⓒ namakemono-san 2025</TextBlock>
48+
</StackPanel>
49+
</GroupBox>
50+
</Grid>
51+
</StackPanel>
52+
</Expander>
53+
54+
<Expander Header="カスタムステータス" IsExpanded="False">
55+
<StackPanel>
56+
57+
<Grid>
58+
<Grid.ColumnDefinitions>
59+
<ColumnDefinition Width="200"/>
60+
<ColumnDefinition Width="*"/>
61+
</Grid.ColumnDefinitions>
62+
<Label Content="カスタムステータスを有効化"/>
63+
<c:ToggleSlider Grid.Column="1"
64+
HorizontalAlignment="Right"
65+
Value="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
66+
</Grid>
67+
68+
<Grid>
69+
<GroupBox Header="テキスト" Margin="8"
70+
IsEnabled="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcEnabled}">
71+
<StackPanel>
72+
73+
<Grid>
74+
<Grid.ColumnDefinitions>
75+
<ColumnDefinition Width="200"/>
76+
<ColumnDefinition Width="*"/>
77+
</Grid.ColumnDefinitions>
78+
<Label Content="上段テキスト (Details)"/>
79+
<TextBox Grid.Column="1"
80+
Width="300"
81+
HorizontalAlignment="Right"
82+
MaxLength="128"
83+
Text="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcDetails, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
84+
</Grid>
85+
86+
<Grid>
87+
<Grid.ColumnDefinitions>
88+
<ColumnDefinition Width="200"/>
89+
<ColumnDefinition Width="*"/>
90+
</Grid.ColumnDefinitions>
91+
<Label Content="下段テキスト (State)"/>
92+
<TextBox Grid.Column="1"
93+
Width="300"
94+
HorizontalAlignment="Right"
95+
MaxLength="128"
96+
Text="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcState, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
97+
</Grid>
98+
99+
</StackPanel>
100+
</GroupBox>
101+
</Grid>
102+
103+
<Grid>
104+
<GroupBox Header="画像(大)" Margin="8"
105+
IsEnabled="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcEnabled}">
106+
<StackPanel>
107+
108+
<Grid>
109+
<Grid.ColumnDefinitions>
110+
<ColumnDefinition Width="200"/>
111+
<ColumnDefinition Width="*"/>
112+
</Grid.ColumnDefinitions>
113+
<Label Content="画像リンク(大)"/>
114+
<TextBox Grid.Column="1"
115+
Width="300"
116+
HorizontalAlignment="Right"
117+
Text="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcLargeImageKey, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
118+
</Grid>
119+
120+
<Grid>
121+
<Grid.ColumnDefinitions>
122+
<ColumnDefinition Width="200"/>
123+
<ColumnDefinition Width="*"/>
124+
</Grid.ColumnDefinitions>
125+
<Label Content="ホバーテキスト(大)"/>
126+
<TextBox Grid.Column="1"
127+
Width="300"
128+
HorizontalAlignment="Right"
129+
MaxLength="128"
130+
Text="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcLargeImageText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
131+
</Grid>
132+
133+
</StackPanel>
134+
</GroupBox>
135+
</Grid>
136+
137+
<Grid>
138+
<GroupBox Header="画像(小)" Margin="8"
139+
IsEnabled="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcEnabled}">
140+
<StackPanel>
141+
142+
<Grid>
143+
<Grid.ColumnDefinitions>
144+
<ColumnDefinition Width="200"/>
145+
<ColumnDefinition Width="*"/>
146+
</Grid.ColumnDefinitions>
147+
<Label Content="画像リンク(小)"/>
148+
<TextBox Grid.Column="1"
149+
Width="300"
150+
HorizontalAlignment="Right"
151+
Text="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcSmallImageKey, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
152+
</Grid>
153+
154+
<Grid>
155+
<Grid.ColumnDefinitions>
156+
<ColumnDefinition Width="200"/>
157+
<ColumnDefinition Width="*"/>
158+
</Grid.ColumnDefinitions>
159+
<Label Content="ホバーテキスト(小)"/>
160+
<TextBox Grid.Column="1"
161+
Width="300"
162+
HorizontalAlignment="Right"
163+
MaxLength="128"
164+
Text="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcSmallImageText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
165+
</Grid>
166+
167+
</StackPanel>
168+
</GroupBox>
169+
</Grid>
170+
171+
<Grid>
172+
<GroupBox Header="ボタン" Margin="8"
173+
IsEnabled="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcEnabled}">
174+
<StackPanel>
175+
176+
<Grid>
177+
<Grid.ColumnDefinitions>
178+
<ColumnDefinition Width="200"/>
179+
<ColumnDefinition Width="*"/>
180+
</Grid.ColumnDefinitions>
181+
<Label Content="ボタンを有効化"/>
182+
<c:ToggleSlider Grid.Column="1"
183+
HorizontalAlignment="Right"
184+
Value="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcEnableButtons, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
185+
</Grid>
186+
187+
<Grid IsEnabled="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcEnableButtons}">
188+
<Grid.ColumnDefinitions>
189+
<ColumnDefinition Width="200"/>
190+
<ColumnDefinition Width="*"/>
191+
</Grid.ColumnDefinitions>
192+
<Label Content="ボタン1 ラベル"/>
193+
<TextBox Grid.Column="1"
194+
Width="300"
195+
HorizontalAlignment="Right"
196+
MaxLength="32"
197+
Text="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcButton1Label, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
198+
</Grid>
199+
200+
<Grid IsEnabled="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcEnableButtons}">
201+
<Grid.ColumnDefinitions>
202+
<ColumnDefinition Width="200"/>
203+
<ColumnDefinition Width="*"/>
204+
</Grid.ColumnDefinitions>
205+
<Label Content="ボタン1 URL"/>
206+
<TextBox Grid.Column="1"
207+
Width="300"
208+
HorizontalAlignment="Right"
209+
Text="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcButton1Url, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
210+
</Grid>
211+
212+
<Grid IsEnabled="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcEnableButtons}">
213+
<Grid.ColumnDefinitions>
214+
<ColumnDefinition Width="200"/>
215+
<ColumnDefinition Width="*"/>
216+
</Grid.ColumnDefinitions>
217+
<Label Content="ボタン2 ラベル"/>
218+
<TextBox Grid.Column="1"
219+
Width="300"
220+
HorizontalAlignment="Right"
221+
MaxLength="32"
222+
Text="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcButton2Label, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
223+
</Grid>
224+
225+
<Grid IsEnabled="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcEnableButtons}">
226+
<Grid.ColumnDefinitions>
227+
<ColumnDefinition Width="200"/>
228+
<ColumnDefinition Width="*"/>
229+
</Grid.ColumnDefinitions>
230+
<Label Content="ボタン2 URL"/>
231+
<TextBox Grid.Column="1"
232+
Width="300"
233+
HorizontalAlignment="Right"
234+
Text="{Binding Source={x:Static local:YmmRpcSettings.Default}, Path=CustomRpcButton2Url, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
235+
</Grid>
236+
237+
</StackPanel>
238+
</GroupBox>
239+
</Grid>
240+
241+
</StackPanel>
242+
</Expander>
243+
244+
</StackPanel>
245+
</ScrollViewer>
246+
247+
</UserControl>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.Windows.Controls;
2+
3+
namespace YmmRPC.Settings;
4+
5+
public partial class YmmRpcSettingsView : UserControl
6+
{
7+
public YmmRpcSettingsView()
8+
{
9+
InitializeComponent();
10+
}
11+
}

0 commit comments

Comments
 (0)