Пример #1
0
        public static bool PerformRandomization(ExportEntry export, RandomizationOption option)
        {
            if (!CanRandomize(export))
            {
                return(false);
            }
            MERLog.Information($"{export.FileRef.FilePath}\t{export.FullPath}");
            var props = export.GetProperties();

            if (export.ClassName == "BioSunFlareComponent" || export.ClassName == "BioSunFlareStreakComponent")
            {
                var tint = props.GetProp <StructProperty>("FlareTint");
                if (tint != null)
                {
                    RStructs.RandomizeTint(tint, false);
                }
                RProperty.RandFloat(props, "Intensity", 0.0001f, 100f, false);
                RProperty.RandFloat(props, "BrightPercent", 0.0001f, 0.1f, false);
                RProperty.RandFloat(props, "Scale", 0.05f, 3f, false);
            }
            else if (export.ClassName == "BioSunActor")
            {
                var tint = props.GetProp <StructProperty>("SunTint");
                if (tint != null)
                {
                    RStructs.RandomizeTint(tint, false);
                }
            }

            export.WriteProperties(props);
            return(true);
        }
Пример #2
0
 public OnOpenAssetHandler(RProperty <EditorPluginModel> model, RiderPathLocator riderPathLocator, IPluginSettings pluginSettings, string slnFile)
 {
     myModel            = model;
     myRiderPathLocator = riderPathLocator;
     myPluginSettings   = pluginSettings;
     mySlnFile          = slnFile;
 }
        // This an entry point
        static PluginEntryPoint()
        {
            ourModel = new RProperty <UnityModel>();

            var logSender = new UnityEventLogSender(ourModel);

            logSender.UnityLogRegisterCallBack();

            ourPluginSettings   = new PluginSettings();
            ourRiderPathLocator = new RiderPathLocator(ourPluginSettings);
            var riderPath = ourRiderPathLocator.GetDefaultRiderApp(EditorPrefsWrapper.ExternalScriptEditor,
                                                                   RiderPathLocator.GetAllFoundPaths(ourPluginSettings.OperatingSystemFamilyRider));

            if (string.IsNullOrEmpty(riderPath))
            {
                return;
            }

            AddRiderToRecentlyUsedScriptApp(riderPath);
            if (!PluginSettings.RiderInitializedOnce)
            {
                EditorPrefsWrapper.ExternalScriptEditor = riderPath;
                PluginSettings.RiderInitializedOnce     = true;
            }

            if (Enabled)
            {
                Init();
            }
        }
        public static bool RandomizeExport(ExportEntry export, RandomizationOption option)
        {
            if (!CanRandomize(export))
            {
                return(false);
            }
            var settings = export.GetProperty <StructProperty>("Settings");

            if (settings != null)
            {
                MERLog.Information($@"Randomizing PostProcessingVolume settings {export.UIndex}");
                // randomize the options
                RProperty.RandBool(settings.Properties, "bEnableDOF", ThreadSafeRandom.Next(3) == 0);
                RProperty.RandBool(settings.Properties, "bEnableFilmic", ThreadSafeRandom.Next(3) == 0);
                RProperty.RandBool(settings.Properties, "bEnableBloom", ThreadSafeRandom.Next(3) == 0);
                RProperty.RandFloat(settings.Properties, "Bloom_Scale", 0, 0.4f, ThreadSafeRandom.Next(5) == 0);
                RProperty.RandFloat(settings.Properties, "DOF_BlurKernelSize", 0, 20f, ThreadSafeRandom.Next(5) == 0);
                RProperty.RandFloat(settings.Properties, "DOF_MaxNearBlurAmount", 0, 0.2f, ThreadSafeRandom.Next(5) == 0);
                RProperty.RandFloat(settings.Properties, "DOF_MaxFarBlurAmount", 0.1f, 0.5f, ThreadSafeRandom.Next(5) == 0);
                RProperty.RandFloat(settings.Properties, "DOF_InnerFocusRadius", 0, 2000f, ThreadSafeRandom.Next(5) == 0);
                RProperty.RandFloat(settings.Properties, "DOF_FocusDistance", 0, 400f, ThreadSafeRandom.Next(5) == 0);
                RProperty.RandFloat(settings.Properties, "Scene_Desaturation", 0, 0.5f, ThreadSafeRandom.Next(5) == 0);
                RProperty.RandFloat(settings.Properties, "Scene_InterpolationDuration", 0, 2f, ThreadSafeRandom.Next(5) == 0);
                RProperty.RandVector(settings.Properties, "Scene_Highlights", 0, 2, ThreadSafeRandom.Next(8) == 0);
                RProperty.RandVector(settings.Properties, "Scene_Midtones", 0, 6f, ThreadSafeRandom.Next(5) == 0);
                RProperty.RandVector(settings.Properties, "Scene_Shadows", 0, .4f, ThreadSafeRandom.Next(8) == 0);
                export.WriteProperty(settings);
                return(true);
            }
            return(false);
        }
Пример #5
0
        public UnityNUnitServiceProvider(ISolution solution, IPsiModules psiModules, ISymbolCache symbolCache,
                                         IUnitTestElementIdFactory idFactory, IUnitTestElementManager elementManager, NUnitTestProvider provider,
                                         ISettingsStore settingsStore, ISettingsOptimization settingsOptimization, ISettingsCache settingsCache,
                                         UnitTestingCachingService cachingService, IDotNetCoreSdkResolver dotNetCoreSdkResolver,
                                         UnityEditorProtocol editorProtocol,
                                         RunViaUnityEditorStrategy runViaUnityEditorStrategy,
                                         NUnitOutOfProcessUnitTestRunStrategy nUnitOutOfProcessUnitTestRunStrategy)
            : base(solution, psiModules, symbolCache, idFactory, elementManager, provider, settingsStore,
                   settingsOptimization, settingsCache, cachingService, dotNetCoreSdkResolver, nUnitOutOfProcessUnitTestRunStrategy)
        {
            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            myRdUnityModel = solution.GetProtocolSolution().GetRdUnityModel();

            myEditorModel         = editorProtocol.UnityModel;
            myUnityEditorStrategy = runViaUnityEditorStrategy;
        }
 public UnityEventLogSender(RProperty <UnityModel> model)
 {
     myModel = model;
 }
Пример #7
0
 get => (double)GetValue(RProperty); set => SetValue(RProperty, value);
Пример #8
0
        public GamepadSettingSync(IMessageSender sender) : base(sender)
        {
            var s       = GamepadSetting.Default;
            var factory = MessageFactory.Instance;


            GamepadEnabled = new RProperty <bool>(s.GamepadEnabled, b =>
            {
                SendMessage(factory.EnableGamepad(b));
                if (!b && GamepadVisibility != null)
                {
                    //読み込み無効なら表示する価値は無いであろう、と判断
                    GamepadVisibility.Value = false;
                }
            });

            PreferDirectInputGamepad = new RProperty <bool>(s.PreferDirectInputGamepad, b => SendMessage(factory.PreferDirectInputGamepad(b)));
            GamepadVisibility        = new RProperty <bool>(s.GamepadVisibility, b => SendMessage(factory.GamepadVisibility(b)));

            //排他になるように制御
            //TODO: RadioButtonの要請により、「一瞬たりとてフラグが2つ同時に立つのは許さん」みたいな要件もありうるので試しておくこと。
            //NOTE: nullableっぽい書き方を一部してるが実際はnullableではない
            GamepadLeanNone = new RProperty <bool>(s.GamepadLeanNone, b =>
            {
                if (b)
                {
                    SendMessage(factory.GamepadLeanMode(LeanModeNames.GamepadLeanNone));
                    GamepadLeanLeftStick?.Set(false);
                    GamepadLeanRightStick?.Set(false);
                    GamepadLeanLeftButtons?.Set(false);
                }
            });
            GamepadLeanLeftStick = new RProperty <bool>(s.GamepadLeanLeftStick, b =>
            {
                if (b)
                {
                    SendMessage(factory.GamepadLeanMode(LeanModeNames.GamepadLeanLeftStick));
                    GamepadLeanNone.Value = false;
                    GamepadLeanRightStick?.Set(false);
                    GamepadLeanLeftButtons?.Set(false);
                }
            });
            GamepadLeanRightStick = new RProperty <bool>(s.GamepadLeanRightStick, b =>
            {
                if (b)
                {
                    SendMessage(factory.GamepadLeanMode(LeanModeNames.GamepadLeanRightStick));
                    GamepadLeanNone.Value      = false;
                    GamepadLeanLeftStick.Value = false;
                    GamepadLeanLeftButtons?.Set(false);
                }
            });
            GamepadLeanLeftButtons = new RProperty <bool>(s.GamepadLeanLeftButtons, b =>
            {
                if (b)
                {
                    SendMessage(factory.GamepadLeanMode(LeanModeNames.GamepadLeanLeftButtons));
                    GamepadLeanNone.Value       = false;
                    GamepadLeanLeftStick.Value  = false;
                    GamepadLeanRightStick.Value = false;
                }
            });

            GamepadLeanReverseHorizontal = new RProperty <bool>(
                s.GamepadLeanReverseHorizontal, b => SendMessage(factory.GamepadLeanReverseHorizontal(b))
                );
            GamepadLeanReverseVertical = new RProperty <bool>(s.GamepadLeanReverseVertical, b => SendMessage(factory.GamepadLeanReverseVertical(b)));
        }
        public WindowSettingSync(IMessageSender sender) : base(sender)
        {
            var setting = WindowSetting.Default;
            var factory = MessageFactory.Instance;

            R = new RProperty <int>(setting.R, _ => SendBackgroundColor());
            G = new RProperty <int>(setting.G, _ => SendBackgroundColor());
            B = new RProperty <int>(setting.B, _ => SendBackgroundColor());

            IsTransparent = new RProperty <bool>(setting.IsTransparent, b =>
            {
                //透明 = ウィンドウフレーム不要。逆も然り
                //NOTE: 後方互換性の都合で必ず背景色の変更の前にフレームの有無を変える。
                //逆にするとウィンドウサイズを維持するための処理が正しく走らない。
                SendMessage(factory.WindowFrameVisibility(!b));

                //ここで透明or不透明の背景を送りつけるとUnity側がよろしく背景透過にしてくれる
                SendBackgroundColor();


                if (b)
                {
                    //背景透過になった時点でクリックスルーしてほしそうなフラグが立ってる => 実際にやる
                    if (WindowDraggable?.Value == false)
                    {
                        SendMessage(factory.IgnoreMouse(true));
                    }
                }
                else
                {
                    //背景透過でない=クリックスルーできなくする
                    SendMessage(factory.IgnoreMouse(true));
                }
            });

            WindowDraggable = new RProperty <bool>(setting.WindowDraggable, b =>
            {
                SendMessage(factory.WindowDraggable(b));
                //すでにウィンドウが透明ならばクリックスルーもついでにやる。不透明の場合、絶対にクリックスルーにはしない
                if (IsTransparent.Value)
                {
                    //ドラッグできない = クリックスルー、なのでフラグが反転することに注意
                    SendMessage(factory.IgnoreMouse(!b));
                }
            });

            TopMost = new RProperty <bool>(setting.TopMost, b => SendMessage(factory.TopMost(b)));

            BackgroundImagePath = new RProperty <string>(
                setting.BackgroundImagePath,
                s => SendMessage(factory.SetBackgroundImagePath(s))
                );

            WholeWindowTransparencyLevel = new RProperty <int>(
                setting.WholeWindowTransparencyLevel,
                i => SendMessage(factory.SetWholeWindowTransparencyLevel(i))
                );

            AlphaValueOnTransparent = new RProperty <int>(
                setting.AlphaValueOnTransparent,
                i => SendMessage(factory.SetAlphaValueOnTransparent(i))
                );
        }