Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Modding;
- using Selectors;
- using UnityEngine;
- namespace NoBounds
- {
- public class Mod : ModEntryPoint
- {
- NoBoundsMod noBoundsMod;
- public override void OnLoad()
- {
- StatMaster.KeyMapper.disableSliderLimits = true;
- noBoundsMod = NoBoundsMod.Instance;
- UnityEngine.Object.DontDestroyOnLoad(noBoundsMod);
- }
- }
- public class NoBoundsMod : SingleInstance<NoBoundsMod>
- {
- public void Start()
- {
- Refresh = -1;
- }
- private BlockMapper blockMapper;
- BlockBehaviour block;
- public int Refresh;
- public void Update()
- {
- if (StatMaster.SimulationState >= SimulationState.GlobalSimulation)
- {
- return;
- }
- if (blockMapper == null)
- {
- blockMapper = BlockMapper.CurrentInstance;
- block = null;
- }
- else
- {
- if (blockMapper.Block != block)
- {
- block = blockMapper.Block;
- if (block != null)
- {
- block.MapperTypes.ForEach((mapperType) =>
- {
- mapperType.DisplayStateChanged += (state) =>
- {
- Refresh = 2;
- };
- });
- ContainerDetails[] containers = blockMapper.GetComponentsInChildren<ContainerDetails>();
- for (int i = 0; i < containers.Length; i++)
- {
- ModifySelectors(containers[i].transform);
- }
- }
- }
- if (Refresh > 0)
- {
- if (--Refresh == 0)
- {
- ContainerDetails[] containers = blockMapper.GetComponentsInChildren<ContainerDetails>();
- for (int i = 0; i < containers.Length; i++)
- {
- ModifySelectors(containers[i].transform);
- }
- }
- }
- }
- }
- public static void ModifySelectors(Transform transform)
- {
- SliderSelector sliderSelector = transform.GetComponentInChildren<SliderSelector>();
- ValueHolder valueHolder = transform.GetComponentInChildren<ValueHolder>();
- if (sliderSelector && valueHolder)
- {
- ModifySliderSelector(valueHolder);
- }
- }
- public static void ModifySliderSelector(ValueHolder valueHolder)
- {
- valueHolder.CharLimit = int.MaxValue;
- valueHolder.MaxDecimals = 15;
- }
- public override string Name {
- get { return "NoBoundsGameObject"; }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement