Ejemplo 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;
        }
    }
Ejemplo 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;
        }
    }
Ejemplo 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;
        }
    }
Ejemplo n.º 4
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.ContinueWorkout:
         LoadLastWorkOut();
         break;
     }
 }
Ejemplo n.º 5
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.NotUntrainedWords:
         Run();
         break;
     }
 }
Ejemplo n.º 6
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.LoadedVocabulary:
         ShowWordCount();
         break;
     }
 }
Ejemplo n.º 7
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.UpdatedLicenseLevel:
         UpdateInfoWord();
         break;
     }
 }
Ejemplo n.º 8
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.LoadedVocabulary:
         Debug.Log("Start Size");
         StartCoroutine(CreatePanels());
         break;
     }
 }
Ejemplo n.º 9
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.LoadedVocabulary:
         StopCoroutine(ChekLoop());
         //StartCoroutine(ChekLoop());
         break;
     }
 }
Ejemplo 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;
     }
 }
Ejemplo n.º 11
0
 void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
     case GAME_EVENTS.CorrectAnswer:
         addbrainvalue.Play("addingBrainValue");
         Invoke("UpdateBrain", 1);
         break;
     }
 }
Ejemplo n.º 12
0
 public void OnNotify(object parametr, GAME_EVENTS notificationName)
 {
     switch (notificationName)
     {
         case GAME_EVENTS.CorrectAnswer:
             AddScore(currentScore);
             print("Верный ответ");
             break;
     }
 }
Ejemplo 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);
    }
Ejemplo 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;
        }
    }
Ejemplo 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");
         }
     }
 }
Ejemplo 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;
        }
    }
Ejemplo 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);
            }
        }
    }
Ejemplo 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;
        }
    }