Exemplo n.º 1
0
 void IQdmsMessageReceiver.ReceiveMessage(QdmsMessage msg)
 {
     if (msg is HUDPushMessage)
     {
         ConsoleModule.WriteLine(string.Format("{0} : {1}", "*HUD PUSH MESSAGE*", ((HUDPushMessage)msg).Contents));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initialize the Console module
        /// </summary>
        public ConsoleModule()
        {
            Instance = this;

            CreateConsole();

            //any hooking into the console could be done here
            AddCommands();
            ConsoleMessagingThing = new ConsoleMessagingIntegrationComponent();
        }
Exemplo n.º 3
0
 private static void GetCustomFlag(string customFlag)
 {
     if (ConfigState.Instance.CustomConfigFlags.Contains(customFlag))
     {
         ConsoleModule.WriteLine("set");
     }
     else
     {
         ConsoleModule.WriteLine("not set");
     }
 }
Exemplo n.º 4
0
        private static void GetGraphicsQuality()
        {
            int    qualityLevel = QualitySettings.GetQualityLevel();
            string qualityName  = string.Empty;

            if (qualityLevel < QualitySettings.names.Length)
            {
                qualityName = QualitySettings.names[qualityLevel];
            }

            ConsoleModule.WriteLine($"Graphics quality: {qualityLevel} ({qualityName})");
        }
Exemplo n.º 5
0
 private static void GetCustomVar(string customVar)
 {
     if (ConfigState.Instance.CustomConfigVars.ContainsKey(customVar) && ConfigState.Instance.CustomConfigVars[customVar] != null)
     {
         ConsoleModule.WriteLine(DebugUtils.JsonStringify(ConfigState.Instance.CustomConfigVars[customVar]));
     }
     else
     {
         //value doesn't exist: warn and exit
         ConsoleModule.WriteLine("Not Found");
     }
 }
Exemplo n.º 6
0
        private static void SetConfig(string configOption, string newValue)
        {
            var property = ConfigState.Instance.GetType().GetProperty(configOption, BindingFlags.Instance | BindingFlags.Public);

            if (property != null)
            {
                property.SetValue(ConfigState.Instance, TypeUtils.CoerceValue(newValue, property.PropertyType)); //TODO handle enums
            }
            else
            {
                ConsoleModule.WriteLine("not found");
            }
        }
Exemplo n.º 7
0
 private static void SetCustomVar(string customVar, string newValue)
 {
     if (ConfigState.Instance.CustomConfigVars.ContainsKey(customVar))
     {
         //value exists: coerce the value
         object value          = ConfigState.Instance.CustomConfigVars[customVar];
         object newValueParsed = TypeUtils.CoerceValue(newValue, value.GetType());
         ConfigState.Instance.CustomConfigVars[customVar] = newValueParsed;
     }
     else
     {
         //value doesn't exist: warn and exit
         ConsoleModule.WriteLine("Value doesn't already exist; can't determine type to set. Use SetCustomVarTyped instead.");
     }
 }
Exemplo n.º 8
0
        private static void ListConfig()
        {
            StringBuilder sb = new StringBuilder(256);

            var properties = ConfigState.Instance.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);

            foreach (var property in properties)
            {
                string key   = property.Name;
                string value = property.GetValue(ConfigState.Instance)?.ToString();

                sb.AppendLine($"{key}={value}");
            }

            ConsoleModule.WriteLine(sb.ToString());
        }
Exemplo n.º 9
0
        private static void GetConfig(string configOption)
        {
            var property = ConfigState.Instance.GetType().GetProperty(configOption, BindingFlags.Instance | BindingFlags.Public);

            if (property != null)
            {
                var value = property.GetValue(ConfigState.Instance);
                if (value is IEnumerable ievalue)
                {
                    ConsoleModule.WriteLine(ievalue.ToNiceString());
                }
                else
                {
                    ConsoleModule.WriteLine(value.ToString());
                }
            }
            else
            {
                ConsoleModule.WriteLine("not found");
            }
        }
Exemplo n.º 10
0
        private static void SetGraphicsQuality(string quality)
        {
            int qualityLevel = int.Parse(quality);

            if (qualityLevel >= QualitySettings.names.Length || qualityLevel < 0)
            {
                ConsoleModule.WriteLine($"Can't set graphics quality (level {qualityLevel} is not defined)");
                return;
            }

            QualitySettings.SetQualityLevel(qualityLevel, true);

            string qualityName = string.Empty;

            if (qualityLevel < QualitySettings.names.Length)
            {
                qualityName = QualitySettings.names[qualityLevel];
            }

            ConsoleModule.WriteLine($"Set graphics quality to: {qualityLevel} ({qualityName})");
        }
Exemplo n.º 11
0
 private static void PrintConfig()
 {
     ConsoleModule.WriteLine(DebugUtils.JsonStringify(ConfigState.Instance));
 }