Code cleanup

Added license stuff
This commit is contained in:
Flamefire committed 2013-08-22 00:56:58 +02:00
1 parent cd826bdafd
commit 762d2c80d2
66 files changed
+553 -357

No files matched your search

+4 -4
View File
@@ -196,7 +196,7 @@ namespace VocaluxeLib.Menu
#region internal
private void _DrawColor()
{
SRectF bounds = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4);
var bounds = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4);
CBase.Drawing.DrawColor(Color, bounds);
}
@@ -206,7 +206,7 @@ namespace VocaluxeLib.Menu
CTexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
if (texture != null)
{
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect;
CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop);
@@ -221,7 +221,7 @@ namespace VocaluxeLib.Menu
CTexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
if (videoTexture != null)
{
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect;
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
@@ -236,7 +236,7 @@ namespace VocaluxeLib.Menu
CTexture videoTexture = CBase.BackgroundMusic.GetVideoTexture();
if (videoTexture != null)
{
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect;
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
+1 -1
View File
@@ -258,7 +258,7 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < _Bars.Length; i++)
{
SRectF bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z);
var bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z);
SColorF color = Color;
if (i == max)
color = MaxColor;
+1 -1
View File
@@ -208,7 +208,7 @@ namespace VocaluxeLib.Menu
_Width = 0f;
foreach (CSongNote note in line.Notes)
{
SNote n = new SNote {Text = note.Text, StartBeat = note.StartBeat, EndBeat = note.EndBeat, Duration = note.Duration, Type = note.NoteType};
var n = new SNote {Text = note.Text, StartBeat = note.StartBeat, EndBeat = note.EndBeat, Duration = note.Duration, Type = note.NoteType};
_Text.Text = note.Text;
_Text.Style = EStyle.Bold;
+21 -21
View File
@@ -151,7 +151,7 @@ namespace VocaluxeLib.Menu
{
foreach (string elName in elements)
{
T element = (T)Activator.CreateInstance(typeof(T), _PartyModeID);
var element = (T)Activator.CreateInstance(typeof(T), _PartyModeID);
if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader, skinIndex))
addElementHandler(element, elName);
else
@@ -198,7 +198,7 @@ namespace VocaluxeLib.Menu
if (_ThemePath == "")
return;
XmlWriterSettings settings = new XmlWriterSettings {Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document};
var settings = new XmlWriterSettings {Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document};
string file = Path.Combine(_ThemePath, ThemeName + ".xml");
using (XmlWriter writer = XmlWriter.Create(file, settings))
@@ -770,7 +770,7 @@ namespace VocaluxeLib.Menu
if (_Interactions.Count <= 0)
return;
List<SZSort> items = new List<SZSort>();
var items = new List<SZSort>();
for (int i = 0; i < _Interactions.Count; i++)
{
@@ -779,7 +779,7 @@ namespace VocaluxeLib.Menu
_Interactions[i].Type != EType.NameSelection && _Interactions[i].Type != EType.Text && _Interactions[i].Type != EType.SongMenu &&
_Interactions[i].Type != EType.Equalizer && _Interactions[i].Type != EType.Playlist && _Interactions[i].Type != EType.ParticleEffect))
continue;
SZSort zs = new SZSort {ID = i, Z = _GetZValue(i)};
var zs = new SZSort {ID = i, Z = _GetZValue(i)};
items.Add(zs);
}
@@ -1105,10 +1105,10 @@ namespace VocaluxeLib.Menu
/// <returns></returns>
private bool _NextInteraction(SKeyEvent key)
{
SKeyEvent[] directions = new SKeyEvent[4];
float[] distances = new float[4];
int[] stages = new int[4];
int[] elements = new int[4];
var directions = new SKeyEvent[4];
var distances = new float[4];
var stages = new int[4];
var elements = new int[4];
for (int i = 0; i < 4; i++)
directions[i] = new SKeyEvent();
@@ -1248,11 +1248,11 @@ namespace VocaluxeLib.Menu
private float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect)
{
PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f);
PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);
var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f);
var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);
PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y);
float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
var vector = new PointF(dest.X - source.X, dest.Y - source.Y);
var distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
bool inDirection = false;
switch (key.Key)
{
@@ -1281,11 +1281,11 @@ namespace VocaluxeLib.Menu
private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect)
{
PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f);
PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);
var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f);
var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);
PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y);
float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
var vector = new PointF(dest.X - source.X, dest.Y - source.Y);
var distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
bool inDirection = false;
switch (key.Key)
{
@@ -1584,7 +1584,7 @@ namespace VocaluxeLib.Menu
private SRectF _GetRect(CInteraction interaction)
{
SRectF result = new SRectF();
var result = new SRectF();
switch (interaction.Type)
{
case EType.Button:
@@ -1808,7 +1808,7 @@ namespace VocaluxeLib.Menu
private void _LoadThemeBasics(CXMLReader xmlReader, int skinIndex)
{
// Backgrounds
CBackground background = new CBackground(_PartyModeID);
var background = new CBackground(_PartyModeID);
int i = 1;
while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader, skinIndex))
{
@@ -1818,7 +1818,7 @@ namespace VocaluxeLib.Menu
}
// Statics
CStatic stat = new CStatic(_PartyModeID);
var stat = new CStatic(_PartyModeID);
i = 1;
while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader, skinIndex))
{
@@ -1828,7 +1828,7 @@ namespace VocaluxeLib.Menu
}
// Texts
CText text = new CText(_PartyModeID);
var text = new CText(_PartyModeID);
i = 1;
while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader, skinIndex))
{
@@ -1838,7 +1838,7 @@ namespace VocaluxeLib.Menu
}
// ParticleEffects
CParticleEffect partef = new CParticleEffect(_PartyModeID);
var partef = new CParticleEffect(_PartyModeID);
i = 1;
while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader, skinIndex))
{
+15 -15
View File
@@ -307,7 +307,7 @@ namespace VocaluxeLib.Menu
if (_Interactions.Count <= 0)
return;
List<SZSort> items = new List<SZSort>();
var items = new List<SZSort>();
for (int i = 0; i < _Interactions.Count; i++)
{
@@ -320,7 +320,7 @@ namespace VocaluxeLib.Menu
_Interactions[i].Type == EType.SongMenu ||
_Interactions[i].Type == EType.Equalizer))
{
SZSort zs = new SZSort {ID = i, Z = _GetZValue(i)};
var zs = new SZSort {ID = i, Z = _GetZValue(i)};
items.Add(zs);
}
}
@@ -613,10 +613,10 @@ namespace VocaluxeLib.Menu
/// <returns></returns>
private bool _NextInteraction(SKeyEvent key)
{
SKeyEvent[] directions = new SKeyEvent[4];
float[] distances = new float[4];
int[] stages = new int[4];
int[] elements = new int[4];
var directions = new SKeyEvent[4];
var distances = new float[4];
var stages = new int[4];
var elements = new int[4];
for (int i = 0; i < 4; i++)
directions[i] = new SKeyEvent();
@@ -756,11 +756,11 @@ namespace VocaluxeLib.Menu
private float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect)
{
PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f);
PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);
var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f);
var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);
PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y);
float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
var vector = new PointF(dest.X - source.X, dest.Y - source.Y);
var distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
bool inDirection = false;
switch (key.Key)
{
@@ -789,11 +789,11 @@ namespace VocaluxeLib.Menu
private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect)
{
PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f);
PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);
var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f);
var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);
PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y);
float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
var vector = new PointF(dest.X - source.X, dest.Y - source.Y);
var distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
bool inDirection = false;
switch (key.Key)
{
@@ -1002,7 +1002,7 @@ namespace VocaluxeLib.Menu
private SRectF _GetRect(int interaction)
{
SRectF result = new SRectF();
var result = new SRectF();
switch (_Interactions[interaction].Type)
{
case EType.Button:
+3 -3
View File
@@ -203,7 +203,7 @@ namespace VocaluxeLib.Menu
break;
case EParticleType.Snow:
int maxy = (int)Math.Round(CBase.Settings.GetRenderH() - _Size * 0.4f);
var maxy = (int)Math.Round(CBase.Settings.GetRenderH() - _Size * 0.4f);
if (Math.Round(Y) < maxy)
{
@@ -525,8 +525,8 @@ namespace VocaluxeLib.Menu
break;
}
int w = (int)(Rect.W - size / 4f);
int h = (int)(Rect.H - size / 4f);
var w = (int)(Rect.W - size / 4f);
var h = (int)(Rect.H - size / 4f);
if (w < 0)
w = 0;
+6 -6
View File
@@ -631,7 +631,7 @@ namespace VocaluxeLib.Menu
CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
UpdatePlaylist();
SKeyEvent key = new SKeyEvent {Key = Keys.Up};
var key = new SKeyEvent {Key = Keys.Up};
if (CurrentPlaylistElement > scrollLimit)
{
@@ -660,7 +660,7 @@ namespace VocaluxeLib.Menu
CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset);
UpdatePlaylist();
SKeyEvent key = new SKeyEvent {Key = Keys.Down};
var key = new SKeyEvent {Key = Keys.Down};
if (CurrentPlaylistElement >= scrollLimit)
{
@@ -973,7 +973,7 @@ namespace VocaluxeLib.Menu
if (!mouseEvent.LBH && DragAndDropSongID != -1)
{
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
var gm = EGameMode.TR_GAMEMODE_NORMAL;
CSong song = CBase.Songs.GetSongByID(DragAndDropSongID);
if (song != null)
@@ -1102,7 +1102,7 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < Math.Floor(Rect.H / _Theme.EntryHeight); i++)
{
CPlaylistElement en = new CPlaylistElement
var en = new CPlaylistElement
{
Background = new CStatic(_PartyModeID, _Theme.TextureBackgroundName, BackgroundColor,
new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z)),
@@ -1143,7 +1143,7 @@ namespace VocaluxeLib.Menu
_PlaylistElementContents.Clear();
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
{
CPlaylistElementContent pec = new CPlaylistElementContent
var pec = new CPlaylistElementContent
{
SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID,
Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes,
@@ -1162,7 +1162,7 @@ namespace VocaluxeLib.Menu
_PlaylistElementContents.Clear();
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
{
CPlaylistElementContent pec = new CPlaylistElementContent {SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID};
var pec = new CPlaylistElementContent {SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID};
pec.Modes = CBase.Songs.GetSongByID(pec.SongID).AvailableGameModes;
pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode;
_PlaylistElementContents.Add(pec);
+4 -4
View File
@@ -750,10 +750,10 @@ namespace VocaluxeLib.Menu
_ValueBounds.Clear();
for (int i = 0; i < numvis; i++)
{
CText text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset],
_ValuePartyModeIDs[i + offset]);
var text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset],
_ValuePartyModeIDs[i + offset]);
SColorF alpha = new SColorF(1f, 1f, 1f, 0.35f);
var alpha = new SColorF(1f, 1f, 1f, 0.35f);
if (i + offset == _Selection)
{
text.Color = SelTextColor;
@@ -774,7 +774,7 @@ namespace VocaluxeLib.Menu
if (WithTextures)
{
float dh = text.Y - Rect.Y - Rect.H * 0.1f;
SRectF rect = new SRectF(text.X - dh / 2, Rect.Y + Rect.H * 0.05f, dh, dh, Rect.Z);
var rect = new SRectF(text.X - dh / 2, Rect.Y + Rect.H * 0.05f, dh, dh, Rect.Z);
CBase.Drawing.DrawTexture(_Textures[i + offset], rect, alpha);
_ValueBounds.Add(rect);
}
+2 -2
View File
@@ -469,7 +469,7 @@ namespace VocaluxeLib.Menu
CBase.Fonts.SetStyle(Style);
SColorF currentColor = (Selected) ? SelColor : Color;
SColorF color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
var color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
CBase.Fonts.DrawText(_Text, Rect.H, Rect.X, Rect.Y, Z, color);
@@ -486,7 +486,7 @@ namespace VocaluxeLib.Menu
CBase.Fonts.SetStyle(Style);
SColorF currentColor = (Selected) ? SelColor : Color;
SColorF color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
var color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
CBase.Fonts.DrawText(Text, Rect.H, Rect.X, Rect.Y, Z, color, begin, end);
@@ -518,7 +518,10 @@ namespace VocaluxeLib.Menu.SongMenu
_Active = active;
}
public virtual bool IsMouseOverActualSelection(SMouseEvent mEvent) { return false; }
public virtual bool IsMouseOverActualSelection(SMouseEvent mEvent)
{
return false;
}
public virtual int GetSelectedSong()
{
+11 -11
View File
@@ -92,9 +92,9 @@ namespace VocaluxeLib.Menu.SongMenu
{
for (int j = 0; j < _NumW; j++)
{
SRectF rect = new SRectF(_Theme.SongMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
_Theme.SongMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
var rect = new SRectF(_Theme.SongMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
_Theme.SongMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
var tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
_Tiles.Add(tile);
}
}
@@ -423,8 +423,8 @@ namespace VocaluxeLib.Menu.SongMenu
time = song.Finish;
time -= song.Start;
int min = (int)Math.Floor(time / 60f);
int sec = (int)(time - min * 60f);
var min = (int)Math.Floor(time / 60f);
var sec = (int)(time - min * 60f);
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
}
}
@@ -458,11 +458,11 @@ namespace VocaluxeLib.Menu.SongMenu
{
if (_Vidtex.Color.A < 1)
_CoverBig.Draw(1f, EAspect.Crop);
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
var bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
RectangleF rect;
CHelper.SetRect(bounds, out rect, _Vidtex.OrigAspect, EAspect.Crop);
SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
var vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
var vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
CBase.Drawing.DrawTexture(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds);
CBase.Drawing.DrawTextureReflection(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
@@ -490,7 +490,7 @@ namespace VocaluxeLib.Menu.SongMenu
CStatic selCov = GetSelectedSongCover();
if (selCov.Texture == null)
return false;
SRectF rect = new SRectF(selCov.Rect.X - selCov.Rect.W*0.2f, selCov.Rect.Y - selCov.Rect.H*0.2f, selCov.Rect.W*1.2f, selCov.Rect.H*1.2f, selCov.Rect.Z);
var rect = new SRectF(selCov.Rect.X - selCov.Rect.W * 0.2f, selCov.Rect.Y - selCov.Rect.H * 0.2f, selCov.Rect.W * 1.2f, selCov.Rect.H * 1.2f, selCov.Rect.Z);
return CHelper.IsInBounds(rect, mEvent);
}
@@ -679,8 +679,8 @@ namespace VocaluxeLib.Menu.SongMenu
{
for (int j = 0; j < _NumW; j++)
{
SRectF rect = new SRectF(_Rect.X + j * (_TileW + _SpaceW), _Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
var rect = new SRectF(_Rect.X + j * (_TileW + _SpaceW), _Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
var tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
_Tiles.Add(tile);
}
}