예제 #1
0
 // Resets the response booleans to default values so another request can be made
 void ResetResponse(bool fakeDecline = false)
 {
     m_hasServerResponded     = fakeDecline;
     m_ticketValidityResponse = false;
     m_itemAddResponse.Reset();
     m_itemRequestResponse.Reset();
 }
예제 #2
0
    // This function should be called using Invoke() after the desired period of time
    IEnumerator ExpireItemTicket(ItemTicket toExpire, float timeToWait)
    {
        //Debug.Log("Waiting to expire ticket: " + toExpire + " in " + timeToWait);

        // Wait for the desired amount of time
        yield return(new WaitForSeconds(timeToWait));

        // Tickets which have been redeemed will be reset to the standard ticket
        if (toExpire.IsValid())
        {
            // Only the server needs to manage whether the item is flagged as requested or not
            if (Network.isServer)
            {
                // Obtain the index
                int index = DetermineTicketIndex(toExpire);

                // Flag the item as unrequested
                if (IsValidIndex(index))
                {
                    // Reset the request
                    m_isItemRequested[index] = false;
                }

                // Must be an add request
                else
                {
                    --addRequests;
                }
            }

            // Reset the ticket to ensure it's invalid
            toExpire.Reset();

            Debug.Log("Expiring ItemTicket: " + toExpire.uniqueID + " / " + toExpire.itemID + " / " + toExpire.itemIndex);
        }
    }