Skip to content

Commit ae8e374

Browse files
committed
Merge branch 'master' of https://github.com/VladimirKhil/SI
2 parents 9184692 + 6b1c68f commit ae8e374

File tree

13 files changed

+99
-16
lines changed

13 files changed

+99
-16
lines changed

src/Common/SIUI.ViewModel/TableInfoViewModel.cs

+14-3
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,26 @@ public string Text
8585
private int _textLength;
8686

8787
/// <summary>
88-
/// Длина текста (при использовании частичного текста свойство Text содержит не только частичный текст, но и форму остального текста вопроса.
88+
/// Длина текста. При использовании частичного текста свойство Text содержит не только частичный текст, но и форму остального текста вопроса.
8989
/// Её отображать не надо
9090
/// </summary>
9191
public int TextLength
9292
{
9393
get { return _textLength; }
9494
set { if (_textLength != value) { _textLength = value; OnPropertyChanged(); } }
9595
}
96-
96+
97+
private string _hint = "";
98+
99+
/// <summary>
100+
/// Additional hint shown over other content with transparency for a limited time.
101+
/// </summary>
102+
public string Hint
103+
{
104+
get { return _hint; }
105+
set { if (_hint != value) { _hint = value; OnPropertyChanged(); } }
106+
}
107+
97108
private int _playerIndex = -1;
98109

99110
/// <summary>
@@ -108,7 +119,7 @@ public int PlayerIndex
108119
public string ActivePlayer => _playerIndex < 0 || _playerIndex >= Players.Count ? "" : Players[_playerIndex].Name;
109120

110121
/// <summary>
111-
/// Игроки, проигравшие кнопку
122+
/// Players lost the button chase.
112123
/// </summary>
113124
public ObservableCollection<string> LostButtonPlayers { get; } = new ObservableCollection<string>();
114125

src/Common/SIUI/SIUI.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Product>SIUI</Product>
77
<Description>SIGame table ui</Description>
88
<Copyright>Copyright © Khil-soft 2010 - 2022</Copyright>
9-
<Version>7.6.0</Version>
9+
<Version>7.7.3</Version>
1010
<OutputPath>bin\$(Configuration)\</OutputPath>
1111
<UseWPF>true</UseWPF>
1212
</PropertyGroup>

src/Common/SIUI/Table.xaml

+37-3
Original file line numberDiff line numberDiff line change
@@ -653,16 +653,50 @@
653653
</DataTemplate>
654654
<DataTemplate x:Key="{x:Static vm:TableStage.Question}">
655655
<Grid>
656-
<!--Основной контент вопроса (текст, изображение, видео, скрипичный ключ)-->
656+
<!-- Main question content (text, image, video, treble clef) -->
657657
<ContentControl
658658
Content="{Binding}"
659659
ContentTemplate="{Binding QuestionContentType, Converter={StaticResource QuestionContentSelector}}"
660660
Margin="10" />
661-
<!--Рамка для нажатия / имя нажавшего-->
661+
662+
<!-- Border for pressing mode / Answerer name -->
662663
<ContentControl
663664
Content="{Binding}"
664665
ContentTemplate="{Binding QuestionStyle, Converter={StaticResource DecoratorSelector}}" />
665-
<!--Фоновый звук-->
666+
667+
<!-- Hint -->
668+
<ContentControl Content="{Binding}">
669+
<ContentControl.Style>
670+
<Style TargetType="ContentControl">
671+
<Setter Property="ContentTemplate">
672+
<Setter.Value>
673+
<DataTemplate>
674+
<Grid>
675+
<Grid.RowDefinitions>
676+
<RowDefinition Height="3*" />
677+
<RowDefinition Height="*" />
678+
</Grid.RowDefinitions>
679+
<Border Grid.Row="1" Background="#88000000">
680+
<TextBlock Text="{Binding Hint}" Style="{StaticResource QuestionText}" Opacity="0.4" />
681+
</Border>
682+
</Grid>
683+
</DataTemplate>
684+
</Setter.Value>
685+
</Setter>
686+
<Style.Triggers>
687+
<DataTrigger Binding="{Binding Hint}" Value="">
688+
<Setter Property="ContentTemplate">
689+
<Setter.Value>
690+
<DataTemplate />
691+
</Setter.Value>
692+
</Setter>
693+
</DataTrigger>
694+
</Style.Triggers>
695+
</Style>
696+
</ContentControl.Style>
697+
</ContentControl>
698+
699+
<!-- Background sound -->
666700
<ContentControl Content="{Binding}">
667701
<ContentControl.Style>
668702
<Style TargetType="ContentControl">

src/SICore/SICore.Connections/SICore.Connections.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
99
<Authors>Vladimir Khil</Authors>
1010
<Company>Khil-soft</Company>
11-
<Version>7.6.0</Version>
11+
<Version>7.7.3</Version>
1212
<Description>SIGame connections framework</Description>
1313
<Copyright>Copyright © Khil-soft 2012 - 2022</Copyright>
1414
</PropertyGroup>

src/SICore/SICore.Network/SICore.Network.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
99
<Authors>Vladimir Khil</Authors>
1010
<Company>Khil-soft</Company>
11-
<Version>7.6.0</Version>
11+
<Version>7.7.3</Version>
1212
<Description>SIGame network framework</Description>
1313
<Copyright>Copyright © Khil-soft 2012 - 2022</Copyright>
1414
</PropertyGroup>

src/SICore/SICore/Clients/Viewer/IViewer.cs

+2
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,7 @@ public interface IViewer : ILogic
143143
void OnReplic(string personCode, string text);
144144

145145
void OnRoundContent(string[] mparams) { }
146+
147+
void OnAtomHint(string hint) { }
146148
}
147149
}

src/SICore/SICore/Clients/Viewer/Viewer.cs

+18-1
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ private void Replace_Executed(PersonAccount person, object arg)
119119
var player = person as PlayerAccount;
120120

121121
string index;
122+
122123
if (player != null)
123124
{
124125
var playerIndex = ClientData.Players.IndexOf(player);
126+
125127
if (playerIndex == -1)
126128
{
127129
return;
@@ -152,6 +154,7 @@ private void Free_Executed(object arg)
152154
if (player != null)
153155
{
154156
var index = ClientData.Players.IndexOf(player);
157+
155158
if (index < 0 || index >= ClientData.Players.Count)
156159
{
157160
AddLog($"Wrong index: {index}" + Environment.NewLine);
@@ -161,7 +164,11 @@ private void Free_Executed(object arg)
161164
indexString = index.ToString();
162165
}
163166

164-
_viewerActions.SendMessage(Messages.Config, MessageParams.Config_Free, player != null ? Constants.Player : Constants.Showman, indexString);
167+
_viewerActions.SendMessage(
168+
Messages.Config,
169+
MessageParams.Config_Free,
170+
player != null ? Constants.Player : Constants.Showman,
171+
indexString);
165172
}
166173

167174
private void Delete_Executed(object arg)
@@ -217,7 +224,9 @@ private void Kick_Executed(object arg)
217224
private void Ban_Executed(object arg)
218225
{
219226
if (arg is not ViewerAccount person)
227+
{
220228
return;
229+
}
221230

222231
if (person == ClientData.Me)
223232
{
@@ -245,6 +254,7 @@ private void DeleteTable_Executed(object arg)
245254
var player = ClientData.Players[i];
246255
player.CanBeSelected = ClientData.Stage == GameStage.Before || !player.IsConnected || !player.IsHuman;
247256
int num = i;
257+
248258
player.SelectionCallback = p =>
249259
{
250260
_viewerActions.SendMessageWithArgs(Messages.Config, MessageParams.Config_DeleteTable, num);
@@ -716,6 +726,13 @@ await _client.Server.ConnectionsLock.WithLockAsync(() =>
716726
_logic.SetAtom(mparams);
717727
break;
718728

729+
case Messages.Atom_Hint:
730+
if (mparams.Length > 1)
731+
{
732+
_logic.OnAtomHint(mparams[1]);
733+
}
734+
break;
735+
719736
case Messages.Atom_Second:
720737
_logic.SetSecondAtom(mparams);
721738
break;

src/SICore/SICore/Clients/Viewer/ViewerHumanLogic.cs

+20
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ namespace SICore
2323
/// </summary>
2424
public class ViewerHumanLogic : Logic<ViewerData>, IViewer
2525
{
26+
private static readonly TimeSpan HintLifetime = TimeSpan.FromSeconds(6);
27+
2628
private bool _disposed = false;
2729

2830
private readonly CancellationTokenSource _cancellation = new();
@@ -803,6 +805,24 @@ virtual public void SetSecondAtom(string[] mparams)
803805
}
804806
}
805807

808+
virtual public void OnAtomHint(string hint)
809+
{
810+
TInfo.Hint = hint;
811+
812+
Task.Run(async () =>
813+
{
814+
try
815+
{
816+
await Task.Delay(HintLifetime);
817+
TInfo.Hint = "";
818+
}
819+
catch (Exception exc)
820+
{
821+
_data.BackLink.SendError(exc);
822+
}
823+
});
824+
}
825+
806826
public void SetRight(string answer)
807827
{
808828
try

src/SICore/SICore/SICore.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
88
<Authors>Vladimir Khil</Authors>
99
<Company>Khil-soft</Company>
10-
<Version>7.6.0</Version>
10+
<Version>7.7.3</Version>
1111
<Description>SIGame players logic</Description>
1212
<Copyright>Copyright © Khil-soft 2012 - 2022</Copyright>
1313
</PropertyGroup>

src/SICore/SIData/SIData.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PropertyGroup>
77
<Authors>Vladimir Khil</Authors>
88
<Company>Khil-soft</Company>
9-
<Version>7.6.0</Version>
9+
<Version>7.7.3</Version>
1010
<Description>SIGame data</Description>
1111
<Copyright>Copyright © Khil-soft 2012 - 2022</Copyright>
1212
</PropertyGroup>

src/SIGame/SIGame.ViewModel.Web/SIGame.ViewModel.Web.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PropertyGroup>
99
<Authors>Vladimir Khil</Authors>
1010
<Company>Khil-soft</Company>
11-
<Version>7.6.0</Version>
11+
<Version>7.7.3</Version>
1212
<Description>SIGame web connector</Description>
1313
<Copyright>Copyright © Khil-soft 2005 - 2022</Copyright>
1414
</PropertyGroup>

src/SIGame/SIGame.ViewModel/SIGame.ViewModel.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
1010
<Authors>Vladimir Khil</Authors>
1111
<Company>Khil-soft</Company>
12-
<Version>7.6.0</Version>
12+
<Version>7.7.3</Version>
1313
<Description>SIGame app</Description>
1414
<Copyright>Copyright © Khil-soft 2005 - 2022</Copyright>
1515
</PropertyGroup>

src/SIGame/SIGame/SIGame.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
<Product>SIGame</Product>
88
<Description>Quizz game</Description>
99
<Copyright>Copyright © Khil-soft 2002-2022</Copyright>
10-
<Version>7.6.0</Version>
11-
<LangVersion>8</LangVersion>
10+
<Version>7.7.3</Version>
1211
<OutputPath>bin\$(Configuration)\</OutputPath>
1312
<UseWPF>true</UseWPF>
1413
<UseWindowsForms>true</UseWindowsForms>

0 commit comments

Comments
 (0)