Example #1
0
 /// <summary>
 /// Get the language from index (a dropdown example) and translate every text
 /// </summary>
 /// <param name="language"></param>
 public void ChangeLanguageFromIndex(int language)
 {
     m_currentLanguage      = ActiveLanguages[language];
     m_currentLanguageIndex = language;
     PlayerPrefs.SetInt(GJ_GameSetup.PlayerPrefs.LAST_LANGUAGE, m_currentLanguageIndex);
     GJ_EventManager.TriggerEvent(GJ_EventSetup.Localization.TRANSLATE_TEXTS);
 }
Example #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == GJ_GameSetup.Tags.PLAYER)
     {
         GJ_EventManager.TriggerEvent(GJ_EventSetup.Game.DEAD);
     }
 }
Example #3
0
 /// <summary>
 /// Method for changing the language. Calling this method will launch translate event so every text shows correctly
 /// </summary>
 /// <param name="language"></param>
 public void ChangeLanguage(SystemLanguage language)
 {
     m_currentLanguage      = language;
     m_currentLanguageIndex = m_activelanguages.IndexOf(m_currentLanguage);
     PlayerPrefs.SetInt(GJ_GameSetup.PlayerPrefs.LAST_LANGUAGE, m_currentLanguageIndex);
     GJ_EventManager.TriggerEvent(GJ_EventSetup.Localization.TRANSLATE_TEXTS);
 }
Example #4
0
        public override void OnEnter()
        {
            if (!showAlways && executionCount >= showCount)
            {
                Continue();
                return;
            }

            executionCount++;

            // Override the active say dialog if needed
            if (character != null && character.SetSayDialog != null)
            {
                SayDialog.ActiveSayDialog = character.SetSayDialog;
            }

            if (setSayDialog != null)
            {
                SayDialog.ActiveSayDialog = setSayDialog;
            }

            var sayDialog = SayDialog.GetSayDialog();

            if (sayDialog == null)
            {
                Continue();
                return;
            }

            var flowchart = GetFlowchart();

            sayDialog.SetActive(true);

            sayDialog.SetCharacter(character);
            sayDialog.SetCharacterImage(portrait);

            string displayText = storyText;

            var activeCustomTags = CustomTag.activeCustomTags;

            for (int i = 0; i < activeCustomTags.Count; i++)
            {
                var ct = activeCustomTags[i];
                displayText = displayText.Replace(ct.TagStartSymbol, ct.ReplaceTagStartWith);
                if (ct.TagEndSymbol != "" && ct.ReplaceTagEndWith != "")
                {
                    displayText = displayText.Replace(ct.TagEndSymbol, ct.ReplaceTagEndWith);
                }
            }

            string subbedText = flowchart.SubstituteVariables(displayText);

            sayDialog.Say(subbedText, !extendPrevious, waitForClick, fadeWhenDone, stopVoiceover, waitForVO, voiceOverClip, delegate {
                GJ_EventManager.TriggerEvent(GJ_EventSetup.Game.CAN_MOVE);
                Continue();
            });
        }
        /// <summary>
        /// Coroutine called for loading the next scene
        /// </summary>
        /// <param name="_index"></param>
        /// <param name="_delayAfterLoading"></param>
        /// <param name="_eventName"></param>
        /// <returns></returns>
        IEnumerator LoadingScreen(int _index, float _delayAfterLoading = 1f, string _eventName = "")
        {
            m_loadingScreenGroup.SetActive(true);
            m_loadingText.text = GJ_TextManager.GetText(GJ_TextSetup.LoadingScreen.LOADING_TEXT);

            AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(_index);

            // Wait until the asynchronous scene fully loads
            while (!asyncLoad.isDone)
            {
                yield return(null);
            }

            yield return(new WaitForSeconds(_delayAfterLoading));

            m_loadingScreenGroup.SetActive(false);

            if (_eventName != "")
            {
                GJ_EventManager.TriggerEvent(_eventName);
            }
        }
Example #6
0
 /// <summary>
 /// Start a new Game from button
 /// </summary>
 public void NewGame()
 {
     GJ_EventManager.TriggerEvent(GJ_EventSetup.SaveData.NEW_GAME);
     GJ_SceneLoader.LoadScene(GJ_SceneSetup.SCENES.MANU_TEST, 1f, GJ_EventSetup.Menu.GO_TO_GAME);
     FungusManager.Instance.MusicManager.StopMusic();
 }
Example #7
0
 /// <summary>
 /// Stop Listening to events
 /// </summary>
 private void StopAllListeners()
 {
     GJ_EventManager.StopListening(GJ_EventSetup.Localization.TRANSLATE_TEXTS, TranslateTexts);
 }
 /// <summary>
 /// Stop Listening to events
 /// </summary>
 private void StopAllListeners()
 {
     GJ_EventManager.StopListening(GJ_EventSetup.Menu.GO_TO_MAIN_MENU, ShowCursor);
     GJ_EventManager.StopListening(GJ_EventSetup.Menu.GO_TO_GAME, HideCursor);
 }
 /// <summary>
 /// Stop listening events so we avoid event leaking
 /// </summary>
 public void StopAllListeners()
 {
     GJ_EventManager.StopListening(GJ_EventSetup.Game.DEAD, ShowDeadCanvasAndRespawn);
     GJ_EventManager.StopListening(GJ_EventSetup.Game.CAN_MOVE, CanMove);
     GJ_EventManager.StopListening(GJ_EventSetup.Localization.TRANSLATE_TEXTS, TranslateTexts);
 }
Example #10
0
 /// <summary>
 /// Stop listening events so we avoid event leaking
 /// </summary>
 public void StopAllListeners()
 {
     GJ_EventManager.StopListening(GJ_EventSetup.SaveData.SAVE_GAME, Save);
     GJ_EventManager.StopListening(GJ_EventSetup.SaveData.NEW_GAME, CreateGameData);
 }
Example #11
0
 /// <summary>
 /// Stop listening events so we avoid event leaking
 /// </summary>
 public void StopAllListeners()
 {
     GJ_EventManager.StopListening(GJ_EventSetup.Audio.STOP_ALL_CHANNELS, StopPlayingSources);
     GJ_EventManager.StopListening(GJ_EventSetup.Audio.MUTE_ALL_CHANNELS, MuteAllChannels);
 }