Beispiel #1
0
 private void InvokeCallback(string msgKey, object msg)
 {
     if (m_netCallbackMap.ContainsKey(msgKey))
     {
         List <Action <object> > callbacks = m_netCallbackMap[msgKey];
         NetCall netCall = new NetCall();
         netCall.msgKey = msgKey;
         netCall.msg    = msg;
         netCall.calls  = callbacks;
         m_callMap.Add(netCall);
     }
 }
Beispiel #2
0
    public void Update()
    {
        int count = m_callMap.Count;

        while (count-- > 0)
        {
            NetCall call = m_callMap[count];
            for (int i = 0; i < call.calls.Count; i++)
            {
                call.calls[i].Invoke(call.msg);
            }
            m_callMap.RemoveAt(count);
            count = m_callMap.Count;
        }
    }
Beispiel #3
0
    public IEnumerator GetUserData(NetCall nc)
    {
        // Create a form object for sending high score data to the server
        WWWForm form = new WWWForm();

        // Assuming the perl script manages high scores for different games
        form.AddField("game", "MyGameName");

        // Create a download object
        WWW download = new WWW(url, form);

        // Wait until the download is done
        yield return(download);

        if (!string.IsNullOrEmpty(download.error))
        {
            print("Error downloading: " + download.error);
        }
        else
        {
            // show the highscores
            nc(download.text);
        }
    }