public void FixupParameters(idWindow window) { int c = _list.Count; for (int i = 0; i < c; i++) { idGuiScript script = _list[i]; script.FixupParameters(window); if (script.IfList != null) { script.IfList.FixupParameters(window); } if (script.ElseList != null) { script.ElseList.FixupParameters(window); } } }
public void Append(idGuiScript script) { _list.Add(script); }
public void Append(idGuiScript script) { _list.Add(script); }
private bool ParseScript(idScriptParser parser, idGuiScriptList list, bool elseBlock = false) { bool ifElseBlock = false; idToken token; // scripts start with { ( unless parm is true ) and have ; separated command lists.. commands are command, // arg.. basically we want everything between the { } as it will be interpreted at // run time if(elseBlock == true) { token = parser.ReadToken(); if(token.ToString().ToLower() == "if") { ifElseBlock = true; } parser.UnreadToken(token); if((ifElseBlock == false) && (parser.ExpectTokenString("{") == false)) { return false; } } else if(parser.ExpectTokenString("{") == false) { return false; } int nest = 0; string tokenLower; while(true) { if((token = parser.ReadToken()) == null) { parser.Error("Unexpected end of file"); return false; } tokenLower = token.ToString().ToLower(); if(tokenLower == "{") { nest++; } else if(tokenLower == "}") { if(nest-- <= 0) { return true; } } idGuiScript script = new idGuiScript(); if(tokenLower == "if") { script.ConditionRegister = ParseExpression(parser); ParseScript(parser, script.IfList); if((token = parser.ReadToken()) != null) { if(token.ToString() == "else") { // pass true to indicate we are parsing an else condition ParseScript(parser, script.ElseList, true); } else { parser.UnreadToken(token); } } list.Append(script); // if we are parsing an else if then return out so // the initial "if" parser can handle the rest of the tokens if(ifElseBlock == true) { return true; } continue; } else { parser.UnreadToken(token); } // empty { } is not allowed if(token.ToString() == "{") { parser.Error("Unexpected {"); return false; } script.Parse(parser); list.Append(script); } }