private void GetFriendsListResponse(LogEventResponse response)
    {
        ClearFriendsList();
        var friendsListData = response.ScriptData.BaseData;

        UpdateFriendsListUI(friendsListData);
    }
예제 #2
0
        public static MarketUsersReply LogEventToMarketUsersReply(LogEventResponse eventResponse)
        {
            MarketUsersReply reply = new MarketUsersReply(true);

            List <object> users = eventResponse.ScriptData.GetObjectList("marketUsers");

            foreach (Dictionary <string, object> user in users)
            {
                MarketUsersReply.User marketUser = new MarketUsersReply.User();

                marketUser.id = user["_id"].ToString();

                marketUser.name   = user["name"].ToString();
                marketUser.gender = ((Dictionary <string, object>)user["profile"])["gender"].ToString();

                long birthdate = long.Parse(((Dictionary <string, object>)user["profile"])["birthdate"].ToString());
                marketUser.birthdate = new DateTime(1970, 1, 1) + new TimeSpan(birthdate * 10000);

                marketUser.price = long.Parse(((Dictionary <string, object>)user["stats"])["price"].ToString());

                marketUser.online         = user["online"].ToString() != "0";
                marketUser.recentlyJoined = user["recentlyJoined"].ToString() != "0";

                reply.Users.Add(marketUser);
            }

            return(reply);
        }
예제 #3
0
 private void WinnedTeamSubmissionCallback(LogEventResponse response)
 {
     if (response.HasErrors)
     {
         Debug.Log("GameSparksManager: Error: " + response.Errors.JSON);
     }
 }
예제 #4
0
        public static StardomAPIReply LogEventErrorToAPIReply(LogEventResponse eventResponse)
        {
            bool   success  = eventResponse.ScriptData.GetBoolean("success").Value;
            string errorMsg = eventResponse.ScriptData.GetString("errorMsg");

            return(new StardomAPIReply(success, errorMsg));
        }
    private void SearchForFriendsResponse(LogEventResponse response)
    {
        ClearSearchForFriendsList();
        var friendsSearchListData = response.ScriptData.BaseData;

        UpdateSearchForFriendsUI(friendsSearchListData);
    }
예제 #6
0
    private void TeamScoreCallback(LogEventResponse response)
    {
        if (response.HasErrors)
        {
            Debug.Log("GameSparksManager: Error: " + response.Errors.JSON);
        }
        else
        {
            GSData dataCola  = response.ScriptData.GetGSData("ColaData");
            GSData dataPepsi = response.ScriptData.GetGSData("PepsiData");

            int counterCola = 0;
            if (dataCola.ContainsKey("count"))
            {
                counterCola = dataCola.GetInt("count").Value;
            }

            int counterPepsi = 0;
            if (dataPepsi.ContainsKey("count"))
            {
                counterPepsi = dataPepsi.GetInt("count").Value;
            }

            ManagersController.Message(Message.Create(this, MessageData.EVENT_GET_TEAMS_SCORE, counterCola, counterPepsi));
        }
    }
 private void OnAcceptFriendRequestResult(LogEventResponse response)
 {
     if (!response.HasErrors)
     {
         // remove pending request from list
         GameObject.Destroy(GameObject.Find(playerID + "pending"));
         FriendsPanel friendsPanelScript = GetComponentInParent <FriendsPanel>();
         friendsPanelScript.GetPendingFriendsList();
     }
 }
예제 #8
0
 private void ProcessPosting(LogEventResponse response)
 {
     if (!response.HasErrors)
     {
         Debug.Log("Score Posted Successfully..." + finalScore);
     }
     else
     {
         Debug.Log("Error Posting Score...");
     }
 }
예제 #9
0
 private void SetLastLoginTimeResponse(LogEventResponse response)
 {
     if (!response.HasErrors)
     {
         Debug.Log("LoginSet correctly");
     }
     else
     {
         Debug.Log("Error while getting the update version... \n " + response.Errors.JSON.ToString());
     }
 }
예제 #10
0
 private void ScoreSubmissionCallback(LogEventResponse response)
 {
     if (response.HasErrors)
     {
         Debug.Log("GameSparksManager: Error: " + response.Errors.JSON);
     }
     else
     {
         //Update leaderboard
         LeaderboardRequest();
     }
 }
    private void OnFriendRequestResponse(LogEventResponse response)
    {
        UnityEngine.UI.Text[] friendResultObjectTexts = GameObject.Find(playerID + "search").GetComponentsInChildren <Text>();
        Text friendResultText = friendResultObjectTexts[0];

        if (!response.HasErrors)
        {
            // Change text of button
            friendResultText.text = "Request Sent!";
        }
        else
        {
            friendResultText.text = "Request Already Sent!";
        }
    }
예제 #12
0
    private void ProcessDownloadBundleListResponse(LogEventResponse response, System.Action <bool> callback)
    {
        IsBundleListDownloading = false;

        if (response == null || response.ScriptData == null || response.HasErrors)
        {
            if (callback != null)
            {
                callback(false);
            }

            return;
        }

        var bundles = response.ScriptData.GetGSDataList("bundles");

        if (bundles == null || bundles.Count == 0)
        {
            if (callback != null)
            {
                callback(false);
            }

            return;
        }

        List <RemoteBundleData> bundles_data = new List <RemoteBundleData>();

        foreach (var item in bundles)
        {
            var shortCode = item.GetString("shortCode");
            var crc       = item.GetString("crc");
            var bundleId  = item.GetString("bundleId");

            var remote_bundle_data = new RemoteBundleData(shortCode, crc, bundleId);
            bundles_data.Add(remote_bundle_data);
        }

        lock (m_remoteBundleListLock)
            m_remoteBundleList = bundles_data.ToArray();

        if (callback != null)
        {
            callback(true);
        }
    }
예제 #13
0
        public static UserProfileReply UserProfileResponseToUserProfileReply(LogEventResponse profileResponse)
        {
            UserProfileReply reply = new UserProfileReply(true);

            reply.id   = profileResponse.ScriptData.GetString("id");
            reply.fbid = profileResponse.ScriptData.GetString("fbid");
            reply.name = profileResponse.ScriptData.GetString("name");

            GSData profile = profileResponse.ScriptData.GetObject("profile");
            GSData stats   = profileResponse.ScriptData.GetObject("stats");

            reply.countryCode = profile.GetString("country");
            reply.mood        = profile.GetInt("mood").Value;
            reply.price       = stats.GetInt("price").Value;

            reply.status = profile.GetString("status");
            reply.pics   = profile.GetStringList("pics");
            reply.videos = profile.GetStringList("videos");

            return(reply);
        }
예제 #14
0
    public void CheckForUpdatesResponse(LogEventResponse response)
    {
        if (!response.HasErrors)
        {
            float versionNumber = response.ScriptData.GetFloat("versionNumber").Value;
            bool  invasive      = response.ScriptData.GetBoolean("invasive").Value;

            if (float.Parse(Application.version) < versionNumber)
            {
                updateButton.SetActive(true);
                if (invasive)
                {
                    updatePanel.SetActive(true);
                }
            }
        }
        else
        {
            Debug.Log("Error while getting the update version... \n " + response.Errors.JSON.ToString());
        }
    }
    public void GettingTournamentData2(LogEventResponse response)
    {
        var res1 = new GSData();
        var res2 = new GSData();
        Dictionary <string, string> dicBoost = new Dictionary <string, string>();
        var cursor = response.ScriptData.BaseData;

        res1 = null;
        res2 = null;
        foreach (var c in cursor)
        {
            res1 = response.ScriptData.GetGSData(c.Key);
            foreach (var k in res1.BaseData)
            {
                if (k.Key == "trackName")
                {
                }
                if (k.Key == "timeTaken")
                {
                }
                if (k.Key == "ghostData")
                {
                    res2 = (GSData)k.Value;
                    foreach (var tt in res2.BaseData)
                    {
                        if (tt.Key == "Tour")
                        {
                            Tournament.tournament.TypeTourString[0] = tt.Value.ToString();
                        }
                        if (tt.Key == "TypeTour")
                        {
                            Tournament.tournament.TypeTourString[1] = tt.Value.ToString();
                        }
                    }
                }
            }
        }
    }
    public void GettingTournamentData(LogEventResponse response)
    {
        var res1 = new GSData();
        var res2 = new GSData();
        //Debug.Log("Getting Keys");
        Dictionary <string, string> dicBoost = new Dictionary <string, string>();
        bool SendMail  = false;
        bool SpendMail = false;
        var  cursor    = response.ScriptData.BaseData;

        if (cursor == null)
        {
            Debug.Log("notdata");
            return;
        }
        res1 = null;
        res2 = null;
        foreach (var c in cursor)
        {
            //Debug.Log(c.Key.ToString());
            if (PortalNetwork.THIS.IsYou(c.Key.ToString()))
            {//
                if (!OpenAppLevel.THIS.onf7)
                {
                    Tournament.joined = true;
                }
                string idtime = "5be8b796fc37de04ee99c3ca";
                //Debug.Log(c.Key.ToString());
                //Debug.Log(c.Key.ToString());
                res1 = response.ScriptData.GetGSData(idtime);//

                foreach (var k in res1.BaseData)
                {
                    if (k.Key == "trackName")
                    {
                    }
                    if (k.Key == "timeTaken")
                    {
                        //Debug.Log(k.Value.ToString());
                        //TimeParse(k.Value.ToString());//
                    }
                    if (k.Key == "timeEnd")
                    {
                        //TimeParse3(k.Value.ToString());
                    }
                    if (k.Key == "ghostData")
                    {
                        string outTime = k.Value.ToString();//
                    }
                    if (k.Key == "Name")
                    {
                        //TounamentLB.THIS.playerNames.Add(k.Value.ToString());
                        //Debug.Log(k.Value.ToString());
                    }
                }
            }
            else
            {
            }
        }
    }
예제 #17
0
 //Post Score Sucessful
 public void OnSucessPostScore(LogEventResponse pEventResponse)
 {
     Debug.Log("Sucess Post");
 }
예제 #18
0
 //Post Score Error
 public void OnErrorPostScore(LogEventResponse pEventResponse)
 {
     Debug.Log("Error on post");
 }
예제 #19
0
 private void OnGetNewGuestUserSuccess(LogEventResponse message)
 {
     Debug.Log("New guest user successful");
     adminLogin = false;
 }
예제 #20
0
 private void OnPlayAgainError(LogEventResponse response)
 {
     print(response.Errors.JSON.ToString());
 }
예제 #21
0
 private void OnPlayAgainSuccess(LogEventResponse response)
 {
     print(response.JSONString);
 }