internal static CVarCommand FindCvarCommand(string name) { foreach (CCommand cmd in m_commands) { CVarCommand varCmd = cmd as CVarCommand; if (varCmd != null && varCmd.cvar.Name == name) { return(varCmd); } } return(null); }
void Execute(string prefix = null) { IList <CCommand> cmds = CRegistery.ListCommands(prefix); foreach (CCommand cmd in cmds) { CVarCommand cvarCmd = cmd as CVarCommand; if (cvarCmd != null) { cvarCmd.ParentCommand = this; cvarCmd.SetDefault(); cvarCmd.ParentCommand = null; } } }
bool Execute(string name) { CVarCommand cmd = CRegistery.FindCvarCommand(name); if (cmd == null) { PrintError("Can't find cvar: '{0}'", name); return(false); } cmd.ParentCommand = this; cmd.SetDefault(); cmd.ParentCommand = null; return(true); }
internal static IList <CVar> ListVars(IList <CVar> outList, ListCommandsFilter <CVarCommand> filter) { if (filter == null) { throw new NullReferenceException("Filter is null"); } foreach (CCommand cmd in m_commands) { CVarCommand varCmd = cmd as CVarCommand; if (varCmd != null && filter(varCmd)) { outList.Add(varCmd.cvar); } } return(outList); }
bool Execute(string cvarName) { CVarCommand cmd = CRegistery.FindCvarCommand(cvarName); if (cmd == null) { PrintError("Can't find cvar '" + cvarName + "'"); return(false); } if (!cmd.IsInt) { PrintError("Can't toggle non-int value"); return(false); } cmd.ParentCommand = this; cmd.SetValue(cmd.BoolValue ? 0 : 1); cmd.ParentCommand = null; return(true); }
public static CVar FindCvar(string name) { CVarCommand cmd = FindCvarCommand(name); return(cmd != null ? cmd.cvar : null); }