Exemple #1
0
        public void ExposeData(SettingsFieldProperties p)
        {
            MethodInfo mi = typeof(Scribe_Values).GetMethod("Look", BindingFlags.Public | BindingFlags.Static).MakeGenericMethod(p.type);

            object[] arguments = new object[] { _value, p.id, null, false };
            mi.Invoke(null, arguments);
            _value = arguments[0];
        }
Exemple #2
0
        public void ExposeData(SettingsFieldProperties p)
        {
            MethodInfo miLook = null;

            string[] parameterNames = new string[] { "list", "label", "lookMode", "ctorArgs" };
            foreach (MethodInfo mi in typeof(Scribe_Collections).GetMember("Look"))
            {
                if (mi.GetParameters().Length == parameterNames.Length)
                {
                    bool mismatch = false; int i = 0;
                    foreach (ParameterInfo pi in mi.GetParameters())
                    {
                        if (!pi.Name.Equals(parameterNames[i]))
                        {
                            mismatch = true; break;
                        }
                        else
                        {
                            i++;
                        }
                    }
                    if (!mismatch)
                    {
                        miLook = mi;
                        break;
                    }
                }
            }
            if (miLook != null)
            {
                miLook = miLook.MakeGenericMethod(p.type.GetGenericArguments()[0]);
                object[] arguments = new object[] { _value, p.id, LookMode.Undefined, null };
                miLook.Invoke(null, arguments);
                _value = (IList)arguments[0];
            }
            else
            {
                Log.Error("Failed to build generic look method for list field!");
            }
        }
Exemple #3
0
 public void OnAfterDeserialize(SettingsFieldProperties p)
 {
 }
Exemple #4
0
 public void OnBeforeSerialize(SettingsFieldProperties p)
 {
 }
Exemple #5
0
 public void ExposeData(SettingsFieldProperties p)
 {
     Scribe_Values.Look <string>(ref _defName, p.id, null);
     Scribe_Values.Look <string>(ref _typeName, p.id + "_type", null);
 }