<commit_before>﻿using System.Collections.Generic;
using System.Linq;
using Alensia.Core.Common;
using Alensia.Core.UI;
using Alensia.Core.UI.Cursor;
using UniRx;
using UnityEngine;
using Zenject;

namespace Alensia.Core.Control
{
    public class Controller : ActivatableMonoBehavior, IController
    {
        [Inject]
        public IRuntimeUIContext UIContext { get; }

        public CursorState DefaultCursorState => UIContext.CursorState;

        public IEnumerable<IControl> Controls => _controls.ToList();

        [Inject] private IList<IControl> _controls;

        protected override void OnInitialized()
        {
            DefaultCursorState.Apply();

            base.OnInitialized();

            Activate();

            Controls
                .Select(c => c.OnActiveStateChange)
                .Merge()
                .Subscribe(_ => CheckInputStatus(), Debug.LogError)
                .AddTo(this);

            CheckInputStatus();
        }

        protected override void OnDisposed()
        {
            Deactivate();

            base.OnDisposed();
        }

        private void CheckInputStatus()
        {
            var control = Controls.FirstOrDefault(c => c.Active && c.CursorState != null);
            var state = control?.CursorState ?? DefaultCursorState;<commit_msg>Remove unnecessary statements<commit_after>﻿using System.Collections.Generic;
using System.Linq;
using Alensia.Core.Common;
using Alensia.Core.UI;
using Alensia.Core.UI.Cursor;
using UniRx;
using UnityEngine;
using Zenject;

namespace Alensia.Core.Control
{
    public class Controller : ActivatableMonoBehavior, IController
    {
        [Inject]
        public IRuntimeUIContext UIContext { get; }

        public CursorState DefaultCursorState => UIContext.CursorState;

        public IEnumerable<IControl> Controls => _controls.ToList();

        [Inject] private IList<IControl> _controls;

        protected override void OnInitialized()
        {
            base.OnInitialized();

            Activate();

            Controls
                .Select(c => c.OnActiveStateChange)
                .Merge()
                .Subscribe(_ => CheckInputStatus(), Debug.LogError)
                .AddTo(this);
        }

        protected override void OnDisposed()
        {
            Deactivate();

            base.OnDisposed();
        }

        private void CheckInputStatus()
        {
            var control = Controls.FirstOrDefault(c => c.Active && c.CursorState != null);
            var state = control?.CursorState ?? DefaultCursorState;
{'fraction_non_alphanumeric': 0.093141075604053, 'fraction_numerical': 0.0, 'mean_word_length': 2.176980198019802, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '1547582', 'n_tokens_mistral': 677, 'n_tokens_neox': 649, 'n_words': 149}