<commit_before>﻿using UnityEngine;
using System.Collections;
using Lockstep.Data;
using System.Collections.Generic;
using System;
using System.Reflection;
namespace Lockstep
{
	public class UnitConfigHelper : BehaviourHelper
	{
		protected override void OnInitialize ()
		{
			SetupConfigs ();
		}
		UnitConfigElementDataItem [] ConfigElementData;
		IUnitConfigDataItem [] ConfigData;

		Dictionary<string, UnitConfigElementDataItem> ConfigElementMap;
		void SetupConfigs ()
		{
			IUnitConfigDataProvider database;

			//todo guard
			if (LSDatabaseManager.TryGetDatabase (out database)) {
				ConfigElementData = database.UnitConfigElementData;
				ConfigElementMap = new Dictionary<string, UnitConfigElementDataItem> ();
				for (int i = 0; i < ConfigElementData.Length; i++) {
					var item = ConfigElementData [i];
					ConfigElementMap.Add (item.Name, item);<commit_msg>Only allow unit config to apply at start of game<commit_after>﻿using UnityEngine;
using System.Collections;
using Lockstep.Data;
using System.Collections.Generic;
using System;
using System.Reflection;
namespace Lockstep
{
	public class UnitConfigHelper : BehaviourHelper
	{
		static bool setted = false;
		protected override void OnInitialize ()
		{
			if (!setted) {
			SetupConfigs ();
				setted = true;
			}
		}
		UnitConfigElementDataItem [] ConfigElementData;
		IUnitConfigDataItem [] ConfigData;

		Dictionary<string, UnitConfigElementDataItem> ConfigElementMap;
		void SetupConfigs ()
		{
			IUnitConfigDataProvider database;

			//todo guard
			if (LSDatabaseManager.TryGetDatabase (out database)) {
				ConfigElementData = database.UnitConfigElementData;
				ConfigElementMap = new Dictionary<string, UnitConfigElementDataItem> ();
				for (int i = 0; i < ConfigElementData.Length; i++) {
					var item = ConfigElementData [i];
					ConfigElementMap.Add (item.Name, item);
{'fraction_non_alphanumeric': 0.08768154922001076, 'fraction_numerical': 0.0010758472296933835, 'mean_word_length': 4.77639751552795, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '6880434', 'n_tokens_mistral': 601, 'n_tokens_neox': 522, 'n_words': 136}