Esempio n. 1
0
    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;
        }
    }
Esempio n. 2
0
    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;
        }
    }
Esempio n. 3
0
    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;
        }
    }
Esempio n. 4
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.ContinueWorkout:
         LoadLastWorkOut();
         break;
     }
 }
Esempio n. 5
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.NotUntrainedWords:
         Run();
         break;
     }
 }
Esempio n. 6
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.LoadedVocabulary:
         ShowWordCount();
         break;
     }
 }
Esempio n. 7
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.UpdatedLicenseLevel:
         UpdateInfoWord();
         break;
     }
 }
Esempio n. 8
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.LoadedVocabulary:
         Debug.Log("Start Size");
         StartCoroutine(CreatePanels());
         break;
     }
 }
Esempio n. 9
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.LoadedVocabulary:
         StopCoroutine(ChekLoop());
         //StartCoroutine(ChekLoop());
         break;
     }
 }
Esempio n. 10
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.WordsEnded:
         string path = folderXml + "/" + fileNameXml;
         vocabulary.SaveToXml(path);
         break;
     }
 }
Esempio n. 11
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.CorrectAnswer:
         addbrainvalue.Play("addingBrainValue");
         Invoke("UpdateBrain", 1);
         break;
     }
 }
Esempio n. 12
0
 public void OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
         case GAME_EVENTS.CorrectAnswer:
             AddScore(currentScore);
             print("Верный ответ");
             break;
     }
 }
Esempio n. 13
0
    /// <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);
    }
Esempio n. 14
0
    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;
        }
    }
Esempio n. 15
0
 /// <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");
         }
     }
 }
Esempio n. 16
0
    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;
        }
    }
Esempio n. 17
0
    /// <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);
            }
        }
    }
Esempio n. 18
0
    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;
        }
    }