<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Guardians;
using UnityEngine;

namespace Booma.Proxy
{
	[AdditionalRegisterationAs(typeof(IFactoryCreatable<GameObject, LocalPlayerWorldRepresentationCreationContext>))]
	[SceneTypeCreate(GameSceneType.LobbyDefault)]
	public sealed class LobbyLocalPlayerWorldObjectFactory : IFactoryCreatable<GameObject, LocalPlayerWorldRepresentationCreationContext>, IGameInitializable
	{
		private IRoomCollection Rooms { get; }

		private IWorldObjectToEntityMappable WorldPlayerMap { get; }

		private INetworkPlayerPrefabProvider PrefabProvider { get; }

		/// <inheritdoc />
		public LobbyLocalPlayerWorldObjectFactory([NotNull] IRoomCollection rooms, [NotNull] IWorldObjectToEntityMappable worldPlayerMap, [NotNull] INetworkPlayerPrefabProvider prefabProvider)
		{
			Rooms = rooms ?? throw new ArgumentNullException(nameof(rooms));
			WorldPlayerMap = worldPlayerMap ?? throw new ArgumentNullException(nameof(worldPlayerMap));
			PrefabProvider = prefabProvider ?? throw new ArgumentNullException(nameof(prefabProvider));
		}

		/// <inheritdoc />
		public GameObject Create(LocalPlayerWorldRepresentationCreationContext context)
		{
			GameObject player = GameObject.Instantiate(PrefabProvider.LocalPlayerPrefab, context.SpawnData.AssociatedObject.Position, context.SpawnData.AssociatedObject.Rotation);

			//TODO: How should we handle rooms?<commit_msg>Updated local player factory to add it to collections<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Guardians;
using UnityEngine;

namespace Booma.Proxy
{
	[AdditionalRegisterationAs(typeof(IFactoryCreatable<GameObject, LocalPlayerWorldRepresentationCreationContext>))]
	[SceneTypeCreate(GameSceneType.LobbyDefault)]
	public sealed class LobbyLocalPlayerWorldObjectFactory : IFactoryCreatable<GameObject, LocalPlayerWorldRepresentationCreationContext>, IGameInitializable
	{
		private IRoomCollection Rooms { get; }

		private IWorldObjectToEntityMappable WorldPlayerMap { get; }

		private IEntityGuidMappable<GameObject> EntityGuidToGameObjectMappable { get; }

		private INetworkPlayerPrefabProvider PrefabProvider { get; }

		/// <inheritdoc />
		public LobbyLocalPlayerWorldObjectFactory([NotNull] IRoomCollection rooms, [NotNull] IWorldObjectToEntityMappable worldPlayerMap, [NotNull] INetworkPlayerPrefabProvider prefabProvider, [NotNull] IEntityGuidMappable<GameObject> entityGuidToGameObjectMappable)
		{
			Rooms = rooms ?? throw new ArgumentNullException(nameof(rooms));
			WorldPlayerMap = worldPlayerMap ?? throw new ArgumentNullException(nameof(worldPlayerMap));
			PrefabProvider = prefabProvider ?? throw new ArgumentNullException(nameof(prefabProvider));
			EntityGuidToGameObjectMappable = entityGuidToGameObjectMappable ?? throw new ArgumentNullException(nameof(entityGuidToGameObjectMappable));
		}

		/// <inheritdoc />
		public GameObject Create(LocalPlayerWorldRepresentationCreationContext context)
		{
			GameObject player = GameObject.Instantiate(PrefabProvider.LocalPlayerPrefab, context.SpawnData.AssociatedObject.Position, context.SpawnData.AssociatedObject.Rotation);

			//This makes it so things can go from GameObject (root) to entity guid.
			WorldPlayerMap.Add(player, context.SpawnData.EntityGuid);
			//This allows for the reverse
			EntityGuidToGameObjectMappable.Add(context.SpawnData.EntityGuid, player);

			//TODO: How should we handle rooms?
{'fraction_non_alphanumeric': 0.07666385846672283, 'fraction_numerical': 0.0, 'mean_word_length': 7.42080378250591, 'pattern_counts': {'":': 0, '<': 13, '<?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': '3231574', 'n_tokens_mistral': 1016, 'n_tokens_neox': 950, 'n_words': 201}