Fix bug with avatar not having filename
Use a nicer name for the avatar chooser
This commit is contained in:
1 parent
0a59b250d3
commit
6686c15864
2 files changed
+16
-8
No files matched your search
@@ -449,7 +449,7 @@ namespace Vocaluxe.Screens
|
|||||||
foreach (CAvatar avatar in avatars)
|
foreach (CAvatar avatar in avatars)
|
||||||
{
|
{
|
||||||
_SelectSlides[_SelectSlideAvatars].AddValue(
|
_SelectSlides[_SelectSlideAvatars].AddValue(
|
||||||
Path.GetFileName(avatar.FileName),
|
avatar.GetDisplayName(),
|
||||||
null,
|
null,
|
||||||
avatar.ID,
|
avatar.ID,
|
||||||
-1);
|
-1);
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using VocaluxeLib.Draw;
|
using VocaluxeLib.Draw;
|
||||||
|
|
||||||
namespace VocaluxeLib.Profile
|
namespace VocaluxeLib.Profile
|
||||||
@@ -22,8 +24,9 @@ namespace VocaluxeLib.Profile
|
|||||||
public class CAvatar
|
public class CAvatar
|
||||||
{
|
{
|
||||||
public int ID;
|
public int ID;
|
||||||
private string _FileName = "";
|
private readonly string _FileName = "";
|
||||||
private CTexture _Texture;
|
private CTexture _Texture;
|
||||||
|
private const int _MaxNameLen = 12;
|
||||||
|
|
||||||
public CTexture Texture
|
public CTexture Texture
|
||||||
{
|
{
|
||||||
@@ -42,13 +45,9 @@ namespace VocaluxeLib.Profile
|
|||||||
|
|
||||||
private CAvatar(CTexture texture, string fileName, int id = -1)
|
private CAvatar(CTexture texture, string fileName, int id = -1)
|
||||||
{
|
{
|
||||||
ID = id;
|
_Texture = texture;
|
||||||
}
|
|
||||||
|
|
||||||
public bool LoadFromFile(string fileName)
|
|
||||||
{
|
|
||||||
_FileName = fileName;
|
_FileName = fileName;
|
||||||
return Reload();
|
ID = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Reload()
|
public bool Reload()
|
||||||
@@ -63,5 +62,14 @@ namespace VocaluxeLib.Profile
|
|||||||
{
|
{
|
||||||
CBase.Drawing.RemoveTexture(ref _Texture);
|
CBase.Drawing.RemoveTexture(ref _Texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetDisplayName()
|
||||||
|
{
|
||||||
|
string name = Path.GetFileNameWithoutExtension(_FileName);
|
||||||
|
Debug.Assert(name != null);
|
||||||
|
if (name.Length > _MaxNameLen)
|
||||||
|
name = name.Substring(0, _MaxNameLen);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user