本文整理汇总了C#中TriggerType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TriggerType.ToString方法的具体用法?C# TriggerType.ToString怎么用?C# TriggerType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriggerType
的用法示例。
在下文中一共展示了TriggerType.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTrigger
private static BaseTrigger AddTrigger(string name, TriggerType type)
{
if (name == null || type.ToString() == null)
{
Log.Instance.Error("{0}/ChatBot (unknown trigger): Trigger not defined correctly. Not loading...", name);
return null;
}
BaseTrigger trigger = triggerFactory.CreateTrigger(type, name);
try
{
Log.Instance.Debug(username + "/ChatBot: Testing onload for {0} trigger {1}", type, name);
if (trigger != null && trigger.OnLoad())
{
Log.Instance.Silly(username + "/ChatBot: onload success for {0} trigger {1}", type, name);
triggers.Add(trigger);
return trigger;
}
else if (trigger != null)
{
Log.Instance.Error(username + "/ChatBot: Error loading {0} trigger {1}", type, name);
return null;
}
}
catch (Exception e)
{
Log.Instance.Error(username + "/ChatBot: Error loading {0} trigger {1}: {2}", type, name, e.StackTrace);
return null;
}
return null;
}
示例2: GeneralTrigger
public GeneralTrigger(BsonDocument doc, TriggerType triggerType) {
TriggerOn = new List<string>();
And = new List<string>();
NotOn = new List<string>();
MessageOverrideAsString = new List<string>();
if (doc != null && doc.ElementCount > 0 && doc.Contains("TriggerOn")) {
foreach (var on in doc["TriggerOn"].AsBsonArray) {
TriggerOn.Add(on.AsString);
}
foreach (var and in doc["And"].AsBsonArray) {
And.Add(and.AsString);
}
foreach (var not in doc["NoTriggerOn"].AsBsonArray) {
NotOn.Add(not.AsString);
}
AutoProcess = doc.Contains("AutoProcess") ? doc["AutoProcess"].AsBoolean : false;
ChanceToTrigger = doc["ChanceToTrigger"].AsInt32;
script = ScriptFactory.GetScript(doc["ScriptID"].AsString, triggerType.ToString());
foreach (var overrides in doc["Overrides"].AsBsonArray) {
MessageOverrideAsString.Add(overrides.AsString);
}
Type = doc["Type"].AsString;
TriggerId = doc["Id"].AsString;
}
}
示例3: CreateTrigger
public BaseTrigger CreateTrigger(TriggerType type, string name)
{
if(TriggerTypes.ContainsKey(type.ToString()))
{
return new BaseTrigger(type, name);
}
return null;
}
示例4: SetTrigger
public void SetTrigger(TriggerType type)
{
anim.SetTrigger(type.ToString());
}