Beispiel #1
0
        private IEnumerator fetchAll(RankingType type, int score)
        {
            builder = new StringBuilder();

            while (true)
            {
                currentRank.Reset();
                fetchRank(type, score);
                yield return(new WaitUntil(currentRank.TakeOrFailure));

                if (!currentRank.Failure)
                {
                    break;
                }
                yield return(new WaitForSeconds(3.0f));
            }

            while (true)
            {
                topRankers.Reset();
                fetchRankers(type);
                yield return(new WaitUntil(topRankers.TakeOrFailure));

                if (!topRankers.Failure)
                {
                    break;
                }
                yield return(new WaitForSeconds(3.0f));
            }
        }
Beispiel #2
0
        public PartialViewResult FootballLeagueRanking(int competitionId, RankingType type)
        {
            FootballLeagueRankingInfoViewModel vm = new FootballLeagueRankingInfoViewModel();

            vm.CompetitionId = competitionId;

            return(PartialView("_FootballLeagueRankingInfo", vm));
        }
Beispiel #3
0
 public static void AddScoreToUserId(int tScore, int UserId, RankingType t)
 {
     if (!getRanking.ContainsKey(UserId))
         AddUserToRanking(UserId, t);
     using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
     {
         dbClient.runFastQuery("UPDATE user_rankings SET score = " + (getRanking[UserId].Score + tScore) + " WHERE userid = " + UserId + " AND type = '" + parseEnum(t) + "';");
     }
 }
Beispiel #4
0
    public void  GetListFromService(RankingType type, int PageIndex)
    {
        LastReqPageIndex = PageIndex;
        SMsgInteract_PvpRanking_CS msg = new SMsgInteract_PvpRanking_CS()
        {
            byIndex = (byte)PageIndex,
        };

        NetServiceManager.Instance.InteractService.SendGetPvpRankingList_CS(msg);
    }
Beispiel #5
0
 public static List<Ranking> getRankingForType(RankingType t)
 {
     List<Ranking> result = new List<Ranking>();
     foreach (Ranking r in getRanking.Values)
     {
         if (r.Type == t)
             result.Add(r);
     }
     return result;
 }
 private List <Ranking> GetRankings(int playerId, RankingType rankingType)
 {
     if (BossId == null || BossId == "-1")
     {
         return(this.rankings.Where(r => r.Player.Id == playerId && r.rankingType == rankingType).ToList());
     }
     else
     {
         return(this.rankings.Where(r => r.Player.Id == playerId && r.Boss.Id == int.Parse(BossId) && r.rankingType == rankingType).ToList());
     }
 }
        public int?GetMaxRank(Player player, RankingType rankingType)
        {
            var rankings = GetRankings(player.Id, rankingType);

            if (rankings.Count > 0)
            {
                return(rankings.Max(r => r.rank));
            }
            else
            {
                return(null);
            }
        }
        public double?GetAverageRank(Player player, RankingType rankingType)
        {
            var rankings = GetRankings(player.Id, rankingType);

            if (rankings.Count > 0)
            {
                return(Math.Round(rankings.Average(r => r.rank), 2));
            }
            else
            {
                return(null);
            }
        }
Beispiel #9
0
        private string getClassName(RankingType type)
        {
            switch (type)
            {
            case RankingType.MarathonMode:
                return(@"MarathonRanking");

            case RankingType.TokotonMode:
                return(@"TokotonRanking");

            default:
                throw new ArgumentOutOfRangeException("Invalid type was specified.");
            }
        }
Beispiel #10
0
 public static void AddUserToRanking(int UserId, RankingType t, string Information = "hlatCompetitions", int RoomId = 0)
 {
     using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
     {
         dbClient.runFastQuery("INSERT INTO user_rankings (type, information, userid, roomid, score) VALUES ('" + parseEnum(t) + "', '" + Information + "', " + UserId + ", " + RoomId + ", 0);");
     }
     Ranking r = new Ranking();
     r.UserId = UserId;
     r.Type = t;
     r.Information = Information;
     r.RoomId = RoomId;
     r.Score = 0;
     getRanking.Add(UserId, r);
 }
Beispiel #11
0
        public Contest(
            EntryType participationType = EntryType.Open,
            EntryType votingType = EntryType.Open,
            RankingType rewardType = RankingType.Multiple,
            DeadlineType deadlineType = DeadlineType.Time)
        {
            this._winners = new HashSet<ContestEntry>();
            this._contestEntries = new HashSet<ContestEntry>();
            this._participants = new HashSet<User>();

            this._participationStrategy = new ParticipationStrategy(participationType);
            this._votingStrategy = new VotingStrategy(votingType);
            this._rewardStrategy = new RewardStrategy(rewardType);
            this._deadlineStrategy = new DeadlineStrategy(deadlineType);
        }
Beispiel #12
0
        private string getClassName(RankingType type)
        {
            switch (type)
            {
            case RankingType.StackMode:
                return(@"StackRanking");

            case RankingType.MarathonMode:
                // TODO: 本来「MarathonRanking」を使用する予定だが、現在のランキングの都合上そのまま使用している(NCMB側でクラス名が変更できない、コピーもできない)
                return(@"Ranking");

            // return @"MarathonRanking";
            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #13
0
        void OnWeaponRankingBtnClick(object obj)
        {
            SoundManager.Instance.PlaySoundEffect("Sound_Button_Ranking_SwitchPage");
            SC_PlayerRankingList.gameObject.SetActive(false);
            SC_SirenRankingList.gameObject.SetActive(false);
            SC_WeaponRankingList.gameObject.SetActive(true);
            CurrentPageindex   = PlayerRankingDataManager.Instance.DefultWeaponRankingPage;
            PerPageIndex       = 0;
            CurrentRankingType = RankingType.WeaponRanking;
            GetCurrentPageData();
            PlayerRankingBtn.spriteSwithList.ApplyAllItem(p => p.ChangeSprite(1));
            SirenRankingBtn.spriteSwithList.ApplyAllItem(p => p.ChangeSprite(1));
            WeaponRankingBtn.spriteSwithList.ApplyAllItem(p => p.ChangeSprite(2));

            SetMyForce(RankingType.WeaponRanking);
        }
Beispiel #14
0
        public void Fetch(RankingType type, int score)
        {
            if (fetchCoroutine != null)
            {
                return;
            }

            try {
                fetchCoroutine = StartCoroutine(fetchAll(type, score));
            } catch (Exception e) {
                Debug.LogError(e);
                textField.text = @"ランキングの取得に失敗";
            } finally {
                fetchCoroutine = null;
            }
        }
Beispiel #15
0
        private void fetchRankers(RankingType type)
        {
            var className = getClassName(type);
            var query     = new NCMBQuery <NCMBObject>(className);

            query.OrderByDescending(@"score");
            query.Limit = FetchCount;
            query.FindAsync((list, e) => {
                if (e != null)
                {
                    Debug.LogError(e);
                    topRankers.Exception = e;
                    return;
                }

                var rankers = new List <Ranker>();
                foreach (var obj in list)
                {
                    var name  = Convert.ToString(obj["name"]);
                    var score = Convert.ToInt32(obj["score"]);
                    rankers.Add(new Ranker(name, score));
                }
                topRankers.Value = rankers;

                for (int i = 0; i < rankers.Count; i++)
                {
                    var str = rankers[i].ToString();

                    if (i < rankers.Count - 1)
                    {
                        builder.AppendLine(str);
                    }
                    else
                    {
                        builder.Append(str);
                    }
                }

                textField.text = builder.ToString();
            });
        }
Beispiel #16
0
        private void fetchRank(RankingType type, int score)
        {
            var className = getClassName(type);
            var query     = new NCMBQuery <NCMBObject>(className);

            query.WhereGreaterThan(@"score", score);
            query.CountAsync((count, e) => {
                if (e != null)
                {
                    Debug.LogError(e);
                    currentRank.Exception = e;
                    return;
                }

                currentRank.Value = count + 1;

                builder.AppendLine($"あなたの順位: { currentRank.Value } 位");
                builder.AppendLine(@"============================");
                textField.text = builder.ToString();
            });
        }
 public RankingConfigurationBuilder(int programNumber, RankingType rankingType)
 {
     _programNumber = programNumber;
     _rankingType = rankingType;
 }
Beispiel #18
0
 private static string parseEnum(RankingType t)
 {
     if (t == RankingType.COMPETITIONS)
         return "competitions";
     else if (t == RankingType.SNOWWAR)
         return "snowwar";
     else if (t == RankingType.FASTFOOD)
         return "fastfood";
     else if (t == RankingType.SLOTCAR)
         return "slotcar";
     else if (t == RankingType.NONE)
         return "";
     return "";
 }