本文整理汇总了C#中Server.Engines.XmlSpawner2.TriggerObject类的典型用法代码示例。如果您正苦于以下问题:C# TriggerObject类的具体用法?C# TriggerObject怎么用?C# TriggerObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TriggerObject类属于Server.Engines.XmlSpawner2命名空间,在下文中一共展示了TriggerObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PausedUberScript
public PausedUberScript(TriggerObject trigObject, bool triggersOnly, double milliseconds)
: base(TimeSpan.FromMilliseconds(milliseconds))
{
TriggersOnly = triggersOnly;
TrigObject = trigObject;
ExpectedEndTime = DateTime.UtcNow + TimeSpan.FromMilliseconds(milliseconds);
Start();
}
示例2: Process
override public ProcessResult Process(ProcessResult lastSiblingResult, TriggerObject trigObject)
{
trigObject.CurrentNodeExecutionChain.Add(this);
ProcessResult result = UserDefinedFunction.Execute(trigObject);
trigObject.CurrentNodeExecutionChain.Remove(this);
return result;
}
示例3: Process
public override ProcessResult Process(ProcessResult lastSiblingResult, TriggerObject trigObject)
{
if (InfiniteLoopRisk == true)
throw new UberScriptException("Line " + LineNumber + ": " + base.ScriptString + "\nAttempted to execute ForLoop with InfiniteLoop risk! Skipping for loop!");
int maxLoopNumber = 10000;
int loopCount = 0;
// first try to execute the initial statement
if (InitialStatement != null)
{
InitialStatement.Process(ProcessResult.None, trigObject);
}
Object result = ConditionalMathTree.Calculate(trigObject);
while (result is bool && (bool)result)
{
//execute the child code
ProcessResult lastResult = ProcessChildren(trigObject);
if (lastResult == ProcessResult.Break) // exit out of this for loop
return ProcessResult.None;
if (lastResult == ProcessResult.Return || lastResult == ProcessResult.ReturnOverride)
{
return lastResult;
}
// ProcessResult.Continue--just keep going
//execute the next part of the loop (often ints.i++)
try
{
RepeatedStatement.Process(ProcessResult.None, trigObject);
}
catch (Exception e)
{
throw new UberScriptException("Line " + LineNumber + ": " + base.ScriptString + "\nForLoop Repeated Statement execution error: ", e);
}
try
{
// see whether we still meet our condition
result = ConditionalMathTree.Calculate(trigObject);
}
catch (Exception e)
{
throw new UberScriptException("Line " + LineNumber + ": " + base.ScriptString + "\nForLoop Conditional Statement execution error: ", e);
}
loopCount++;
if (loopCount > maxLoopNumber)
{
InfiniteLoopRisk = true;
throw new UberScriptException("Attempted to execute ForLoop with InfiniteLoop risk! Skipping for loop!");
}
}
return ProcessResult.None;
}
示例4: GetStringValue
public static string GetStringValue(TriggerObject trigObject, object o, string name, out Type ptype)
{
object value = GetObject(trigObject, o, name, out ptype);
string ToString;
if (value == null)
ToString = "null";
else
ToString = value.ToString();
return ToString;
}
示例5: OnTarget
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Script == null)
{
return;
}
TriggerObject trigObject = new TriggerObject {
This = m_Source,
TrigMob = @from,
TrigName = TriggerName.onTarget,
Targeted = targeted
};
m_Script.Execute(trigObject, true);
}
示例6: Dupe
public TriggerObject Dupe()
{
TriggerObject output = new TriggerObject();
output.TrigName = TrigName;
output.This = This;
output.TrigMob = TrigMob;
output.TrigItem = TrigItem;
output.Spell = Spell;
output.Damage = Damage;
output.Speech = Speech;
output.Targeted = Targeted;
output.SkillName = SkillName;
output.SkillValue = SkillValue;
output.Script = Script;
output.GumpID = GumpID;
foreach (KeyValuePair<string, int> pair in ints) { output.ints.Add(pair.Key, pair.Value); }
foreach (KeyValuePair<string, string> pair in strings) { output.strings.Add(pair.Key, pair.Value); }
foreach (KeyValuePair<string, double> pair in doubles) { output.doubles.Add(pair.Key, pair.Value); }
foreach (KeyValuePair<string, object> pair in objs) { output.objs.Add(pair.Key, pair.Value); }
return output;
}
示例7: Process
public override ProcessResult Process(ProcessResult lastSiblingResult, TriggerObject trigObject)
{
ProcessResult lastResult = ProcessResult.None;
// NOTE: I commented out the try here because
if (trigObject.PausedNodeChain != null)
{
if (trigObject.PausedNodeChain.Count == 1 && trigObject.PausedNodeChain.Peek() == this)
{
trigObject.PausedNodeChain = null;
}
else
{
// it was paused inside of the spawnentry statement, so just keep going
return ProcessChildren(trigObject);
}
}
lastResult = ProcessChildren(trigObject);
if (lastResult == ProcessResult.Return || lastResult == ProcessResult.ReturnOverride || lastResult == ProcessResult.Break || lastResult == ProcessResult.Continue)
{
return lastResult;
}
return ProcessResult.None;
}
示例8: GetName
public string GetName(TriggerObject trigObject)
{
object output = m_Name.Calculate(trigObject);
if (output == null)
{
return "null";
}
return output.ToString();
}
示例9: GenerateGump
public override Rectangle2D GenerateGump(TriggerObject trigObject, UberScriptGump gump, int originX, int originY)
{
if (m_Condition != null && GetCondition(trigObject) == false)
{
return new Rectangle2D();
}
gump.AddLabel(originX + GetX(trigObject), originY + GetY(trigObject), GetHue(trigObject), GetLabel(trigObject));
return new Rectangle2D(GetX(trigObject), GetY(trigObject), GetWidth(trigObject), GetHeight(trigObject));
}
示例10: GetWidth
public override int GetWidth(TriggerObject trigObject)
{
return m_Condition != null && GetCondition(trigObject) == false ? 0 : GetWidthFromString(GetLabel(trigObject));
}
示例11: MathTree
protected MathTree m_Height = new MathTree(null, "10"); // 44 is default tile size
public override int GetHeight(TriggerObject trigObject)
{
if (m_Condition != null && GetCondition(trigObject) == false)
{
return 0;
}
object output = m_Height.Calculate(trigObject);
if (!(output is int))
{
throw new UberScriptException(
GetType() + " GetHeight did not resolve to an integer: " + output + " from " + m_Height.ScriptString);
}
return (int)output;
}
示例12: GetLoopFunction
public string GetLoopFunction(TriggerObject trigObject)
{
object output = m_LoopFunction.Calculate(trigObject);
if (output == null)
{
return null;
}
return output.ToString();
}
示例13: GetHeight
public override int GetHeight(TriggerObject trigObject)
{
if (m_Condition != null && GetCondition(trigObject) == false)
{
return 0;
}
if (FitToContents)
{
int padding = GetPadding(trigObject);
int height = 0;
int verticalGap = GetVerticalGap(trigObject);
int count = 0;
foreach (UberGumpElement child in Children)
{
int childHeight = child.GetHeight(trigObject);
int childY = child.GetY(trigObject);
// list--assume they are all as tall as the first one
if (child is UberGumpList)
{
UberGumpList list = (UberGumpList)child;
ArrayList actualList = list.GetListSource(trigObject);
if (actualList != null)
{
if (actualList.Count > 1)
{
height += (childHeight) * (actualList.Count - 1);
}
}
}
height += childHeight + childY;
count += 1;
}
return height + padding * 2 + ((count - 1) * verticalGap);
}
object output = m_Height.Calculate(trigObject);
if (!(output is int))
{
throw new UberScriptException(
GetType() + " GetHeight did not resolve to an integer: " + output + " from " + m_Width.ScriptString);
}
return (int)output;
}
示例14: GetCondition
public bool GetCondition(TriggerObject trigObject)
{
object output = m_Condition.Calculate(trigObject);
if (!(output is bool))
{
throw new UberScriptException(
GetType() + " GetCondition did not resolve to an bool: " + output + " from " + m_Condition.ScriptString);
}
return (bool)output;
}
示例15: GetPressedID
public int GetPressedID(TriggerObject trigObject)
{
object output = m_PressedID.Calculate(trigObject);
if (!(output is int))
{
throw new UberScriptException(
GetType() + " GetPressedID did not resolve to an integer: " + output + " from " + m_PressedID.ScriptString);
}
return (int)output;
}