void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.ButtonHandlerLoaded: StartBehaviour(); break; case GAME_EVENTS.WordsEnded: print("ScoreValue = " + GetCorrectAnswers()); WordsEndedBehaviour(); break; case GAME_EVENTS.CorrectAnswer: AddWorkoutProgress(currentWord, subWorkout); if (currentWord.AllWorkoutDone()) { currentWord.AddLicenseLevel(); } break; case GAME_EVENTS.BuildTask: IWorkout workout = parametr as IWorkout; subWorkout = workout.WorkoutName; currentWord = workout.GetCurrentWord(); break; } }
public void OnNotify(object parametr, GAME_EVENTS notificationName) { ButtonComponent button = null; if (parametr != null) { button = ((Component)parametr).GetComponent <ButtonComponent>(); } if (ResultText == null) { return; } switch (notificationName) { case GAME_EVENTS.CorrectAnswer: ResultText.text = "Верный ответ."; ResultText.color = correctColor; break; case GAME_EVENTS.NonCorrectAnswer: ResultText.text = "Неверный ответ."; ResultText.color = wrongColor; FillSamleText(button); break; case GAME_EVENTS.BuildTask: ResultText.text = string.Empty; SampleText.text = string.Empty; break; } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.CoreBuild: core = parametr as Workout; core.buttonsHandler = GameObject.FindObjectOfType <ButtonsHandler>(); core.DrawTask += Core_DrawTask; core.BuildFirstTask(); InitWordCountBar(); //FindObjectOfType<DebugUI>().FillPanel(questions); break; case GAME_EVENTS.ShowResult: if (isReverse && sayToggle.isOn) { GameManager.AudioPlayer.SayWord(); } ShowImage(); ShowTranscript(); ShowRepeatWordButton(); WordProgressUpdate(); ShowContext(); core.SetNextQuestion(); break; } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.ContinueWorkout: LoadLastWorkOut(); break; } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.NotUntrainedWords: Run(); break; } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.LoadedVocabulary: ShowWordCount(); break; } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.UpdatedLicenseLevel: UpdateInfoWord(); break; } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.LoadedVocabulary: Debug.Log("Start Size"); StartCoroutine(CreatePanels()); break; } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.LoadedVocabulary: StopCoroutine(ChekLoop()); //StartCoroutine(ChekLoop()); break; } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.WordsEnded: string path = folderXml + "/" + fileNameXml; vocabulary.SaveToXml(path); break; } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.CorrectAnswer: addbrainvalue.Play("addingBrainValue"); Invoke("UpdateBrain", 1); break; } }
public void OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.CorrectAnswer: AddScore(currentScore); print("Верный ответ"); break; } }
/// <summary> /// Function to add a listener for an notification to the listeners list - /// Добавляет слушателя для уведомления в список слушателей /// </summary> /// <param name="sender"></param> /// <param name="notificationName"></param> public void AddListener(MonoBehaviour sender, GAME_EVENTS notificationName) { //Add listener to dictionary if (!_listeners.ContainsKey(notificationName)) { _listeners.Add(notificationName, new List <MonoBehaviour>()); } //Add object to listener list for this notification _listeners[notificationName].Add(sender); }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.CoreBuild: core = parametr as Workout; core.buttonsHandler = GameObject.FindObjectOfType <ButtonsHandler>(); core.DrawTask += Core_DrawTask; core.BuildFirstTask(); //FindObjectOfType<DebugUI>().FillPanel(questions); break; case GAME_EVENTS.ShowResult: core.RunNextQuestion(); break; } }
/// <summary> /// Function to post a notification to a listener - /// Функция отправки уведомлений слушателю /// </summary> public void PostNotification(object parametr, GAME_EVENTS notificationName) { //If no key in dictionary exists, then exit if (!_listeners.ContainsKey(notificationName)) { return; } //Else post notification to all matching listener‘s - Уведомлять о новых сообщениях всем соответствующим слушателям foreach (IObserver listener in _listeners[notificationName]) { if (listener != null) { //listener.SendMessage(notificationName, sender, SendMessageOptions.DontRequireReceiver); listener.OnNotify(parametr, notificationName); } else { Debug.LogError("listener == null"); } } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.CoreBuild: core = parametr as Workout; core.buttonsHandler = GameObject.FindObjectOfType <ButtonsHandler>(); core.DrawTask += Core_DrawTask; core.BuildFirstTask(); InitWordCountBar(); //FindObjectOfType<DebugUI>().FillPanel(questions); break; case GAME_EVENTS.ShowResult: SetupEnterButton(core.RunNextQuestion); CheckAnswer(); ShowQuestion(); ShowImage(); WordProgressUpdate(); break; } }
/// <summary> /// Function to remove a listener for a notification - /// Функция удаления слушателя для уведомления /// </summary> /// <param name="sender"></param> /// <param name="notificationName"></param> public void RemoveListener(Component sender, GAME_EVENTS notificationName) { //If no key in dictionary exists, then exit if (!_listeners.ContainsKey(notificationName)) { return; } List <MonoBehaviour> listListeners = _listeners[notificationName]; int senderID = sender.GetInstanceID(); //Cycle through listeners and identify component, and then remove //Проведите цикл прослушивающих и идентифицируйте компонент, а затем удалите for (int i = listListeners.Count - 1; i >= 0; i--) { int currentID = listListeners[i].GetInstanceID(); //Check instance ID - Проверить идентификатор экземпляра if (currentID == senderID) { //Matched. Remove from list - Совпало. Убрать из списка listListeners.RemoveAt(i); } } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.BuildTask: WordProgressUpdate(); ProgeressUpdate(); HideImage(); break; case GAME_EVENTS.LoadedVocabulary: LoadTasks(); BuildTask(0); FindObjectOfType <DebugUI>().FillPanel(questions); break; case GAME_EVENTS.ShowResult: ShowImage(); WordProgressUpdate(); ShowContext(); buttonsHandler.SetNextQuestion(() => BuildTask(questionID + 1)); break; } }