示例#1
0
        public long insertUpdateBasecSetting(BasicSettingBE.BasicBe basicBe)
        {
            var result = DB.BasicSettings.FirstOrDefault(s => s.BasicSettingID != null);

            if (result != null)
            {
                result.CanteenPersonName  = basicBe.CanteenPersonName;
                result.CanteenEmailId     = basicBe.Canteen_EmailId;
                result.Activate_Moderator = basicBe.Activate_Moderator;
                result.LastModifiedBy     = basicBe.LastModifiedBy;
                result.LastModifiedOn     = basicBe.LastModifiedOn;
                result.SettingStatus      = true;
                DB.SaveChanges();
                return(result.BasicSettingID);
            }
            else
            {
                BasicSetting basicSetting = new BasicSetting();

                basicSetting.CanteenPersonName  = basicBe.CanteenPersonName;
                basicSetting.CanteenEmailId     = basicBe.Canteen_EmailId;
                basicSetting.AddedBy            = basicBe.AddedBy;
                basicSetting.AddedOn            = basicBe.AddedOn;
                basicSetting.Activate_Moderator = basicBe.Activate_Moderator;
                basicSetting.LastModifiedBy     = basicBe.LastModifiedBy;
                basicSetting.LastModifiedOn     = basicBe.LastModifiedOn;
                basicSetting.SettingStatus      = true;
                DB.AddToBasicSettings(basicSetting);
                DB.SaveChanges();
                return(basicSetting.BasicSettingID);
            }
        }
            static bool Prefix(Manager.Config __instance)
            {
                var traverse = Traverse.Create(__instance);

                if (!traverse.Method("CheckInstance").GetValue <bool>())
                {
                    return(false);
                }
                GameObject.DontDestroyOnLoad(__instance.gameObject);

                traverse.Property("SoundData").SetValue(new SoundSystem("Sound"));
                traverse.Property("TextData").SetValue(new TextSystem("Text"));
                traverse.Property("EtcData").SetValue(new EtceteraSystem("Etc"));
                traverse.Property("DebugStatus").SetValue(new DebugSystem("Debug"));
                BasicSettings  = new BasicSetting("GraphicBasic");
                BloomSettings  = new BloomSetting("Bloom");
                CurveSettings  = new CurveSetting("ColorCorrectionCurve");
                SSAOSettings   = new SSAOSetting("SSAO");
                SSRSettings    = new SSRSetting("SSR");
                ShadowSettings = new ShadowSetting("Shadow");

                var xmlCtrl = new Control("Config", "Config.xml", "Config", new List <Data> {
                    Manager.Config.SoundData, Manager.Config.TextData, Manager.Config.EtcData, Manager.Config.DebugStatus
                });

                traverse.Field("xmlCtrl").SetValue(xmlCtrl);

                __instance.Load();
                xmlGraphicsSetting = new Control("GraphicSetting", "Config.xml", "GraphicSetting", new List <Data> {
                    BasicSettings
                });
                xmlGraphicsSetting.Read();

                string stylePreset  = BasicSettings.StylePreset;
                string ssaopreset   = BasicSettings.SSAOPreset;
                string ssrpreset    = BasicSettings.SSRPreset;
                string shadowPreset = BasicSettings.ShadowPreset;

                var xmlStyle = new Control("GraphicSetting/Style", stylePreset + ".xml", "Config", new List <Data> {
                    BloomSettings, CurveSettings
                });

                traverse.Field("xmlStyle").SetValue(xmlStyle);

                xmlSSAO = new Control("GraphicSetting/SSAO", ssaopreset + ".xml", "Config", new List <Data> {
                    SSAOSettings
                });
                xmlSSR = new Control("GraphicSetting/SSR", ssrpreset + ".xml", "Config", new List <Data> {
                    SSRSettings
                });
                xmlShadow = new Control("GraphicSetting/Shadow", shadowPreset + ".xml", "Config", new List <Data> {
                    ShadowSettings
                });
                xmlShadow.Read();
                xmlSSAO.Read();
                xmlSSR.Read();
                xmlStyle.Read();

                Manager.Config.ScrollBarValue = 1f;
                if (ShadowSettings.ShadowProjection == 0)
                {
                    QualitySettings.shadowProjection = ShadowProjection.CloseFit;
                }
                else if (ShadowSettings.ShadowProjection == 1)
                {
                    QualitySettings.shadowProjection = ShadowProjection.StableFit;
                }

                QualitySettings.shadowNearPlaneOffset            = ShadowSettings.ShadowNearPlaneOffset;
                QualitySettings.shadowDistance                   = ShadowSettings.ShadowDistance;
                QualitySettings.shadowCascades                   = ShadowSettings.ShadowCascades;
                QualitySettings.shadowCascade2Split              = ShadowSettings.ShadowCascade2Split;
                QualitySettings.shadowCascade4Split              = new Vector3(ShadowSettings.ShadowCascade4Split_x, ShadowSettings.ShadowCascade4Split_y, ShadowSettings.ShadowCascade4Split_z);
                QualitySettings.antiAliasing                     = BasicSettings.MSAA;
                HarmonyPatch_BloomAndFlares.BlmIntst             = BloomSettings.Bloomintensity;
                HarmonyPatch_BloomAndFlares.BlmSprd              = BloomSettings.BloomBlurSpread;
                HarmonyPatch_BloomAndFlares.BlmThrshd            = BloomSettings.BloomThreshold;
                HarmonyPatch_ColorCorrectionCurves.CCCCustom     = CurveSettings.Curve;
                HarmonyPatch_ColorCorrectionCurves.CCCName       = CurveSettings.CurveName;
                HarmonyPatch_ColorCorrectionCurves.CCCSaturation = CurveSettings.CurveSaturation;
                HarmonyPatch_ScreenSpaceReflection.SSRPresets    = SSRSettings.SSRpresets;
                if (HarmonyPatch_ScreenSpaceReflection.SSRPresets != 0)
                {
                    return(false);
                }

                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.screenEdgeFading               = SSRSettings.SSRscreenEdgeFading;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.maxDistance                    = SSRSettings.SSRmaxDistance;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.fadeDistance                   = SSRSettings.SSRfadeDistance;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.reflectionMultiplier           = SSRSettings.SSRreflectionMultiplier;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.enableHDR                      = SSRSettings.SSRenableHDR;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.additiveReflection             = SSRSettings.SSRadditiveReflection;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.maxSteps                  = SSRSettings.SSRmaxSteps;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.rayStepSize               = SSRSettings.SSRrayStepSize;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.widthModifier             = SSRSettings.SSRwidthModifier;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.smoothFallbackThreshold   = SSRSettings.SSRsmoothFallbackThreshold;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.distanceBlur              = SSRSettings.SSRdistanceBlur;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.fresnelFade               = SSRSettings.SSRfresnelFade;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.fresnelFadePower          = SSRSettings.SSRfresnelFadePower;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.smoothFallbackDistance    = SSRSettings.SSRsmoothFallbackDistance;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.useTemporalConfidence       = SSRSettings.SSRuseTemporalConfidence;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.temporalFilterStrength      = SSRSettings.SSRtemporalFilterStrength;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.treatBackfaceHitAsMiss      = SSRSettings.SSRtreatBackfaceHitAsMiss;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.allowBackwardsRays          = SSRSettings.SSRallowBackwardsRays;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.traceBehindObjects          = SSRSettings.SSRtraceBehindObjects;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.highQualitySharpReflections = SSRSettings.SSRhighQualitySharpReflections;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.traceEverywhere             = SSRSettings.SSRtraceEverywhere;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.bilateralUpsample           = SSRSettings.SSRbilateralUpsample;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.improveCorners              = SSRSettings.SSRimproveCorners;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.reduceBanding               = SSRSettings.SSRreduceBanding;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.highlightSuppression        = SSRSettings.SSRhighlightSuppression;

                switch (SSRSettings.SSRresolution)
                {
                case 0:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.resolution = ScreenSpaceReflection.SSRResolution.FullResolution;
                    break;

                case 1:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.resolution = ScreenSpaceReflection.SSRResolution.HalfTraceFullResolve;
                    break;

                case 2:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.resolution = ScreenSpaceReflection.SSRResolution.HalfResolution;
                    break;
                }

                switch (SSRSettings.SSRdebugMode)
                {
                case 0:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.None;
                    return(false);

                case 1:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.IncomingRadiance;
                    return(false);

                case 2:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.SSRResult;
                    return(false);

                case 3:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.FinalGlossyTerm;
                    return(false);

                case 4:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.SSRMask;
                    return(false);

                case 5:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.Roughness;
                    return(false);

                case 6:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.BaseColor;
                    return(false);

                case 7:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.SpecColor;
                    return(false);

                case 8:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.Reflectivity;
                    return(false);

                case 9:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.ReflectionProbeOnly;
                    return(false);

                case 10:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.ReflectionProbeMinusSSR;
                    return(false);

                case 11:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.SSRMinusReflectionProbe;
                    return(false);

                case 12:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.NoGlossy;
                    return(false);

                case 13:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.NegativeNoGlossy;
                    return(false);

                case 14:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.MipLevel;
                    return(false);

                default:
                    return(false);
                }
            }