removed namespace Base from CNotes, some simplifications

This commit is contained in:
Alexander Eckart committed 2012-12-13 23:00:52 +01:00
1 parent da7fb490a8
commit ded087967d
7 files changed
+40 -27

No files matched your search

+5 -5
View File
@@ -315,7 +315,7 @@ namespace Vocaluxe.Base
{ {
CNote nt = _Player[p].SingLine[Line].LastNote; CNote nt = _Player[p].SingLine[Line].LastNote;
if (notes[Note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != Tone) if (notes[Note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != Tone)
_Player[p].SingLine[Line].AddNote(new CNote(beat, 1, Tone, String.Empty, true, notes[Note].NoteType)); _Player[p].SingLine[Line].AddNote(new CNote(CMain.Base, beat, 1, Tone, String.Empty, true, notes[Note].NoteType));
else else
{ {
_Player[p].SingLine[Line].IncLastNoteLength(); _Player[p].SingLine[Line].IncLastNoteLength();
@@ -323,7 +323,7 @@ namespace Vocaluxe.Base
} }
else else
{ {
_Player[p].SingLine[Line].AddNote(new CNote(beat, 1, Tone, String.Empty, true, notes[Note].NoteType)); _Player[p].SingLine[Line].AddNote(new CNote(CMain.Base, beat, 1, Tone, String.Empty, true, notes[Note].NoteType));
} }
_Player[p].SingLine[Line].LastNote.IsPerfect(notes[Note]); _Player[p].SingLine[Line].LastNote.IsPerfect(notes[Note]);
@@ -335,7 +335,7 @@ namespace Vocaluxe.Base
{ {
CNote nt = _Player[p].SingLine[Line].LastNote; CNote nt = _Player[p].SingLine[Line].LastNote;
if (nt.EndBeat + 1 != beat || nt.Hit) if (nt.EndBeat + 1 != beat || nt.Hit)
_Player[p].SingLine[Line].AddNote(new CNote(beat, 1, TonePlayer, String.Empty, false, ENoteType.Freestyle)); _Player[p].SingLine[Line].AddNote(new CNote(CMain.Base, beat, 1, TonePlayer, String.Empty, false, ENoteType.Freestyle));
else else
{ {
if (nt.Tone == TonePlayer && nt.EndBeat + 1 == beat) if (nt.Tone == TonePlayer && nt.EndBeat + 1 == beat)
@@ -344,13 +344,13 @@ namespace Vocaluxe.Base
} }
else else
{ {
_Player[p].SingLine[Line].AddNote(new CNote(beat, 1, TonePlayer, String.Empty, false, ENoteType.Freestyle)); _Player[p].SingLine[Line].AddNote(new CNote(CMain.Base, beat, 1, TonePlayer, String.Empty, false, ENoteType.Freestyle));
} }
} }
} }
else else
{ {
_Player[p].SingLine[Line].AddNote(new CNote(beat, 1, TonePlayer, String.Empty, false, ENoteType.Freestyle)); _Player[p].SingLine[Line].AddNote(new CNote(CMain.Base, beat, 1, TonePlayer, String.Empty, false, ENoteType.Freestyle));
} }
} }
+2 -4
View File
@@ -280,16 +280,14 @@ namespace Vocaluxe.Menu
for (int i = 0; i < _Screens.Count; i++) for (int i = 0; i < _Screens.Count; i++)
{ {
CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]); CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
_Screens[i].Initialize(CMain.Config, CMain.Settings, CMain.Theme, CMain.Helper, CMain.Log, CMain.BackgroundMusic, CMain.Draw, _Screens[i].Initialize(CMain.Base);
CMain.Graphics, CMain.Fonts, CMain.Language, CMain.Game, CMain.Profiles);
_Screens[i].LoadTheme(); _Screens[i].LoadTheme();
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]); CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
} }
for (int i = 0; i < _PopupScreens.Count; i++) for (int i = 0; i < _PopupScreens.Count; i++)
{ {
_PopupScreens[i].Initialize(CMain.Config, CMain.Settings, CMain.Theme, CMain.Helper, CMain.Log, CMain.BackgroundMusic, CMain.Draw, _PopupScreens[i].Initialize(CMain.Base);
CMain.Graphics, CMain.Fonts, CMain.Language, CMain.Game, CMain.Profiles);
_PopupScreens[i].LoadTheme(); _PopupScreens[i].LoadTheme();
} }
} }
+12
View File
@@ -21,6 +21,8 @@ namespace Vocaluxe.Base
public static ILanguage Language = new BLanguage(); public static ILanguage Language = new BLanguage();
public static IGame Game = new BGame(); public static IGame Game = new BGame();
public static IProfiles Profiles = new BProfiles(); public static IProfiles Profiles = new BProfiles();
public static Menu.Base Base = new Menu.Base(Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, Game, Profiles);
} }
class BConfig : IConfig class BConfig : IConfig
@@ -89,6 +91,16 @@ namespace Vocaluxe.Base
{ {
return CSettings.GameState; return CSettings.GameState;
} }
public int GetToneMin()
{
return CSettings.ToneMin;
}
public int GetToneMax()
{
return CSettings.ToneMax;
}
} }
class BTheme : ITheme class BTheme : ITheme
+1 -1
View File
@@ -744,7 +744,7 @@ namespace Vocaluxe.Lib.Song
private void ParseNote(int Player, ENoteType NoteType, int Start, int Length, int Tone, string Text) private void ParseNote(int Player, ENoteType NoteType, int Start, int Length, int Tone, string Text)
{ {
CNote note = new CNote(Start, Length, Tone, Text, NoteType); CNote note = new CNote(CMain.Base, Start, Length, Tone, Text, NoteType);
CLines lines = this.Notes.GetLines(Player); CLines lines = this.Notes.GetLines(Player);
if (lines.LineCount == 0) if (lines.LineCount == 0)
+3 -4
View File
@@ -93,13 +93,12 @@ namespace Vocaluxe.Menu
} }
public CMenu() public CMenu()
{ {
} }
public void Initialize(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic, IDrawing Draw, public void Initialize(Base Base)
IGraphics Graphics, IFonts Fonts, ILanguage Language, IGame Game, IProfiles Profiles)
{ {
_Base = new Base(Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, Game, Profiles); _Base = Base;
Init(); Init();
} }
+4 -2
View File
@@ -10,8 +10,7 @@ namespace Vocaluxe.Menu
{ {
interface IMenu interface IMenu
{ {
void Initialize(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic, IDrawing Draw, void Initialize(Base Base);
IGraphics Graphics, IFonts Fonts, ILanguage Language, IGame Game, IProfiles Profiles);
void LoadTheme(); void LoadTheme();
void SaveTheme(); void SaveTheme();
@@ -64,6 +63,9 @@ namespace Vocaluxe.Menu
float GetZNear(); float GetZNear();
EGameState GetGameState(); EGameState GetGameState();
int GetToneMin();
int GetToneMax();
} }
public interface ITheme public interface ITheme
+13 -11
View File
@@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Vocaluxe.Base;
using Vocaluxe.Menu; using Vocaluxe.Menu;
namespace Vocaluxe.Menu.SingNotes namespace Vocaluxe.Menu.SingNotes
@@ -84,6 +83,7 @@ namespace Vocaluxe.Menu.SingNotes
public class CNote public class CNote
{ {
private Base _Base;
private int _StartBeat; private int _StartBeat;
private int _Duration; private int _Duration;
private int _Tone; private int _Tone;
@@ -93,8 +93,9 @@ namespace Vocaluxe.Menu.SingNotes
private bool _Perfect; // for drawing perfect note effect private bool _Perfect; // for drawing perfect note effect
#region Contructors #region Contructors
public CNote() public CNote(Base Base)
{ {
_Base = Base;
StartBeat = 0; StartBeat = 0;
Duration = 1; Duration = 1;
Tone = 0; Tone = 0;
@@ -106,6 +107,7 @@ namespace Vocaluxe.Menu.SingNotes
public CNote(CNote note) public CNote(CNote note)
{ {
_Base = note._Base;
_StartBeat = note._StartBeat; _StartBeat = note._StartBeat;
_Duration = note._Duration; _Duration = note._Duration;
_Tone = note._Tone; _Tone = note._Tone;
@@ -115,8 +117,8 @@ namespace Vocaluxe.Menu.SingNotes
_Perfect = note._Perfect; _Perfect = note._Perfect;
} }
public CNote(int StartBeat, int Duration, int Tone, string Text) public CNote(Base Base, int StartBeat, int Duration, int Tone, string Text)
: this() : this(Base)
{ {
this.StartBeat = StartBeat; this.StartBeat = StartBeat;
this.Duration = Duration; this.Duration = Duration;
@@ -125,8 +127,8 @@ namespace Vocaluxe.Menu.SingNotes
this.Text = Text; this.Text = Text;
} }
public CNote(int StartBeat, int Duration, int Tone, string Text, bool Hit) public CNote(Base Base, int StartBeat, int Duration, int Tone, string Text, bool Hit)
: this() : this(Base)
{ {
this.StartBeat = StartBeat; this.StartBeat = StartBeat;
this.Duration = Duration; this.Duration = Duration;
@@ -136,14 +138,14 @@ namespace Vocaluxe.Menu.SingNotes
this.Hit = Hit; this.Hit = Hit;
} }
public CNote(int StartBeat, int Duration, int Tone, string Text, ENoteType NoteType) public CNote(Base Base, int StartBeat, int Duration, int Tone, string Text, ENoteType NoteType)
: this(StartBeat, Duration, Tone, Text) : this(Base, StartBeat, Duration, Tone, Text)
{ {
this.NoteType = NoteType; this.NoteType = NoteType;
} }
public CNote(int StartBeat, int Duration, int Tone, string Text, bool Hit, ENoteType NoteType) public CNote(Base Base, int StartBeat, int Duration, int Tone, string Text, bool Hit, ENoteType NoteType)
: this(StartBeat, Duration, Tone, Text) : this(Base, StartBeat, Duration, Tone, Text)
{ {
this.NoteType = NoteType; this.NoteType = NoteType;
this.Hit = Hit; this.Hit = Hit;
@@ -192,7 +194,7 @@ namespace Vocaluxe.Menu.SingNotes
get { return _Tone; } get { return _Tone; }
set set
{ {
if ((value >= CSettings.ToneMin) && (value <= CSettings.ToneMax)) if ((value >= _Base.Settings.GetToneMin()) && (value <= _Base.Settings.GetToneMax()))
_Tone = value; _Tone = value;
} }
} }