IEnumerator CustomActionThread(ScenarioRTL.Action act) { while (!act.Logic()) { yield return(0); } }
string CustomAction(string param) { param = param.Trim(); if (string.IsNullOrEmpty(param)) { return("parameters needed"); } string[] ss = param.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries); string classname = ss[0]; ScenarioRTL.Action act = ScenarioRTL.Asm.CreateActionInstance(classname); ScenarioRTL.IO.StatementRaw raw = new ScenarioRTL.IO.StatementRaw(); if (act == null) { return("cannot create statement"); } raw.classname = classname; raw.order = 0; raw.parameters = new ScenarioRTL.IO.ParamRaw(ss.Length - 1); for (int i = 1; i < ss.Length; ++i) { string paramstr = ss[i]; string[] nv = paramstr.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (nv.Length == 2) { raw.parameters.Set(i - 1, nv[0], nv[1]); } else { raw.parameters.Set(i - 1, "null", "0"); } } act.Init(null, raw); StartCoroutine(CustomActionThread(act)); return("[" + classname + "] is running"); }