本文整理汇总了C#中Timer.setShowTime方法的典型用法代码示例。如果您正苦于以下问题:C# Timer.setShowTime方法的具体用法?C# Timer.setShowTime怎么用?C# Timer.setShowTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer.setShowTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: startElement
/*
* (non-Javadoc)
*
* @see es.eucm.eadventure.engine.loader.subparsers.SubParser#startElement(java.lang.string, java.lang.string,
* java.lang.string, org.xml.sax.Attributes)
*/
public override void startElement(string namespaceURI, string sName, string qName, Dictionary<string, string> attrs)
{
// If no element is being subparsed
if (subParsing == SUBPARSING_NONE)
{
// If it is a timer tag, create a new timer with its time
if (qName.Equals("timer"))
{
string time = "";
bool usesEndCondition = true;
bool runsInLoop = true;
bool multipleStarts = true;
bool countDown = false, showWhenStopped = false, showTime = false;
string displayName = "timer";
foreach (KeyValuePair<string, string> entry in attrs)
{
if (entry.Key.Equals("time"))
time = entry.Value.ToString();
if (entry.Key.Equals("usesEndCondition"))
usesEndCondition = entry.Value.ToString().Equals("yes");
if (entry.Key.Equals("runsInLoop"))
runsInLoop = entry.Value.ToString().Equals("yes");
if (entry.Key.Equals("multipleStarts"))
multipleStarts = entry.Value.ToString().Equals("yes");
if (entry.Key.Equals("showTime"))
showTime = entry.Value.ToString().Equals("yes");
if (entry.Key.Equals("displayName"))
displayName = entry.Value.ToString();
if (entry.Key.Equals("countDown"))
countDown = entry.Value.ToString().Equals("yes");
if (entry.Key.Equals("showWhenStopped"))
showWhenStopped = entry.Value.ToString().Equals("yes");
}
timer = new Timer(long.Parse(time));
timer.setRunsInLoop(runsInLoop);
timer.setUsesEndCondition(usesEndCondition);
timer.setMultipleStarts(multipleStarts);
timer.setShowTime(showTime);
timer.setDisplayName(displayName);
timer.setCountDown(countDown);
timer.setShowWhenStopped(showWhenStopped);
}
// If it is a condition tag, create the new condition, the subparser and switch the state
else if (qName.Equals("init-condition") || qName.Equals("end-condition"))
{
currentConditions = new Conditions();
subParser = new ConditionSubParser(currentConditions, chapter);
subParsing = SUBPARSING_CONDITION;
}
// If it is a effect tag, create the new effect, the subparser and switch the state
else if (qName.Equals("effect") || qName.Equals("post-effect"))
{
currentEffects = new Effects();
subParser = new EffectSubParser(currentEffects, chapter);
subParsing = SUBPARSING_EFFECT;
}
}
// If it is reading an effect or a condition, spread the call
if (subParsing != SUBPARSING_NONE)
{
subParser.startElement(namespaceURI, sName, qName, attrs);
}
}
示例2: ParseElement
public override void ParseElement(XmlElement element)
{
XmlNodeList
initscondition = element.SelectNodes("init-condition"),
endscondition = element.SelectNodes("end-condition"),
effects = element.SelectNodes("effect"),
postseffect = element.SelectNodes("post-effect");
string tmpArgVal;
string time = "";
bool usesEndCondition = true;
bool runsInLoop = true;
bool multipleStarts = true;
bool countDown = false, showWhenStopped = false, showTime = false;
string displayName = "timer";
tmpArgVal = element.GetAttribute("time");
if (!string.IsNullOrEmpty(tmpArgVal))
{
time = tmpArgVal;
}
tmpArgVal = element.GetAttribute("usesEndCondition");
if (!string.IsNullOrEmpty(tmpArgVal))
{
usesEndCondition = tmpArgVal.Equals("yes");
}
tmpArgVal = element.GetAttribute("runsInLoop");
if (!string.IsNullOrEmpty(tmpArgVal))
{
runsInLoop = tmpArgVal.Equals("yes");
}
tmpArgVal = element.GetAttribute("multipleStarts");
if (!string.IsNullOrEmpty(tmpArgVal))
{
multipleStarts = tmpArgVal.Equals("yes");
}
tmpArgVal = element.GetAttribute("showTime");
if (!string.IsNullOrEmpty(tmpArgVal))
{
showTime = tmpArgVal.Equals("yes");
}
tmpArgVal = element.GetAttribute("displayName");
if (!string.IsNullOrEmpty(tmpArgVal))
{
displayName = tmpArgVal;
}
tmpArgVal = element.GetAttribute("countDown");
if (!string.IsNullOrEmpty(tmpArgVal))
{
countDown = tmpArgVal.Equals("yes");
}
tmpArgVal = element.GetAttribute("showWhenStopped");
if (!string.IsNullOrEmpty(tmpArgVal))
{
showWhenStopped = tmpArgVal.Equals("yes");
}
timer = new Timer(long.Parse(time));
timer.setRunsInLoop(runsInLoop);
timer.setUsesEndCondition(usesEndCondition);
timer.setMultipleStarts(multipleStarts);
timer.setShowTime(showTime);
timer.setDisplayName(displayName);
timer.setCountDown(countDown);
timer.setShowWhenStopped(showWhenStopped);
if (element.SelectSingleNode("documentation") != null)
timer.setDocumentation(element.SelectSingleNode("documentation").InnerText);
foreach (XmlElement el in initscondition)
{
currentConditions = new Conditions();
new ConditionSubParser_(currentConditions, chapter).ParseElement(el);
timer.setInitCond(currentConditions);
}
foreach (XmlElement el in endscondition)
{
currentConditions = new Conditions();
new ConditionSubParser_(currentConditions, chapter).ParseElement(el);
timer.setEndCond(currentConditions);
}
foreach (XmlElement el in effects)
{
currentEffects = new Effects();
new EffectSubParser_(currentEffects, chapter).ParseElement(el);
timer.setEffects(currentEffects);
}
foreach (XmlElement el in postseffect)
{
currentEffects = new Effects();
new EffectSubParser_(currentEffects, chapter).ParseElement(el);
timer.setPostEffects(currentEffects);
}
chapter.addTimer(timer);
}