Ejemplo n.º 1
0
        internal override void Init(CountersData data, Vector3 position)
        {
            beatmapObjectManager = data.BOM;
            TextHelper.CreateText(out missedText, position - new Vector3(0, 0.4f, 0));
            missedText.text      = "0";
            missedText.fontSize  = 4;
            missedText.color     = Color.white;
            missedText.alignment = TextAlignmentOptions.Center;

            GameObject labelGO = new GameObject("Counters+ | Missed Label");

            labelGO.transform.parent = transform;
            TextHelper.CreateText(out label, position);
            label.text      = "Misses";
            label.fontSize  = 3;
            label.color     = Color.white;
            label.alignment = TextAlignmentOptions.Center;

            if (settings.CustomMissTextIntegration && PluginUtility.IsPluginPresent("CustomMissText"))
            {
                UpdateCustomMissText();
            }
            else if (!PluginUtility.IsPluginPresent("CustomMissText"))
            {
                settings.CustomMissTextIntegration = false;
                settings.Save();
            }

            if (beatmapObjectManager != null)
            {
                beatmapObjectManager.noteWasMissedEvent += OnNoteMiss;
                beatmapObjectManager.noteWasCutEvent    += OnNoteCut;
            }
        }
Ejemplo n.º 2
0
 private void UpdateCustomMissText()
 {
     try
     {
         if (PluginUtility.IsPluginPresent("CustomMissText"))
         {
             label.text = String.Join(" ", CustomMissText.Plugin.allEntries[UnityEngine.Random.Range(0, CustomMissText.Plugin.allEntries.Count)]);
         }
     }
     catch { }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Grabs a list of all Custom Counter references in CountersPlus.ini, if their mod is loaded by BSIPA.
        /// </summary>
        public static List <CustomConfigModel> LoadCustomCounters()
        {
            List <CustomConfigModel> counters = new List <CustomConfigModel>();
            FileIniDataParser        parser   = new FileIniDataParser();
            IniData data = parser.ReadFile(Path.Combine(BeatSaber.UserDataPath, "CountersPlus.ini"));

            foreach (SectionData section in data.Sections)
            {
                if (section.Keys.Any((KeyData x) => x.KeyName == "SectionName") &&
                    PluginUtility.IsPluginPresent(section.Keys["ModCreator"]))
                {
                    CustomConfigModel unloadedModel = new CustomConfigModel(section.SectionName);
                    CustomConfigModel loadedModel   = DeserializeFromConfig(unloadedModel, section.SectionName) as CustomConfigModel;
                    counters.Add(loadedModel);
                }
            }
            return(counters);
        }
Ejemplo n.º 4
0
        protected override void DidActivate(bool firstActivation, ActivationType type)
        {
            try
            {
                if (firstActivation)
                {
                    Instance     = this;
                    cellInstance = Resources.FindObjectsOfTypeAll <LevelListTableCell>().First((LevelListTableCell x) => x.name == "LevelListTableCell");
                    base.DidActivate(firstActivation, type);

                    foreach (var kvp in AdvancedCounterSettings.counterUIItems)
                    {
                        counterInfos.Add(CreateFromModel(kvp.Key));
                    }
                    FileIniDataParser parser = new FileIniDataParser();
                    IniData           data   = parser.ReadFile(Path.Combine(BeatSaber.UserDataPath, "CountersPlus.ini"));
                    foreach (SectionData section in data.Sections)
                    {
                        if (section.Keys.Any((KeyData x) => x.KeyName == "SectionName") &&
                            PluginUtility.IsPluginPresent(section.Keys["ModCreator"]))
                        {
                            CustomConfigModel potential = new CustomConfigModel(section.SectionName);
                            potential = ConfigLoader.DeserializeFromConfig(potential, section.SectionName) as CustomConfigModel;

                            counterInfos.Add(new SettingsInfo()
                            {
                                Name        = potential.DisplayName,
                                Description = $"A custom counter added by {potential.ModCreator}!",
                                Model       = potential,
                                IsCustom    = true,
                            });
                        }
                    }
                    _customListTableView.didSelectCellWithIdxEvent += OnCellSelect;
                    _customListTableView.ReloadData();
                    _customListTableView.SelectCellWithIdx(0, false);
                }
            }
            catch (Exception e) {
                Plugin.Log(e.Message + e.StackTrace, Plugin.LogInfo.Fatal, "Check dependencies. If issue persists, re-install Counters+. If issue still persists, create an issue on the Counters+ GitHub.");
            }
        }