Exemplo n.º 1
0
        private void Awake()
        {
            if (_Instance != null)
            {
                Destroy(gameObject);
                return;
            }

            if (isDontDestroyOnLoad)
            {
                DontDestroyOnLoad(gameObject);
            }

            _Instance = this;

            _serviceLocator = new ServiceLocator();
            _serviceLocator.InitServices();

            _translationManager = _serviceLocator.Get <ITranslationManager>();

            _translationManager.TranslateSuccessEvent      += TranslateSuccessEventHandler;
            _translationManager.DetectLanguageSuccessEvent += DetectLanguageSuccessEventHandler;
            _translationManager.GetLanguagesSuccessEvent   += GetLanguagesSuccessEventHandler;

            _translationManager.TranslateFailedEvent      += TranslateFailedEventHandler;
            _translationManager.DetectLanguageFailedEvent += DetectLanguageFailedEventHandler;
            _translationManager.GetLanguagesFailedEvent   += GetLanguagesFailedEventHandler;

            _translationManager.ContentOutOfLengthEvent += ContentOutOfLengthEventHandler;
        }
Exemplo n.º 2
0
        public void Init()
        {
            _gcTranslation = GCTranslation.Instance;

            _networking = new Networking();
            _networking.NetworkResponseEvent += NetworkResponseEventHandler;
        }
Exemplo n.º 3
0
        private void OnDestroy()
        {
            if (_Instance == this)
            {
                _translationManager.TranslateSuccessEvent      -= TranslateSuccessEventHandler;
                _translationManager.DetectLanguageSuccessEvent -= DetectLanguageSuccessEventHandler;
                _translationManager.GetLanguagesSuccessEvent   -= GetLanguagesSuccessEventHandler;

                _translationManager.TranslateFailedEvent      -= TranslateFailedEventHandler;
                _translationManager.DetectLanguageFailedEvent -= DetectLanguageFailedEventHandler;
                _translationManager.GetLanguagesFailedEvent   -= GetLanguagesFailedEventHandler;

                _translationManager.ContentOutOfLengthEvent -= ContentOutOfLengthEventHandler;

                _Instance = null;
                _serviceLocator.Dispose();
            }
        }