//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using bs;
namespace bs.Editor
{
/** @addtogroup GUI-Editor
* @{
*/
///
/// Helper object that creates a localized string in the editor-specific string table. Allows easier separation between
/// editor and game string tables.
///
internal class LocEdString
{
// Note: This must match C++ HEString::ENGINE_STRING_TABLE_ID
private const int EDITOR_STRING_TABLE_ID = 30000;
private LocString internalString;
///
/// Creates a new empty localized string in the editor string table.
///
public LocEdString()
{
internalString = new LocString(EDITOR_STRING_TABLE_ID);
}
///
/// Creates a new localized string with the specified identifier in the editor string table. If the identifier
/// doesn't previously exist in the string table, identifier value will also be used for initializing the default
/// language version of the string.
///
/// String you can use for later referencing the localized string.
public LocEdString(string identifier)
{
internalString = new LocString(identifier, EDITOR_STRING_TABLE_ID);
}
///
/// Implicitly converts between an editor localized string and a normal localized string. The normal localized
/// string will still internally reference the editor string table, making it equivalent to the original editor
/// string aside from being different types.
///
/// Editor localized string to convert to normal localized string.
/// Normal localized string referencing the editor string table.
public static implicit operator LocString(LocEdString edString)
{
return edString.internalString;
}
///
/// Implicity converts between an editor localized string and GUI contents.
///
/// Editor localized string to convert.
/// GUI contents object that may be used for initializing various GUI elements.
public static implicit operator GUIContent(LocEdString edString)
{
return new GUIContent(edString.internalString);
}
}
/** @} */
}