Merge remote-tracking branch 'remotes/origin/release-0.3' into develop
This commit is contained in:
commit
84fc0fcb91
51 files changed
+903
-883
No files matched your search
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AndroidRemote", "AndroidRemote\AndroidRemote.csproj", "{D97EF6F3-7C3F-439F-B022-647948E206D2}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vocaluxe App", "AndroidRemote\Vocaluxe App.csproj", "{D97EF6F3-7C3F-439F-B022-647948E206D2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -15,6 +15,10 @@ Global
|
||||
{D97EF6F3-7C3F-439F-B022-647948E206D2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = AndroidRemote.csproj
|
||||
StartupItem = AndroidRemote\Vocaluxe App.csproj
|
||||
Policies = $0
|
||||
$0.DotNetNamingPolicy = $1
|
||||
$1.DirectoryNamespaceAssociation = None
|
||||
$1.ResourceNamePolicy = FileFormatDefault
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,99 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D97EF6F3-7C3F-439F-B022-647948E206D2}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>AndroidRemote</RootNamespace>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AssemblyName>AndroidRemote</AssemblyName>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;MONO</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
|
||||
<DefineConstants>MONO</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="Newtonsoft.Json.MonoDroid">
|
||||
<HintPath>Newtonsoft.Json.MonoDroid.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="..\ClientServerLib\CClient.cs">
|
||||
<Link>ClientServerLib\CClient.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\CConnection.cs">
|
||||
<Link>ClientServerLib\CConnection.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\Structs.cs">
|
||||
<Link>ClientServerLib\Structs.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\DeffieHellman\BigInt.cs">
|
||||
<Link>ClientServerLib\DeffieHellman\BigInt.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\DeffieHellman\DeffieHellman.cs">
|
||||
<Link>ClientServerLib\DeffieHellman\DeffieHellman.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\DeffieHellman\StrongNumberProvider.cs">
|
||||
<Link>ClientServerLib\DeffieHellman\StrongNumberProvider.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\CDiscover.cs">
|
||||
<Link>ClientServerLib\CDiscover.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Vocaluxe\Base\Server\CCommands.cs">
|
||||
<Link>ClientServerLib\Server\CCommands.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Vocaluxe\Base\Server\VocaluxeStructs.cs">
|
||||
<Link>ClientServerLib\Server\VocaluxeStructs.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Main.axml" />
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
<AndroidResource Include="Resources\drawable\Icon.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="ClientServerLib\" />
|
||||
<Folder Include="Assets\" />
|
||||
<Folder Include="ClientServerLib\Vocaluxe\" />
|
||||
<Folder Include="ClientServerLib\Server\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -14,43 +14,47 @@ using Android.Provider;
|
||||
using ClientServerLib;
|
||||
using Vocaluxe.Base.Server;
|
||||
|
||||
namespace AndroidRemote
|
||||
namespace org.vocaluxe.app
|
||||
{
|
||||
[Activity (Label = "Vocaluxe Remote", MainLauncher = true, ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation)]
|
||||
[Activity (Label = "Vocaluxe App", MainLauncher = true, ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation)]
|
||||
public class Activity1 : Activity
|
||||
{
|
||||
private readonly int REQUEST_TAKE_PICTURE = 1;
|
||||
private readonly int REQUEST_PICK_PICTURE = 2;
|
||||
|
||||
CClient client = new CClient();
|
||||
CDiscover discover;
|
||||
Button bConnect;
|
||||
Button bLogin;
|
||||
Button bSendAvatar;
|
||||
Button bSendProfile;
|
||||
|
||||
TextView tIP;
|
||||
TextView tPassword;
|
||||
|
||||
bool loggedIn;
|
||||
ProgressDialog pDialog;
|
||||
|
||||
byte[] fileBytes;
|
||||
|
||||
Java.IO.File file;
|
||||
Java.IO.File file2;
|
||||
Java.IO.File dir;
|
||||
System.IO.FileStream fs;
|
||||
|
||||
bool sendProfile;
|
||||
|
||||
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
loggedIn = false;
|
||||
|
||||
// Set our view from the "main" layout resource
|
||||
|
||||
SetContentView (Resource.Layout.Main);
|
||||
pDialog = new ProgressDialog (this);
|
||||
pDialog.SetCancelable (false);
|
||||
|
||||
bConnect = FindViewById<Button> (Resource.Id.btConnect);
|
||||
bConnect.Click += delegate { Connect(); };
|
||||
|
||||
bLogin = FindViewById<Button> (Resource.Id.btLogin);
|
||||
bLogin.Click += delegate { Login(); };
|
||||
|
||||
Button bDiscover = FindViewById<Button> (Resource.Id.btDiscover);
|
||||
bDiscover.Click += delegate { Discover(); };
|
||||
|
||||
bSendAvatar = FindViewById<Button> (Resource.Id.btSendAvatar);
|
||||
bSendAvatar.Click += SendAvatar;
|
||||
@@ -62,6 +66,9 @@ namespace AndroidRemote
|
||||
tPassword = FindViewById<TextView> (Resource.Id.tbPassword);
|
||||
|
||||
sendProfile = false;
|
||||
|
||||
discover = new CDiscover(3000, CCommands.BroadcastKeyword);
|
||||
Discover ();
|
||||
}
|
||||
|
||||
protected override void OnStop ()
|
||||
@@ -72,19 +79,55 @@ namespace AndroidRemote
|
||||
|
||||
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
|
||||
{
|
||||
base.OnActivityResult(requestCode, resultCode, data);
|
||||
|
||||
// make it available in the gallery
|
||||
Intent mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
|
||||
Android.Net.Uri contentUri = Android.Net.Uri.FromFile(file);
|
||||
mediaScanIntent.SetData(contentUri);
|
||||
SendBroadcast(mediaScanIntent);
|
||||
System.IO.FileInfo fi = new System.IO.FileInfo(file.Path);
|
||||
fs = new System.IO.FileStream(file.Path, System.IO.FileMode.Open);
|
||||
fileBytes = new byte[fi.Length];
|
||||
fs.BeginRead (fileBytes, 0, (int)fi.Length, new AsyncCallback(OnFileRead), null);
|
||||
//base.OnActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode != Result.Ok)
|
||||
return;
|
||||
|
||||
if (requestCode == REQUEST_TAKE_PICTURE)
|
||||
{
|
||||
// make it available in the gallery
|
||||
//Intent mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
|
||||
Android.Net.Uri contentUri = Android.Net.Uri.FromFile(file);
|
||||
//mediaScanIntent.SetData(contentUri);
|
||||
//SendBroadcast(mediaScanIntent);
|
||||
|
||||
Java.IO.File dir2 = new Java.IO.File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures), Resources.GetString(Resource.String.app_name));
|
||||
if (!dir.Exists())
|
||||
{
|
||||
dir.Mkdirs();
|
||||
}
|
||||
|
||||
file2 = new Java.IO.File(dir, String.Format("myPhoto_{0}.jpg", Guid.NewGuid()));
|
||||
|
||||
Intent picker = new Intent ("com.android.camera.action.CROP");
|
||||
//Intent picker = new Intent (Intent.ActionGetContent, contentUri);
|
||||
picker.SetDataAndType (contentUri, "image/*");
|
||||
picker.PutExtra ("crop", "true");
|
||||
picker.PutExtra ("aspectX", 1);
|
||||
picker.PutExtra ("aspectY", 1);
|
||||
picker.PutExtra ("outputX", 512);
|
||||
picker.PutExtra ("outputY", 512);
|
||||
picker.PutExtra ("return-data", false);
|
||||
//picker.PutExtra ("outputFormat", Bitmap.CompressFormat.Jpeg.ToString ());
|
||||
picker.PutExtra ("noFaceDetection", true);
|
||||
picker.PutExtra (MediaStore.ExtraOutput, Android.Net.Uri.FromFile(file2));
|
||||
StartActivityForResult (picker, REQUEST_PICK_PICTURE);
|
||||
}
|
||||
|
||||
if (requestCode == REQUEST_PICK_PICTURE)
|
||||
{
|
||||
if (data.Extras != null)
|
||||
{
|
||||
System.IO.FileInfo fi = new System.IO.FileInfo(file2.Path);
|
||||
fs = new System.IO.FileStream(file2.Path, System.IO.FileMode.Open);
|
||||
fileBytes = new byte[fi.Length];
|
||||
fs.BeginRead (fileBytes, 0, (int)fi.Length, new AsyncCallback(OnFileRead), null);
|
||||
fi = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnFileRead(IAsyncResult ar)
|
||||
{
|
||||
if (fileBytes == null)
|
||||
@@ -93,6 +136,12 @@ namespace AndroidRemote
|
||||
fs.Flush();
|
||||
fs.Close();
|
||||
|
||||
if (file != null)
|
||||
file.Delete ();
|
||||
|
||||
if (file2 != null)
|
||||
file2.Delete ();
|
||||
|
||||
if (sendProfile)
|
||||
{
|
||||
sendProfile = false;
|
||||
@@ -100,7 +149,6 @@ namespace AndroidRemote
|
||||
if (tv.Text == String.Empty)
|
||||
return;
|
||||
|
||||
|
||||
client.SendMessage (CCommands.CreateCommandSendProfile(fileBytes, tv.Text, 0), OnResponse);
|
||||
}
|
||||
else
|
||||
@@ -116,41 +164,53 @@ namespace AndroidRemote
|
||||
|
||||
private void SendAvatar(object sender, EventArgs eventArgs)
|
||||
{
|
||||
_TakePicture (false);
|
||||
}
|
||||
|
||||
private void SendProfile(object sender, EventArgs eventArgs)
|
||||
{
|
||||
_TakePicture (true);
|
||||
}
|
||||
|
||||
private void _TakePicture(bool SendProfile)
|
||||
{
|
||||
sendProfile = SendProfile;
|
||||
|
||||
if (!IsThereAnAppToTakePictures())
|
||||
return;
|
||||
|
||||
Intent intent = new Intent(MediaStore.ActionImageCapture);
|
||||
dir = new Java.IO.File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures), "AndroidRemote");
|
||||
if (dir.Exists())
|
||||
dir = new Java.IO.File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures), Resources.GetString(Resource.String.app_name));
|
||||
if (!dir.Exists())
|
||||
{
|
||||
dir.Mkdirs();
|
||||
}
|
||||
|
||||
file = new Java.IO.File(dir, String.Format("myPhoto_{0}.jpg", Guid.NewGuid()));
|
||||
intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(file));
|
||||
StartActivityForResult(intent, 0);
|
||||
}
|
||||
|
||||
private void SendProfile(object sender, EventArgs eventArgs)
|
||||
{
|
||||
sendProfile = true;
|
||||
SendAvatar(sender, eventArgs);
|
||||
StartActivityForResult(intent, REQUEST_TAKE_PICTURE);
|
||||
}
|
||||
|
||||
private void Connect()
|
||||
{
|
||||
if (!client.Connected)
|
||||
client.Connect(tIP.Text, 3000, OnConnectionChanged);
|
||||
{
|
||||
pDialog.SetMessage ("Connecting for Server...");
|
||||
pDialog.Show ();
|
||||
client.Connect(tIP.Text, 3000, tPassword.Text, OnConnectionChanged);
|
||||
}
|
||||
else
|
||||
{
|
||||
pDialog.Hide ();
|
||||
client.Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private void Login()
|
||||
|
||||
private void Discover()
|
||||
{
|
||||
if (!loggedIn)
|
||||
client.SendMessage (CCommands.CreateCommandLogin(tPassword.Text), OnResponse);
|
||||
else
|
||||
client.Disconnect();
|
||||
pDialog.SetMessage ("Searching for Server...");
|
||||
pDialog.Show ();
|
||||
discover.Discover (_OnDiscovered);
|
||||
}
|
||||
|
||||
private void OnConnectionChanged(bool Connected)
|
||||
@@ -169,18 +229,6 @@ namespace AndroidRemote
|
||||
int command = BitConverter.ToInt32(Message, 0);
|
||||
switch (command)
|
||||
{
|
||||
case CCommands.ResponseLoginFailed:
|
||||
RunOnUiThread (() => Toast.MakeText(this, Resources.GetString(Resource.String.message_login_failed), ToastLength.Short).Show());
|
||||
break;
|
||||
|
||||
case CCommands.ResponseLoginWrongPassword:
|
||||
RunOnUiThread (() => Toast.MakeText(this, Resources.GetString(Resource.String.message_wrong_password), ToastLength.Short).Show());
|
||||
break;
|
||||
|
||||
case CCommands.ResponseLoginOK:
|
||||
RunOnUiThread (() => UpdateLoginStatus(true));
|
||||
break;
|
||||
|
||||
case CCommands.ResponseOK:
|
||||
RunOnUiThread (() => Toast.MakeText(this, Resources.GetString(Resource.String.message_ok), ToastLength.Short).Show());
|
||||
break;
|
||||
@@ -194,73 +242,43 @@ namespace AndroidRemote
|
||||
}
|
||||
}
|
||||
|
||||
private void _OnDiscovered(string Address, string HostName)
|
||||
{
|
||||
RunOnUiThread (() =>
|
||||
{
|
||||
if (Address != CDiscover.sTimeout && Address != CDiscover.sFinished)
|
||||
{
|
||||
tIP.Text = Address;
|
||||
Connect ();
|
||||
}
|
||||
else if (Address == CDiscover.sTimeout)
|
||||
{
|
||||
pDialog.Hide ();
|
||||
Toast.MakeText(this, "Cant't find any Vocaluxe Server", ToastLength.Short).Show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void UpdateConnectionStatus(bool Connected)
|
||||
{
|
||||
if (Connected)
|
||||
{
|
||||
bLogin.Enabled = true;
|
||||
pDialog.Hide ();
|
||||
bConnect.Text = Resources.GetString(Resource.String.button_disconnect);
|
||||
Toast.MakeText(this, Resource.String.message_connected, ToastLength.Short).Show();
|
||||
bSendAvatar.Enabled = true;
|
||||
bSendProfile.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pDialog.Hide ();
|
||||
client.Disconnect();
|
||||
bLogin.Enabled = false;
|
||||
bLogin.Text = Resources.GetString(Resource.String.button_login);
|
||||
bConnect.Text = Resources.GetString(Resource.String.button_connect);
|
||||
bSendAvatar.Enabled = false;
|
||||
bSendProfile.Enabled = false;
|
||||
Toast.MakeText(this, Resources.GetString(Resource.String.message_disconnected), ToastLength.Short).Show();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateLoginStatus(bool LoggedIn)
|
||||
{
|
||||
loggedIn = LoggedIn;
|
||||
|
||||
if (LoggedIn)
|
||||
{
|
||||
bLogin.Text = Resources.GetString(Resource.String.button_logout);
|
||||
Toast.MakeText(this, Resources.GetString(Resource.String.message_logged_in), ToastLength.Short).Show();
|
||||
bSendAvatar.Enabled = true;
|
||||
bSendProfile.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.MakeText(this, Resources.GetString(Resource.String.message_logged_out), ToastLength.Short).Show();
|
||||
bSendAvatar.Enabled = false;
|
||||
bSendProfile.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class BitmapHelpers
|
||||
{
|
||||
public static Bitmap LoadAndResizeBitmap(this string fileName, int width, int height)
|
||||
{
|
||||
// First we get the the dimensions of the file on disk
|
||||
BitmapFactory.Options options = new BitmapFactory.Options { InJustDecodeBounds = true };
|
||||
BitmapFactory.DecodeFile(fileName, options);
|
||||
|
||||
// Next we calculate the ratio that we need to resize the image by
|
||||
// in order to fit the requested dimensions.
|
||||
int outHeight = options.OutHeight;
|
||||
int outWidth = options.OutWidth;
|
||||
int inSampleSize = 1;
|
||||
|
||||
if (outHeight > height || outWidth > width)
|
||||
{
|
||||
inSampleSize = outWidth > outHeight
|
||||
? outHeight / height
|
||||
: outWidth / width;
|
||||
}
|
||||
|
||||
// Now we will load the image and have BitmapFactory resize it for us.
|
||||
options.InSampleSize = inSampleSize;
|
||||
options.InJustDecodeBounds = false;
|
||||
Bitmap resizedBitmap = BitmapFactory.DecodeFile(fileName, options);
|
||||
return resizedBitmap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="AndroidRemote.AndroidRemote">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="0.1" package="org.vocaluxe.app">
|
||||
<uses-sdk />
|
||||
<application android:label="AndroidRemote" android:icon="@drawable/icon"></application>
|
||||
<application android:label="Vocaluxe App" android:icon="@drawable/icon"></application>
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
@@ -5,7 +5,7 @@ using Android.App;
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("AndroidRemote")]
|
||||
[assembly: AssemblyTitle("Vocaluxe App")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
|
||||
+46
-86
@@ -2,16 +2,16 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.18034
|
||||
// Laufzeitversion:4.0.30319.18047
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
[assembly: global::Android.Runtime.ResourceDesignerAttribute("AndroidRemote.Resource", IsApplication=true)]
|
||||
[assembly: global::Android.Runtime.ResourceDesignerAttribute("org.vocaluxe.app.Resource", IsApplication=true)]
|
||||
|
||||
namespace AndroidRemote
|
||||
namespace org.vocaluxe.app
|
||||
{
|
||||
|
||||
|
||||
@@ -47,9 +47,6 @@ namespace AndroidRemote
|
||||
// aapt resource value: 0x7f020000
|
||||
public const int Icon = 2130837504;
|
||||
|
||||
// aapt resource value: 0x7f020001
|
||||
public const int monoandroidsplash = 2130837505;
|
||||
|
||||
static Drawable()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
@@ -63,35 +60,35 @@ namespace AndroidRemote
|
||||
public partial class Id
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f060002
|
||||
public const int btConnect = 2131099650;
|
||||
// aapt resource value: 0x7f050004
|
||||
public const int btConnect = 2131034116;
|
||||
|
||||
// aapt resource value: 0x7f060005
|
||||
public const int btLogin = 2131099653;
|
||||
// aapt resource value: 0x7f050005
|
||||
public const int btDiscover = 2131034117;
|
||||
|
||||
// aapt resource value: 0x7f060006
|
||||
public const int btSendAvatar = 2131099654;
|
||||
// aapt resource value: 0x7f050006
|
||||
public const int btSendAvatar = 2131034118;
|
||||
|
||||
// aapt resource value: 0x7f060009
|
||||
public const int btSendProfile = 2131099657;
|
||||
// aapt resource value: 0x7f050009
|
||||
public const int btSendProfile = 2131034121;
|
||||
|
||||
// aapt resource value: 0x7f060001
|
||||
public const int tbIP = 2131099649;
|
||||
// aapt resource value: 0x7f050001
|
||||
public const int tbIP = 2131034113;
|
||||
|
||||
// aapt resource value: 0x7f060004
|
||||
public const int tbPassword = 2131099652;
|
||||
// aapt resource value: 0x7f050003
|
||||
public const int tbPassword = 2131034115;
|
||||
|
||||
// aapt resource value: 0x7f060008
|
||||
public const int tbPlayerName = 2131099656;
|
||||
// aapt resource value: 0x7f050008
|
||||
public const int tbPlayerName = 2131034120;
|
||||
|
||||
// aapt resource value: 0x7f060000
|
||||
public const int textView1 = 2131099648;
|
||||
// aapt resource value: 0x7f050000
|
||||
public const int textView1 = 2131034112;
|
||||
|
||||
// aapt resource value: 0x7f060003
|
||||
public const int textView2 = 2131099651;
|
||||
// aapt resource value: 0x7f050002
|
||||
public const int textView2 = 2131034114;
|
||||
|
||||
// aapt resource value: 0x7f060007
|
||||
public const int textView3 = 2131099655;
|
||||
// aapt resource value: 0x7f050007
|
||||
public const int textView3 = 2131034119;
|
||||
|
||||
static Id()
|
||||
{
|
||||
@@ -109,9 +106,6 @@ namespace AndroidRemote
|
||||
// aapt resource value: 0x7f030000
|
||||
public const int Main = 2130903040;
|
||||
|
||||
// aapt resource value: 0x7f030001
|
||||
public const int monoandroidsplash = 2130903041;
|
||||
|
||||
static Layout()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
@@ -135,55 +129,37 @@ namespace AndroidRemote
|
||||
public const int button_disconnect = 2130968578;
|
||||
|
||||
// aapt resource value: 0x7f040003
|
||||
public const int button_login = 2130968579;
|
||||
public const int button_send_avatar = 2130968579;
|
||||
|
||||
// aapt resource value: 0x7f040004
|
||||
public const int button_logout = 2130968580;
|
||||
|
||||
// aapt resource value: 0x7f040005
|
||||
public const int button_send_avatar = 2130968581;
|
||||
|
||||
// aapt resource value: 0x7f040006
|
||||
public const int button_send_profile = 2130968582;
|
||||
|
||||
// aapt resource value: 0x7f040012
|
||||
public const int ip_address = 2130968594;
|
||||
|
||||
// aapt resource value: 0x7f040007
|
||||
public const int message_connected = 2130968583;
|
||||
|
||||
// aapt resource value: 0x7f040008
|
||||
public const int message_disconnected = 2130968584;
|
||||
|
||||
// aapt resource value: 0x7f040009
|
||||
public const int message_logged_in = 2130968585;
|
||||
|
||||
// aapt resource value: 0x7f04000a
|
||||
public const int message_logged_out = 2130968586;
|
||||
|
||||
// aapt resource value: 0x7f04000b
|
||||
public const int message_login_failed = 2130968587;
|
||||
|
||||
// aapt resource value: 0x7f04000e
|
||||
public const int message_nok = 2130968590;
|
||||
|
||||
// aapt resource value: 0x7f04000d
|
||||
public const int message_ok = 2130968589;
|
||||
public const int button_send_profile = 2130968580;
|
||||
|
||||
// aapt resource value: 0x7f04000c
|
||||
public const int message_wrong_password = 2130968588;
|
||||
public const int ip_address = 2130968588;
|
||||
|
||||
// aapt resource value: 0x7f040013
|
||||
public const int password = 2130968595;
|
||||
// aapt resource value: 0x7f040005
|
||||
public const int message_connected = 2130968581;
|
||||
|
||||
// aapt resource value: 0x7f04000f
|
||||
public const int text_ip_address = 2130968591;
|
||||
// aapt resource value: 0x7f040006
|
||||
public const int message_disconnected = 2130968582;
|
||||
|
||||
// aapt resource value: 0x7f040010
|
||||
public const int text_password = 2130968592;
|
||||
// aapt resource value: 0x7f040008
|
||||
public const int message_nok = 2130968584;
|
||||
|
||||
// aapt resource value: 0x7f040011
|
||||
public const int text_player_name = 2130968593;
|
||||
// aapt resource value: 0x7f040007
|
||||
public const int message_ok = 2130968583;
|
||||
|
||||
// aapt resource value: 0x7f04000d
|
||||
public const int password = 2130968589;
|
||||
|
||||
// aapt resource value: 0x7f040009
|
||||
public const int text_ip_address = 2130968585;
|
||||
|
||||
// aapt resource value: 0x7f04000a
|
||||
public const int text_password = 2130968586;
|
||||
|
||||
// aapt resource value: 0x7f04000b
|
||||
public const int text_player_name = 2130968587;
|
||||
|
||||
static String()
|
||||
{
|
||||
@@ -194,22 +170,6 @@ namespace AndroidRemote
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Style
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f050000
|
||||
public const int Mono_Android_Theme_Splash = 2131034112;
|
||||
|
||||
static Style()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Style()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 60 KiB |
@@ -9,54 +9,63 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView1"
|
||||
android:layout_margin="3dp"
|
||||
android:linksClickable="false" />
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/tbIP"
|
||||
android:layout_margin="3dp"
|
||||
android:text="@string/ip_address" />
|
||||
<Button
|
||||
android:text="@string/button_connect"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btConnect" />
|
||||
<TextView
|
||||
android:text="@string/text_password"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
android:id="@+id/textView2" />
|
||||
<EditText
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/tbPassword"
|
||||
android:layout_margin="3dp"
|
||||
android:text="@string/password" />
|
||||
<Button
|
||||
android:text="@string/button_login"
|
||||
android:text="@string/button_connect"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btLogin"
|
||||
android:enabled="false" />
|
||||
android:layout_margin="3dp"
|
||||
android:id="@+id/btConnect" />
|
||||
<Button
|
||||
android:text="Discover"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
android:id="@+id/btDiscover" />
|
||||
<Button
|
||||
android:text="@string/button_send_avatar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btSendAvatar"
|
||||
android:layout_margin="3dp"
|
||||
android:enabled="false" />
|
||||
<TextView
|
||||
android:text="@string/text_player_name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
android:id="@+id/textView3" />
|
||||
<EditText
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
android:id="@+id/tbPlayerName" />
|
||||
<Button
|
||||
android:text="@string/button_send_profile"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btSendProfile"
|
||||
android:layout_margin="3dp"
|
||||
android:enabled="false" />
|
||||
</LinearLayout>
|
||||
@@ -1,23 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">AndroidRemote</string>
|
||||
<string name="app_name">Vocaluxe App</string>
|
||||
<string name="button_connect">Connect</string>
|
||||
<string name="button_disconnect">Disconnect</string>
|
||||
<string name="button_login">Login</string>
|
||||
<string name="button_logout">Logout</string>
|
||||
<string name="button_send_avatar">Send Avatar Picture</string>
|
||||
<string name="button_send_profile">Send Profile</string>
|
||||
<string name="message_connected">Connected</string>
|
||||
<string name="message_disconnected">Disconnected</string>
|
||||
<string name="message_logged_in">Logged in</string>
|
||||
<string name="message_logged_out">Logged out</string>
|
||||
<string name="message_login_failed">Login failed</string>
|
||||
<string name="message_wrong_password">Wrong Password</string>
|
||||
<string name="message_ok">Success</string>
|
||||
<string name="message_nok">Error</string>
|
||||
<string name="text_ip_address">IP Address of Vocaluxe Server:</string>
|
||||
<string name="text_password">Password:</string>
|
||||
<string name="text_player_name">Player Name:</string>
|
||||
<string name="ip_address">192.168.178.57</string>
|
||||
<string name="ip_address"></string>
|
||||
<string name="password">vocaluxe</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D97EF6F3-7C3F-439F-B022-647948E206D2}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>org.vocaluxe.app</RootNamespace>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AssemblyName>VocaluxeApp</AssemblyName>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;MONO</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<DefineConstants>MONO</DefineConstants>
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="Newtonsoft.Json.MonoDroid">
|
||||
<HintPath>Newtonsoft.Json.MonoDroid.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="..\ClientServerLib\CClient.cs">
|
||||
<Link>ClientServerLib\CClient.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\CConnection.cs">
|
||||
<Link>ClientServerLib\CConnection.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\Structs.cs">
|
||||
<Link>ClientServerLib\Structs.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\DeffieHellman\BigInt.cs">
|
||||
<Link>ClientServerLib\DeffieHellman\BigInt.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\DeffieHellman\DeffieHellman.cs">
|
||||
<Link>ClientServerLib\DeffieHellman\DeffieHellman.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\DeffieHellman\StrongNumberProvider.cs">
|
||||
<Link>ClientServerLib\DeffieHellman\StrongNumberProvider.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ClientServerLib\CDiscover.cs">
|
||||
<Link>ClientServerLib\CDiscover.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Vocaluxe\Base\Server\CCommands.cs">
|
||||
<Link>ClientServerLib\Server\CCommands.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Vocaluxe\Base\Server\VocaluxeStructs.cs">
|
||||
<Link>ClientServerLib\Server\VocaluxeStructs.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Main.axml" />
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
<AndroidResource Include="Resources\drawable\Icon.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="ClientServerLib\" />
|
||||
<Folder Include="Assets\" />
|
||||
<Folder Include="ClientServerLib\Vocaluxe\" />
|
||||
<Folder Include="ClientServerLib\Server\" />
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<TextStylePolicy TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
|
||||
<NameConventionPolicy>
|
||||
<Rules>
|
||||
<NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
|
||||
<RequiredPrefixes>
|
||||
<String>I</String>
|
||||
</RequiredPrefixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
|
||||
<RequiredSuffixes>
|
||||
<String>Attribute</String>
|
||||
</RequiredSuffixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
|
||||
<RequiredSuffixes>
|
||||
<String>EventArgs</String>
|
||||
</RequiredSuffixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
|
||||
<RequiredSuffixes>
|
||||
<String>Exception</String>
|
||||
</RequiredSuffixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="PascalCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Protected, Public" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" />
|
||||
<NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
|
||||
<AllowedPrefixes>
|
||||
<String>_</String>
|
||||
<String>m_</String>
|
||||
</AllowedPrefixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
|
||||
<AllowedPrefixes>
|
||||
<String>_</String>
|
||||
<String>m_</String>
|
||||
</AllowedPrefixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Parameters" AffectedEntity="Parameter" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
|
||||
<RequiredPrefixes>
|
||||
<String>T</String>
|
||||
</RequiredPrefixes>
|
||||
</NamingRule>
|
||||
</Rules>
|
||||
</NameConventionPolicy>
|
||||
<VersionControlPolicy inheritsSet="Mono" />
|
||||
<ChangeLogPolicy inheritsSet="Mono" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -29,6 +29,8 @@ namespace ClientServerLib
|
||||
private OnSend onSend;
|
||||
private OnReceived onReceived;
|
||||
|
||||
private byte[] data;
|
||||
|
||||
public bool Connected
|
||||
{
|
||||
get { return connected; }
|
||||
@@ -41,14 +43,12 @@ namespace ClientServerLib
|
||||
running = true;
|
||||
requests = new List<SRequest>();
|
||||
responses = new List<SRequest>();
|
||||
data = new byte[bufferLength];
|
||||
|
||||
connection = new CConnection(new TcpClient(), -1);
|
||||
|
||||
clientThread = new Thread(new ThreadStart(Runner));
|
||||
clientThread.Start();
|
||||
}
|
||||
|
||||
public void Connect(string IP = "127.0.0.1", int Port = 3000,
|
||||
public void Connect(string IP = "127.0.0.1", int Port = 3000, string Password = null,
|
||||
OnConnectionChanged OnConnectionChanged = null,
|
||||
OnSend OnSend = null,
|
||||
OnReceived OnReceived = null)
|
||||
@@ -61,7 +61,15 @@ namespace ClientServerLib
|
||||
|
||||
ip = IP;
|
||||
port = Port;
|
||||
connection.Password = Password;
|
||||
doConnect = true;
|
||||
|
||||
if (clientThread == null)
|
||||
{
|
||||
running = true;
|
||||
clientThread = new Thread(new ThreadStart(Runner));
|
||||
clientThread.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,9 +93,13 @@ namespace ClientServerLib
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Disconnect();
|
||||
running = false;
|
||||
clientThread.Join(100);
|
||||
|
||||
if (clientThread != null)
|
||||
clientThread.Join(100);
|
||||
|
||||
clientThread = null;
|
||||
DoDisconnect();
|
||||
}
|
||||
|
||||
public void SendMessage(byte[] Message, ResponseCallback Callback)
|
||||
@@ -111,10 +123,14 @@ namespace ClientServerLib
|
||||
{
|
||||
try
|
||||
{
|
||||
serverEndPoint = new IPEndPoint(IPAddress.Parse(ip), port);
|
||||
connection.TcpClient.Connect(serverEndPoint);
|
||||
connected = true;
|
||||
RaiseOnConnectionChanged();
|
||||
IPAddress resolvedIP;
|
||||
if (TryResolveIPAddress(ip, out resolvedIP))
|
||||
{
|
||||
serverEndPoint = new IPEndPoint(resolvedIP, port);
|
||||
connection.TcpClient.Connect(serverEndPoint);
|
||||
connected = true;
|
||||
RaiseOnConnectionChanged();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -122,7 +138,7 @@ namespace ClientServerLib
|
||||
|
||||
for (int i = 0; i < 500; i++)
|
||||
{
|
||||
if (doConnect)
|
||||
if (running && doConnect)
|
||||
Thread.Sleep(10);
|
||||
else
|
||||
break;
|
||||
@@ -141,6 +157,7 @@ namespace ClientServerLib
|
||||
try
|
||||
{
|
||||
Communicate();
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -148,9 +165,62 @@ namespace ClientServerLib
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!doConnect && !connected)
|
||||
{
|
||||
for (int i = 0; i < 500; i++)
|
||||
{
|
||||
if (running && !doConnect)
|
||||
Thread.Sleep(10);
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryResolveIPAddress(string serverNameOrURL, out IPAddress resolvedIPAddress)
|
||||
{
|
||||
bool isResolved = false;
|
||||
IPHostEntry hostEntry = null;
|
||||
IPAddress resolvIP = null;
|
||||
try
|
||||
{
|
||||
if (!IPAddress.TryParse(serverNameOrURL, out resolvIP))
|
||||
{
|
||||
hostEntry = Dns.GetHostEntry(serverNameOrURL);
|
||||
if (hostEntry != null && hostEntry.AddressList != null && hostEntry.AddressList.Length > 0)
|
||||
{
|
||||
if (hostEntry.AddressList.Length == 1)
|
||||
{
|
||||
resolvIP = hostEntry.AddressList[0];
|
||||
isResolved = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (IPAddress var in hostEntry.AddressList)
|
||||
{
|
||||
if (var.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
resolvIP = var;
|
||||
isResolved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
isResolved = true;
|
||||
}
|
||||
catch (Exception) {}
|
||||
finally
|
||||
{
|
||||
resolvedIPAddress = resolvIP;
|
||||
}
|
||||
return isResolved;
|
||||
}
|
||||
|
||||
private void DoDisconnect()
|
||||
{
|
||||
try
|
||||
@@ -161,6 +231,7 @@ namespace ClientServerLib
|
||||
|
||||
connection = new CConnection(new TcpClient(), -1);
|
||||
connected = false;
|
||||
doConnect = false;
|
||||
RaiseOnConnectionChanged();
|
||||
}
|
||||
|
||||
@@ -170,8 +241,7 @@ namespace ClientServerLib
|
||||
DoDisconnect();
|
||||
|
||||
NetworkStream clientStream = connection.TcpClient.GetStream();
|
||||
|
||||
byte[] data = new byte[bufferLength];
|
||||
|
||||
int bytesRead;
|
||||
|
||||
if (!connection.KeySet)
|
||||
@@ -302,7 +372,10 @@ namespace ClientServerLib
|
||||
{
|
||||
onConnectionChanged(connected);
|
||||
}
|
||||
catch {}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine (e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void RaiseOnSend(byte[] Message)
|
||||
|
||||
@@ -14,10 +14,13 @@ namespace ClientServerLib
|
||||
internal class CConnection
|
||||
{
|
||||
private bool keySet;
|
||||
private byte[] key;
|
||||
private bool encryption;
|
||||
private CDiffieHellman dh;
|
||||
private string password;
|
||||
private CDiffieHellman dh;
|
||||
private UTF8Encoding encoder;
|
||||
private int connectionID;
|
||||
private static SHA256Managed SHA256 = new SHA256Managed();
|
||||
|
||||
public TcpClient TcpClient;
|
||||
|
||||
@@ -31,14 +34,26 @@ namespace ClientServerLib
|
||||
get { return connectionID; }
|
||||
}
|
||||
|
||||
public CConnection(TcpClient client, int ConnectionID, bool Encryption = false)
|
||||
public string Password
|
||||
{
|
||||
set
|
||||
{
|
||||
password = value;
|
||||
encryption = value != null;
|
||||
keySet = false;
|
||||
}
|
||||
}
|
||||
|
||||
public CConnection(TcpClient client, int ConnectionID, string Password = null)
|
||||
{
|
||||
TcpClient = client;
|
||||
client.NoDelay = true;
|
||||
keySet = false;
|
||||
encryption = Encryption;
|
||||
encryption = Password != null;
|
||||
password = Password;
|
||||
connectionID = ConnectionID;
|
||||
encoder = new UTF8Encoding();
|
||||
key = null;
|
||||
}
|
||||
|
||||
public byte[] GetKeyParams()
|
||||
@@ -64,11 +79,12 @@ namespace ClientServerLib
|
||||
{
|
||||
encryption = false;
|
||||
keySet = true;
|
||||
key = null;
|
||||
return encoder.GetBytes(response);
|
||||
}
|
||||
|
||||
dh = new CDiffieHellman(256).GenerateResponse(response);
|
||||
|
||||
key = _BuildHash(dh.Key, password);
|
||||
keySet = true;
|
||||
encryption = true;
|
||||
return encoder.GetBytes(dh.ToString());
|
||||
@@ -81,6 +97,7 @@ namespace ClientServerLib
|
||||
if (response == "NO ENCRYPTION")
|
||||
{
|
||||
keySet = true;
|
||||
key = null;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -88,6 +105,7 @@ namespace ClientServerLib
|
||||
return;
|
||||
|
||||
dh.HandleResponse(response);
|
||||
key = _BuildHash(dh.Key, password);
|
||||
keySet = true;
|
||||
}
|
||||
|
||||
@@ -101,6 +119,19 @@ namespace ClientServerLib
|
||||
return _Decompress(_Decrypt(Data));
|
||||
}
|
||||
|
||||
private byte[] _BuildHash(byte[] Key, string Password)
|
||||
{
|
||||
if (Key == null || Password == null)
|
||||
return null;
|
||||
|
||||
byte[] hash = SHA256.ComputeHash(encoder.GetBytes(Password));
|
||||
byte[] serial = new byte[Key.Length + hash.Length];
|
||||
Array.Copy(Key, serial, Key.Length);
|
||||
Array.Copy(hash, 0, serial, Key.Length, hash.Length);
|
||||
|
||||
return SHA256.ComputeHash(serial);
|
||||
}
|
||||
|
||||
private byte[] _Encrypt(byte[] Data)
|
||||
{
|
||||
if (Data == null || (!keySet && encryption))
|
||||
@@ -125,7 +156,7 @@ namespace ClientServerLib
|
||||
|
||||
using (Aes aes = new AesManaged())
|
||||
{
|
||||
aes.Key = dh.Key;
|
||||
aes.Key = key;
|
||||
aes.GenerateIV();
|
||||
|
||||
using (var encryptor = aes.CreateEncryptor(aes.Key, aes.IV))
|
||||
@@ -184,7 +215,7 @@ namespace ClientServerLib
|
||||
|
||||
using (Aes aes = new AesManaged())
|
||||
{
|
||||
aes.Key = dh.Key;
|
||||
aes.Key = key;
|
||||
aes.IV = IV;
|
||||
|
||||
byte[] encrypted = new byte[messageLength - 24];
|
||||
|
||||
@@ -14,6 +14,9 @@ namespace ClientServerLib
|
||||
|
||||
public class CDiscover
|
||||
{
|
||||
public static readonly string sTimeout = "Timeout";
|
||||
public static readonly string sFinished = "Finished";
|
||||
|
||||
private string _Keyword;
|
||||
private string _BroadcastAddress;
|
||||
private int _Port;
|
||||
@@ -114,7 +117,9 @@ namespace ClientServerLib
|
||||
_DiscoverRunning = false;
|
||||
|
||||
if (!foundSomething)
|
||||
_OnDiscovered("Timeout", "unknown");
|
||||
_OnDiscovered(sTimeout, String.Empty);
|
||||
else
|
||||
_OnDiscovered(sFinished, String.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ namespace ClientServerLib
|
||||
private Thread listenThread;
|
||||
private int port;
|
||||
private bool encryption;
|
||||
private string password;
|
||||
private int bufferLength = 8192;
|
||||
private bool running;
|
||||
|
||||
@@ -22,12 +23,13 @@ namespace ClientServerLib
|
||||
private Dictionary<int, CConnection> clients;
|
||||
private Queue<int> ids;
|
||||
|
||||
public CServer(HandleRequest RequestCallback, int Port = 3000, bool Encryption = false)
|
||||
public CServer(HandleRequest RequestCallback, int Port = 3000, string Password = null)
|
||||
{
|
||||
port = Port;
|
||||
running = false;
|
||||
requestCallback = RequestCallback;
|
||||
encryption = Encryption;
|
||||
encryption = Password != null;
|
||||
password = Password;
|
||||
|
||||
clients = new Dictionary<int, CConnection>();
|
||||
ids = new Queue<int>(1000);
|
||||
@@ -92,7 +94,7 @@ namespace ClientServerLib
|
||||
if (client != null)
|
||||
{
|
||||
int id = ids.Dequeue();
|
||||
CConnection connection = new CConnection(client, id, encryption);
|
||||
CConnection connection = new CConnection(client, id, password);
|
||||
|
||||
lock (clients)
|
||||
{
|
||||
@@ -103,10 +105,19 @@ namespace ClientServerLib
|
||||
|
||||
NetworkStream clientStream = client.GetStream();
|
||||
byte[] serverParams = connection.GetKeyParams();
|
||||
clientStream.Write(serverParams, 0, serverParams.Length);
|
||||
clientStream.Flush();
|
||||
|
||||
clientThread.Start(connection);
|
||||
try
|
||||
{
|
||||
clientStream.Write(serverParams, 0, serverParams.Length);
|
||||
clientStream.Flush();
|
||||
}
|
||||
catch
|
||||
{
|
||||
client = null;
|
||||
}
|
||||
|
||||
if (client != null)
|
||||
clientThread.Start(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,8 +173,15 @@ namespace ClientServerLib
|
||||
//send message
|
||||
byte[] encrypted = connection.Encrypt(answer);
|
||||
|
||||
clientStream.Write(encrypted, 0, encrypted.Length);
|
||||
clientStream.Flush();
|
||||
try
|
||||
{
|
||||
clientStream.Write(encrypted, 0, encrypted.Length);
|
||||
clientStream.Flush();
|
||||
}
|
||||
catch
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -971,6 +971,9 @@ namespace DiffieHellman
|
||||
|
||||
public override bool Equals(object o)
|
||||
{
|
||||
if (o == null)
|
||||
return false;
|
||||
|
||||
BigInteger bi = (BigInteger)o;
|
||||
|
||||
if (this.dataLength != bi.dataLength)
|
||||
@@ -2965,8 +2968,6 @@ namespace DiffieHellman
|
||||
{
|
||||
data = new uint[0];
|
||||
data = null;
|
||||
GC.Collect();
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -115,10 +115,11 @@ namespace DiffieHellman
|
||||
{
|
||||
// Generate the key.
|
||||
using (BigInteger given = new BigInteger(parts[2], 36))
|
||||
using (BigInteger key = given.ModPow(mine, prime))
|
||||
using (BigInteger key = given.ModPow(mine, prime))
|
||||
{
|
||||
this.key = key.GetBytes();
|
||||
}
|
||||
|
||||
// Generate the response.
|
||||
using (BigInteger send = g.ModPow(mine, prime))
|
||||
{
|
||||
|
||||
+3
-17
@@ -42,7 +42,6 @@
|
||||
this.lbServerIP = new System.Windows.Forms.Label();
|
||||
this.tbPassword = new System.Windows.Forms.TextBox();
|
||||
this.lbPassword = new System.Windows.Forms.Label();
|
||||
this.btLogin = new System.Windows.Forms.Button();
|
||||
this.btLeft = new System.Windows.Forms.Button();
|
||||
this.btRight = new System.Windows.Forms.Button();
|
||||
this.btUp = new System.Windows.Forms.Button();
|
||||
@@ -143,7 +142,7 @@
|
||||
//
|
||||
// btConnect
|
||||
//
|
||||
this.btConnect.Location = new System.Drawing.Point(831, 64);
|
||||
this.btConnect.Location = new System.Drawing.Point(831, 90);
|
||||
this.btConnect.Name = "btConnect";
|
||||
this.btConnect.Size = new System.Drawing.Size(165, 23);
|
||||
this.btConnect.TabIndex = 5;
|
||||
@@ -162,7 +161,7 @@
|
||||
//
|
||||
// tbPassword
|
||||
//
|
||||
this.tbPassword.Location = new System.Drawing.Point(910, 128);
|
||||
this.tbPassword.Location = new System.Drawing.Point(910, 64);
|
||||
this.tbPassword.Name = "tbPassword";
|
||||
this.tbPassword.Size = new System.Drawing.Size(86, 20);
|
||||
this.tbPassword.TabIndex = 6;
|
||||
@@ -171,23 +170,12 @@
|
||||
// lbPassword
|
||||
//
|
||||
this.lbPassword.AutoSize = true;
|
||||
this.lbPassword.Location = new System.Drawing.Point(828, 131);
|
||||
this.lbPassword.Location = new System.Drawing.Point(828, 67);
|
||||
this.lbPassword.Name = "lbPassword";
|
||||
this.lbPassword.Size = new System.Drawing.Size(56, 13);
|
||||
this.lbPassword.TabIndex = 7;
|
||||
this.lbPassword.Text = "Password:";
|
||||
//
|
||||
// btLogin
|
||||
//
|
||||
this.btLogin.Enabled = false;
|
||||
this.btLogin.Location = new System.Drawing.Point(831, 154);
|
||||
this.btLogin.Name = "btLogin";
|
||||
this.btLogin.Size = new System.Drawing.Size(165, 23);
|
||||
this.btLogin.TabIndex = 8;
|
||||
this.btLogin.Text = "Login";
|
||||
this.btLogin.UseVisualStyleBackColor = true;
|
||||
this.btLogin.Click += new System.EventHandler(this.btLogin_Click);
|
||||
//
|
||||
// btLeft
|
||||
//
|
||||
this.btLeft.Enabled = false;
|
||||
@@ -298,7 +286,6 @@
|
||||
this.Controls.Add(this.btUp);
|
||||
this.Controls.Add(this.btRight);
|
||||
this.Controls.Add(this.btLeft);
|
||||
this.Controls.Add(this.btLogin);
|
||||
this.Controls.Add(this.tbDataReceiving);
|
||||
this.Controls.Add(this.lbPassword);
|
||||
this.Controls.Add(this.lbDataReceiving);
|
||||
@@ -336,7 +323,6 @@
|
||||
private System.Windows.Forms.Label lbServerIP;
|
||||
private System.Windows.Forms.TextBox tbPassword;
|
||||
private System.Windows.Forms.Label lbPassword;
|
||||
private System.Windows.Forms.Button btLogin;
|
||||
private System.Windows.Forms.Button btLeft;
|
||||
private System.Windows.Forms.Button btRight;
|
||||
private System.Windows.Forms.Button btUp;
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace ClientTest
|
||||
}
|
||||
|
||||
lbConnectionStatusText.Text = "Connecting...";
|
||||
client.Connect(tbServerIP.Text, port, OnConnectionChanged, OnSend, OnReceived);
|
||||
client.Connect(tbServerIP.Text, port, tbPassword.Text, OnConnectionChanged, OnSend, OnReceived);
|
||||
}
|
||||
|
||||
private void Disconnect()
|
||||
@@ -120,7 +120,6 @@ namespace ClientTest
|
||||
{
|
||||
lbConnectionStatusText.Text = "Connected";
|
||||
btConnect.Text = "Disconnect";
|
||||
btLogin.Enabled = true;
|
||||
btUp.Enabled = true;
|
||||
btDown.Enabled = true;
|
||||
btLeft.Enabled = true;
|
||||
@@ -136,8 +135,6 @@ namespace ClientTest
|
||||
client.Disconnect();
|
||||
lbConnectionStatusText.Text = "Disconnected";
|
||||
btConnect.Text = "Connect";
|
||||
btLogin.Text = "Login";
|
||||
btLogin.Enabled = false;
|
||||
loggedIn = false;
|
||||
btUp.Enabled = false;
|
||||
btDown.Enabled = false;
|
||||
|
||||
Binary file not shown.
@@ -92,6 +92,7 @@
|
||||
<string name="TR_SCREENPARTY_AUTHOR">Author</string>
|
||||
<string name="TR_SCREENPARTY_VERSION">Version</string>
|
||||
<string name="TR_SCREENPARTY_ERROR">Can't load this party-mode.</string>
|
||||
<string name="TR_SCREENPARTY_ERROR_MICS">There are no mics configured!</string>
|
||||
<string name="TR_SCREENPARTY_TARGETAUDIENCE">Target audience</string>
|
||||
<string name="TR_SCREENPARTY_NOTEAMS">No teams</string>
|
||||
<string name="TR_SCREENPARTY_NUMTEAMS">Number of teams</string>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
Vocaluxe 0.2 README
|
||||
Vocaluxe 0.3 README
|
||||
----------------------------
|
||||
|
||||
=================================
|
||||
|
||||
@@ -410,7 +410,7 @@
|
||||
<Text>
|
||||
<!--<X>, <Y>: Text position-->
|
||||
<X>75</X>
|
||||
<Y>16</Y>
|
||||
<Y>12</Y>
|
||||
<!--<H>: Text height-->
|
||||
<H>27</H>
|
||||
<!--<MaxW>: Maximum text width (if exists)-->
|
||||
@@ -467,7 +467,7 @@
|
||||
<Text>
|
||||
<!--<X>, <Y>: Text position-->
|
||||
<X>75</X>
|
||||
<Y>16</Y>
|
||||
<Y>12</Y>
|
||||
<!--<H>: Text height-->
|
||||
<H>27</H>
|
||||
<!--<MaxW>: Maximum text width (if exists)-->
|
||||
@@ -835,4 +835,4 @@
|
||||
</Reflection>
|
||||
</EqualizerChannel2>
|
||||
</ScreenOptionsRecord>
|
||||
</root>
|
||||
</root>
|
||||
@@ -79,9 +79,9 @@
|
||||
</Static4>
|
||||
<StaticWebcamOutput>
|
||||
<!--<Skin>: Texture name-->
|
||||
<Skin>CoverBackground</Skin>
|
||||
<Skin>Invisible</Skin>
|
||||
<!--<X>, <Y>, <Z>, <W>, <H>: Static position, width and height-->
|
||||
<X>75</X>
|
||||
<X>500</X>
|
||||
<Y>460</Y>
|
||||
<Z>0,00</Z>
|
||||
<W>320</W>
|
||||
@@ -756,4 +756,4 @@
|
||||
<NumVisible>3</NumVisible>
|
||||
</SelectSlideWebcamCapabilities>
|
||||
</ScreenOptionsVideo>
|
||||
</root>
|
||||
</root>
|
||||
@@ -568,7 +568,7 @@
|
||||
<!--<Font>: Text font name-->
|
||||
<Font>Outline</Font>
|
||||
<!--<Text>: Nothing or translation tag-->
|
||||
<Text>TR_BUTTON_EXIT</Text>
|
||||
<Text>TR_BUTTON_BACK</Text>
|
||||
</Text>
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
@@ -653,4 +653,4 @@
|
||||
<NumVisible>1</NumVisible>
|
||||
</SelectSlideModes>
|
||||
</ScreenParty>
|
||||
</root>
|
||||
</root>
|
||||
@@ -533,15 +533,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _SetTeamNames()
|
||||
{
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
|
||||
if (profiles == null)
|
||||
{
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
|
||||
return;
|
||||
}
|
||||
|
||||
if (_GameData.NumPlayerAtOnce < 1 || _GameData.ProfileIDs.Count < _GameData.NumPlayerAtOnce || profiles.Length < _GameData.NumPlayerAtOnce)
|
||||
if (_GameData.NumPlayerAtOnce < 1 || _GameData.ProfileIDs.Count < _GameData.NumPlayerAtOnce)
|
||||
{
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
|
||||
return;
|
||||
@@ -554,10 +546,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
if (c != null)
|
||||
{
|
||||
if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length)
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName;
|
||||
else
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = "foobar";
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(_GameData.ProfileIDs[c.Player[i]]);
|
||||
}
|
||||
else
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = "foobar";
|
||||
|
||||
@@ -380,12 +380,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
||||
{
|
||||
_Texts[_TextNextPlayerMessage].Visible = true;
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||
{
|
||||
int pid = _GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i];
|
||||
_NextPlayerStatics[i].Texture = profiles[_GameState.ProfileIDs[pid]].Avatar.Texture;
|
||||
_NextPlayerTexts[i].Text = profiles[_GameState.ProfileIDs[pid]].PlayerName;
|
||||
int id = _GameState.ProfileIDs[_GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i]];
|
||||
_NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id);
|
||||
_NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor(i + 1);
|
||||
}
|
||||
}
|
||||
@@ -492,7 +491,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _UpdateRoundsTable()
|
||||
{
|
||||
CProfile[] profile = CBase.Profiles.GetProfiles();
|
||||
for (int i = 0; i < _RoundsTable.Count; i++)
|
||||
{
|
||||
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
||||
@@ -503,8 +501,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_RoundsTable[i].TextPlayer[p].Visible = true;
|
||||
_RoundsTable[i].TextScores[p].Visible = true;
|
||||
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
|
||||
int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
|
||||
_RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
|
||||
_RoundsTable[i].TextPlayer[p].Text = CBase.Profiles.GetPlayerName(_GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]);
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
@@ -586,8 +583,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _UpdatePlayerTable()
|
||||
{
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
|
||||
for (int i = 0; i < _PlayerTable.Count; i++)
|
||||
{
|
||||
STableRow row = _PlayerTable[i];
|
||||
@@ -602,7 +597,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
row.GamePoints.Visible = true;
|
||||
|
||||
row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + ".";
|
||||
row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName;
|
||||
row.Name.Text = CBase.Profiles.GetPlayerName(_GameState.ResultTable[i + _PlayerTableOffset].PlayerID);
|
||||
row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString();
|
||||
row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString();
|
||||
row.SingPoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString();
|
||||
@@ -658,7 +653,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private string _GetPlayerWinString()
|
||||
{
|
||||
string s = "";
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
|
||||
for (int i = 0; i < _GameState.ResultTable.Count; i++)
|
||||
{
|
||||
@@ -666,7 +660,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
if (i > 0)
|
||||
s += ", ";
|
||||
s += profiles[_GameState.ResultTable[i].PlayerID].PlayerName;
|
||||
s += CBase.Profiles.GetPlayerName(_GameState.ResultTable[i].PlayerID);
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
@@ -62,7 +62,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private bool _SelectingMouseActive;
|
||||
private int _OldMouseX;
|
||||
private int _OldMouseY;
|
||||
private int _SelectedPlayerNr = -1;
|
||||
private bool _ButtonsAdded;
|
||||
|
||||
private int _NumPlayer = 4;
|
||||
@@ -148,34 +147,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
base.HandleMouse(mouseEvent);
|
||||
|
||||
/*
|
||||
//Check if LeftButton is hold and Select-Mode inactive
|
||||
if (MouseEvent.LBH && !SelectingMouseActive)
|
||||
{
|
||||
//Save mouse-coords
|
||||
OldMouseX = MouseEvent.X;
|
||||
OldMouseY = MouseEvent.Y;
|
||||
//Check if mouse if over tile
|
||||
for (int i = 0; i < PlayerChooseButtons.Count; i++)
|
||||
{
|
||||
if (PlayerChooseButtons[i].Button.Selected)
|
||||
{
|
||||
SelectedPlayerNr = PlayerChooseButtons[i].ProfileID;
|
||||
if (SelectedPlayerNr != -1)
|
||||
{
|
||||
//Activate mouse-selecting
|
||||
SelectingMouseActive = true;
|
||||
//Update of Drag/Drop-Texture
|
||||
chooseAvatarStatic.Visible = true;
|
||||
chooseAvatarStatic.Rect = PlayerChooseButtons[i].Button.Rect;
|
||||
chooseAvatarStatic.Rect.Z = -100;
|
||||
chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
|
||||
chooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//Check if LeftButton is hold and Select-Mode active
|
||||
if (mouseEvent.LBH && _SelectingMouseActive)
|
||||
{
|
||||
@@ -188,44 +159,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
|
||||
else if (_SelectingMouseActive)
|
||||
{
|
||||
//Check if really a player was selected
|
||||
if (_SelectedPlayerNr != -1)
|
||||
{
|
||||
//Foreach Drop-Area
|
||||
for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
//Check first, if area is "active"
|
||||
if (_PlayerDestinationButtons[i].Visible)
|
||||
{
|
||||
//Check if Mouse is in area
|
||||
if (CHelper.IsInBounds(_PlayerDestinationButtons[i].Rect, mouseEvent))
|
||||
{
|
||||
int added = -1;
|
||||
//Add Player-ID to list.
|
||||
if (_Data.ScreenNames.ProfileIDs.Count < (i + 1))
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDs.Add(_SelectedPlayerNr);
|
||||
added = _Data.ScreenNames.ProfileIDs.Count - 1;
|
||||
}
|
||||
else if (_Data.ScreenNames.ProfileIDs.Count >= (i + 1))
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDs[i] = _SelectedPlayerNr;
|
||||
added = i;
|
||||
}
|
||||
_UpdateButtonNext();
|
||||
//Update texture and name
|
||||
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[added].Texture = _ChooseAvatarStatic.Texture;
|
||||
_PlayerDestinationButtons[added].SelTexture = _ChooseAvatarStatic.Texture;
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].PlayerName;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
}
|
||||
}
|
||||
}
|
||||
_SelectedPlayerNr = -1;
|
||||
}
|
||||
//Reset variables
|
||||
_SelectingMouseActive = false;
|
||||
_ChooseAvatarStatic.Visible = false;
|
||||
@@ -350,12 +283,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count)
|
||||
{
|
||||
_PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose];
|
||||
_PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName;
|
||||
_PlayerChooseButtons[i].Button.Texture =
|
||||
CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
|
||||
_PlayerChooseButtons[i].Button.SelTexture =
|
||||
CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
|
||||
int id = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose];
|
||||
_PlayerChooseButtons[i].ProfileID = id;
|
||||
_PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetPlayerName(id);
|
||||
_PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerChooseButtons[i].Button.Enabled = true;
|
||||
@@ -377,14 +309,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private void _UpdateVisibleProfiles()
|
||||
{
|
||||
_PlayerChooseButtonsVisibleProfiles.Clear();
|
||||
for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
|
||||
Profile.CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
for (int i = 0; i < profiles.Length; i++)
|
||||
{
|
||||
bool visible = false;
|
||||
//Show profile only if active
|
||||
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != i);
|
||||
if (profiles[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != profiles[i].ID);
|
||||
if (visible)
|
||||
_PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
_PlayerChooseButtonsVisibleProfiles.Add(profiles[i].ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,11 +342,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
if (_Data.ScreenNames.ProfileIDs[i] != -1)
|
||||
{
|
||||
int id = _Data.ScreenNames.ProfileIDs[i];
|
||||
_PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
|
||||
_PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
|
||||
_PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].PlayerName;
|
||||
_PlayerDestinationButtons[i].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetPlayerName(id);
|
||||
_PlayerDestinationButtons[i].Enabled = true;
|
||||
}
|
||||
}
|
||||
@@ -444,17 +378,18 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
foreach (CPlayerChooseButton button in _PlayerChooseButtons)
|
||||
{
|
||||
if (!button.Button.Selected || button.ProfileID == -1 || _Data.ScreenNames.ProfileIDs.Count >= _NumPlayer)
|
||||
int id = button.ProfileID;
|
||||
if (!button.Button.Selected || id == -1 || _Data.ScreenNames.ProfileIDs.Count >= _NumPlayer)
|
||||
continue;
|
||||
_Data.ScreenNames.ProfileIDs.Add(button.ProfileID);
|
||||
_Data.ScreenNames.ProfileIDs.Add(id);
|
||||
int added = _Data.ScreenNames.ProfileIDs.Count - 1;
|
||||
_UpdateButtonNext();
|
||||
//Update texture and name
|
||||
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[button.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[button.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[button.ProfileID].PlayerName;
|
||||
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetPlayerName(id);
|
||||
_PlayerDestinationButtons[added].Enabled = true;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
|
||||
@@ -380,12 +380,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
||||
{
|
||||
_Texts[_TextNextPlayerMessage].Visible = true;
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||
{
|
||||
int pid = _GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i];
|
||||
_NextPlayerStatics[i].Texture = profiles[_GameState.ProfileIDs[pid]].Avatar.Texture;
|
||||
_NextPlayerTexts[i].Text = profiles[_GameState.ProfileIDs[pid]].PlayerName;
|
||||
int id = _GameState.ProfileIDs[_GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i]];
|
||||
_NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id);
|
||||
_NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor(i + 1);
|
||||
}
|
||||
}
|
||||
@@ -492,7 +491,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private void _UpdateRoundsTable()
|
||||
{
|
||||
CProfile[] profile = CBase.Profiles.GetProfiles();
|
||||
for (int i = 0; i < _RoundsTable.Count; i++)
|
||||
{
|
||||
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
||||
@@ -503,8 +501,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_RoundsTable[i].TextPlayer[p].Visible = true;
|
||||
_RoundsTable[i].TextScores[p].Visible = true;
|
||||
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
|
||||
int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
|
||||
_RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
|
||||
_RoundsTable[i].TextPlayer[p].Text = CBase.Profiles.GetPlayerName(_GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]);
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
@@ -586,8 +583,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private void _UpdatePlayerTable()
|
||||
{
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
|
||||
for (int i = 0; i < _PlayerTable.Count; i++)
|
||||
{
|
||||
STableRow row = _PlayerTable[i];
|
||||
@@ -602,7 +597,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
row.GamePoints.Visible = true;
|
||||
|
||||
row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + ".";
|
||||
row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName;
|
||||
row.Name.Text = CBase.Profiles.GetPlayerName(_GameState.ResultTable[i + _PlayerTableOffset].PlayerID);
|
||||
row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString();
|
||||
row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString();
|
||||
row.SingPoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString();
|
||||
@@ -658,15 +653,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private string _GetPlayerWinString()
|
||||
{
|
||||
string s = "";
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
|
||||
for (int i = 0; i < _GameState.ResultTable.Count; i++)
|
||||
{
|
||||
if (_GameState.ResultTable[i].Position == 1)
|
||||
{
|
||||
if (i > 0)
|
||||
s += ", ";
|
||||
s += profiles[_GameState.ResultTable[i].PlayerID].PlayerName;
|
||||
s += CBase.Profiles.GetPlayerName(_GameState.ResultTable[i].PlayerID);
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
@@ -61,7 +62,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private bool _SelectingMouseActive;
|
||||
private int _OldMouseX;
|
||||
private int _OldMouseY;
|
||||
private int _SelectedPlayerNr = -1;
|
||||
private bool _ButtonsAdded;
|
||||
|
||||
private int _NumPlayer = 4;
|
||||
@@ -85,10 +85,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
_Data.ScreenNames.ProfileIDs = new List<int>();
|
||||
|
||||
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose};
|
||||
_ThemeButtons = new string[] { _ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose };
|
||||
|
||||
_Data = new SDataFromScreen();
|
||||
SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, ProfileIDs = new List<int>()};
|
||||
SFromScreenNames names = new SFromScreenNames { FadeToConfig = false, ProfileIDs = new List<int>() };
|
||||
_Data.ScreenNames = names;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
base.HandleInput(keyEvent);
|
||||
|
||||
if (keyEvent.KeyPressed) {}
|
||||
if (keyEvent.KeyPressed) { }
|
||||
else
|
||||
{
|
||||
switch (keyEvent.Key)
|
||||
@@ -147,34 +147,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
base.HandleMouse(mouseEvent);
|
||||
|
||||
/*
|
||||
//Check if LeftButton is hold and Select-Mode inactive
|
||||
if (MouseEvent.LBH && !SelectingMouseActive)
|
||||
{
|
||||
//Save mouse-coords
|
||||
OldMouseX = MouseEvent.X;
|
||||
OldMouseY = MouseEvent.Y;
|
||||
//Check if mouse if over tile
|
||||
for (int i = 0; i < PlayerChooseButtons.Count; i++)
|
||||
{
|
||||
if (PlayerChooseButtons[i].Button.Selected)
|
||||
{
|
||||
SelectedPlayerNr = PlayerChooseButtons[i].ProfileID;
|
||||
if (SelectedPlayerNr != -1)
|
||||
{
|
||||
//Activate mouse-selecting
|
||||
SelectingMouseActive = true;
|
||||
//Update of Drag/Drop-Texture
|
||||
chooseAvatarStatic.Visible = true;
|
||||
chooseAvatarStatic.Rect = PlayerChooseButtons[i].Button.Rect;
|
||||
chooseAvatarStatic.Rect.Z = -100;
|
||||
chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
|
||||
chooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//Check if LeftButton is hold and Select-Mode active
|
||||
if (mouseEvent.LBH && _SelectingMouseActive)
|
||||
{
|
||||
@@ -184,47 +156,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_OldMouseX = mouseEvent.X;
|
||||
_OldMouseY = mouseEvent.Y;
|
||||
}
|
||||
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
|
||||
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
|
||||
else if (_SelectingMouseActive)
|
||||
{
|
||||
//Check if really a player was selected
|
||||
if (_SelectedPlayerNr != -1)
|
||||
{
|
||||
//Foreach Drop-Area
|
||||
for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
//Check first, if area is "active"
|
||||
if (_PlayerDestinationButtons[i].Visible)
|
||||
{
|
||||
//Check if Mouse is in area
|
||||
if (CHelper.IsInBounds(_PlayerDestinationButtons[i].Rect, mouseEvent))
|
||||
{
|
||||
int added = -1;
|
||||
//Add Player-ID to list.
|
||||
if (_Data.ScreenNames.ProfileIDs.Count < (i + 1))
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDs.Add(_SelectedPlayerNr);
|
||||
added = _Data.ScreenNames.ProfileIDs.Count - 1;
|
||||
}
|
||||
else if (_Data.ScreenNames.ProfileIDs.Count >= (i + 1))
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDs[i] = _SelectedPlayerNr;
|
||||
added = i;
|
||||
}
|
||||
_UpdateButtonNext();
|
||||
//Update texture and name
|
||||
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[added].Texture = _ChooseAvatarStatic.Texture;
|
||||
_PlayerDestinationButtons[added].SelTexture = _ChooseAvatarStatic.Texture;
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].PlayerName;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
}
|
||||
}
|
||||
}
|
||||
_SelectedPlayerNr = -1;
|
||||
}
|
||||
//Reset variables
|
||||
_SelectingMouseActive = false;
|
||||
_ChooseAvatarStatic.Visible = false;
|
||||
@@ -313,7 +247,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]);
|
||||
b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH);
|
||||
b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW);
|
||||
CPlayerChooseButton pcb = new CPlayerChooseButton {Button = b, ProfileID = -1};
|
||||
CPlayerChooseButton pcb = new CPlayerChooseButton { Button = b, ProfileID = -1 };
|
||||
_PlayerChooseButtons.Add(pcb);
|
||||
column++;
|
||||
if (column >= _PlayerChooseButtonsNumH)
|
||||
@@ -349,12 +283,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count)
|
||||
{
|
||||
_PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose];
|
||||
_PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName;
|
||||
_PlayerChooseButtons[i].Button.Texture =
|
||||
CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
|
||||
_PlayerChooseButtons[i].Button.SelTexture =
|
||||
CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
|
||||
int id = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose];
|
||||
_PlayerChooseButtons[i].ProfileID = id;
|
||||
_PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetPlayerName(id);
|
||||
_PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerChooseButtons[i].Button.Enabled = true;
|
||||
@@ -376,17 +309,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private void _UpdateVisibleProfiles()
|
||||
{
|
||||
_PlayerChooseButtonsVisibleProfiles.Clear();
|
||||
for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
|
||||
Profile.CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
for (int i = 0; i < profiles.Length; i++)
|
||||
{
|
||||
bool visible = false;
|
||||
//Show profile only if active
|
||||
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
//Don't show profile if is selected
|
||||
visible = !_Data.ScreenNames.ProfileIDs.Contains(i);
|
||||
}
|
||||
if (profiles[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != profiles[i].ID);
|
||||
if (visible)
|
||||
_PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
_PlayerChooseButtonsVisibleProfiles.Add(profiles[i].ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,11 +342,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
if (_Data.ScreenNames.ProfileIDs[i] != -1)
|
||||
{
|
||||
int id = _Data.ScreenNames.ProfileIDs[i];
|
||||
_PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
|
||||
_PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
|
||||
_PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].PlayerName;
|
||||
_PlayerDestinationButtons[i].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetPlayerName(id);
|
||||
_PlayerDestinationButtons[i].Enabled = true;
|
||||
}
|
||||
}
|
||||
@@ -444,50 +376,44 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private bool _OnAdd()
|
||||
{
|
||||
foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons)
|
||||
foreach (CPlayerChooseButton button in _PlayerChooseButtons)
|
||||
{
|
||||
if (chooseButton.Button.Selected && chooseButton.ProfileID != -1)
|
||||
{
|
||||
if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer)
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDs.Add(chooseButton.ProfileID);
|
||||
int added = _Data.ScreenNames.ProfileIDs.Count - 1;
|
||||
_UpdateButtonNext();
|
||||
//Update texture and name
|
||||
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].PlayerName;
|
||||
_PlayerDestinationButtons[added].Enabled = true;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
_CheckInteraction();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
int id = button.ProfileID;
|
||||
if (!button.Button.Selected || id == -1 || _Data.ScreenNames.ProfileIDs.Count >= _NumPlayer)
|
||||
continue;
|
||||
_Data.ScreenNames.ProfileIDs.Add(id);
|
||||
int added = _Data.ScreenNames.ProfileIDs.Count - 1;
|
||||
_UpdateButtonNext();
|
||||
//Update texture and name
|
||||
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetPlayerName(id);
|
||||
_PlayerDestinationButtons[added].Enabled = true;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
_CheckInteraction();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool _OnRemove()
|
||||
private void _OnRemove()
|
||||
{
|
||||
for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
if (_PlayerDestinationButtons[i].Selected)
|
||||
{
|
||||
if ((i + 1) <= _Data.ScreenNames.ProfileIDs.Count)
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDs.RemoveAt(i);
|
||||
_UpdateButtonNext();
|
||||
_UpdateButtonPlayerDestination();
|
||||
_UpdateButtonPlayerChoose();
|
||||
_CheckInteraction();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!_PlayerDestinationButtons[i].Selected)
|
||||
continue;
|
||||
if ((i + 1) > _Data.ScreenNames.ProfileIDs.Count)
|
||||
continue;
|
||||
_Data.ScreenNames.ProfileIDs.RemoveAt(i);
|
||||
_UpdateButtonNext();
|
||||
_UpdateButtonPlayerDestination();
|
||||
_UpdateButtonPlayerChoose();
|
||||
_CheckInteraction();
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void _Back()
|
||||
|
||||
@@ -727,7 +727,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (players.Length < 2)
|
||||
return;
|
||||
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
CRound r = _GameData.Rounds[roundNr];
|
||||
bool isDuet = CBase.Songs.GetSongByID(r.SongID).IsDuet;
|
||||
|
||||
@@ -740,18 +739,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
//try to fill with the right data
|
||||
if (r != null)
|
||||
{
|
||||
if (_GameData.ProfileIDsTeam1[r.SingerTeam1] < profiles.Length)
|
||||
{
|
||||
players[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
|
||||
if (isDuet)
|
||||
players[0].LineNr = 0;
|
||||
}
|
||||
if (_GameData.ProfileIDsTeam2[r.SingerTeam2] < profiles.Length)
|
||||
{
|
||||
players[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
|
||||
if (isDuet)
|
||||
players[1].LineNr = 1;
|
||||
}
|
||||
players[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
|
||||
if (isDuet)
|
||||
players[0].LineNr = 0;
|
||||
|
||||
players[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
|
||||
if (isDuet)
|
||||
players[1].LineNr = 1;
|
||||
|
||||
SongSelected(r.SongID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,17 +494,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_GameData.Rounds[_SelectedField].SingerTeam1 = singerTeam1;
|
||||
_GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2;
|
||||
|
||||
_Texts[_TextNextPlayerT1].Visible = true;
|
||||
_Texts[_TextNextPlayerT2].Visible = true;
|
||||
_Texts[_TextNextPlayerNameT1].Visible = true;
|
||||
_Texts[_TextNextPlayerNameT2].Visible = true;
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
_Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName;
|
||||
_Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName;
|
||||
_Statics[_StaticAvatarT1].Visible = true;
|
||||
_Statics[_StaticAvatarT2].Visible = true;
|
||||
_Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture;
|
||||
_Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture;
|
||||
_UpdatePlayerInformation();
|
||||
|
||||
}
|
||||
int songID = 0;
|
||||
@@ -553,17 +543,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_GameData.Rounds[_SelectedField].SingerTeam2 = _GameData.Rounds[_OldSelectedField].SingerTeam2;
|
||||
_UpdateFieldContents();
|
||||
|
||||
_Texts[_TextNextPlayerT1].Visible = true;
|
||||
_Texts[_TextNextPlayerT2].Visible = true;
|
||||
_Texts[_TextNextPlayerNameT1].Visible = true;
|
||||
_Texts[_TextNextPlayerNameT2].Visible = true;
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
_Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName;
|
||||
_Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName;
|
||||
_Statics[_StaticAvatarT1].Visible = true;
|
||||
_Statics[_StaticAvatarT2].Visible = true;
|
||||
_Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture;
|
||||
_Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture;
|
||||
_UpdatePlayerInformation();
|
||||
|
||||
_UpdateJokerButtons();
|
||||
|
||||
@@ -574,6 +554,20 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_SetInteractionToButton(_Buttons[_ButtonNextRound]);
|
||||
}
|
||||
|
||||
private void _UpdatePlayerInformation()
|
||||
{
|
||||
_Texts[_TextNextPlayerT1].Visible = true;
|
||||
_Texts[_TextNextPlayerT2].Visible = true;
|
||||
_Texts[_TextNextPlayerNameT1].Visible = true;
|
||||
_Texts[_TextNextPlayerNameT2].Visible = true;
|
||||
_Texts[_TextNextPlayerNameT1].Text = CBase.Profiles.GetPlayerName(_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]);
|
||||
_Texts[_TextNextPlayerNameT2].Text = CBase.Profiles.GetPlayerName(_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]);
|
||||
_Statics[_StaticAvatarT1].Visible = true;
|
||||
_Statics[_StaticAvatarT2].Visible = true;
|
||||
_Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]);
|
||||
_Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]);
|
||||
}
|
||||
|
||||
private void _UseJoker(int teamNr, int jokerNum)
|
||||
{
|
||||
switch (jokerNum)
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_ChooseAvatarStatic.Rect = chooseButton.Button.Rect;
|
||||
_ChooseAvatarStatic.Rect.Z = -100;
|
||||
_ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
|
||||
_ChooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].Avatar.Texture;
|
||||
_ChooseAvatarStatic.Texture = CBase.Profiles.GetAvatar(_SelectedPlayerNr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[added].Texture = _ChooseAvatarStatic.Texture;
|
||||
_PlayerDestinationButtons[added].SelTexture = _ChooseAvatarStatic.Texture;
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].PlayerName;
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetPlayerName(_SelectedPlayerNr);
|
||||
_PlayerDestinationButtons[added].Enabled = true;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
@@ -414,12 +414,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count)
|
||||
{
|
||||
_PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose];
|
||||
_PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName;
|
||||
_PlayerChooseButtons[i].Button.Texture =
|
||||
CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
|
||||
_PlayerChooseButtons[i].Button.SelTexture =
|
||||
CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
|
||||
int id = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose];
|
||||
_PlayerChooseButtons[i].ProfileID = id;
|
||||
_PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetPlayerName(id);
|
||||
_PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerChooseButtons[i].Button.Enabled = true;
|
||||
@@ -441,14 +440,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private void _UpdateVisibleProfiles()
|
||||
{
|
||||
_PlayerChooseButtonsVisibleProfiles.Clear();
|
||||
for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
|
||||
Profile.CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
for (int i = 0; i < profiles.Length; i++)
|
||||
{
|
||||
bool visible = false;
|
||||
//Show profile only if active
|
||||
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
visible = _Data.ScreenNames.ProfileIDsTeam1.All(t => t != i) && _Data.ScreenNames.ProfileIDsTeam2.All(t => t != i);
|
||||
if (profiles[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
visible = _Data.ScreenNames.ProfileIDsTeam1.All(profileID => profileID != profiles[i].ID) && _Data.ScreenNames.ProfileIDsTeam2.All(profileID => profileID != profiles[i].ID);
|
||||
if (visible)
|
||||
_PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
_PlayerChooseButtonsVisibleProfiles.Add(profiles[i].ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,11 +486,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
if (_Data.ScreenNames.ProfileIDsTeam1[i] != -1)
|
||||
{
|
||||
int id = _Data.ScreenNames.ProfileIDsTeam1[i];
|
||||
_PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture;
|
||||
_PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture;
|
||||
_PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].PlayerName;
|
||||
_PlayerDestinationButtons[i].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetPlayerName(id);
|
||||
_PlayerDestinationButtons[i].Enabled = true;
|
||||
}
|
||||
}
|
||||
@@ -510,11 +511,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
if (_Data.ScreenNames.ProfileIDsTeam2[i] != -1)
|
||||
{
|
||||
int id = _Data.ScreenNames.ProfileIDsTeam2[i];
|
||||
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture;
|
||||
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture;
|
||||
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].PlayerName;
|
||||
_PlayerDestinationButtons[i].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetPlayerName(id);
|
||||
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = true;
|
||||
}
|
||||
}
|
||||
@@ -553,9 +555,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
//Update texture and name
|
||||
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].PlayerName;
|
||||
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetAvatar(chooseButton.ProfileID);
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetAvatar(chooseButton.ProfileID);
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetPlayerName(chooseButton.ProfileID);
|
||||
_PlayerDestinationButtons[added].Enabled = true;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
@@ -570,9 +572,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
//Update texture and name
|
||||
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
|
||||
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].PlayerName;
|
||||
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetAvatar(chooseButton.ProfileID);
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetAvatar(chooseButton.ProfileID);
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetPlayerName(chooseButton.ProfileID);
|
||||
_PlayerDestinationButtons[added].Enabled = true;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
|
||||
+33
-29
@@ -28,12 +28,6 @@ using VocaluxeLib.Draw;
|
||||
|
||||
namespace Vocaluxe.Base
|
||||
{
|
||||
struct SCover
|
||||
{
|
||||
public string Name;
|
||||
public CTexture Texture;
|
||||
}
|
||||
|
||||
struct SCoverTheme
|
||||
{
|
||||
public string Name;
|
||||
@@ -41,10 +35,10 @@ namespace Vocaluxe.Base
|
||||
public string File;
|
||||
}
|
||||
|
||||
abstract class CCover
|
||||
static class CCover
|
||||
{
|
||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
||||
private static readonly List<SCover> _Cover = new List<SCover>();
|
||||
private static readonly Dictionary<string, CTexture> _Cover = new Dictionary<string, CTexture>();
|
||||
private static readonly List<SCoverTheme> _CoverThemes = new List<SCoverTheme>();
|
||||
|
||||
private static readonly Object _MutexCover = new Object();
|
||||
@@ -97,13 +91,11 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
lock (_MutexCover)
|
||||
{
|
||||
foreach (SCover cover in _Cover)
|
||||
{
|
||||
if (cover.Name == name)
|
||||
return cover.Texture;
|
||||
}
|
||||
if (!_CoverExists(name))
|
||||
return NoCover;
|
||||
|
||||
return _Cover[name];
|
||||
}
|
||||
return NoCover;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -113,7 +105,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
lock (_MutexCover)
|
||||
{
|
||||
return _Cover.Any(cover => cover.Name == name);
|
||||
return _Cover.ContainsKey(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,9 +114,11 @@ namespace Vocaluxe.Base
|
||||
/// </summary>
|
||||
public static void ReloadCover()
|
||||
{
|
||||
foreach (SCover cover in _Cover)
|
||||
List<string> keys = _Cover.Keys.ToList();
|
||||
|
||||
foreach (string key in keys)
|
||||
{
|
||||
CTexture texture = cover.Texture;
|
||||
CTexture texture = _Cover[key];
|
||||
CDraw.RemoveTexture(ref texture);
|
||||
}
|
||||
_Cover.Clear();
|
||||
@@ -184,8 +178,9 @@ namespace Vocaluxe.Base
|
||||
|
||||
if (String.IsNullOrEmpty(coverTheme.Name))
|
||||
return;
|
||||
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderCover, coverTheme.File));
|
||||
|
||||
List<string> ignoreList = new List<string>();
|
||||
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderCover, coverTheme.File));
|
||||
if (xmlReader != null)
|
||||
{
|
||||
lock (_MutexCover)
|
||||
@@ -201,12 +196,12 @@ namespace Vocaluxe.Base
|
||||
string coverFilePath = Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, filePath));
|
||||
if (!File.Exists(coverFilePath))
|
||||
continue;
|
||||
SCover sk = new SCover {Name = name, Texture = CDraw.AddTexture(coverFilePath)};
|
||||
|
||||
_Cover.Add(sk);
|
||||
_AddCover(name, coverFilePath);
|
||||
ignoreList.Add(Path.GetFileName(coverFilePath));
|
||||
|
||||
if (sk.Name == "NoCover")
|
||||
NoCover = sk.Texture;
|
||||
if (name == "NoCover")
|
||||
NoCover = _Cover[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,15 +217,24 @@ namespace Vocaluxe.Base
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
string name = Path.GetFileNameWithoutExtension(file);
|
||||
if (!ignoreList.Contains(Path.GetFileName(file)))
|
||||
_AddCover(Path.GetFileNameWithoutExtension(file), file);
|
||||
}
|
||||
}
|
||||
|
||||
if (_CoverExists(name))
|
||||
continue;
|
||||
// ReSharper disable AssignNullToNotNullAttribute
|
||||
SCover sk = new SCover {Name = name, Texture = CDraw.AddTexture(file)};
|
||||
// ReSharper restore AssignNullToNotNullAttribute
|
||||
private static void _AddCover(string Name, string File)
|
||||
{
|
||||
CTexture texture = CDraw.AddTexture(File);
|
||||
|
||||
_Cover.Add(sk);
|
||||
if (!_CoverExists(Name))
|
||||
{
|
||||
_Cover.Add(Name, texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
CTexture tex = _Cover[Name];
|
||||
CDraw.RemoveTexture(ref tex);
|
||||
_Cover[Name] = texture;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,6 +561,11 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
return CProfiles.GetPlayerName(profileID, playerNum);
|
||||
}
|
||||
|
||||
public CTexture GetAvatar(int profileID)
|
||||
{
|
||||
return CProfiles.GetAvatarTextureFromProfile(profileID);
|
||||
}
|
||||
}
|
||||
|
||||
class CBrecord : IRecording
|
||||
|
||||
@@ -481,6 +481,11 @@ namespace Vocaluxe.Base
|
||||
|
||||
return _Profiles[profileID].Avatar.ID;
|
||||
}
|
||||
|
||||
public static int GetProfileID(int num)
|
||||
{
|
||||
return _Profiles[num].ID;
|
||||
}
|
||||
#endregion profile properties
|
||||
|
||||
#region avatar texture
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Vocaluxe.Base
|
||||
//TODO: Remove this when this is decided
|
||||
private const string _ProgramCodeName = "Shining Heaven";
|
||||
|
||||
public const ERevision VersionRevision = ERevision.Alpha;
|
||||
public const ERevision VersionRevision = ERevision.Beta;
|
||||
|
||||
public const int DatabaseHighscoreVersion = 2;
|
||||
public const int DatabaseCoverVersion = 1;
|
||||
|
||||
@@ -72,9 +72,9 @@ namespace Vocaluxe.Base
|
||||
Char firstLetter = Char.ToUpper(songPointer.SortString.Normalize(NormalizationForm.FormD)[0]);
|
||||
if (Char.IsLetter(firstLetter))
|
||||
{
|
||||
if (lastCategory == null || songPointer.SortString != lastCategory.Name)
|
||||
if (lastCategory == null || firstLetter.ToString() != lastCategory.Name)
|
||||
{
|
||||
lastCategory = new CCategory(songPointer.SortString);
|
||||
lastCategory = new CCategory(firstLetter.ToString());
|
||||
_Categories.Add(lastCategory);
|
||||
}
|
||||
lastCategory.Songs.Add(songPointer);
|
||||
|
||||
@@ -86,28 +86,28 @@ namespace Vocaluxe.Base
|
||||
|
||||
private int _SortByFieldArtistTitle(CSongPointer s1, CSongPointer s2)
|
||||
{
|
||||
int res = String.Compare(s1.SortString, s2.SortString, StringComparison.OrdinalIgnoreCase);
|
||||
int res = String.Compare(s1.SortString, s2.SortString, StringComparison.CurrentCultureIgnoreCase);
|
||||
if (res == 0)
|
||||
{
|
||||
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
res = String.Compare(CSongs.Songs[s1.SongID].ArtistSorting, CSongs.Songs[s2.SongID].ArtistSorting, StringComparison.OrdinalIgnoreCase);
|
||||
return res != 0 ? res : String.Compare(CSongs.Songs[s1.SongID].TitleSorting, CSongs.Songs[s2.SongID].TitleSorting, StringComparison.OrdinalIgnoreCase);
|
||||
res = String.Compare(CSongs.Songs[s1.SongID].ArtistSorting, CSongs.Songs[s2.SongID].ArtistSorting, StringComparison.CurrentCultureIgnoreCase);
|
||||
return res != 0 ? res : String.Compare(CSongs.Songs[s1.SongID].TitleSorting, CSongs.Songs[s2.SongID].TitleSorting, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
res = String.Compare(CSongs.Songs[s1.SongID].Artist, CSongs.Songs[s2.SongID].Artist, StringComparison.OrdinalIgnoreCase);
|
||||
return res != 0 ? res : String.Compare(CSongs.Songs[s1.SongID].Title, CSongs.Songs[s2.SongID].Title, StringComparison.OrdinalIgnoreCase);
|
||||
res = String.Compare(CSongs.Songs[s1.SongID].Artist, CSongs.Songs[s2.SongID].Artist, StringComparison.CurrentCultureIgnoreCase);
|
||||
return res != 0 ? res : String.Compare(CSongs.Songs[s1.SongID].Title, CSongs.Songs[s2.SongID].Title, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private int _SortByFieldTitle(CSongPointer s1, CSongPointer s2)
|
||||
{
|
||||
int res = String.Compare(s1.SortString, s2.SortString, StringComparison.OrdinalIgnoreCase);
|
||||
int res = String.Compare(s1.SortString, s2.SortString, StringComparison.CurrentCultureIgnoreCase);
|
||||
if (res == 0)
|
||||
{
|
||||
return _IgnoreArticles == EOffOn.TR_CONFIG_ON
|
||||
? String.Compare(CSongs.Songs[s1.SongID].TitleSorting, CSongs.Songs[s2.SongID].TitleSorting, StringComparison.OrdinalIgnoreCase) :
|
||||
String.Compare(CSongs.Songs[s1.SongID].Title, CSongs.Songs[s2.SongID].Title, StringComparison.OrdinalIgnoreCase);
|
||||
? String.Compare(CSongs.Songs[s1.SongID].TitleSorting, CSongs.Songs[s2.SongID].TitleSorting, StringComparison.CurrentCultureIgnoreCase) :
|
||||
String.Compare(CSongs.Songs[s1.SongID].Title, CSongs.Songs[s2.SongID].Title, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,11 @@ namespace Vocaluxe.Base.Server
|
||||
public static void Init()
|
||||
{
|
||||
_Clients = new Dictionary<int, CClientHandler>();
|
||||
_Server = new CServer(RequestHandler, CConfig.ServerPort, CConfig.ServerEncryption == EOffOn.TR_CONFIG_ON);
|
||||
if (CConfig.ServerEncryption == EOffOn.TR_CONFIG_ON)
|
||||
_Server = new CServer(RequestHandler, CConfig.ServerPort, CConfig.ServerPassword);
|
||||
else
|
||||
_Server = new CServer(RequestHandler, CConfig.ServerPort, String.Empty);
|
||||
|
||||
_Discover = new CDiscover(CConfig.ServerPort, CCommands.BroadcastKeyword);
|
||||
Controller.Init();
|
||||
}
|
||||
@@ -88,30 +92,6 @@ namespace Vocaluxe.Base.Server
|
||||
}
|
||||
|
||||
int command = BitConverter.ToInt32(message, 0);
|
||||
switch (command)
|
||||
{
|
||||
case CCommands.CommandLogin:
|
||||
SLoginData data;
|
||||
|
||||
if (!CCommands.DecodeCommandLogin(message, out data))
|
||||
answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseLoginFailed);
|
||||
else
|
||||
{
|
||||
byte[] serverPw = CCommands.SHA256.ComputeHash(Encoding.UTF8.GetBytes(CConfig.ServerPassword));
|
||||
|
||||
if (!serverPw.SequenceEqual(data.SHA256))
|
||||
answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseLoginWrongPassword);
|
||||
else
|
||||
{
|
||||
answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseLoginOK);
|
||||
_Clients[connectionID].LoggedIn = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!loggedIn)
|
||||
return answer;
|
||||
|
||||
switch (command)
|
||||
{
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
||||
|
||||
try
|
||||
{
|
||||
CAcinerella.AcSeek(_Videodecoder, (_LastDecodedTime > _SkipTime) ? -1 : 0, (Int64)(_SkipTime * 1000f));
|
||||
CAcinerella.AcSeek(_Videodecoder, -1, (Int64)(_SkipTime * 1000f));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
|
||||
// Revision
|
||||
//
|
||||
|
||||
[assembly: AssemblyVersion("0.3.0.78")]
|
||||
[assembly: AssemblyFileVersion("0.3.0.78")]
|
||||
[assembly: AssemblyVersion("0.3.0.80")]
|
||||
[assembly: AssemblyFileVersion("0.3.0.80")]
|
||||
@@ -62,7 +62,7 @@ namespace Vocaluxe.Screens
|
||||
private bool _SelectingFast;
|
||||
private int _SelectingSwitchNr = -1;
|
||||
private int _SelectingFastPlayerNr;
|
||||
private int _SelectedPlayerNr = -1;
|
||||
private int _SelectedProfileID = -1;
|
||||
private bool _AvatarsChanged;
|
||||
private bool _ProfilesChanged;
|
||||
|
||||
@@ -177,23 +177,13 @@ namespace Vocaluxe.Screens
|
||||
//Check, if a player is selected
|
||||
if (_NameSelections[_NameSelection].Selection > -1)
|
||||
{
|
||||
CProfile[] profiles = CProfiles.GetProfiles();
|
||||
_SelectedPlayerNr = _NameSelections[_NameSelection].Selection;
|
||||
if (profiles.Length <= _SelectedPlayerNr)
|
||||
_SelectedProfileID = _NameSelections[_NameSelection].Selection;
|
||||
|
||||
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
|
||||
return true;
|
||||
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[_SelectingFastPlayerNr - 1].ProfileID = profiles[_SelectedPlayerNr].ID;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingFastPlayerNr - 1] = profiles[_SelectedPlayerNr].FileName;
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingFastPlayerNr - 1]].Texture = profiles[_SelectedPlayerNr].Avatar.Texture;
|
||||
_Texts[_TextPlayer[_SelectingFastPlayerNr - 1]].Text = profiles[_SelectedPlayerNr].PlayerName;
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
//Update Tiles-List
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
_UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID);
|
||||
|
||||
_SetInteractionToButton(_Buttons[_ButtonStart]);
|
||||
}
|
||||
//Started selecting with 'P'
|
||||
@@ -242,15 +232,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
case Keys.Delete:
|
||||
//Delete profile-selection
|
||||
CGame.Players[_SelectingFastPlayerNr - 1].ProfileID = -1;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingFastPlayerNr - 1] = String.Empty;
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingFastPlayerNr - 1]].Texture = _OriginalPlayerAvatarTextures[_SelectingFastPlayerNr - 1];
|
||||
_Texts[_TextPlayer[_SelectingFastPlayerNr - 1]].Text = CProfiles.GetPlayerName(-1, _SelectingFastPlayerNr);
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
_ResetPlayerSelection(_SelectingFastPlayerNr - 1);
|
||||
//Reset all values
|
||||
_SelectingFastPlayerNr = 0;
|
||||
_SelectingKeyboardActive = false;
|
||||
@@ -365,7 +347,7 @@ namespace Vocaluxe.Screens
|
||||
base.HandleMouse(mouseEvent);
|
||||
|
||||
//Check if LeftButton is hold and Select-Mode inactive
|
||||
if (mouseEvent.LBH && _SelectedPlayerNr < 0 && !_SelectingFast)
|
||||
if (mouseEvent.LBH && _SelectedProfileID < 0 && !_SelectingFast)
|
||||
{
|
||||
//Save mouse-coords
|
||||
_OldMouseX = mouseEvent.X;
|
||||
@@ -374,8 +356,8 @@ namespace Vocaluxe.Screens
|
||||
if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
|
||||
{
|
||||
//Get player-number of tile
|
||||
_SelectedPlayerNr = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
|
||||
if (_SelectedPlayerNr != -1)
|
||||
_SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
|
||||
if (_SelectedProfileID != -1)
|
||||
{
|
||||
//Update of Drag/Drop-Texture
|
||||
CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent);
|
||||
@@ -393,7 +375,7 @@ namespace Vocaluxe.Screens
|
||||
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
|
||||
{
|
||||
_SelectingSwitchNr = i;
|
||||
_SelectedPlayerNr = CGame.Players[i].ProfileID;
|
||||
_SelectedProfileID = CGame.Players[i].ProfileID;
|
||||
//Update of Drag/Drop-Texture
|
||||
CStatic selectedPlayer = _Statics[_StaticPlayerAvatar[i]];
|
||||
_ChooseAvatarStatic.Visible = true;
|
||||
@@ -408,7 +390,7 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
|
||||
//Check if LeftButton is hold and Select-Mode active
|
||||
if (mouseEvent.LBH && _SelectedPlayerNr >= 0 && !_SelectingFast)
|
||||
if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast)
|
||||
{
|
||||
//Update coords for Drag/Drop-Texture
|
||||
_ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX;
|
||||
@@ -417,7 +399,7 @@ namespace Vocaluxe.Screens
|
||||
_OldMouseY = mouseEvent.Y;
|
||||
}
|
||||
// LeftButton isn't hold anymore, but Select-Mode is still active -> "Drop" of Avatar
|
||||
else if (_SelectedPlayerNr >= 0 && !_SelectingFast)
|
||||
else if (_SelectedProfileID >= 0 && !_SelectingFast)
|
||||
{
|
||||
//Foreach Drop-Area
|
||||
for (int i = 0; i < _StaticPlayer.Length; i++)
|
||||
@@ -430,58 +412,27 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (_SelectingSwitchNr > -1 && CGame.Players[i].ProfileID > -1)
|
||||
{
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[_SelectingSwitchNr].ProfileID = CGame.Players[i].ProfileID;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingSwitchNr] = CProfiles.GetProfileFileName(CGame.Players[i].ProfileID);
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID);
|
||||
_Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID);
|
||||
_UpdateSelectedProfile(_SelectingSwitchNr, CGame.Players[i].ProfileID);
|
||||
}
|
||||
else if (_SelectingSwitchNr > -1)
|
||||
{
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[_SelectingSwitchNr].ProfileID = -1;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingSwitchNr] = string.Empty;
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = _OriginalPlayerAvatarTextures[_SelectingSwitchNr];
|
||||
_Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.GetPlayerName(-1, (_SelectingSwitchNr + 1));
|
||||
_ResetPlayerSelection(_SelectingSwitchNr);
|
||||
}
|
||||
|
||||
CProfile[] profiles = CProfiles.GetProfiles();
|
||||
if (profiles.Length <= _SelectedPlayerNr)
|
||||
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
|
||||
return true;
|
||||
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[i].ProfileID = profiles[_SelectedPlayerNr].ID;
|
||||
//Update config for default players.
|
||||
CConfig.Players[i] = profiles[_SelectedPlayerNr].FileName;
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[i]].Texture = _ChooseAvatarStatic.Texture;
|
||||
_Texts[_TextPlayer[i]].Text = profiles[_SelectedPlayerNr].PlayerName;
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
//Update Tiles-List
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
_UpdateSelectedProfile(i, _SelectedProfileID);
|
||||
break;
|
||||
}
|
||||
//Selected player is dropped out of area
|
||||
if (_SelectingSwitchNr > -1)
|
||||
{
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[_SelectingSwitchNr].ProfileID = -1;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingSwitchNr] = string.Empty;
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = _OriginalPlayerAvatarTextures[_SelectingSwitchNr];
|
||||
_Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.GetPlayerName(-1, (_SelectingSwitchNr + 1));
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
_ResetPlayerSelection(_SelectingSwitchNr);
|
||||
}
|
||||
}
|
||||
_SelectingSwitchNr = -1;
|
||||
_SelectedPlayerNr = -1;
|
||||
_SelectedProfileID = -1;
|
||||
//Reset variables
|
||||
_ChooseAvatarStatic.Visible = false;
|
||||
}
|
||||
@@ -491,25 +442,14 @@ namespace Vocaluxe.Screens
|
||||
if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
|
||||
{
|
||||
//Get player-number of tile
|
||||
_SelectedPlayerNr = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
|
||||
if (_SelectedPlayerNr != -1)
|
||||
_SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
|
||||
if (_SelectedProfileID != -1)
|
||||
{
|
||||
CProfile[] profiles = CProfiles.GetProfiles();
|
||||
if (profiles.Length <= _SelectedPlayerNr)
|
||||
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
|
||||
return true;
|
||||
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[_SelectingFastPlayerNr - 1].ProfileID = profiles[_SelectedPlayerNr].ID;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingFastPlayerNr - 1] = profiles[_SelectedPlayerNr].FileName;
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingFastPlayerNr - 1]].Texture = profiles[_SelectedPlayerNr].Avatar.Texture;
|
||||
_Texts[_TextPlayer[_SelectingFastPlayerNr - 1]].Text = profiles[_SelectedPlayerNr].PlayerName;
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
//Update Tiles-List
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
_UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID);
|
||||
|
||||
_SelectingFastPlayerNr++;
|
||||
if (_SelectingFastPlayerNr <= CGame.NumPlayer)
|
||||
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
|
||||
@@ -534,29 +474,17 @@ namespace Vocaluxe.Screens
|
||||
|
||||
if (mouseEvent.LD && _NameSelections[_NameSelection].IsOverTile(mouseEvent) && !_SelectingFast)
|
||||
{
|
||||
_SelectedPlayerNr = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
|
||||
if (_SelectedPlayerNr > -1)
|
||||
_SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
|
||||
if (_SelectedProfileID > -1)
|
||||
{
|
||||
for (int i = 0; i < CGame.NumPlayer; i++)
|
||||
{
|
||||
if (CGame.Players[i].ProfileID == -1)
|
||||
{
|
||||
CProfile[] profiles = CProfiles.GetProfiles();
|
||||
if (profiles.Length <= _SelectedPlayerNr)
|
||||
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
|
||||
return true;
|
||||
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[i].ProfileID = profiles[_SelectedPlayerNr].ID;
|
||||
//Update config for default players.
|
||||
CConfig.Players[i] = profiles[_SelectedPlayerNr].FileName;
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[i]].Texture = profiles[_SelectedPlayerNr].Avatar.Texture;
|
||||
_Texts[_TextPlayer[i]].Text = profiles[_SelectedPlayerNr].PlayerName;
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
//Update Tiles-List
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
_UpdateSelectedProfile(i, _SelectedProfileID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -573,17 +501,7 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
|
||||
{
|
||||
CGame.Players[i].ProfileID = -1;
|
||||
//Update config for default players.
|
||||
CConfig.Players[i] = String.Empty;
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i];
|
||||
_Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(-1, i + 1);
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
//Update Tiles-List
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
_ResetPlayerSelection(i);
|
||||
exit = false;
|
||||
}
|
||||
}
|
||||
@@ -760,6 +678,22 @@ namespace Vocaluxe.Screens
|
||||
_CheckPlayers();
|
||||
}
|
||||
|
||||
private void _UpdateSelectedProfile(int playerNum, int profileId)
|
||||
{
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[playerNum].ProfileID = profileId;
|
||||
//Update config for default players.
|
||||
CConfig.Players[playerNum] = CProfiles.GetProfileFileName(profileId);
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[playerNum]].Texture = CProfiles.GetAvatarTextureFromProfile(profileId);
|
||||
_Texts[_TextPlayer[playerNum]].Text = CProfiles.GetPlayerName(profileId);
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
//Update Tiles-List
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
}
|
||||
|
||||
private void _ResetPlayerSelections()
|
||||
{
|
||||
for (int i = 0; i < CGame.NumPlayer; i++)
|
||||
@@ -775,6 +709,21 @@ namespace Vocaluxe.Screens
|
||||
CConfig.SaveConfig();
|
||||
}
|
||||
|
||||
private void _ResetPlayerSelection(int playerNum)
|
||||
{
|
||||
CGame.Players[playerNum].ProfileID = -1;
|
||||
//Update config for default players.
|
||||
CConfig.Players[playerNum] = String.Empty;
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[playerNum]].Texture = _OriginalPlayerAvatarTextures[playerNum];
|
||||
_Texts[_TextPlayer[playerNum]].Text = CProfiles.GetPlayerName(-1, playerNum + 1);
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
//Update Tiles-List
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
}
|
||||
|
||||
private void _CheckMics()
|
||||
{
|
||||
List<int> playerWithoutMicro = new List<int>();
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (_SearchActive)
|
||||
_ApplyNewSearchFilter(_SearchText + keyEvent.Unicode);
|
||||
else
|
||||
else if(!_Sso.Selection.PartyMode)
|
||||
{
|
||||
_JumpTo(keyEvent.Unicode);
|
||||
return true;
|
||||
@@ -284,26 +284,32 @@ namespace Vocaluxe.Screens
|
||||
break;
|
||||
|
||||
case Keys.D1:
|
||||
case Keys.NumPad1:
|
||||
_SelectNextRandom(0);
|
||||
break;
|
||||
|
||||
case Keys.D2:
|
||||
case Keys.NumPad2:
|
||||
_SelectNextRandom(1);
|
||||
break;
|
||||
|
||||
case Keys.D3:
|
||||
case Keys.NumPad3:
|
||||
_SelectNextRandom(2);
|
||||
break;
|
||||
|
||||
case Keys.D4:
|
||||
case Keys.NumPad4:
|
||||
_SelectNextRandom(3);
|
||||
break;
|
||||
|
||||
case Keys.D5:
|
||||
case Keys.NumPad5:
|
||||
_SelectNextRandom(4);
|
||||
break;
|
||||
|
||||
case Keys.D6:
|
||||
case Keys.NumPad6:
|
||||
_SelectNextRandom(5);
|
||||
break;
|
||||
}
|
||||
@@ -443,9 +449,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
if (mouseEvent.LD && !_Sso.Selection.PartyMode)
|
||||
{
|
||||
//TODO: Causes Bug if you select a song (e.g. with Select random song) and double click a normal button.
|
||||
//E.g. clicking to fast on Select random song starts the next random song. is this OK?
|
||||
if (CSongs.NumSongsVisible > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1)
|
||||
if (CSongs.NumSongsVisible > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1 && _SongMenus[_SongMenu].IsMouseOverActualSelection(mouseEvent))
|
||||
{
|
||||
_ToggleSongOptions(ESongOptionsView.None);
|
||||
_StartVisibleSong(_SongMenus[_SongMenu].GetActualSelection());
|
||||
@@ -1003,18 +1007,76 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
int start = 0;
|
||||
int curSelected = _SongMenus[_SongMenu].GetActualSelection();
|
||||
if (CSongs.IsInCategory)
|
||||
bool firstLevel = CConfig.Tabs == EOffOn.TR_CONFIG_OFF && CSongs.IsInCategory;
|
||||
bool secondSort = CConfig.Tabs == EOffOn.TR_CONFIG_ON &&
|
||||
(CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST ||
|
||||
CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST_LETTER ||
|
||||
CConfig.SongSorting == ESongSorting.TR_CONFIG_FOLDER ||
|
||||
CConfig.SongSorting == ESongSorting.TR_CONFIG_TITLE_LETTER);
|
||||
if (firstLevel && !secondSort)
|
||||
{
|
||||
//TODO: Check and use sorting method
|
||||
//TODO: What's to do with multiple tags?
|
||||
//How can we get current letter? I think we have to save it - Or is there a better method?
|
||||
ReadOnlyCollection<CSong> songs = CSongs.VisibleSongs;
|
||||
int ct = songs.Count;
|
||||
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
start = curSelected + 1;
|
||||
int visibleID = _FindIndex(songs, start, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
int visibleID = -1;
|
||||
switch (CConfig.SongSorting)
|
||||
{
|
||||
case ESongSorting.TR_CONFIG_ARTIST:
|
||||
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
|
||||
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
start = curSelected + 1;
|
||||
visibleID = _FindIndex(songs, start, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
break;
|
||||
|
||||
//TODO: Does this make sense? Maybe we should deactivate this for years? You could only jump between 1 and 2
|
||||
case ESongSorting.TR_CONFIG_YEAR:
|
||||
case ESongSorting.TR_CONFIG_DECADE:
|
||||
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Year.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
start = curSelected + 1;
|
||||
visibleID = _FindIndex(songs, start, element => element.Year.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
break;
|
||||
|
||||
case ESongSorting.TR_CONFIG_TITLE_LETTER:
|
||||
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Title.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
start = curSelected + 1;
|
||||
visibleID = _FindIndex(songs, start, element => element.Title.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
break;
|
||||
|
||||
case ESongSorting.TR_CONFIG_FOLDER:
|
||||
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Folder.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
start = curSelected + 1;
|
||||
visibleID = _FindIndex(songs, start, element => element.Folder.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
break;
|
||||
}
|
||||
if (visibleID > -1)
|
||||
_SongMenus[_SongMenu].SetSelectedSong(visibleID);
|
||||
}
|
||||
else
|
||||
else if (secondSort && CSongs.IsInCategory)
|
||||
{
|
||||
ReadOnlyCollection<CSong> songs = CSongs.VisibleSongs;
|
||||
int ct = songs.Count;
|
||||
int visibleID = -1;
|
||||
switch (CConfig.SongSorting)
|
||||
{
|
||||
case ESongSorting.TR_CONFIG_FOLDER:
|
||||
case ESongSorting.TR_CONFIG_TITLE_LETTER:
|
||||
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
start = curSelected + 1;
|
||||
visibleID = _FindIndex(songs, start, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
break;
|
||||
|
||||
case ESongSorting.TR_CONFIG_ARTIST:
|
||||
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
|
||||
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Title.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
start = curSelected + 1;
|
||||
visibleID = _FindIndex(songs, start, element => element.Title.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
break;
|
||||
}
|
||||
if (visibleID > -1)
|
||||
_SongMenus[_SongMenu].SetSelectedSong(visibleID);
|
||||
}
|
||||
else if(!CSongs.IsInCategory)
|
||||
{
|
||||
ReadOnlyCollection<CCategory> categories = CSongs.Categories;
|
||||
int ct = categories.Count;
|
||||
@@ -1137,6 +1199,7 @@ namespace Vocaluxe.Screens
|
||||
_Buttons[_ButtonOptionsSing].Visible = true;
|
||||
_Buttons[_ButtonOptionsPlaylist].Visible = true;
|
||||
_SetInteractionToButton(_Buttons[_ButtonOptionsSing]);
|
||||
_SetSelectSlidePlaylistToCurrentPlaylist();
|
||||
}
|
||||
|
||||
private void _ShowSongOptionsGeneral()
|
||||
@@ -1199,7 +1262,6 @@ namespace Vocaluxe.Screens
|
||||
_Playlists[_Playlist].LoadPlaylist(playlistID);
|
||||
_SongMenus[_SongMenu].SetSmallView(true);
|
||||
_Playlists[_Playlist].Visible = true;
|
||||
_SetSelectSlidePlaylistToCurrentPlaylist();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1250,7 +1312,6 @@ namespace Vocaluxe.Screens
|
||||
//Open playlist
|
||||
_OpenPlaylist(_Playlists[_Playlist].ActivePlaylistID);
|
||||
|
||||
_SetSelectSlidePlaylistToCurrentPlaylist();
|
||||
_Playlists[_Playlist].ScrollToBottom();
|
||||
}
|
||||
}
|
||||
@@ -1278,8 +1339,6 @@ namespace Vocaluxe.Screens
|
||||
//Add new playlist to select-slide
|
||||
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue(CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].PlaylistName);
|
||||
_SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValue(CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].PlaylistName);
|
||||
|
||||
_SetSelectSlidePlaylistToCurrentPlaylist();
|
||||
}
|
||||
//Add song to loaded playlist
|
||||
else
|
||||
|
||||
@@ -69,13 +69,16 @@ namespace VocaluxeLib
|
||||
public static int TryReadInt(StreamReader sr)
|
||||
{
|
||||
string value = String.Empty;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
int tmp = sr.Peek();
|
||||
//Check for ' ', ?, ?, \n, \r
|
||||
while (tmp != 32 && tmp != 19 && tmp != 16 && tmp != 13 && tmp != 10)
|
||||
//Check for ' ', ?, ?, \n, \r, E
|
||||
while (tmp != 32 && tmp != 19 && tmp != 16 && tmp != 13 && tmp != 10 && tmp != 69)
|
||||
{
|
||||
if (sr.EndOfStream)
|
||||
break;
|
||||
|
||||
char chr = (char)sr.Read();
|
||||
value += chr.ToString();
|
||||
tmp = sr.Peek();
|
||||
|
||||
@@ -197,6 +197,7 @@ namespace VocaluxeLib
|
||||
CProfile[] GetProfiles();
|
||||
EGameDifficulty GetDifficulty(int profileID);
|
||||
string GetPlayerName(int profileID, int playerNum = 0);
|
||||
CTexture GetAvatar(int profileID);
|
||||
}
|
||||
|
||||
public interface ISongs
|
||||
|
||||
@@ -44,15 +44,15 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
private class CTile
|
||||
{
|
||||
public int PlayerNr;
|
||||
public int ProfileID;
|
||||
public readonly CStatic Avatar;
|
||||
public readonly CText Name;
|
||||
|
||||
public CTile(CStatic av, CText tex, int pl)
|
||||
public CTile(CStatic av, CText tex, int pID)
|
||||
{
|
||||
Avatar = av;
|
||||
Name = tex;
|
||||
PlayerNr = pl;
|
||||
ProfileID = pID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ namespace VocaluxeLib.Menu
|
||||
case Keys.Right:
|
||||
if (_ActualSelection + 1 < _Tiles.Count)
|
||||
{
|
||||
if (_Tiles[_ActualSelection + 1].PlayerNr != -1)
|
||||
if (_Tiles[_ActualSelection + 1].ProfileID != -1)
|
||||
_ActualSelection++;
|
||||
}
|
||||
else
|
||||
@@ -316,7 +316,7 @@ namespace VocaluxeLib.Menu
|
||||
case Keys.Down:
|
||||
if (_ActualSelection + _NumW < _Tiles.Count)
|
||||
{
|
||||
if (_Tiles[_ActualSelection + _NumW].PlayerNr != -1)
|
||||
if (_Tiles[_ActualSelection + _NumW].ProfileID != -1)
|
||||
_ActualSelection += _NumW;
|
||||
}
|
||||
else
|
||||
@@ -326,11 +326,11 @@ namespace VocaluxeLib.Menu
|
||||
if (offset != Offset)
|
||||
{
|
||||
_ActualSelection = _ActualSelection - _Tiles.Count + _NumW;
|
||||
if (_Tiles[_ActualSelection].PlayerNr == -1)
|
||||
if (_Tiles[_ActualSelection].ProfileID == -1)
|
||||
{
|
||||
for (int i = _Tiles.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (_Tiles[i].PlayerNr != -1)
|
||||
if (_Tiles[i].ProfileID != -1)
|
||||
{
|
||||
_ActualSelection = i;
|
||||
break;
|
||||
@@ -412,14 +412,14 @@ namespace VocaluxeLib.Menu
|
||||
_Tiles[i].Avatar.Texture = CBase.Profiles.GetProfiles()[_VisibleProfiles[i + offset * _Tiles.Count]].Avatar.Texture;
|
||||
_Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1);
|
||||
_Tiles[i].Name.Text = CBase.Profiles.GetProfiles()[_VisibleProfiles[i + offset * _Tiles.Count]].PlayerName;
|
||||
_Tiles[i].PlayerNr = _VisibleProfiles[i + offset * _Tiles.Count];
|
||||
_Tiles[i].ProfileID = _VisibleProfiles[i + offset * _Tiles.Count];
|
||||
}
|
||||
else
|
||||
{
|
||||
_Tiles[i].Avatar.Texture = _TextureEmptyTile;
|
||||
_Tiles[i].Avatar.Color = ColorEmptyTile;
|
||||
_Tiles[i].Name.Text = "";
|
||||
_Tiles[i].PlayerNr = -1;
|
||||
_Tiles[i].ProfileID = -1;
|
||||
}
|
||||
}
|
||||
Offset = offset;
|
||||
@@ -441,7 +441,7 @@ namespace VocaluxeLib.Menu
|
||||
foreach (CTile tile in _Tiles)
|
||||
{
|
||||
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
|
||||
return tile.PlayerNr;
|
||||
return tile.ProfileID;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -515,7 +515,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
if (visible)
|
||||
_VisibleProfiles.Add(i);
|
||||
_VisibleProfiles.Add(profiles[i].ID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -199,6 +199,8 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
_Theme.Text = value;
|
||||
_Text = translation;
|
||||
if (_EditMode)
|
||||
_Text += "|";
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_SongMenu.SetActive(active);
|
||||
}
|
||||
|
||||
public bool IsMouseOverActualSelection(SMouseEvent mEvent)
|
||||
{
|
||||
return _SongMenu.IsMouseOverActualSelection(mEvent);
|
||||
}
|
||||
|
||||
public int GetSelectedSong()
|
||||
{
|
||||
return _SongMenu.GetSelectedSong();
|
||||
|
||||
@@ -518,6 +518,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Active = active;
|
||||
}
|
||||
|
||||
public virtual bool IsMouseOverActualSelection(SMouseEvent mEvent) { return false; }
|
||||
|
||||
public virtual int GetSelectedSong()
|
||||
{
|
||||
return -1;
|
||||
@@ -625,6 +627,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (Math.Abs(startposition) < 0.001)
|
||||
startposition = CBase.Sound.GetLength(stream) / 4f;
|
||||
|
||||
if (startposition >= 0.5f)
|
||||
startposition -= 0.5f;
|
||||
|
||||
CBase.Sound.SetPosition(stream, startposition);
|
||||
CBase.Sound.Play(stream);
|
||||
CBase.Sound.Fade(stream, 100f, 3f);
|
||||
|
||||
@@ -485,6 +485,15 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
return _Locked;
|
||||
}
|
||||
|
||||
public override bool IsMouseOverActualSelection(SMouseEvent mEvent)
|
||||
{
|
||||
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);
|
||||
return CHelper.IsInBounds(rect, mEvent);
|
||||
}
|
||||
|
||||
public override CStatic GetSelectedSongCover()
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
|
||||
@@ -40,6 +40,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
bool IsActive();
|
||||
void SetActive(bool active);
|
||||
|
||||
bool IsMouseOverActualSelection(SMouseEvent mEvent);
|
||||
|
||||
int GetSelectedCategory();
|
||||
void SetSelectedCategory(int categoryNr);
|
||||
int GetActualSelection();
|
||||
|
||||
Reference in new issue
Block a user