示例#1
0
        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);
        }
示例#2
0
        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;
                }
            }
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        public static CVar FindCvar(string name)
        {
            CVarCommand cmd = FindCvarCommand(name);

            return(cmd != null ? cmd.cvar : null);
        }