Merge remote-tracking branch 'flokuep/release-0.1' into release-0.1

This commit is contained in:
Alexander Eckart committed 2012-03-08 16:58:07 +01:00
commit f5c7bcda03
10 files changed
+708 -31

No files matched your search

Binary file not shown.
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<ScreenOptionsSound>
<ScreenVersion>1</ScreenVersion>
<ScreenVersion>2</ScreenVersion>
<Background1>
<!--<Type>: Background type: None, Color, Texture, Video-->
<Type>Video</Type>
@@ -394,4 +394,4 @@
<NumVisible>1</NumVisible>
</SelectSlideBackgroundMusicSource>
</ScreenOptionsSound>
</root>
</root>
@@ -0,0 +1,18 @@
ScreenOptionsSound
++++++++++
Version 2:
Add:
<ButtonExit>
<SelectSlideBackgroundMusic>
<SelectSlideBackgroundMusicVolume>
<SelectSlideBackgroundMusicSource>
and some texts for description (Text2, Text3, Text4)
"TR_SCREENOSOUND_BACKGROUNDMUSIC"
"TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME"
"TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE"
++++++++++
+292 -22
View File
@@ -27,14 +27,17 @@ namespace Vocaluxe.Base
private static string _HighscoreFilePath;
private static string _CoverFilePath;
private static string _CreditsRessourcesFilePath;
public static void Init()
{
_HighscoreFilePath = Path.Combine(System.Environment.CurrentDirectory, CSettings.sFileHighscoreDB);
_CoverFilePath = Path.Combine(System.Environment.CurrentDirectory, CSettings.sFileCoverDB);
_CreditsRessourcesFilePath = Path.Combine(System.Environment.CurrentDirectory, CSettings.sFileCreditsRessourcesDB);
InitHighscoreDB();
InitCoverDB();
InitCreditsRessourcesDB();
}
#region Highscores
@@ -126,7 +129,7 @@ namespace Vocaluxe.Base
command.Parameters.Add("@Medley", System.Data.DbType.Int32, 0).Value = Medley;
command.Parameters.Add("@Duet", System.Data.DbType.Int32, 0).Value = Duet;
command.Parameters.Add("@Difficulty", System.Data.DbType.Int32, 0).Value = (int)player.Difficulty;
SQLiteDataReader reader = null;
try
{
@@ -194,7 +197,7 @@ namespace Vocaluxe.Base
SQLiteCommand command;
Score = new List<SScores>();
try
{
connection.Open();
@@ -223,7 +226,7 @@ namespace Vocaluxe.Base
command.Parameters.Add("@SongID", System.Data.DbType.Int32, 0).Value = DataBaseSongID;
command.Parameters.Add("@Medley", System.Data.DbType.Int32, 0).Value = Medley;
command.Parameters.Add("@Duet", System.Data.DbType.Int32, 0).Value = Duet;
SQLiteDataReader reader = null;
try
{
@@ -248,13 +251,13 @@ namespace Vocaluxe.Base
Score.Add(score);
}
reader.Close();
reader.Dispose();
reader.Dispose();
}
}
command.Dispose();
connection.Close();
@@ -360,7 +363,7 @@ namespace Vocaluxe.Base
reader.Close();
reader.Dispose();
}
return -1;
}
@@ -679,7 +682,7 @@ namespace Vocaluxe.Base
command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id;
command.ExecuteNonQuery();
}
//Delete old tables after conversion
command.CommandText = "DROP TABLE US_Scores;";
command.ExecuteNonQuery();
@@ -726,7 +729,7 @@ namespace Vocaluxe.Base
command.CommandText = "PRAGMA table_info(US_Scores);";
reader = command.ExecuteReader();
bool dateExists = false;
@@ -743,12 +746,12 @@ namespace Vocaluxe.Base
}
}
}
reader.Close();
//This is a USDX 1.01 DB
if(!dateExists)
if (!dateExists)
command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', '0', '0', '0', Difficulty from US_Scores";
else // This is a CMD 1.01 DB
command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores";
@@ -790,9 +793,9 @@ namespace Vocaluxe.Base
data.id = Sqlite3.sqlite3_column_int(Stmt, 0);
byte[] bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 1);
byte[] bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 1);
data.str1 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes));
bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 2);
data.str2 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes));
@@ -802,7 +805,7 @@ namespace Vocaluxe.Base
}
Stmt = new Sqlite3.Vdbe();
if (!dateExists)
res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT rowid, Player FROM US_Scores", -1, ref Stmt, 0);
else
@@ -830,7 +833,7 @@ namespace Vocaluxe.Base
if (dateExists)
data.ticks = UnixTimeToTicks(Sqlite3.sqlite3_column_int(Stmt, 2));
scores.Add(data);
}
Sqlite3.sqlite3_finalize(Stmt);
@@ -863,14 +866,14 @@ namespace Vocaluxe.Base
command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id;
command.ExecuteNonQuery();
}
//Delete old tables after conversion
command.CommandText = "DROP TABLE US_Scores;";
command.ExecuteNonQuery();
command.CommandText = "DROP TABLE US_Songs;";
command.ExecuteNonQuery();
reader.Dispose();
command.Dispose();
connection.Close();
@@ -884,7 +887,7 @@ namespace Vocaluxe.Base
#region open db
SQLiteConnection connSource = new SQLiteConnection();
connSource.ConnectionString = "Data Source=" + SourceDBPath;
try
{
connSource.Open();
@@ -1034,7 +1037,7 @@ namespace Vocaluxe.Base
return false;
}
int w = MaxSize;
int h = MaxSize;
@@ -1051,7 +1054,7 @@ namespace Vocaluxe.Base
byte[] data = new byte[w * h * 4];
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Marshal.Copy(bmp_data.Scan0, data, 0, w*h*4);
Marshal.Copy(bmp_data.Scan0, data, 0, w * h * 4);
bmp.UnlockBits(bmp_data);
bmp.Dispose();
@@ -1197,6 +1200,273 @@ namespace Vocaluxe.Base
}
#endregion Cover
#region CreditsRessources
public static bool GetCreditsRessource(string FileName, ref STexture tex)
{
bool result = false;
SQLiteConnection connection = new SQLiteConnection();
connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath;
SQLiteCommand command;
try
{
connection.Open();
}
catch (Exception)
{
return false;
}
command = new SQLiteCommand(connection);
command.CommandText = "SELECT id, width, height FROM Images WHERE [Path] = @path";
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = FileName;
SQLiteDataReader reader = null;
try
{
reader = command.ExecuteReader();
}
catch (Exception)
{
throw;
}
if (reader != null && reader.HasRows)
{
reader.Read();
int id = reader.GetInt32(0);
int w = reader.GetInt32(1);
int h = reader.GetInt32(2);
reader.Close();
command.CommandText = "SELECT Data FROM ImageData WHERE ImageID = " + id.ToString();
try
{
reader = command.ExecuteReader();
}
catch (Exception)
{
throw;
}
if (reader.HasRows)
{
result = true;
reader.Read();
byte[] data = GetBytes(reader);
tex = CDraw.AddTexture(w, h, ref data);
}
}
if (reader != null)
{
reader.Close();
reader.Dispose();
}
command.Dispose();
connection.Close();
connection.Dispose();
return result;
}
//If you want to add an image to db, call this method!
private static bool AddImageToCreditsDB(String ImagePath)
{
bool result = false;
STexture tex;
if (File.Exists(ImagePath))
{
SQLiteConnection connection = new SQLiteConnection();
connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath;
SQLiteCommand command;
try
{
connection.Open();
}
catch (Exception)
{
return false;
}
command = new SQLiteCommand(connection);
SQLiteDataReader reader = null;
if (reader != null)
reader.Close();
Bitmap origin;
try
{
origin = new Bitmap(ImagePath);
}
catch (Exception)
{
CLog.LogError("Error loading Texture: " + ImagePath);
tex = new STexture(-1);
if (reader != null)
{
reader.Close();
reader.Dispose();
}
command.Dispose();
connection.Close();
connection.Dispose();
return false;
}
int w = origin.Width;
int h = origin.Height;
Bitmap bmp = new Bitmap(w, h);
Graphics g = Graphics.FromImage(bmp);
g.DrawImage(origin, new Rectangle(0, 0, w, h));
g.Dispose();
tex = CDraw.AddTexture(bmp);
byte[] data = new byte[w * h * 4];
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Marshal.Copy(bmp_data.Scan0, data, 0, w * h * 4);
bmp.UnlockBits(bmp_data);
bmp.Dispose();
command.CommandText = "INSERT INTO Images (Path, width, height) " +
"VALUES (@path, " + w.ToString() + ", " + h.ToString() + ")";
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = Path.GetFileName(ImagePath);
command.ExecuteNonQuery();
command.CommandText = "SELECT id FROM Images WHERE [Path] = @path";
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = Path.GetFileName(ImagePath);
reader = null;
try
{
reader = command.ExecuteReader();
}
catch (Exception)
{
throw;
}
if (reader != null)
{
reader.Read();
int id = reader.GetInt32(0);
reader.Close();
command.CommandText = "INSERT INTO ImageData (ImageID, Data) " +
"VALUES ('" + id.ToString() + "', @data)";
command.Parameters.Add("@data", System.Data.DbType.Binary, 20).Value = data;
command.ExecuteReader();
result = true;
}
}
return result;
}
private static bool InitCreditsRessourcesDB()
{
SQLiteConnection connection = new SQLiteConnection();
connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath;
SQLiteCommand command;
try
{
connection.Open();
}
catch (Exception)
{
return false;
}
command = new SQLiteCommand(connection);
command.CommandText = "SELECT Value FROM Version";
SQLiteDataReader reader = null;
try
{
reader = command.ExecuteReader();
}
catch (Exception)
{
;
}
if (reader == null)
{
// Log error
CLog.LogError("Can't find Credits-DB!");
}
else if (reader.FieldCount == 0)
{
// Log error
CLog.LogError("Can't find Credits-DB! Field-Count = 0");
}
else
{
reader.Read();
if (reader.GetInt32(0) < CSettings.iDatabaseHighscoreVersion)
{
// update database
}
}
if (reader != null)
{
reader.Close();
reader.Dispose();
}
command.Dispose();
connection.Close();
connection.Dispose();
return true;
}
private static void CreateCreditsRessourcesDB()
{
SQLiteConnection connection = new SQLiteConnection();
connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath;
SQLiteCommand command;
try
{
connection.Open();
}
catch (Exception)
{
return;
}
command = new SQLiteCommand(connection);
command.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);";
command.ExecuteNonQuery();
command.CommandText = "INSERT INTO Version (id, Value) VALUES(NULL, " + CSettings.iDatabaseCreditsRessourcesVersion.ToString() + ")";
command.ExecuteNonQuery();
command.CommandText = "CREATE TABLE IF NOT EXISTS Images ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
"Path TEXT NOT NULL, width INTEGER NOT NULL, height INTEGER NOT NULL);";
command.ExecuteNonQuery();
command.CommandText = "CREATE TABLE IF NOT EXISTS ImageData ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
"ImageID INTEGER NOT NULL, Data BLOB NOT NULL);";
command.ExecuteNonQuery();
command.Dispose();
connection.Close();
connection.Dispose();
}
#endregion CreditsRessources
private static byte[] GetBytes(SQLiteDataReader reader)
{
const int CHUNK_SIZE = 2 * 1024;
@@ -1223,4 +1493,4 @@ namespace Vocaluxe.Base
return t70.Ticks;
}
}
}
}
+2
View File
@@ -51,6 +51,7 @@ namespace Vocaluxe.Base
public const int iDatabaseHighscoreVersion = 1;
public const int iDatabaseCoverVersion = 1;
public const int iDatabaseCreditsRessourcesVersion = 1;
public static int iRenderW = 1280;
@@ -72,6 +73,7 @@ namespace Vocaluxe.Base
public const string sFileOldHighscoreDB = "Ultrastar.db";
public static string sFileHighscoreDB = "HighscoreDB.sqlite";
public const string sFileCoverDB = "CoverDB.sqlite";
public const string sFileCreditsRessourcesDB = "CreditsRessourcesDB.sqlite";
public const string sFilePerformanceLog = "Performance.log";
public const string sFileErrorLog = "Error.log";
public const string sFileBenchmarkLog = "Benchmark.log";
+21 -6
View File
@@ -31,6 +31,8 @@ namespace Vocaluxe.Menu
ScreenNames = 14,
ScreenCredits = 15,
ScreenNull = -1
}
@@ -219,6 +221,7 @@ namespace Vocaluxe.Menu
ScreenList.Add(new CScreenOptionsVideo());
ScreenList.Add(new CScreenOptionsTheme());
ScreenList.Add(new CScreenNames());
ScreenList.Add(new CScreenCredits());
CLog.StopBenchmark(1, "Build Screen List");
Screens = ScreenList.ToArray();
@@ -246,9 +249,12 @@ namespace Vocaluxe.Menu
for (int i = 0; i < Screens.Length; i++)
{
CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
Screens[i].LoadTheme();
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
if (Enum.GetNames(typeof(EScreens))[i] != Enum.GetName(typeof(EScreens), (int)EScreens.ScreenCredits))
{
CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
Screens[i].LoadTheme();
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
}
}
}
@@ -257,7 +263,10 @@ namespace Vocaluxe.Menu
ReloadCursor();
for (int i = 0; i < Screens.Length; i++)
{
Screens[i].ReloadTheme();
if (Enum.GetNames(typeof(EScreens))[i] != Enum.GetName(typeof(EScreens), (int)EScreens.ScreenCredits))
{
Screens[i].ReloadTheme();
}
}
}
@@ -266,7 +275,10 @@ namespace Vocaluxe.Menu
ReloadCursor();
for (int i = 0; i < Screens.Length; i++)
{
Screens[i].ReloadTextures();
if (Enum.GetNames(typeof(EScreens))[i] != Enum.GetName(typeof(EScreens), (int)EScreens.ScreenCredits))
{
Screens[i].ReloadTextures();
}
}
}
@@ -275,7 +287,10 @@ namespace Vocaluxe.Menu
CTheme.SaveTheme();
for (int i = 0; i < Screens.Length; i++)
{
Screens[i].SaveTheme();
if (Enum.GetNames(typeof(EScreens))[i] != Enum.GetName(typeof(EScreens), (int)EScreens.ScreenCredits))
{
Screens[i].SaveTheme();
}
}
}
+367
View File
@@ -0,0 +1,367 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
enum EDirection
{
Left,
Right,
Up
}
class CCreditName
{
public CStatic image;
public CParticleEffect particle;
public SRectF particleRect;
public EDirection direction;
public float StartTimeUp;
public bool active;
}
namespace Vocaluxe.Screens
{
class CScreenCredits :CMenu
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
private CStatic logo;
private CParticleEffect starsRed;
private CParticleEffect starsBlue;
private List<CCreditName> _CreditNames;
private Stopwatch LogoTimer;
private Stopwatch CreditsTimer;
public CScreenCredits()
{
Init();
}
protected override void Init()
{
base.Init();
_ThemeName = "ScreenCredits";
_ScreenVersion = ScreenVersion;
LogoTimer = new Stopwatch();
CreditsTimer = new Stopwatch();
}
public override bool HandleInput(KeyEvent KeyEvent)
{
if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
{
}
else
{
switch (KeyEvent.Key)
{
case Keys.Escape:
case Keys.Back:
CGraphics.FadeTo(EScreens.ScreenMain);
break;
case Keys.Enter:
CGraphics.FadeTo(EScreens.ScreenMain);
break;
}
}
return true;
}
public override bool HandleMouse(MouseEvent MouseEvent)
{
if (MouseEvent.LB && IsMouseOver(MouseEvent))
{
}
if (MouseEvent.LB)
{
CGraphics.FadeTo(EScreens.ScreenMain);
}
if (MouseEvent.RB)
{
CGraphics.FadeTo(EScreens.ScreenMain);
}
return true;
}
public override bool UpdateGame()
{
if (!animation())
{
CGraphics.FadeTo(EScreens.ScreenMain);
}
return true;
}
public override void OnShow()
{
STexture tex = new STexture();
STexture particleTex = new STexture();
//Vocaluxe-Logo
CDataBase.GetCreditsRessource("Logo_voc.png", ref tex);
logo = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF((CSettings.iRenderW - tex.width)/2, -270 , tex.width, tex.height, -2));
//Little stars for logo
CDataBase.GetCreditsRessource("PerfectNoteStar.png", ref particleTex);
int numstars = (int)(logo.Rect.W * 0.25f /2f);
starsRed = new CParticleEffect(numstars, new SColorF(1, 0, 0, 1), new SRectF(logo.Rect.X, logo.Rect.Y, logo.Rect.W, logo.Rect.H, -1), particleTex, 35, EParticeType.Star);
starsBlue = new CParticleEffect(numstars, new SColorF(0.149f, 0.415f, 0.819f, 1), new SRectF(logo.Rect.X, logo.Rect.Y, logo.Rect.W, logo.Rect.H, -1), particleTex, 35, EParticeType.Star);
//Credit names
_CreditNames = new List<CCreditName>();
CCreditName CreditEntry = new CCreditName();
//brunzel
CDataBase.GetCreditsRessource("brunzel.png", ref tex);
CCreditName CreditEntryBrunzel = new CCreditName();
CreditEntryBrunzel.image = new CStatic(tex, new SColorF(1,1,1,1), new SRectF(-450, 580, 400, 120, -4));
CreditEntryBrunzel.particleRect = new SRectF(CreditEntryBrunzel.image.Rect.X + 342, CreditEntryBrunzel.image.Rect.Y + 4, 30, 30, -5);
CreditEntryBrunzel.particle = new CParticleEffect(8, new SColorF(1, 0, 0, 1), CreditEntryBrunzel.particleRect, particleTex, 35, EParticeType.Star);
CreditEntryBrunzel.active = true;
CreditEntryBrunzel.direction = EDirection.Left;
_CreditNames.Add(CreditEntryBrunzel);
//Darkice
CDataBase.GetCreditsRessource("Darkice.png", ref tex);
CCreditName CreditEntryDarkice = new CCreditName();
CreditEntryDarkice.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(CSettings.iRenderW, 580, 400, 120, -4));
CreditEntryDarkice.particleRect = new SRectF(CreditEntryDarkice.image.Rect.X + 242, CreditEntryDarkice.image.Rect.Y + 23, 30, 30, -5);
CreditEntryDarkice.particle = new CParticleEffect(8, new SColorF(0.149f, 0.415f ,0.819f, 1), CreditEntryDarkice.particleRect, particleTex, 35, EParticeType.Star);
CreditEntryDarkice.active = true;
CreditEntryDarkice.direction = EDirection.Right;
_CreditNames.Add(CreditEntryDarkice);
//flokuep
CDataBase.GetCreditsRessource("flokuep.png", ref tex);
CCreditName CreditEntryFlokuep = new CCreditName();
CreditEntryFlokuep.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(-450, 580, 400, 120, -4));
CreditEntryFlokuep.particleRect = new SRectF(CreditEntryFlokuep.image.Rect.X + 141, CreditEntryFlokuep.image.Rect.Y-2, 30, 30, -5);
CreditEntryFlokuep.particle = new CParticleEffect(8, new SColorF(1, 0, 0, 1), CreditEntryFlokuep.particleRect, particleTex, 35, EParticeType.Star);
CreditEntryFlokuep.active = true;
CreditEntryFlokuep.direction = EDirection.Left;
_CreditNames.Add(CreditEntryFlokuep);
//bohning
CDataBase.GetCreditsRessource("bohning.png", ref tex);
CCreditName CreditEntryBohning = new CCreditName();
CreditEntryBohning.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(CSettings.iRenderW, 580, 350, 110, -4));
CreditEntryBohning.particleRect = new SRectF(CreditEntryBohning.image.Rect.X + 172, CreditEntryBohning.image.Rect.Y + 16, 10, 10, -5);
CreditEntryBohning.particle = new CParticleEffect(4, new SColorF(0.149f, 0.415f ,0.819f, 1), CreditEntryBohning.particleRect, particleTex, 25, EParticeType.Star);
CreditEntryBohning.active = true;
CreditEntryBohning.direction = EDirection.Right;
_CreditNames.Add(CreditEntryBohning);
//mesand
CDataBase.GetCreditsRessource("mesand.png", ref tex);
CCreditName CreditEntryMesand = new CCreditName();
CreditEntryMesand.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(-450, 580, 350, 110, -4));
CreditEntryMesand.particleRect = new SRectF(CreditEntryMesand.image.Rect.X + 240, CreditEntryMesand.image.Rect.Y - 2, 10, 10, -5);
CreditEntryMesand.particle = new CParticleEffect(4, new SColorF(1, 0, 0, 1), CreditEntryMesand.particleRect, particleTex, 25, EParticeType.Star);
CreditEntryMesand.active = true;
CreditEntryMesand.direction = EDirection.Left;
_CreditNames.Add(CreditEntryMesand);
//babene03
CDataBase.GetCreditsRessource("babene03.png", ref tex);
CCreditName CreditEntryBabene03 = new CCreditName();
CreditEntryBabene03.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(CSettings.iRenderW, 580, 350, 110, -4));
CreditEntryBabene03.particleRect = new SRectF(CreditEntryBabene03.image.Rect.X + 7, CreditEntryBabene03.image.Rect.Y + 4, 10, 10, -5);
CreditEntryBabene03.particle = new CParticleEffect(4, new SColorF(0.149f, 0.415f ,0.819f, 1), CreditEntryBabene03.particleRect, particleTex, 25, EParticeType.Star);
CreditEntryBabene03.active = true;
CreditEntryBabene03.direction = EDirection.Right;
_CreditNames.Add(CreditEntryBabene03);
//pantero
CDataBase.GetCreditsRessource("pantero.png", ref tex);
CCreditName CreditEntrypantero = new CCreditName();
CreditEntrypantero.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(-450, 580, 350, 110, -4));
CreditEntrypantero.particleRect = new SRectF(CreditEntrypantero.image.Rect.X + 140, CreditEntrypantero.image.Rect.Y + 15, 10, 10, -5);
CreditEntrypantero.particle = new CParticleEffect(4, new SColorF(1, 0, 0, 1), CreditEntrypantero.particleRect, particleTex, 25, EParticeType.Star);
CreditEntrypantero.active = true;
CreditEntrypantero.direction = EDirection.Left;
_CreditNames.Add(CreditEntrypantero);
//Pinky007
CDataBase.GetCreditsRessource("Pinky007.png", ref tex);
CCreditName CreditEntryPinky007 = new CCreditName();
CreditEntryPinky007.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(CSettings.iRenderW, 580, 350, 110, -4));
CreditEntryPinky007.particleRect = new SRectF(CreditEntryPinky007.image.Rect.X + 42, CreditEntryPinky007.image.Rect.Y + 15, 10, 10, -5);
CreditEntryPinky007.particle = new CParticleEffect(4, new SColorF(0.149f, 0.415f ,0.819f, 1), CreditEntryPinky007.particleRect, particleTex, 25, EParticeType.Star);
CreditEntryPinky007.active = true;
CreditEntryPinky007.direction = EDirection.Right;
_CreditNames.Add(CreditEntryPinky007);
//CreditEntry.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(0, 0, 350, 110, -4));
}
public override void OnShowFinish()
{
base.OnShowFinish();
LogoTimer.Start();
}
public override bool Draw()
{
base.Draw();
//Draw background
CDraw.DrawColor(new SColorF(0, 0.18f, 0.474f, 1), new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, 0));
//Draw stars
starsBlue.Update();
starsBlue.Draw();
starsRed.Update();
starsRed.Draw();
logo.Draw();
//Draw credit-entries
for (int i = 0; i < _CreditNames.Count; i++)
{
if (_CreditNames[i].active)
{
_CreditNames[i].image.Draw();
_CreditNames[i].particle.Update();
_CreditNames[i].particle.Draw();
}
}
return true;
}
private bool animation()
{
bool active = false;
if (LogoTimer.IsRunning)
{
active = true;
logo.Rect.Y = -270 + (270f / 3000f) * LogoTimer.ElapsedMilliseconds;
SRectF rect = new SRectF(logo.Rect.X, logo.Rect.Y, logo.Rect.W, logo.Rect.H, -1);
starsRed.Area = rect;
starsBlue.Area = rect;
if (LogoTimer.ElapsedMilliseconds >= 2000 && !CreditsTimer.IsRunning)
{
CreditsTimer.Start();
}
if (LogoTimer.ElapsedMilliseconds >= 3000)
{
LogoTimer.Stop();
LogoTimer.Reset();
}
}
if (CreditsTimer.IsRunning)
{
active = true;
for (int i = 0; i < _CreditNames.Count; i++)
{
if (_CreditNames[i].active)
{
switch (_CreditNames[i].direction)
{
case EDirection.Left:
if (i * 4000f <= CreditsTimer.ElapsedMilliseconds)
{
float xOld = _CreditNames[i].image.Rect.X;
_CreditNames[i].image.Rect.X = -450 + (((CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2)/3000f) * (CreditsTimer.ElapsedMilliseconds-(i*4000f));
_CreditNames[i].particleRect.X += (_CreditNames[i].image.Rect.X - xOld);
_CreditNames[i].particle.Area = _CreditNames[i].particleRect;
//Check if name is in middle of screen and should go up
if (_CreditNames[i].image.Rect.X >= (CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2)
{
_CreditNames[i].direction = EDirection.Up;
_CreditNames[i].StartTimeUp = CreditsTimer.ElapsedMilliseconds;
}
}
break;
case EDirection.Right:
if (i * 4000f <= CreditsTimer.ElapsedMilliseconds)
{
float xOld = _CreditNames[i].image.Rect.X;
_CreditNames[i].image.Rect.X = CSettings.iRenderW - (((CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2) / 3000f) * (CreditsTimer.ElapsedMilliseconds - (i * 4000f));
_CreditNames[i].particleRect.X -= (xOld - _CreditNames[i].image.Rect.X);
_CreditNames[i].particle.Area = _CreditNames[i].particleRect;
//Check if name is in middle of screen and should go up
if (_CreditNames[i].image.Rect.X <= (CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2 )
{
_CreditNames[i].direction = EDirection.Up;
_CreditNames[i].StartTimeUp = CreditsTimer.ElapsedMilliseconds;
}
}
break;
case EDirection.Up:
float yOld = _CreditNames[i].image.Rect.Y;
_CreditNames[i].image.Rect.Y = 580 - (430f / 3000f) * (CreditsTimer.ElapsedMilliseconds - _CreditNames[i].StartTimeUp);
_CreditNames[i].particleRect.Y -= (yOld - _CreditNames[i].image.Rect.Y);
_CreditNames[i].particle.Area = _CreditNames[i].particleRect;
//Fade names out
if (_CreditNames[i].image.Rect.Y <= 350f)
{
//Catch some bad alpha-values
float alpha = ((250 - _CreditNames[i].image.Rect.Y) / 20);
if(alpha > 1)
{
alpha = 1;
}
else if(alpha < 0)
{
alpha = 0;
}
_CreditNames[i].image.Alpha = 1 - alpha;
}
//Set name inactive
if (_CreditNames[i].image.Rect.Y <= 150f)
{
_CreditNames[i].active = false;
//Check, if last name is set to false
if (i == _CreditNames.Count - 1)
{
//Will later fade to Main-Screen
active = false;
//Stop and reset timer for next time
CreditsTimer.Stop();
CreditsTimer.Reset();
}
}
break;
}
}
}
}
return active;
}
}
}
+4
View File
@@ -69,6 +69,10 @@ namespace Vocaluxe.Screens
CGraphics.FadeTo(EScreens.ScreenTest);
break;
case Keys.C:
CGraphics.FadeTo(EScreens.ScreenCredits);
break;
case Keys.Enter:
if (Buttons[htButtons(ButtonSing)].Selected)
CGraphics.FadeTo(EScreens.ScreenSong);
+1 -1
View File
@@ -12,7 +12,7 @@ namespace Vocaluxe.Screens
class CScreenOptionsSound : CMenu
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
const int ScreenVersion = 2;
private const string SelectSlideBackgroundMusic = "SelectSlideBackgroundMusic";
private const string SelectSlideBackgroundMusicVolume = "SelectSlideBackgroundMusicVolume";
+1
View File
@@ -187,6 +187,7 @@
<Compile Include="Program.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Screens\CScreenCredits.cs" />
<Compile Include="Screens\CScreenHighscore.cs" />
<Compile Include="Screens\CScreenLoad.cs" />
<Compile Include="Screens\CScreenMain.cs" />