本文整理汇总了C#中Phase.AddConditional方法的典型用法代码示例。如果您正苦于以下问题:C# Phase.AddConditional方法的具体用法?C# Phase.AddConditional怎么用?C# Phase.AddConditional使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phase
的用法示例。
在下文中一共展示了Phase.AddConditional方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadSceneFile
public static void ReadSceneFile(TextAsset file)
{
Manager = PhaseManager.Get();
CurrentPhase = new Phase();
Regex regex = new Regex(@"\t*");
string temp = regex.Replace(file.text, "");
regex = new Regex(@" {2,}");
temp = regex.Replace(temp, " ");
regex = new Regex(@" *= *");
temp = regex.Replace(temp, "=");
regex = new Regex(Environment.NewLine + @"{2,}");
temp = regex.Replace(temp, "");
StreamWriter newFile = new StreamWriter(Application.dataPath + @"\ParseFix.txt");
newFile.Write(temp);
newFile.Close();
StreamReader fileReader = new StreamReader(Application.dataPath + @"\ParseFix.txt");
while (!fileReader.EndOfStream)
{
++CurrentLine;
Debug.Log("Line #" + CurrentLine);
string line = fileReader.ReadLine();
if(String.IsNullOrEmpty(line) || line.Trim().Length == 0)
{
Debug.Log("Skipping: Empty Line");
continue;
}
if (line.TrimStart().Substring(0, 2) == PP.COMMENT_LINE)
{
Debug.Log("Skipping: Comment Line");
continue;
}
if (line == PP.PHASE_CLOSE)
{
Debug.Log("Phase Ended");
Manager.AddPhase(CurrentPhase);
CurrentPhase = null;
}
else
{
switch (line.GetWord(0, " "))
{
case PP.PHASE_OPEN:
case PP.GLOBAL_OPEN:
Debug.Log("Beginning New Phase");
CurrentPhase = new Phase();
break;
case PP.GLOBAL_CLOSE:
Manager.AddGlobalPhase(CurrentPhase);
CurrentPhase = null;
break;
case PP.CUSTOM_EVENT_OPEN:
string eName = line.GetWord(1, " ");
eName = eName.SplitTextDelimited("=")[1];
// Since Events can have prerequisite
string preReqCheck = line.GetLastWord(" ");
Debug.Log("PreReqs for " + eName + ": " + preReqCheck);
if (preReqCheck.SplitTextDelimited("=")[0] == PP.PARAM_EVENT_REQ)
{
Debug.Log("PreReqs found");
CreateCustomEvent(ref fileReader, eName, Int32.Parse(preReqCheck.SplitTextDelimited("=")[1]));
}
else
{
Debug.Log("No PreReqs found, defaulting.");
CreateCustomEvent(ref fileReader, eName);
}
break;
case PP.EVENT_BEGIN_PHASE:
case PP.EVENT_ENTER_TRIGGER:
case PP.EVENT_ITEM_PICKUP:
case PP.EVENT_TIMER_COMPLETED:
Debug.Log("Creating Event Watcher");
CreateEventWatcher(line);
break;
case PP.EVENT_MATH_CONDITION:
CurrentPhase.AddConditional(CreateConditional(line));
break;
case PP.OBJECT_TIMER:
case PP.OBJECT_VARIABLE:
case PP.OBJECT_SOUND:
Debug.Log("Creating Object");
CreateObject(line);
break;
case PP.PHASE_CLOSE:
break;
default:
Debug.Log("Couldn't parse line: " + line);
break;
}
}
}
//.........这里部分代码省略.........