internal bool Evaluate(TagData inData, object inContext, out TagEventData outEvent) { outEvent = new TagEventData(m_EventId); outEvent.IsClosing = inData.IsClosing(); switch (m_DataMode) { case DataMode.String: { if (inData.Data.IsEmpty) { outEvent.StringArgument = m_DefaultString; } else { outEvent.StringArgument = inData.Data; } break; } case DataMode.Float: { float arg; if (!StringParser.TryParseFloat(inData.Data, out arg)) { arg = m_DefaultValue.AsFloat(); } outEvent.Argument0 = arg; break; } case DataMode.Bool: { bool arg; if (!StringParser.TryParseBool(inData.Data, out arg)) { arg = m_DefaultValue.AsBool(); } outEvent.Argument0 = arg; break; } case DataMode.StringHash: { StringHash32 arg; if (!StringHash32.TryParse(inData.Data, out arg)) { arg = m_DefaultValue.AsStringHash(); } outEvent.Argument0 = arg; break; } } if (m_HandleClosing && outEvent.IsClosing) { outEvent.Type = m_EventClosingId; if (m_EventClosingDelegate != null) { m_EventClosingDelegate(inData, inContext, ref outEvent); } return(true); } else { if (m_EventDelegate != null) { m_EventDelegate(inData, inContext, ref outEvent); } return(true); } }
/// <summary> /// Returns the first StringHash32 argument. /// </summary> public StringHash32 GetStringHash() { return(Argument0.AsStringHash()); }