<commit_before>﻿using System.Collections;
using System.Collections.Generic;
using DatabaseAPI;
using Mirror;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

namespace AdminTools
{
	/// <summary>
	/// Controls the updating and display of the info panels
	/// of in game items for admin use
	/// </summary>
	public class AdminOverlay : MonoBehaviour
	{
		private static AdminOverlay _adminOverlay;

		public static AdminOverlay Instance
		{
			get
			{
				if (_adminOverlay == null)
				{
					_adminOverlay = FindObjectOfType<AdminOverlay>();
				}

				return _adminOverlay;
			}
		}

		[SerializeField] private GameObject infoPanelPrefab;
		private List<AdminOverlayPanel> infoPanelPool = new List<AdminOverlayPanel>();
		private List<AdminOverlayPanel> panelsInUse = new List<AdminOverlayPanel>();

		private Dictionary<uint, AdminInfo> serverInfos = new Dictionary<uint, AdminInfo>();

		[SerializeField] private Button overlayToggleButton = null;
		[SerializeField] private Color selectedColor;
		[SerializeField] private Color unSelectedColor;

		public bool IsOn { get; private set; }

		private void OnEnable()
		{
			SceneManager.activeSceneChanged += OnSceneChange;
		}

		private void OnDisable()
		{
			SceneManager.activeSceneChanged -= OnSceneChange;
		}

		void OnSceneChange(Scene oldScene, Scene newScene)
		{
			Init();
			serverInfos.Clear();
		}

		void Init()<commit_msg>Fix overlays getting stuck between rounds<commit_after>﻿using System.Collections;
using System.Collections.Generic;
using DatabaseAPI;
using Mirror;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

namespace AdminTools
{
	/// <summary>
	/// Controls the updating and display of the info panels
	/// of in game items for admin use
	/// </summary>
	public class AdminOverlay : MonoBehaviour
	{
		private static AdminOverlay _adminOverlay;

		public static AdminOverlay Instance
		{
			get
			{
				if (_adminOverlay == null)
				{
					_adminOverlay = FindObjectOfType<AdminOverlay>();
				}

				return _adminOverlay;
			}
		}

		[SerializeField] private GameObject infoPanelPrefab;
		private List<AdminOverlayPanel> infoPanelPool = new List<AdminOverlayPanel>();
		private List<AdminOverlayPanel> panelsInUse = new List<AdminOverlayPanel>();

		private Dictionary<uint, AdminInfo> serverInfos = new Dictionary<uint, AdminInfo>();

		[SerializeField] private Button overlayToggleButton = null;
		[SerializeField] private Color selectedColor;
		[SerializeField] private Color unSelectedColor;

		public bool IsOn { get; private set; }

		void Awake()
		{
			Init();
		}

		private void OnEnable()
		{
			SceneManager.activeSceneChanged += OnSceneChange;
		}

		private void OnDisable()
		{
			SceneManager.activeSceneChanged -= OnSceneChange;
		}

		void OnSceneChange(Scene oldScene, Scene newScene)
		{
			foreach (Transform t in transform)
			{
				var panel = t.GetComponent<AdminOverlayPanel>();
				if (panel != null && t.gameObject.activeInHierarchy)
				{
					panel.ReturnToPool();
				}
			}
		}

		void Init()
{'fraction_non_alphanumeric': 0.09096837300293446, 'fraction_numerical': 0.0, 'mean_word_length': 4.130434782608695, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, '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': '2011102', 'n_tokens_mistral': 1003, 'n_tokens_neox': 883, 'n_words': 244}