<commit_before>﻿using System;
using System.Collections.Generic;
using Mod.Managers;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using JetBrains.Annotations;
using Mod.Animation;
using Mod.Discord;
using Mod.Interface;
using Mod.Logging;
using Mod.Modules;
using Mod.Profiles;
using UnityEngine;
using AnimationInfo = Mod.Animation.AnimationInfo;
using Console = Mod.Interface.Console;
using LogType = Mod.Logging.LogType;
using Random = UnityEngine.Random;

namespace Mod
{
    public class Shelter : MonoBehaviour
    {
        public static readonly string ModDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Shelter\\";
        public static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
        public static readonly Stopwatch Stopwatch = Stopwatch.StartNew();
        public static List<Profile> Profiles => _profileManager.ProfileFile.Profiles;
        public static Profile Profile => _profileManager.ProfileFile.SelectedProfile;
        public static readonly long StartTime = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;

        private static RainbowAnimation _modAnimation;
        
        private static FileLogger _logger;
        private static ConsoleLogger _consoleLogger;
        private static InterfaceManager _interfaceManager;
        private static CommandManager _commandManager;
        private static InputManager _inputManager;
        private static EventManager _eventManager;
        private static AnimationManager _animationManager;
        private static ProfileManager _profileManager;
        private static ChatManager _chatManager;

        public Shelter()
        {
            if (!Directory.Exists(ModDirectory))
                Directory.CreateDirectory(ModDirectory);
        }
        
        public static void InitComponents()
        {
            _modAnimation = new RainbowAnimation();
            
            _logger = new FileLogger();
            _consoleLogger = new ConsoleLogger();
            _eventManager = new EventManager();
            _interfaceManager = new InterfaceManager();
            _profileManager = new ProfileManager();
            _inputManager = new InputManager();
            _animationManager = new AnimationManager();
            _chatManager = new ChatManager();
            ModuleManager.LoadModules();
            
            Log("Shelter mod initialized.");
        }

        public void Update()
        {
            _modAnimation.Increment(0.0005f);
            
//            DiscordApi.RunCallbacks();
            if (Input.GetKeyDown(KeyCode.I) && Input.GetKey(KeyCode.LeftControl))
                File.WriteAllLines($"GameObjects{Random.Range(0, 255)}.txt", FindObjectsOfType(typeof(GameObject)).OrderBy(x => x.GetInstanceID()).Select(x => $"{x.GetInstanceID()} - {x.name}").ToArray());
        }

        private void OnDisable()
        {
//            DiscordApi.Shutdown();
        }

        public static void OnMainMenu()
        {
            _commandManager?.Dispose();
            _commandManager = null;
            _interfaceManager.DisableAll();
            _interfaceManager.Enable(nameof(Background));
            _interfaceManager.Enable(nameof(Loading));
            _interfaceManager.Enable(nameof(MainMenu));
            DiscordRpc.SendMainMenu();
        }
        
        
        public static void OnJoinedGame()
        {<commit_msg>Made mod's animation framerate independent<commit_after>﻿using System;
using System.Collections.Generic;
using Mod.Managers;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using JetBrains.Annotations;
using Mod.Animation;
using Mod.Discord;
using Mod.Interface;
using Mod.Logging;
using Mod.Modules;
using Mod.Profiles;
using UnityEngine;
using AnimationInfo = Mod.Animation.AnimationInfo;
using Console = Mod.Interface.Console;
using LogType = Mod.Logging.LogType;
using Random = UnityEngine.Random;

namespace Mod
{
    public class Shelter : MonoBehaviour
    {
        public static readonly string ModDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Shelter\\";
        public static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
        public static readonly Stopwatch Stopwatch = Stopwatch.StartNew();
        public static List<Profile> Profiles => _profileManager.ProfileFile.Profiles;
        public static Profile Profile => _profileManager.ProfileFile.SelectedProfile;
        public static readonly long StartTime = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;

        private static RainbowAnimation _modAnimation;
        
        private static FileLogger _logger;
        private static ConsoleLogger _consoleLogger;
        private static InterfaceManager _interfaceManager;
        private static CommandManager _commandManager;
        private static InputManager _inputManager;
        private static EventManager _eventManager;
        private static AnimationManager _animationManager;
        private static ProfileManager _profileManager;
        private static ChatManager _chatManager;

        public Shelter()
        {
            if (!Directory.Exists(ModDirectory))
                Directory.CreateDirectory(ModDirectory);
        }
        
        public static void InitComponents()
        {
            _modAnimation = new RainbowAnimation();
            
            _logger = new FileLogger();
            _consoleLogger = new ConsoleLogger();
            _eventManager = new EventManager();
            _interfaceManager = new InterfaceManager();
            _profileManager = new ProfileManager();
            _inputManager = new InputManager();
            _animationManager = new AnimationManager();
            _chatManager = new ChatManager();
            ModuleManager.LoadModules();
            
            Log("Shelter mod initialized.");
        }

        public void Update()
        {
            _modAnimation.Increment(0.1f * Time.deltaTime);
            
//            DiscordApi.RunCallbacks();
            if (Input.GetKeyDown(KeyCode.I) && Input.GetKey(KeyCode.LeftControl))
                File.WriteAllLines($"GameObjects{Random.Range(0, 255)}.txt", FindObjectsOfType(typeof(GameObject)).OrderBy(x => x.GetInstanceID()).Select(x => $"{x.GetInstanceID()} - {x.name}").ToArray());
        }

        private void OnDisable()
        {
//            DiscordApi.Shutdown();
        }

        public static void OnMainMenu()
        {
            _commandManager?.Dispose();
            _commandManager = null;
            _interfaceManager.DisableAll();
            _interfaceManager.Enable(nameof(Background));
            _interfaceManager.Enable(nameof(Loading));
            _interfaceManager.Enable(nameof(MainMenu));
            DiscordRpc.SendMainMenu();
        }
        
        
        public static void OnJoinedGame()
        {
{'fraction_non_alphanumeric': 0.08586074327210594, 'fraction_numerical': 0.003844510892780863, 'mean_word_length': 2.59467758444217, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7111876', 'n_tokens_mistral': 1720, 'n_tokens_neox': 1677, 'n_words': 411}