コード例 #1
0
        private string Run_Program(Arguments args, BackgroundWorker worker, DoWorkEventArgs _) {
            var result = new MapCleaner.MapCleanerResult();

            bool editorRead = EditorReaderStuff.TryGetFullEditorReader(out var reader);

            if (args.Paths.Length == 1) {
                var editor = EditorReaderStuff.GetBeatmapEditor(args.Paths[0], reader, editorRead);

                List<TimingPoint> orgininalTimingPoints = new List<TimingPoint>();
                foreach (TimingPoint tp in editor.Beatmap.BeatmapTiming.TimingPoints) { orgininalTimingPoints.Add(tp.Copy()); }
                int oldTimingPointsCount = editor.Beatmap.BeatmapTiming.TimingPoints.Count;

                result.Add(MapCleaner.CleanMap(editor, args.CleanerArguments, worker));

                // Update result with removed count
                int removed = oldTimingPointsCount - editor.Beatmap.BeatmapTiming.TimingPoints.Count;
                result.TimingPointsRemoved += removed;

                List<TimingPoint> newTimingPoints = editor.Beatmap.BeatmapTiming.TimingPoints;
                Monitor_Differences(orgininalTimingPoints, newTimingPoints);

                // Save the file
                editor.SaveFile();
            } else {
                foreach (string path in args.Paths) {
                    var editor = EditorReaderStuff.GetBeatmapEditor(path, reader, editorRead);

                    int oldTimingPointsCount = editor.Beatmap.BeatmapTiming.TimingPoints.Count;

                    result.Add(MapCleaner.CleanMap(editor, args.CleanerArguments, worker));

                    // Update result with removed count
                    int removed = oldTimingPointsCount - editor.Beatmap.BeatmapTiming.TimingPoints.Count;
                    result.TimingPointsRemoved += removed;

                    // Save the file
                    editor.SaveFile();
                }
            }

            // Do stuff
            if (args.Quick)
                RunFinished?.Invoke(this, new RunToolCompletedEventArgs(true, editorRead));

            // Make an accurate message
            string message = $"Successfully {(result.TimingPointsRemoved < 0 ? "added" : "removed")} {Math.Abs(result.TimingPointsRemoved)} {(Math.Abs(result.TimingPointsRemoved) == 1 ? "greenline" : "greenlines")}" +
                (args.CleanerArguments.ResnapObjects ? $" and resnapped {result.ObjectsResnapped} {(result.ObjectsResnapped == 1 ? "object" : "objects")}" : "") + 
                (args.CleanerArguments.RemoveUnusedSamples ? $" and removed {result.SamplesRemoved} unused {(result.SamplesRemoved == 1 ? "sample" : "samples")}" : "") + "!";
            return args.Quick ? "" : message;
        }
コード例 #2
0
            static void PlayerSetup(PlayerScript __instance, ref AudioClip[] ___weaponSound)
            {
                MFPClassicAssets.LoadGunSounds(___weaponSound);

#if DEBUG
                Hook.UnlockWeapons();
#endif

                __instance.weaponSound = MFPClassicAssets.weaponSound;
                __instance.setGunSound();

                #region Web-ify the HUD
                Image healthBar1HUD = GameObject.Find("HUD/Canvas/HealthAndSlowMo/HealthBar/HealthBar1/Bar").GetComponent <Image>();
                Image healthBar3HUD = GameObject.Find("HUD/Canvas/HealthAndSlowMo/HealthBar/HealthBar3/Bar").GetComponent <Image>();

                MFPClassicAssets.healthBar2HUD.transform.parent.GetComponent <Image>().color = MFPClassicAssets.hudLightOrange;

                //sonra bunları transform find yap üşendiğim için copy paste
                GameObject.Find("HUD/Canvas/HealthAndSlowMo/SlowMoIcon/SlowMoBar/Bar").GetComponent <Image>().color = MFPClassicAssets.hudOrange;
                GameObject.Find("HUD/Canvas/HealthAndSlowMo/SlowMoIcon/SlowMoBar").GetComponent <Image>().color     = MFPClassicAssets.hudLightOrange;

                GameObject weaponPanel = GameObject.Find("HUD/Canvas/WeaponPanel");

                weaponPanel.transform.Find("WeaponIcon").GetComponent <Image>().color         = MFPClassicAssets.hudLightOrange;
                weaponPanel.transform.Find("InfiniteSymbol").GetComponent <Image>().color     = MFPClassicAssets.hudLightOrange;
                weaponPanel.transform.Find("AmmoText").GetComponent <TextMeshProUGUI>().color = MFPClassicAssets.hudLightOrange;

                MFPClassicAssets.slowMoIcon = GameObject.Find("HUD/Canvas/HealthAndSlowMo/SlowMoIcon").GetComponent <Image>();

                GameObject.Find("HUD/Canvas/SpeechBubble_Tail").GetComponent <Image>().color = Color.white;

                foreach (Image obj in GameObject.Find("HUD/Canvas/SpeechBubble_Bubble").GetComponentsInChildren <Image>())
                {
                    obj.color = Color.white;
                }

                foreach (Text obj in GameObject.Find("HUD/Canvas/SpeechBubble_Bubble").GetComponentsInChildren <Text>())
                {
                    obj.color = Color.black;
                    obj.font  = MFPClassicAssets.preAlphaFont;
                }


                GameObject healthBar = GameObject.Find("HUD/Canvas/HealthAndSlowMo/HealthBar");
                healthBar.GetComponent <RectTransform>().sizeDelta = new Vector2(1000, 64f);

                GameObject healthBarIcon = GameObject.Find("HUD/Canvas/HealthAndSlowMo/HealthIcon");
                healthBarIcon.GetComponent <Image>().sprite = MFPClassicAssets.hudHealthSquare;


                GameObject healthBarAnchor = new GameObject();
                healthBarAnchor.AddComponent <RectTransform>();
                healthBarAnchor.transform.parent = GameObject.Find("HUD/Canvas/WeaponPanel").transform;

                healthBarAnchor.GetComponent <RectTransform>().localPosition = new Vector3(50, 250, 0);


                healthBar.transform.parent        = healthBarAnchor.transform;
                healthBar.transform.localPosition = Vector3.zero;


                GameObject healthBarIconAnchor = new GameObject();

                healthBarIconAnchor.AddComponent <RectTransform>();
                healthBarIconAnchor.transform.parent = GameObject.Find("HUD/Canvas/WeaponPanel").transform;

                healthBarIconAnchor.GetComponent <RectTransform>().localPosition = new Vector3(50, 430, 0);
                healthBarIcon.transform.parent        = healthBarIconAnchor.transform;
                healthBarIcon.transform.localPosition = Vector3.zero;

                healthBar.GetComponent <RectTransform>().Rotate(0, 0, 90);


                // healthBar.GetComponent<RectTransform>().transform.position = new Vector3(1230, 0);
                // healthBar.GetComponent<RectTransform>().localPosition += Vector3.right * 10;
                #endregion

                if (!doLoad)
                {
                    return;
                }

                MapCleaner.Clean();

                new GameObject().AddComponent <MapManager>();
            }