private object CastAndTranslateValueToSet(CustomVariable cv, object valueToSetTo)
{
if (cv.Type == "Color")
{
if (valueToSetTo == null || string.IsNullOrEmpty(valueToSetTo as string))
{
}
Type colorType = typeof(Color);
PropertyInfo propertyInfo = colorType.GetProperty((string)valueToSetTo, BindingFlags.Public | BindingFlags.Static);
Color colorToSet = (Color)(propertyInfo.GetValue(null, null));
return colorToSet;
}
else if (cv.Type == "string" && valueToSetTo is string)
{
if (cv.GetIsFile())
{
// do noting
}
else if (cv != null && cv.GetIsAnimationChain())
{
// do nothing
}
else if (LocalizationManager.HasDatabase)
{
valueToSetTo = LocalizationManager.Translate((string)valueToSetTo);
}
//else if (namedObject.SourceType == SourceType.File)
//{
// if (instructionSave.Member != "CurrentChain")
// {
// value = "LocalizationManager.Translate(" + value + ")";
// }
//}
//else if (namedObject.SourceType == SourceType.Entity)
//{
// EntitySave entitySave = ObjectFinder.GetEntitySave(namedObject.SourceClassType);
// if (entitySave != null)
// {
// CustomVariable variableInEntity = entitySave.GetCustomVariable(instructionSave.Member);
// if (variableInEntity == null || variableInEntity.IsAnimationChain == false)
// {
// value = "LocalizationManager.Translate(" + value + ")";
// }
// }
//}
return valueToSetTo;
}
else
{
return valueToSetTo;
}
}