public static void SubmitStat(LeaderBoardType type, int score, bool force = false)
 {
     if (App.State.IsBlackListed && !force)
     {
         return;
     }
     if (type.ToString().Contains("Fastest") && score == 0)
     {
         return;
     }
     if (App.CurrentPlattform == Plattform.Steam && App.IsTimeTooOldForSteam)
     {
         return;
     }
     if (App.CurrentPlattform == Plattform.Steam && App.State.Ext.ImportedSaveFromKongToSteam)
     {
         return;
     }
     if ("JaldinSicon".Equals(App.State.SteamName) || "Blas de Lezo".Equals(App.State.SteamName))
     {
         return;
     }
     if ((App.State.ShouldSubmitScore || force) && (force || !App.State.PossibleCheater))
     {
         if (App.CurrentPlattform == Plattform.Steam)
         {
             Leaderboards.Instance.ScoresToSubmit.Push(new LeaderboardScore(type, score));
         }
         else if (App.CurrentPlattform == Plattform.Kongregate)
         {
             Kongregate.SubmitStat(type.ToString(), score, false);
         }
     }
 }
Esempio n. 2
0
 public LeaderBoardDetailHeader(
     string title,
     string subTitle,
     LeaderBoardType type       = LeaderBoardType.collection,
     bool isCollected           = false,
     bool isLoading             = false,
     bool isHost                = false,
     List <string> images       = null,
     Action ClickButtonCallback = null,
     Widget followButton        = null,
     Widget leftWidget          = null,
     float leftWidgetTopPadding = 8,
     Key key = null
     ) : base(key)
 {
     this.type                 = type;
     this.isCollected          = isCollected;
     this.images               = images ?? new List <string>();
     this.isLoading            = isLoading;
     this.title                = title;
     this.isHost               = isHost;
     this.subTitle             = subTitle;
     this.ClickButtonCallback  = ClickButtonCallback;
     this.followButton         = followButton;
     this.leftWidget           = leftWidget;
     this.leftWidgetTopPadding = leftWidgetTopPadding;
 }
 public void ShowLeaderBoardOf(LeaderBoardType type)
 {
     GameObject obj2 = UnityEngine.Object.Instantiate(this.leadBoardPrefabs[((int) type) - 1]) as GameObject;
     obj2.GetComponent<LeaderBoardRankUI>().GoBackEvent += new EventHandler<EventArgs>(this.HandleGoBackEvent);
     this.hideActionGO.SetActive(true);
     this.hideActionGO.GetComponent<AnimatePosition>().StartMove();
 }
Esempio n. 4
0
        public static object fetchLeaderBoardDetail(string tagId, int page, LeaderBoardType type)
        {
            return(new ThunkAction <AppState>((dispatcher, getState) => {
                return LeaderBoardApi.FetchLeaderBoardDetail(tagId: tagId, page: page, leaderBoardType: type)
                .Then(detailResponse => {
                    dispatcher.dispatch(new UserMapAction {
                        userMap = detailResponse.userSimpleV2Map
                    });
                    dispatcher.dispatch(new TeamMapAction {
                        teamMap = detailResponse.teamSimpleMap
                    });

                    var articleIds = new List <string>();
                    var articleDict = new Dictionary <string, Article>();
                    detailResponse.projectSimples.ForEach(project => {
                        articleIds.Add(item: project.id);
                        articleDict.Add(key: project.id, value: project);
                    });
                    dispatcher.dispatch(new ArticleMapAction {
                        articleMap = articleDict
                    });

                    dispatcher.dispatch(new FetchLeaderBoardDetailSuccessAction {
                        type = type,
                        albumId = tagId,
                        articleList = articleIds,
                        hasMore = detailResponse.hasMore,
                        pageNumber = page
                    });

                    dispatcher.dispatch(new FavoriteTagMapAction {
                        favoriteTagMap = detailResponse.favoriteTagMap
                    });
                    dispatcher.dispatch(new FavoriteTagArticleMapAction {
                        favoriteTagArticleMap = detailResponse.favoriteTagArticleMap
                    });
                    dispatcher.dispatch(new CollectedTagMapAction {
                        collectedTagMap = detailResponse.collectedTagMap
                    });
                    if (type == LeaderBoardType.collection)
                    {
                        if (detailResponse.myFavoriteTag != null)
                        {
                            detailResponse.rankData.myFavoriteTagId = detailResponse.myFavoriteTag.id;
                        }

                        dispatcher.dispatch(new RankListAction {
                            rankList = new List <RankData> {
                                detailResponse.rankData
                            }
                        });
                    }
                })
                .Catch(error => {
                    dispatcher.dispatch(new FetchLeaderBoardDetailFailureAction());
                    Debuger.LogError(message: error);
                });
            }));
        }
 public LeaderBoardDetailScreenConnector(
     string tagId,
     LeaderBoardType type = LeaderBoardType.collection,
     Key key = null
     ) : base(key: key)
 {
     this.tagId = tagId;
     this.type  = type;
 }
Esempio n. 6
0
        public static Promise <FetchLeaderBoardDetailResponse> FetchLeaderBoardDetail(
            string tagId, int page, LeaderBoardType leaderBoardType)
        {
            var promise = new Promise <FetchLeaderBoardDetailResponse>();
            var para    = new Dictionary <string, object> {
                { "page", page }
            };
            var request = HttpManager.GET(
                $"{Config.apiAddress_cn}{Config.apiPath}/rankList/{leaderBoardType.ToString()}/{tagId}",
                parameter: para);

            HttpManager.resume(request: request).Then(responseText => {
                var detailResponse = JsonConvert.DeserializeObject <FetchLeaderBoardDetailResponse>(value: responseText);
                promise.Resolve(value: detailResponse);
            }).Catch(exception => promise.Reject(ex: exception));
            return(promise);
        }
	/// <summary>
	/// 리더보드 기록 가져오기
	/// </summary>
	private void GetLoadScores (LeaderBoardType lType)
	{
//        Social.LoadScores(m_leaderBoardIDs[(int)lType], scores =>
//        {
//            if (scores.Length > 0)
//            {
//                Log.log("Got " + scores.Length + " scores");
//                string myScores = "Leaderboard:\n";
//                foreach (IScore score in scores)
//                    myScores += "\t" + score.userID + " " + score.formattedValue + " " + score.date + "\n";
//                Log.log(myScores);
//            }
//            else
//                Log.log("No scores loaded");
//        });
	}
	/// <summary>
	/// 로그인시 베스트 스코어 가져오기 구글 서버에서 값을 가져오도록 수정필요
	/// </summary>
	/// <param name="lType"></param>
	/// <returns></returns>
	public int GetBoardScore (LeaderBoardType lType)
	{
		if (!m_login) {
			return PlayerPrefs.GetInt (NameManager.PREF_BEST_SCORE, NameManager.PREF_BEST_SCORE_DEFAULT);
		} else {
			// 스코어 가져오는 로직 필요
			GetLoadScores (lType);

			return PlayerPrefs.GetInt (NameManager.PREF_BEST_SCORE, NameManager.PREF_BEST_SCORE_DEFAULT);
		}
	}
	public void SendBoardScore (LeaderBoardType lType, int score)
	{
		if (!m_login)
			return;

		#if UNITY_ANDROID
		string leaderBoardID = m_leaderBoardIDsForAndroid[(int)lType];

		#elif UNITY_IOS
		string leaderBoardID = m_leaderBoardIDsForIOS [(int)lType];

		#else
		string leaderBoardID = m_leaderBoardIDsForAndroid [(int)lType];

		#endif



		Social.ReportScore (score, leaderBoardID, (bool success) => {
			print ("send Score:" + score);
		});
	}
Esempio n. 10
0
 ///<summary>
 ///        Возвращает рейтинг пользователей в игре
 ///      
 ///</summary>
 ///<param name="type">Тип рейтинга</param>
 ///<param name="global">Глобальный/только друзья</param>
 public EntityList<int> GetLeaderboardSync(
     LeaderBoardType type ,  bool global = true
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Apps.GetLeaderboard(
                 type,global
             )
         );
     task.Wait();
     return task.Result.Response;
 }
Esempio n. 11
0
 ///<summary>
 ///        Возвращает рейтинг пользователей в игре
 ///      
 ///</summary>
 ///<param name="type">Тип рейтинга</param>
 ///<param name="global">Глобальный/только друзья</param>
 public async Task <EntityList<int>> GetLeaderboard(
     LeaderBoardType type ,  bool global = true
 ) {
     return (
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Apps.GetLeaderboard(
                 type,global
             )
         ).ConfigureAwait(false)
     ).Response;
 }
Esempio n. 12
0
            ///<summary>
            ///        Возвращает рейтинг пользователей в игре
            ///      
            ///</summary>
            ///<param name="type">Тип рейтинга</param>
            ///<param name="global">Глобальный/только друзья</param>
            public Request<EntityList<int>> GetLeaderboard(
                LeaderBoardType type ,  bool global = true
            ) {
                var req = new Request<EntityList<int>>{
                    MethodName = "apps.getLeaderboard",
                    Parameters = new Dictionary<string, string> {

                        { "type", type.ToNCString().ToSnake()},
                        { "global", (global?1:0).ToNCString()},
                        {"extended","0"},

                    }
                };
                    req.Token = _parent.CurrentToken;
                return req;
            }
Esempio n. 13
0
 ///<summary>
 ///        Возвращает рейтинг пользователей в игре
 ///      
 ///</summary>
 ///<param name="type">Тип рейтинга</param>
 ///<param name="global">Глобальный/только друзья</param>
 public async Task<string> GetLeaderboard(
     LeaderBoardType type ,  bool global = true
 ){
     return await _parent.Executor.ExecRawAsync(
         _parent._reqapi.Apps.GetLeaderboard(
                type,global
         )
     ).ConfigureAwait(false);
 }
Esempio n. 14
0
 public LeaderboardScore(LeaderBoardType type, CDouble score)
 {
     this.Type  = type;
     this.Score = score;
 }