public void OnCallGroupDisconnected(Call_Group _group, Call_State _finalState)
    {
        // Grab the call participants
        List <Call_Individual> callers = _group.CallParticipants;

        // Unbind all of the callers within the group
        foreach (var caller in callers)
        {
            UnbindKey(caller.BoundKeyCode);
        }

        // If the call group was the one that was bound, we should unbind it
        if (_group == m_groupToBind)
        {
            m_groupToBind = null;
        }

        // If any of the callers was in the selection, we should remove that as well
        foreach (var caller in callers)
        {
            if (m_selectedCallers.Contains(caller))
            {
                DeselectCaller(caller);
            }
        }

        // Invoke the event since the key bindings have changed
        m_OnBindingsChanged.Invoke();

        // Unhook the listener
        _group.m_OnCallCompleted.RemoveListener(this.OnCallGroupDisconnected);
    }
Ejemplo n.º 2
0
    public void UpdateCallState()
    {
        // Grab the first caller's room so we can see if everyone else is there too
        Room_Name firstCallerRoom = m_callParticipants[0].CurrentRoom;

        // Check in with the individual callers and see if they are in the same room
        foreach (var caller in m_callParticipants)
        {
            // If one of the participants is not in the same room, this call is in a waiting state by default
            if (firstCallerRoom != caller.CurrentRoom)
            {
                m_callState = Call_State.Waiting;
                return;
            }
        }

        // If all of the callers are in the same room, we still need to determine if they are actually in a chat room
        // If they are not in a chat room but they are all together, they are still waiting
        if (firstCallerRoom >= Room_Name.Chat_1 && firstCallerRoom <= Room_Name.Chat_5)
        {
            m_callState = Call_State.Active;
        }
        else
        {
            m_callState = Call_State.Waiting;
        }
    }
    public void UpdateCallState()
    {
        // Grab the first caller's room so we can see if everyone else is there too
        Room_Name firstCallerRoom = m_callParticipants[0].CurrentRoom;

        // We need to check if it's ONLY this call group in this room. There shouldn't be another group in here
        if (m_roomManager.GetCurrentCapacity(firstCallerRoom) != m_numParticipants)
        {
            m_callState = Call_State.Waiting;
            return;
        }

        // Check in with the individual callers and see if they are in the same room
        foreach (var caller in m_callParticipants)
        {
            // If one of the participants is not in the same room, this call is in a waiting state by default
            if (firstCallerRoom != caller.CurrentRoom)
            {
                m_callState = Call_State.Waiting;
                return;
            }
        }

        // If all of the callers are in the same room, we still need to determine if they are actually in a chat room
        // If they are not in a chat room but they are all together, they are still waiting
        if (firstCallerRoom >= Room_Name.Chat_1 && firstCallerRoom <= Room_Name.Chat_5)
        {
            m_callState = Call_State.Active;
            if (prevState == Call_State.Waiting)
            {
                if (audioManager == null)
                {
                    audioManager = GameObject.Find("AudioManager").GetComponent <Audio_Manager>();
                }
                audioManager.PlayOneShot(2, 0.5f);
            }
            prevState = m_callState;
        }
        else
        {
            m_callState = Call_State.Waiting;
            prevState   = m_callState;
        }
    }
Ejemplo n.º 4
0
    //--- Event Hooks ---//
    public void OnCallCompleted(Call_Group _callObj, Call_State _callFinalState)
    {
        // Handle the call termination differently, depending on if ended well or not
        if (_callFinalState == Call_State.Waited_Too_Long)
        {
            // Play negative feedback
            audioManager.PlayOneShot(4, 0.2f);

            //TODO: Increment missed calls counter
            persistManager.callsMissed += 1;
        }
        else if (_callFinalState == Call_State.Completed)
        {
            // Play positive feedback
            audioManager.PlayOneShot(3, 0.5f);
            // Add points, reputation, etc
            callsCompletedDaily++;
            GameObject.FindObjectOfType <CashCalculation_Script>().CalculateCashForCall(_callObj);

            //End of game Satisfaction
            //TODO: Increment total calls completed
            persistManager.callsCompleted    += 1;
            persistManager.gamesSatisfaction += _callObj.GetSatisfationFromCall();

            //callCash.GetComponent<TextMeshProUGUI>().text = GameObject.FindObjectOfType<CashCalculation_Script>().CalculateCashForCall(_callObj).ToString();
            totalCash.GetComponent <TextMeshProUGUI>().text = GameObject.FindObjectOfType <CashCalculation_Script>().TotalCashEarned().ToString(); //Returns Total Cash
            //Debug the new money recieved.
            //Debug.Log(this.GetComponent<CashCalculation_Script>().CalculateCashForCall(_callObj));
        }

        // Remove the UI element from the call backlog
        m_callLogUI.RemoveCallGroupUI(_callObj);

        // Unhook the event
        _callObj.m_OnCallCompleted.RemoveListener(this.OnCallCompleted);

        // Remove the callers from their associated rooms
        m_roomManager.DisconnectCallers(_callObj.CallParticipants);

        // We should also remove the call from the list
        // However, we need to wait until the end of the frame to ensure all the other call operations are complete
        StartCoroutine(DeleteCall(_callObj));
    }
Ejemplo n.º 5
0
    //--- Constructors ---//
    public Call_Group(int _numParticipants, float _waitTimeMax, float _callTimeMax)
    {
        // Init the event
        m_OnCallCompleted = new Call_CompletionEvent();

        // Init the private data
        m_callParticipants  = new List <Call_Individual>();
        m_callState         = Call_State.Waiting;
        m_numParticipants   = _numParticipants;
        m_waitTimeMax       = _waitTimeMax;
        m_waitTimeRemaining = m_waitTimeMax;
        m_callTimeMax       = _callTimeMax;
        m_callTimeRemaining = m_callTimeMax;

        // Create the call participants and keep track of them
        for (int i = 0; i < m_numParticipants; i++)
        {
            m_callParticipants.Add(new Call_Individual());
        }
    }
Ejemplo n.º 6
0
    //--- Event Hooks ---//
    public void OnCallCompleted(Call_Group _callObj, Call_State _callFinalState)
    {
        // Handle the call termination differently, depending on if ended well or not
        if (_callFinalState == Call_State.Waited_Too_Long)
        {
            // TODO: Play negative feedback
        }
        else if (_callFinalState == Call_State.Completed)
        {
            // TODO: Play positive feedback

            // TODO: Add points, reputation, etc
        }

        // Remove the UI element from the call backlog
        m_callLogUI.RemoveCallGroupUI(_callObj);

        // Either way, unhook the event and remove the call from the list
        _callObj.m_OnCallCompleted.RemoveAllListeners();
        m_callList.Remove(_callObj);
    }
    //--- Constructors ---//
    public Call_Group(int _numParticipants, float _waitTimeMax, float _callTimeMax)
    {
        // Init the event
        m_OnCallCompleted = new Call_CompletionEvent();

        // Init the private data
        m_roomManager       = GameObject.FindObjectOfType <Room_Manager>();
        m_callParticipants  = new List <Call_Individual>();
        m_callState         = Call_State.Waiting;
        m_numParticipants   = _numParticipants;
        m_waitTimeMax       = _waitTimeMax;
        m_waitTimeRemaining = m_waitTimeMax;
        m_callTimeMax       = _callTimeMax;
        m_callTimeRemaining = m_callTimeMax;
        m_isInBindMode      = false;
        m_shouldCheckState  = true;

        // Create the call participants and keep track of them
        for (int i = 0; i < m_numParticipants; i++)
        {
            m_callParticipants.Add(new Call_Individual());
        }
    }