Exemplo n.º 1
0
    private void MouseManager_ClickEvent(object sender, ClickArgs e)
    {
        var clickedObject = e.clickedObject;

        //if you clicked an object that is not selected already
        if (selectedObject != clickedObject)
        {
            //clear previous selection
            if (DeselectionEvent != null && selectedObject != null)
            {
                DeselectionEvent.Invoke(this, new ClickArgs(selectedObject));
            }
            //select the object
            if (SelectionEvent != null && clickedObject != null)
            {
                SelectionEvent.Invoke(this, new ClickArgs(clickedObject));
            }
        }
        else
        {
            //if you clicked the selected object
            //deselect the object
            if (DeselectionEvent != null)
            {
                DeselectionEvent.Invoke(this, new ClickArgs(clickedObject));
            }
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// Invokes the SelectionEvent event listener
 /// </summary>
 public static void InvokeSelection()
 {
     if (SelectionEvent != null)
     {
         SelectionEvent.Invoke();
     }
 }
Exemplo n.º 3
0
 void FireSelectionEvent(TreeViewItem item)
 {
     if (m_SelectionEvent != null)
     {
         m_SelectionEvent.Invoke(item);
     }
 }
Exemplo n.º 4
0
    private void HandleDialogueInput()
    {
        if (currentDialogue == null || currentDialogue.selectionEvent == null)
        {
            return;
        }

        int index = currentDialogue.index;

        if (Input.GetKeyDown(KeyCode.S))
        {
            currentDialogue.index = Math.Min(index + 1, currentDialogue.values.Count - 1);
            RenderDialogue(currentDialogue);
        }
        else if (Input.GetKeyDown(KeyCode.W))
        {
            currentDialogue.index = Math.Max(0, index - 1);
            RenderDialogue(currentDialogue);
        }
        else if (Input.GetKeyDown(KeyCode.E))
        {
            SelectionEvent ev = currentDialogue.selectionEvent;
            currentDialogue = null;
            ev.Invoke(index);
        }
    }
Exemplo n.º 5
0
 public override void CallFunction()
 {
     base.CallFunction();
     if (m_OptionSelected)
     {
         OnSelected.Invoke(m_SelectedIndex);
     }
 }
Exemplo n.º 6
0
 private void EndSelection()
 {
     if (Input.GetMouseButtonUp(0) && boxRect.gameObject.activeSelf)
     {
         clickedAfterDrag = GetSelectableAtMousePosition();
         ApplySingleClickDeselection();
         ApplyPreSelections();
         ResetBoxRect();
         onSelectionChange.Invoke(GetAllSelected());
     }
 }
Exemplo n.º 7
0
 public override void CallFunction()
 {
     if (m_OptionSelected)
     {
         OnSelected.Invoke(m_SelectedIndex);
         if (m_ObjectToCall != null)
         {
             m_ObjectToCall.SendMessage(m_FunctionToCall, m_SelectedIndex);
         }
     }
 }
Exemplo n.º 8
0
        void EndSelection()
        {
            //Get out if we haven't finished selecting, or if the selection has been aborted (boxRect disabled)
            if (!Input.GetMouseButtonUp(0) || !boxRect.gameObject.activeSelf)
            {
                return;
            }

            clickedAfterDrag = GetSelectableAtMousePosition();

            ApplySingleClickDeselection();
            ApplyPreSelections();
            ResetBoxRect();
            onSelectionChange.Invoke(GetAllSelected());
        }
        void DeactivateMenu()
        {
            if (m_OptionSelected)
            {
                OnSelected.Invoke(m_SelectedIndex);
            }

            m_State = State.Deactivating;

            if (!m_DisplaySelectedName)
            {
                m_MenuText.text = m_MenuName;
            }

            //print("Deactivating,    Name set to : " + m_MenuText.text);

            m_TargetRadius = 0;
        }
Exemplo n.º 10
0
    void DeactivateMenu()
    {
        if (m_OptionSelected)
        {
            OnSelected.Invoke(m_SelectedIndex);
            if (m_ObjectToMessage != null)
            {
                m_ObjectToMessage.SendMessage(m_FunctionCall, m_SelectedIndex);
            }
        }

        m_State = State.Deactivating;

        if (!m_DisplaySelectedName)
        {
            m_MenuText.text = m_MenuName;
        }

        print("Deactivating,    Name set to : " + m_MenuText.text);

        m_TargetRadius = 0;
    }
Exemplo n.º 11
0
    public void SelectFeedback()
    {
        List <MomentoInteracao> feedbacks;

        // (Switch não usado pois o nível de ensino não é constante)
        if (EstadoDoJogo.Instance.NivelDeEnsino == NivelDeEnsino.EducacaoInfantil)
        {
            feedbacks = feedbacksInfantil;
        }
        else if (EstadoDoJogo.Instance.NivelDeEnsino == NivelDeEnsino.EnsinoFundamental)
        {
            feedbacks = feedbacksFundamental;
        }
        else if (EstadoDoJogo.Instance.NivelDeEnsino == NivelDeEnsino.EnsinoMedio)
        {
            feedbacks = feedbacksMedio;
        }
        else
        {
            feedbacks = feedbacksSuperior;
        }

        bool positive = ComboChecker.ComboClassification.Arriscada != ComboChecker.EvaluateComboClassification();

        for (int i = 0; i < feedbacks.Count; i++)
        {
            if (feedbacks[i].midias[0] == stateMachineController.CurrentMedia().nomeMidia&&
                positive == feedbacks[i].alunoFeliz)
            {
                interactionManager.Interaction = feedbacks[i];
                break;
            }
        }

        OnSelectionEvent.Invoke(positive, stateMachineController.CurrentMedia().sprite);
    }
Exemplo n.º 12
0
 public override void OnDeselect(BaseEventData eventData)
 {
     base.OnDeselect(eventData);
     onDeselected?.Invoke(this);
 }
Exemplo n.º 13
0
 public void Deselect()
 {
     OnDeselect.Invoke();
 }
Exemplo n.º 14
0
 public void Select()
 {
     OnSelect.Invoke();
 }