Feature/rating pop up (#760)
* WIP * WIP * Add text * Cleanup * More Cleanup * Update Changelog * Fix layout --------- Co-authored-by: Florian Schulze <flori.schulze@yahoo.de> Co-authored-by: Florian Ostertag <flokuep@users.noreply.github.com>
This commit is contained in:
12 files changed
+828
-3
No files matched your search
@@ -31,7 +31,8 @@ namespace VocaluxeLib.Menu
|
||||
Equalizer,
|
||||
Playlist,
|
||||
ParticleEffect,
|
||||
ProgressBar
|
||||
ProgressBar,
|
||||
RatingPopup,
|
||||
}
|
||||
|
||||
public class CInteraction
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace VocaluxeLib.Menu
|
||||
[XmlArray("ParticleEffects")] public List<SThemeParticleEffect> ParticleEffects;
|
||||
[XmlArray("ScreenSettings")] public List<SThemeScreenSetting> ScreenSettings;
|
||||
[XmlArray("ProgressBars")] public List<SThemeProgressBar> ProgressBars;
|
||||
[XmlArray("RatingPopups")] public List<SThemeRatingPopup> RatingPopups;
|
||||
}
|
||||
|
||||
struct SZSort
|
||||
@@ -85,6 +86,7 @@ namespace VocaluxeLib.Menu
|
||||
protected string[] _ThemeParticleEffects;
|
||||
protected string[] _ThemeScreenSettings;
|
||||
protected string[] _ThemeProgressBars;
|
||||
protected string[] _ThemeRatingPopups;
|
||||
protected readonly Dictionary<string, CScreenSetting> _ScreenSettings = new Dictionary<string, CScreenSetting>();
|
||||
|
||||
// ReSharper restore MemberCanBePrivate.Global
|
||||
@@ -121,6 +123,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeParticleEffects = null;
|
||||
_ThemeScreenSettings = null;
|
||||
_ThemeProgressBars = null;
|
||||
_ThemeRatingPopups = null;
|
||||
}
|
||||
|
||||
protected virtual void _OnSongMenuChanged()
|
||||
@@ -148,7 +151,8 @@ namespace VocaluxeLib.Menu
|
||||
private static readonly string[] _AllowedMissing = new string[]
|
||||
{
|
||||
"Backgrounds", "Statics", "Texts", "Buttons", "SongMenus", "Lyrics", "SelectSlides", "SingNotes",
|
||||
"NameSelections", "Equalizers", "Playlists", "ParticleEffects", "ScreenSettings", "ProgressBars"
|
||||
"NameSelections", "Equalizers", "Playlists", "ParticleEffects", "ScreenSettings", "ProgressBars",
|
||||
"RatingPopups"
|
||||
};
|
||||
|
||||
public override void HandleError(CXmlException e)
|
||||
@@ -198,6 +202,9 @@ namespace VocaluxeLib.Menu
|
||||
foreach (SThemeProgressBar pb in Theme.ProgressBars)
|
||||
_AddProgressBar(new CProgressBar(pb, PartyModeID), pb.Name);
|
||||
|
||||
foreach (SThemeRatingPopup rp in Theme.RatingPopups)
|
||||
_AddRatingPopup(new CRatingPopup(rp, PartyModeID), rp.Name);
|
||||
|
||||
foreach (SThemeScreenSetting ss in Theme.ScreenSettings)
|
||||
_AddScreenSetting(new CScreenSetting(ss, PartyModeID), ss.Name);
|
||||
|
||||
@@ -276,6 +283,7 @@ namespace VocaluxeLib.Menu
|
||||
_AddThemeablesToList(Theme.ParticleEffects, _ParticleEffects);
|
||||
_AddThemeablesToList(Theme.Playlists, _Playlists);
|
||||
_AddThemeablesToList(Theme.ProgressBars, _ProgressBars);
|
||||
_AddThemeablesToList(Theme.RatingPopups, _RatingPopups);
|
||||
_AddThemeablesToList(Theme.ScreenSettings, _ScreenSettings.Values);
|
||||
_AddThemeablesToList(Theme.SelectSlides, _SelectSlides);
|
||||
_AddThemeablesToList(Theme.Statics, _Statics);
|
||||
@@ -406,6 +414,16 @@ namespace VocaluxeLib.Menu
|
||||
return new CProgressBar(pb);
|
||||
}
|
||||
|
||||
public CRatingPopup GetNewRatingPopup()
|
||||
{
|
||||
return new CRatingPopup(PartyModeID);
|
||||
}
|
||||
|
||||
public static CRatingPopup GetNewRatingPopup(CRatingPopup rp)
|
||||
{
|
||||
return new CRatingPopup(rp);
|
||||
}
|
||||
|
||||
// ReSharper restore MemberCanBeProtected.Global
|
||||
// ReSharper restore UnusedMember.Global
|
||||
#endregion Create Elements
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace VocaluxeLib.Menu
|
||||
protected readonly COrderedDictionaryLite<CPlaylist> _Playlists;
|
||||
protected readonly COrderedDictionaryLite<CParticleEffect> _ParticleEffects;
|
||||
protected readonly COrderedDictionaryLite<CProgressBar> _ProgressBars;
|
||||
protected readonly COrderedDictionaryLite<CRatingPopup> _RatingPopups;
|
||||
private readonly SColorF _HighlightColor = new SColorF(1, 0, 0, 0);
|
||||
|
||||
protected CObjectInteractions()
|
||||
@@ -64,6 +65,7 @@ namespace VocaluxeLib.Menu
|
||||
_Playlists = new COrderedDictionaryLite<CPlaylist>(this);
|
||||
_ParticleEffects = new COrderedDictionaryLite<CParticleEffect>(this);
|
||||
_ProgressBars = new COrderedDictionaryLite<CProgressBar>(this);
|
||||
_RatingPopups = new COrderedDictionaryLite<CRatingPopup>(this);
|
||||
}
|
||||
|
||||
public virtual void Init()
|
||||
@@ -89,6 +91,7 @@ namespace VocaluxeLib.Menu
|
||||
_Playlists.Clear();
|
||||
_ParticleEffects.Clear();
|
||||
_ProgressBars.Clear();
|
||||
_RatingPopups.Clear();
|
||||
}
|
||||
|
||||
private void _SetSelected(int newSelection)
|
||||
@@ -302,6 +305,8 @@ namespace VocaluxeLib.Menu
|
||||
return _ParticleEffects[element.Num];
|
||||
case EType.ProgressBar:
|
||||
return _ProgressBars[element.Num];
|
||||
case EType.RatingPopup:
|
||||
return _RatingPopups[element.Num];
|
||||
}
|
||||
throw new ArgumentException("Invalid element type: " + element.Type);
|
||||
}
|
||||
@@ -411,6 +416,11 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
_AddElement(_ProgressBars.Add(pb, key), EType.ProgressBar);
|
||||
}
|
||||
|
||||
protected void _AddRatingPopup(CRatingPopup rp, String key = null)
|
||||
{
|
||||
_AddElement(_RatingPopups.Add(rp, key), EType.RatingPopup);
|
||||
}
|
||||
#endregion Element-Adding
|
||||
|
||||
#region InteractionHandling
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Draw;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
[XmlType("RatingPopup")]
|
||||
public struct SThemeRatingPopup
|
||||
{
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
public string SkinRatingPopup;
|
||||
public SRectF Rect;
|
||||
public SThemeText Text;
|
||||
}
|
||||
|
||||
public sealed class CRatingPopup : CMenuElementBase, IMenuElement, IThemeable
|
||||
{
|
||||
private readonly int _PartyModeID;
|
||||
private SThemeRatingPopup _Theme;
|
||||
private CTextureRef _TextureRatingPopup;
|
||||
public CTextureRef TextureRatingPopup
|
||||
{
|
||||
get { return _TextureRatingPopup ?? CBase.Themes.GetSkinTexture(_Theme.SkinRatingPopup, _PartyModeID); }
|
||||
|
||||
set { _TextureRatingPopup = value; }
|
||||
}
|
||||
|
||||
public bool Selectable => false;
|
||||
public bool ThemeLoaded { get; private set; }
|
||||
public CText Text;
|
||||
public float Alpha = 1;
|
||||
public SColorF Color;
|
||||
|
||||
public CRatingPopup(int partyModeID)
|
||||
{
|
||||
_PartyModeID = partyModeID;
|
||||
Text = new CText(partyModeID);
|
||||
Text.AllMonitors = false;
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
public CRatingPopup(CRatingPopup rp)
|
||||
{
|
||||
_PartyModeID = rp._PartyModeID;
|
||||
_TextureRatingPopup = rp._TextureRatingPopup;
|
||||
Text = new CText(rp.Text);
|
||||
Text.AllMonitors = false;
|
||||
Visible = false;
|
||||
MaxRect = rp.MaxRect;
|
||||
}
|
||||
|
||||
public CRatingPopup(SThemeRatingPopup theme, int partyModeID)
|
||||
{
|
||||
_Theme = theme;
|
||||
_PartyModeID = partyModeID;
|
||||
Text = new CText(theme.Text, partyModeID);
|
||||
Text.AllMonitors = false;
|
||||
Visible = false;
|
||||
ThemeLoaded = true;
|
||||
}
|
||||
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
SColorF color = Color;
|
||||
color.A = Alpha;
|
||||
Text.Color.A = Alpha;
|
||||
|
||||
if (_TextureRatingPopup != null)
|
||||
{
|
||||
CBase.Drawing.DrawTexture(_TextureRatingPopup , Rect, color, false);
|
||||
}
|
||||
|
||||
Text.DrawRelative(Rect.X, Rect.Y);
|
||||
}
|
||||
|
||||
public object GetTheme()
|
||||
{
|
||||
_Theme.Text = (SThemeText)Text.GetTheme();
|
||||
return _Theme;
|
||||
}
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public void LoadSkin()
|
||||
{
|
||||
if (!ThemeLoaded)
|
||||
return;
|
||||
|
||||
TextureRatingPopup = CBase.Themes.GetSkinTexture(_Theme.SkinRatingPopup, _PartyModeID);
|
||||
Text = new CText(_Theme.Text, _PartyModeID);
|
||||
Text.LoadSkin();
|
||||
MaxRect = _Theme.Rect;
|
||||
}
|
||||
|
||||
public void UnloadSkin()
|
||||
{
|
||||
}
|
||||
|
||||
public void ReloadSkin()
|
||||
{
|
||||
UnloadSkin();
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
X += stepX;
|
||||
Y += stepY;
|
||||
|
||||
_Theme.Rect.X += stepX;
|
||||
_Theme.Rect.Y += stepY;
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
W += stepW;
|
||||
if (W <= 0)
|
||||
W = 1;
|
||||
|
||||
H += stepH;
|
||||
if (H <= 0)
|
||||
H = 1;
|
||||
|
||||
_Theme.Rect.W = Rect.W;
|
||||
_Theme.Rect.H = Rect.H;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,12 +346,15 @@ namespace VocaluxeLib
|
||||
public double PointsLineBonus;
|
||||
public double PointsGoldenNotes;
|
||||
public double Rating;
|
||||
public double RatingLastLine;
|
||||
public int NoteDiff;
|
||||
public int VoiceNr;
|
||||
public List<CSungLine> SungLines;
|
||||
public int CurrentLine;
|
||||
public int CurrentNote;
|
||||
|
||||
public float TimeLastLineChange;
|
||||
|
||||
public int SongID;
|
||||
public EGameMode GameMode;
|
||||
public long DateTicks;
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
<Compile Include="Menu\CParticleEffect.cs" />
|
||||
<Compile Include="Menu\CPlaylist.cs" />
|
||||
<Compile Include="Game\CPoints.cs" />
|
||||
<Compile Include="Menu\CRatingPopup.cs" />
|
||||
<Compile Include="Menu\CScreenSetting.cs" />
|
||||
<Compile Include="Menu\CSelectSlide.cs" />
|
||||
<Compile Include="Menu\CProgressBar.cs" />
|
||||
|
||||
Reference in new issue
Block a user