예제 #1
0
        public T RegisterValueWithEnum(T id, string name)
        {
            var newid = RegisterValue(id);

            EnumPatcher.AddEnumValue(RegistryType, newid, name);
            return(newid);
        }
예제 #2
0
        public static Identifiable.Id CreateIdentifiableId(object value, string name, bool shouldCategorize = true)
        {
            if (SRModLoader.CurrentLoadingStep > SRModLoader.LoadingStep.PRELOAD)
            {
                throw new Exception("Can't register identifiables outside of the PreLoad step");
            }
            var id = (Identifiable.Id)value;

            if (moddedIdentifiables.ContainsKey(id))
            {
                throw new Exception(
                          $"Identifiable {value} is already registered to {moddedIdentifiables[id].ModInfo.Id}");
            }
            var sr = SRMod.GetCurrentMod();

            if (sr != null)
            {
                moddedIdentifiables[id] = sr;
            }
            EnumPatcher.AddEnumValue(typeof(Identifiable.Id), id, name);

            if (shouldCategorize)
            {
                CategorizeId(id);
            }
            return(id);
        }
예제 #3
0
        public static PlayerState.Upgrade CreatePersonalUpgrade(object value, string name)
        {
            if (SRModLoader.CurrentLoadingStep > SRModLoader.LoadingStep.PRELOAD)
            {
                throw new Exception("Can't register gadgets outside of the PreLoad step");
            }
            var id = (PlayerState.Upgrade)value;

            if (moddedUpgrades.ContainsKey(id))
            {
                throw new Exception(
                          $"Upgrade {value} is already registered to {moddedUpgrades[id].ModInfo.Id}");
            }
            var sr = SRMod.GetCurrentMod();

            if (sr != null)
            {
                moddedUpgrades[id] = sr;
            }
            EnumPatcher.AddEnumValue(typeof(PlayerState.Upgrade), id, name);
            return(id);
        }