<commit_before>﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
#if UNITY_EDITOR
using UnityEditor;
#endif

namespace LiteNetLibManager
{
    public class LiteNetLibAssets : MonoBehaviour
    {
        private static int spawnPositionCounter = 0;
        public bool playerSpawnRandomly;
        public LiteNetLibIdentity playerPrefab;
        public LiteNetLibIdentity[] spawnablePrefabs;
        public LiteNetLibIdentity PlayerPrefab { get; protected set; }
        public LiteNetLibScene offlineScene;
        public LiteNetLibScene onlineScene;
        public LiteNetLibLoadSceneEvent onLoadSceneStart;
        public LiteNetLibLoadSceneEvent onLoadSceneProgress;
        public LiteNetLibLoadSceneEvent onLoadSceneFinish;

        internal readonly List<LiteNetLibSpawnPoint> CacheSpawnPoints = new List<LiteNetLibSpawnPoint>();
        internal readonly Dictionary<int, LiteNetLibIdentity> GuidToPrefabs = new Dictionary<int, LiteNetLibIdentity>();
        internal readonly Dictionary<uint, LiteNetLibIdentity> SceneObjects = new Dictionary<uint, LiteNetLibIdentity>();
        internal readonly Dictionary<uint, LiteNetLibIdentity> SpawnedObjects = new Dictionary<uint, LiteNetLibIdentity>();
        
        public LiteNetLibGameManager Manager { get; private set; }
        public string LogTag { get { return Manager.LogTag + "::LiteNetLibAssets"; } }

        private void Awake()
        {
            Manager = GetComponent<LiteNetLibGameManager>();
        }

        public void Initialize()
        {
            RegisterPrefabs();
            RegisterSpawnPoints();
            RegisterSceneObjects();
        }

        public void Clear(bool doNotResetObjectId = false)
        {
            ClearSpawnedObjects();
            CacheSpawnPoints.Clear();
            SceneObjects.Clear();
            ResetSpawnPositionCounter();
            if (!doNotResetObjectId)
                LiteNetLibIdentity.ResetObjectId();
        }

        public void RegisterSpawnPoints()
        {
            CacheSpawnPoints.Clear();
            CacheSpawnPoints.AddRange(FindObjectsOfType<LiteNetLibSpawnPoint>());<commit_msg>Improve Log Tag and add on initialize event<commit_after>﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
#if UNITY_EDITOR
using UnityEditor;
#endif

namespace LiteNetLibManager
{
    public class LiteNetLibAssets : MonoBehaviour
    {
        private static int spawnPositionCounter = 0;
        public bool playerSpawnRandomly;
        public LiteNetLibIdentity playerPrefab;
        public LiteNetLibIdentity[] spawnablePrefabs;
        public LiteNetLibIdentity PlayerPrefab { get; protected set; }
        public LiteNetLibScene offlineScene;
        public LiteNetLibScene onlineScene;
        public LiteNetLibLoadSceneEvent onLoadSceneStart;
        public LiteNetLibLoadSceneEvent onLoadSceneProgress;
        public LiteNetLibLoadSceneEvent onLoadSceneFinish;
        public UnityEvent onInitialize;

        internal readonly List<LiteNetLibSpawnPoint> CacheSpawnPoints = new List<LiteNetLibSpawnPoint>();
        internal readonly Dictionary<int, LiteNetLibIdentity> GuidToPrefabs = new Dictionary<int, LiteNetLibIdentity>();
        internal readonly Dictionary<uint, LiteNetLibIdentity> SceneObjects = new Dictionary<uint, LiteNetLibIdentity>();
        internal readonly Dictionary<uint, LiteNetLibIdentity> SpawnedObjects = new Dictionary<uint, LiteNetLibIdentity>();
        
        public LiteNetLibGameManager Manager { get; private set; }
        private string logTag;
        public string LogTag
        {
            get
            {
                if (string.IsNullOrEmpty(logTag))
                    logTag = $"{Manager.LogTag}->{name}({GetType().Name})";
                return logTag;
            }
        }

        private void Awake()
        {
            Manager = GetComponent<LiteNetLibGameManager>();
        }

        public void Initialize()
        {
            if (onInitialize != null)
                onInitialize.Invoke();
            RegisterPrefabs();
            RegisterSpawnPoints();
            RegisterSceneObjects();
        }

        public void Clear(bool doNotResetObjectId = false)
        {
            ClearSpawnedObjects();
            CacheSpawnPoints.Clear();
            SceneObjects.Clear();
            ResetSpawnPositionCounter();
            if (!doNotResetObjectId)
                LiteNetLibIdentity.ResetObjectId();
        }

        public void RegisterSpawnPoints()
        {
            CacheSpawnPoints.Clear();
            CacheSpawnPoints.AddRange(FindObjectsOfType<LiteNetLibSpawnPoint>());
{'fraction_non_alphanumeric': 0.0699004448210125, 'fraction_numerical': 0.00042363905952128787, 'mean_word_length': 2.72397476340694, 'pattern_counts': {'":': 1, '<': 23, '<?xml version=': 0, '>': 24, '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': '505005', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1200, 'n_words': 269}