Beispiel #1
0
        private static void VFPreloadPrePatch()
        {
            if (LDBTool.Finshed)
            {
                return;
            }
            LDBToolPlugin.logger.LogInfo("Pre Loading...");
            if (LDBTool.PreAddDataAction != null)
            {
                LDBTool.PreAddDataAction();
                LDBTool.PreAddDataAction = null;
            }

            LDBTool.AddProtos(LDBTool.PreToAdd);
        }
Beispiel #2
0
        private static void VFPreloadPostPatch()
        {
            if (LDBTool.Finshed)
            {
                return;
            }
            LDBToolPlugin.logger.LogInfo("Post Loading...");
            if (LDBTool.PostAddDataAction != null)
            {
                LDBTool.PostAddDataAction();
                LDBTool.PostAddDataAction = null;
            }

            LDBTool.AddProtos(LDBTool.PostToAdd);

            if (LDBTool.EditDataAction != null)
            {
                foreach (PropertyInfo propertyInfo in typeof(LDB).GetProperties())
                {
                    Type setType = propertyInfo.PropertyType;
                    if (!setType.IsConstructedGenericType)
                    {
                        setType = setType.BaseType;
                    }

                    Type protoType = setType.GetGenericArguments()[0];

                    object protoSet = propertyInfo.GetValue(null);

                    MethodInfo method = typeof(VFPreload_Patch).GetMethod(nameof(EditAllProtos), AccessTools.all).MakeGenericMethod(protoType);
                    method.Invoke(null, new[] { protoSet });
                }
            }

            GameMain.iconSet.loaded = false;
            GameMain.iconSet.Create();
            LDBTool.SetBuildBar();
            LDBTool.Finshed = true;
            LDBToolPlugin.logger.LogInfo("Done.");
        }