Exemple #1
0
        public BaseResponse WordRejectedByAdmin(AssignWordToDeveloperRequest request)
        {
            try
            {
                BaseResponse response = new BaseResponse();
                using (DDS_Context dbContext = new DDS_Context())
                {
                    TempWord wordEntity = new TempWord();
                    wordEntity = dbContext.TempWord.FirstOrDefault(x => x.Id == request.WordId);
                    if (wordEntity == null)
                    {
                        response.IsSucceed = false;
                        response.Message   = "Bir Hata Oluştu, Reddetme Başarısız.";
                    }
                    else
                    {
                        wordEntity.Status      = 5; /*Status=AdminRejected*/
                        wordEntity.UpdatedDate = DateTime.Now;

                        dbContext.SaveChanges();

                        response.IsSucceed = true;
                        response.Message   = "Kelime Reddedildi.";
                    }
                    return(response);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        public BaseResponse ReportWord(ReportRequest request)
        {
            try
            {
                using (DDS_Context dbContext = new DDS_Context())
                {
                    BaseResponse response = new BaseResponse();
                    TempWord     data     = new TempWord();
                    data.Word           = request.Word;
                    data.Status         = 1;
                    data.InterestId     = request.InterestId;
                    data.CreatedDate    = DateTime.Now;
                    data.UpdatedDate    = DateTime.Now;
                    data.AcceptanceVote = 0;
                    data.RejectionVote  = 0;
                    data.UserId         = request.UserId;
                    dbContext.TempWord.Add(data);

                    response.IsSucceed = true;
                    response.Message   = "Bildiriminiz için teşekkür ederiz.";
                    dbContext.SaveChanges();

                    return(response);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
        public BaseResponse AssignWordToDeveloper(AssignWordToDeveloperRequest request)
        {
            try
            {
                BaseResponse response = new BaseResponse();
                using (DDS_Context dbContext = new DDS_Context())
                {
                    TempWord wordEntity = new TempWord();
                    wordEntity = dbContext.TempWord.FirstOrDefault(x => x.Id == request.WordId);
                    if (wordEntity == null)
                    {
                        response.IsSucceed = false;
                        response.Message   = "Bir Hata Oluştu, Görevlendirme Yapılamadı.";
                    }
                    else
                    {
                        wordEntity.DeveloperId = request.DeveloperId;
                        wordEntity.Status      = 2; /*Status=OnDeveloper*/
                        wordEntity.UpdatedDate = DateTime.Now;

                        dbContext.SaveChanges();

                        response.IsSucceed = true;
                        response.Message   = "Geliştirici Görevlendirildi.";
                    }
                    return(response);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        //decided to have the main game class this time process the miscdata.
        async Task IMiscDataNM.MiscDataReceived(string status, string content)
        {
            switch (status)
            {
            case "firstoption":
                await Aggregator.PublishAsync(new FirstOptionEventModel(content));

                break;

            case "advancedsettings":
                await Aggregator.PublishAsync(new AdvancedSettingsEventModel(content));

                break;

            case "howmanycards":
                await Aggregator.PublishAsync(new CardsChosenEventModel(int.Parse(content)));

                break;

            case "giveup":     //no more tilelist now.
                SingleInfo = PlayerList !.GetSelf();
                if (SingleInfo.TookTurn == false)
                {
                    throw new BasicBlankException("Did not take turn");
                }
                SaveRoot !.PlayOrder.WhoTurn = int.Parse(content);    //hopefully this works too.
                await GiveUpAsync();

                break;

            case "playword":
                SingleInfo = PlayerList !.GetSelf();
                if (SingleInfo.TookTurn == false)
                {
                    throw new BasicBlankException("Did not take turn");
                }
                TempWord thisWord = await js.DeserializeObjectAsync <TempWord>(content);

                SaveRoot !.PlayOrder.WhoTurn = thisWord.Player;
                SingleInfo = PlayerList.GetWhoPlayer();     //hopefully this still works.
                SingleInfo.TimeToGetWord = thisWord.TimeToGetWord;
                SingleInfo.TileList      = thisWord.TileList;
                await PlayWordAsync(thisWord.CardUsed);

                break;

            case "whowon":
                await ClientResultsAsync(int.Parse(content));

                break;

            default:
                throw new BasicBlankException($"Nothing for status {status}  with the message of {content}");
            }
        }
        public async Task PlayAsync()
        {
            _global.PauseContinueTimer();
            if (_basicData.MultiPlayer == true && _mainGame !.Check !.IsEnabled == true)
            {
                await UIPlatform.ShowMessageAsync("Should not have enabled the network helpers since you had to take your turn.");

                return;
            }
            var thisCard = _board.GetCompletedCard();

            if (thisCard == null)
            {
                _global.PauseContinueTimer();
                await UIPlatform.ShowMessageAsync("You must pick the tiles before playing");

                return;
            }
            if (thisCard.IsValidWord() == false)
            {
                var thisWord = thisCard.GetWord();
                if (_mainGame.SaveRoot !.Level == EnumLevel.Easy)
                {
                    _board.UnDo();
                    await UIPlatform.ShowMessageAsync($"{thisWord} is not a word or is too hard. Please try again");

                    _global.PauseContinueTimer();
                    return;
                }
                if (_basicData.MultiPlayer == false)
                {
                    await UIPlatform.ShowMessageAsync($"{thisWord} does not exist.  Therefore; its going to the next one");

                    await _giveUp.SelfGiveUpAsync(true);

                    return;
                }
                await UIPlatform.ShowMessageAsync($"{thisWord} does not exist.  Therefore; waiting for other players to decide if they have a word");

                await _giveUp.SelfGiveUpAsync(true);

                return;
            }
            if (_basicData.MultiPlayer == true)
            {
                _mainGame.SingleInfo = _mainGame.PlayerList !.GetSelf();
                TempWord thisWord = new TempWord();
                thisWord.Player   = _mainGame.SingleInfo.Id;
                thisWord.CardUsed = thisCard.Deck;
                thisWord.TileList = _mainGame.SingleInfo.TileList;
                if (thisWord.TileList.Count == 0)
                {
                    throw new BasicBlankException("Must have tiles to form a word to send");
                }
                _mainGame.SingleInfo.TimeToGetWord = (int)_global.Stops !.TimeTaken();
                _global.Stops.ManualStop(false);
                thisWord.TimeToGetWord = _mainGame.SingleInfo.TimeToGetWord;
                if (_mainGame.SingleInfo.TimeToGetWord == 0)
                {
                    throw new BasicBlankException("Time Taken Cannot Be 0");
                }
                await _mainGame.Network !.SendAllAsync("playword", thisWord);
                _mainGame.SaveRoot !.PlayOrder.WhoTurn = _mainGame.SingleInfo.Id;
            }
            await _mainGame !.PlayWordAsync(thisCard.Deck);
        }