Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it

            jumble = FindViewById <TextView>(Resource.Id.myjumble);
            hint   = FindViewById <TextView> (Resource.Id.hint);

            Button submitbutton = FindViewById <Button>(Resource.Id.scorebutton);



            var  connectivityManager = (ConnectivityManager)Application.Context.GetSystemService(Context.ConnectivityService);
            var  activeNetworkInfo   = connectivityManager.ActiveNetworkInfo;
            bool isonlien            = activeNetworkInfo.IsConnected;
            bool isWifi = activeNetworkInfo.Type == ConnectivityType.Wifi;



            WordBank = new ArrayList();

            WordMeaning myfirstwordmeaning;

            myfirstwordmeaning         = new WordMeaning();
            myfirstwordmeaning.word    = "Small";
            myfirstwordmeaning.meaning = "Chotu";

            WordBank.Add(myfirstwordmeaning);
            WordBank.Add(new WordMeaning("Small", "Chotu"));
            WordBank.Add(new WordMeaning("Bucket", "Balti"));
            WordBank.Add(new WordMeaning("name", "naam"));



            //  jumble.Text = x;
            jumble.Click += delegate {
                jumble.Text = $"Correct The Word ->  {jumbleme()}";
            };


            EditText answer = FindViewById <EditText>(Resource.Id.AnswerInput);

            answer.Click += delegate
            {
                answer.Text = "";
            };



            submitbutton.Click += async(object sender, EventArgs e) => {
                Scoreclick(sender, e);
            };
        }
Пример #2
0
        private async void  Scoreclick(object sender, EventArgs e)
        {
            TextView score = FindViewById <TextView>(Resource.Id.score);



            EditText answer = FindViewById <EditText>(Resource.Id.AnswerInput);

            string JumbleAnswer = answer.Text;

            if (JumbleWordSequnence >= WordBank.Count - 1)
            {
                JumbleWordSequnence = 0;
            }

            WordMeaning CurrentWordMeaningToJumble = new WordMeaning();

            CurrentWordMeaningToJumble = (WordMeaning)WordBank[JumbleWordSequnence];

            if (JumbleAnswer.ToLower() == CurrentWordMeaningToJumble.word.ToLower())
            {
                _player = MediaPlayer.Create(this, Resource.Raw.a);
                _player.Start();
                scorecount                 = scorecount + 1;
                JumbleWordSequnence        = JumbleWordSequnence + 1;
                CurrentWordMeaningToJumble = (WordMeaning)WordBank[JumbleWordSequnence];
                jumble.Text                = $"GREAT!! NEXT WORD ->  {jumbleme()}";
                score.SetBackgroundColor((Android.Graphics.Color.Green));
                score.SetTextColor((Android.Graphics.Color.White));
                hint.Text = CurrentWordMeaningToJumble.meaning;
            }
            else
            {
                CurrentWordMeaningToJumble = (WordMeaning)WordBank[JumbleWordSequnence];
                _player = MediaPlayer.Create(this, Resource.Raw.c);
                _player.Start();
                jumble.Text = $"Sorry!! NEXT Hint ->  {jumbleme()}";
                score.SetBackgroundColor((Android.Graphics.Color.Red));
                score.SetTextColor((Android.Graphics.Color.White));
                hint.Text = CurrentWordMeaningToJumble.meaning;
            }


            score.Text = scorecount.ToString();
            if (WordBankUpdated == false)
            {
                string x = await Callweb().ConfigureAwait(false);

                WordBankUpdated = true;
            }
        }
Пример #3
0
        string jumbleme()
        {
            WordMeaning _wordMeaning = new WordMeaning();

            _wordMeaning = (WordMeaning)WordBank[JumbleWordSequnence];


            hint.Text = _wordMeaning.meaning;

            Char[]    WordChar          = _wordMeaning.word.ToCharArray();
            int       _WordLength       = WordChar.Length;
            int       CharCounter       = 1;
            string    finalJumbledWord  = "";
            ArrayList RandomIntegerList = new ArrayList();

            while (CharCounter <= _WordLength)
            {
                Random Jumbler    = new Random();
                int    JumblerInt = Jumbler.Next(0, _WordLength);
                if (!RandomIntegerList.Contains(JumblerInt))
                {
                    RandomIntegerList.Add(JumblerInt);

                    finalJumbledWord = finalJumbledWord + WordChar[JumblerInt].ToString();
                    CharCounter++;
                    if (finalJumbledWord == _wordMeaning.word)
                    {
                        CharCounter       = 1;
                        RandomIntegerList = null;
                        RandomIntegerList = new ArrayList();
                        finalJumbledWord  = "";
                    }
                }
            }


            return(finalJumbledWord);
        }