コード例 #1
0
 public void LogInWithPublish(List <string> perms)
 {
     DebugUtils.DebugLog("Request facebook login with publish.");
     FB.LogInWithPublishPermissions(perms, OnLoginCb);
 }
コード例 #2
0
 void OnHideCb(bool isGameShown)
 {
     DebugUtils.DebugLog("isGameShown: {0}", isGameShown);
 }
コード例 #3
0
 public void LogInWithRead(List <string> perms)
 {
     DebugUtils.DebugLog("Request facebook login with read.");
     FB.LogInWithReadPermissions(perms, OnLoginCb);
 }
コード例 #4
0
        private void DownloadDataCompleteCb(object sender, DownloadDataCompletedEventArgs ar)
        {
            try
            {
                if (ar.Error != null)
                {
                    DebugUtils.Log("Exception Error: {0}", ar.Error);
                    OnResultCallback(AnnounceResult.kExceptionError);
                    DebugUtils.Assert(false);
                }
                else
                {
                    // Parse json
                    string data = Encoding.UTF8.GetString(ar.Result);
                    Dictionary <string, object> json = Json.Deserialize(data) as Dictionary <string, object>;
                    if (json == null)
                    {
                        DebugUtils.Log("Deserialize json failed. json: {0}", data);
                        OnResultCallback(AnnounceResult.kInvalidJson);
                        return;
                    }

                    DebugUtils.Assert(json.ContainsKey("list"));
                    List <object> list = json["list"] as List <object>;
                    if (list == null || list.Count <= 0)
                    {
                        DebugUtils.Log("Invalid announcement list. list: {0}", list);
                        OnResultCallback(AnnounceResult.kListIsNullOrEmpty);
                        return;
                    }

                    announce_list_.Clear();

                    foreach (Dictionary <string, object> node in list)
                    {
                        announce_list_.Add(node);

                        // download image
                        if (node.ContainsKey(kImageUrlKey) && node.ContainsKey(kImageMd5Key))
                        {
                            CheckDownloadImage(node[kImageUrlKey] as string, node[kImageMd5Key] as string);
                        }
                    }

                    DebugUtils.Log("Announcement has been updated. total count: {0}", announce_list_.Count);

                    if (image_list_.Count > 0)
                    {
                        // Request a file.
                        KeyValuePair <string, string> item = image_list_[0];
                        web_client_.DownloadFileAsync(new Uri(item.Key), item.Value);
                        DebugUtils.Log("Download url: {0}", item.Key);
                    }
                    else
                    {
                        OnResultCallback(AnnounceResult.kSuccess);
                    }
                }
            }
            catch (Exception e)
            {
                DebugUtils.Log("Failure in DownloadDataCompleteCb: {0}", e.ToString());
                OnResultCallback(AnnounceResult.kExceptionError);
            }
        }