本文整理汇总了C#中Scenario.AddTestCase方法的典型用法代码示例。如果您正苦于以下问题:C# Scenario.AddTestCase方法的具体用法?C# Scenario.AddTestCase怎么用?C# Scenario.AddTestCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scenario
的用法示例。
在下文中一共展示了Scenario.AddTestCase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadScenario
/// <summary>
/// Loads a scenario from the given XML-File.
/// Be sure that the file exists, is well formed and is in to corresponding directory.
/// </summary>
/// <returns></returns>
public Scenario LoadScenario()
{
Scenario scenario = new Scenario();
try
{
XmlDocument doc = new XmlDocument();
doc.Load(getCurrentInputFileName());
XmlElement root = doc.DocumentElement;
XmlNodeList list = root.GetElementsByTagName("TestCase");
for (int i = 0; i < list.Count; i++)
{
TestCase t = new TestCase();
t.id=Convert.ToInt32(list[i].Attributes["id"].Value);
t.numElements = Convert.ToInt32(list[i].Attributes["numElements"].Value);
t.targetElement = Convert.ToInt32(list[i].Attributes["targetElement"].Value);
t.phoneIntensity[0]=Convert.ToInt32(list[i].Attributes["phoneIntensityMin"].Value);
t.phoneIntensity[1]=Convert.ToInt32(list[i].Attributes["phoneIntensityMax"].Value);
t.vibroIntensity[0]=Convert.ToInt32(list[i].Attributes["vibroIntensityMin"].Value);
t.vibroIntensity[1]=Convert.ToInt32(list[i].Attributes["vibroIntensityMax"].Value);
Vector3 scale = new Vector3();
scale.x = (list[i].Attributes["scaleX"] != null) ? (float)Convert.ToDouble(list[i].Attributes["scaleX"].Value) : 40.0f;
scale.y = (list[i].Attributes["scaleY"] != null) ? (float)Convert.ToDouble(list[i].Attributes["scaleY"].Value) : 10.0f;
scale.z = (list[i].Attributes["scaleZ"] != null) ? (float)Convert.ToDouble(list[i].Attributes["scaleZ"].Value) : 20.0f;
t.sceneScale = scale;
scenario.AddTestCase(t);
}
if (list.Count == 0)
{
UIController.Instance.ReportError(getCurrentInputFileName() + ": No TestCases found!");
}
}
catch (Exception ex)
{
Debug.Log("Xml Loading: " + ex.ToString());
UIController.Instance.ReportError(getCurrentInputFileName() + " not found or is invalid! Please make sure that the corresponding file exists and is well formed!");
}
return scenario;
}