コード例 #1
0
ファイル: AGame.cs プロジェクト: TheIndra55/Sanara
        private async Task <IUserMessage> SaveScores(string reason)
        {
            Tuple <Db.Db.Comparaison, int> newScore;

            if (_guild == null && _contributors.Count == 0)
            {
                return(await PostText(reason)); // TODO
            }
            else
            {
                newScore = await Program.p.db.SetNewScore(_saveName, _score, _guild == null?_contributors[0] : _guild.Id, string.Join("|", _contributors));
            }
            if (newScore.Item1 == Db.Db.Comparaison.Best)
            {
                return(await PostText(reason + Environment.NewLine + Sentences.NewBestScore(_guild, newScore.Item2.ToString(), _score.ToString())));
            }
            else if (newScore.Item1 == Db.Db.Comparaison.Equal)
            {
                return(await PostText(reason + Environment.NewLine + Sentences.EqualizedScore(_guild, _score.ToString())));
            }
            else
            {
                return(await PostText(reason + Environment.NewLine + Sentences.DidntBeatScore(_guild, newScore.Item2.ToString(), _score.ToString())));
            }
        }
コード例 #2
0
ファイル: AGame.cs プロジェクト: Kadantte/Sanara
        private async Task SaveScores(string reason)
        {
            var newScore = await Program.p.db.SetNewScore(_saveName, _score, _chan.GuildId, string.Join("|", _contributors));

            if (newScore.Item1 == Db.Db.Comparaison.Best)
            {
                await PostText(reason + Environment.NewLine + Sentences.NewBestScore(_chan.GuildId, newScore.Item2.ToString(), _score.ToString()));
            }
            else if (newScore.Item1 == Db.Db.Comparaison.Equal)
            {
                await PostText(reason + Environment.NewLine + Sentences.EqualizedScore(_chan.GuildId, _score.ToString()));
            }
            else
            {
                await PostText(reason + Environment.NewLine + Sentences.DidntBeatScore(_chan.GuildId, newScore.Item2.ToString(), _score.ToString()));
            }
        }