Exemple #1
0
        public void TestConvarEnum()
        {
            ConVar.Set("convar_enum", "Pizza");
            Assert.AreEqual(Food.Pizza, ConVar.Get <Food>("convar_enum"));

            ConVar.Set("convar_enum", Food.Spaghetti);
            Assert.AreEqual(Food.Spaghetti, ConVar.Get <Food>("convar_enum"));
        }
Exemple #2
0
        public void TestConvarBool()
        {
            ConVar.Set("convar_bool", "true");
            Assert.AreEqual(true, ConVar.Get("convar_bool"));

            ConVar.Set("convar_bool", false);
            Assert.AreEqual(false, ConVar.Get("convar_bool"));
        }
Exemple #3
0
        public async Task Convar(CommandContext ctx, string name, string value = null)
        {
            // set or get?
            if (value == null)
            {
                var val = ConVar.Get <string>(name);

                var type   = ConVar.Convars[name].Value;
                var convar = ConVar.Convars[name].Key;

                await ctx.RespondAsync($"\"{name}\" is set to \"{val}\"\n" +
                                       $"type is \"{type.PropertyType}\"\n" +
                                       $"defined in \"{type.DeclaringType.FullName}\"\n" +
                                       $"description is \"{convar.HelpText}\"");

                return;
            }

            ConVar.Set(name, value);
            return;
        }
Exemple #4
0
 public void TestConvarString()
 {
     ConVar.Set("convar_string", "test");
     Assert.AreEqual("test", ConVar.Get("convar_string"));
 }