コード例 #1
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));
    }
コード例 #2
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);
    }