コード例 #1
0
ファイル: GameParameters.cs プロジェクト: Xtremrules/dot42
    static public IGameParameters GetParametersFromPreferences(string gameType, Preferences preferences)
    {
      var gameParameters = new MultiplyGameParameters(gameType);
      gameParameters.tableOf = preferences.TableOf;
      gameParameters.isRandom = preferences.RandomQuestions;

      return (IGameParameters)gameParameters;
    }
コード例 #2
0
ファイル: GameParameters.cs プロジェクト: Xtremrules/dot42
    static public IGameParameters GetParametersFromPreferences(string gameType, Preferences preferences)
    {
      var gameParameters = new AddGameParameters(gameType);
      gameParameters.upperLimit = preferences.UpperLimit;
      gameParameters.counterMin = preferences.CounterMin;
      gameParameters.counterMax = preferences.CounterMax;
      gameParameters.randomlyReverseOperands = false;

      return (IGameParameters)gameParameters;
    }
コード例 #3
0
ファイル: MainActivity.cs プロジェクト: Xtremrules/dot42
        protected override void OnCreate(Bundle savedInstance)
        {
            base.OnCreate(savedInstance);
            SetContentView(R.Layout.MainLayout);

            var actionBar = GetActionBar();
            actionBar.SetNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

            //actionBar.SetListNavigationCallbacks(ArrayAdapter<string>.CreateFromResource(this, R.Arrays.gameType_array, R.Layout.TextView),
            //                                     this);

            //actionBar.SetListNavigationCallbacks(ArrayAdapter<string>.CreateFromResource(this, R.Arrays.gameType_array, Android.R.Layout.Simple_spinner_item),
            //                                     this);

            var adapter = ArrayAdapter<string>.CreateFromResource(this, R.Arrays.gameType_array, Android.R.Layout.Simple_spinner_item);
            adapter.SetDropDownViewResource(Android.R.Layout.Simple_spinner_dropdown_item);
            actionBar.SetListNavigationCallbacks(adapter, this);

            tvAnswer = (TextView)FindViewById(R.Id.answer);
            tvQuestion = (TextView)FindViewById(R.Id.question);
            tvResult = (TextView)FindViewById(R.Id.result);

            var btn = (Button)FindViewById(R.Id.cmd0);
            btn.Click += new EventHandler(btn_Click);
            btn = (Button)FindViewById(R.Id.cmd1);
            btn.Click += new EventHandler(btn_Click);
            btn = (Button)FindViewById(R.Id.cmd2);
            btn.Click += new EventHandler(btn_Click);
            btn = (Button)FindViewById(R.Id.cmd3);
            btn.Click += new EventHandler(btn_Click);
            btn = (Button)FindViewById(R.Id.cmd4);
            btn.Click += new EventHandler(btn_Click);
            btn = (Button)FindViewById(R.Id.cmd5);
            btn.Click += new EventHandler(btn_Click);
            btn = (Button)FindViewById(R.Id.cmd6);
            btn.Click += new EventHandler(btn_Click);
            btn = (Button)FindViewById(R.Id.cmd7);
            btn.Click += new EventHandler(btn_Click);
            btn = (Button)FindViewById(R.Id.cmd8);
            btn.Click += new EventHandler(btn_Click);
            btn = (Button)FindViewById(R.Id.cmd9);
            btn.Click += new EventHandler(btn_Click);
            btn = (Button)FindViewById(R.Id.Ok);
            btn.Click += new EventHandler(btnOk_Click);
            btn = (Button)FindViewById(R.Id.Erase);
            btn.Click += new EventHandler(btnErase_Click);

            var gamePreferences = new Preferences();
            gamePreferences.RetrievePreferences(GetSharedPreferences("GamePreferences", 0));
            gameParameterFactory.Preferences = gamePreferences;

            game = GameFactory.GetGame(gameType, gameParameterFactory);
            tvQuestion.SetText(game.GetNextAssignment());
        }
コード例 #4
0
ファイル: SettingsActivity.cs プロジェクト: rfcclub/dot42
    protected override void OnCreate(Bundle savedInstance)
    {
      base.OnCreate(savedInstance);
      SetContentView(R.Layouts.SettingActivityLayout);

      ActionBar actionBar = GetActionBar();
      // To enable the icon for up navigation (which displays the "up" indicator next to the icon)
      actionBar.SetDisplayHomeAsUpEnabled(true);


      gamePreferences = new Preferences();
      gamePreferences.RetrievePreferences(GetSharedPreferences("GamePreferences", MODE_MULTI_PROCESS));

      txtV = FindViewById<TextView>(R.Ids.tableChoosen);
      txtV1 = FindViewById<TextView>(R.Ids.tableChoosenTxt);

      seekbar = FindViewById<SeekBar>(R.Ids.seekbar);
      seekbar.ProgressChanged += new EventHandler<ProgressChangedEventArgs>(seekbar_ProgressChanged);
      seekbar.SetProgress(gamePreferences.TableOf);

      var btn = FindViewById<Button>(R.Ids.Ok);
      btn.Click += new EventHandler(btn_ClickOk);
      btn = FindViewById<Button>(R.Ids.Cancel);
      btn.Click += new EventHandler(btn_ClickCancel);

      swV = FindViewById<Switch>(R.Ids.isRandom);
      swV.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(swV_CheckedChanged);
      swV.SetChecked(!gamePreferences.RandomQuestions);

      rbtnTo10 = FindViewById<RadioButton>(R.Ids.To10);
      if (gamePreferences.UpperLimit == 10)
      {
        rbtnTo10.SetChecked(true);
      }
      rbtnTo50 = FindViewById<RadioButton>(R.Ids.To50);
      if (gamePreferences.UpperLimit == 50)
      {
        rbtnTo50.SetChecked(true);
      }
      rbtnTo100 = FindViewById<RadioButton>(R.Ids.To100);
      if (gamePreferences.UpperLimit == 100)
      {
        rbtnTo100.SetChecked(true);
      }
      rbtnTo500 = FindViewById<RadioButton>(R.Ids.To500);
      if (gamePreferences.UpperLimit == 500)
      {
        rbtnTo500.SetChecked(true);
      }
      rbtnTo1000 = FindViewById<RadioButton>(R.Ids.To1000);
      if (gamePreferences.UpperLimit == 1000)
      {
        rbtnTo1000.SetChecked(true);
      }
      rbtnTo10.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(rbtnTo_CheckedChanged);
      rbtnTo50.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(rbtnTo_CheckedChanged);
      rbtnTo100.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(rbtnTo_CheckedChanged);
      rbtnTo500.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(rbtnTo_CheckedChanged);
      rbtnTo1000.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(rbtnTo_CheckedChanged);

      rbtn0To10 = FindViewById<RadioButton>(R.Ids.With0To10);
      if (gamePreferences.CounterMin == 0)
      {
        rbtn0To10.SetChecked(true);
      }
      rbtn10To20 = FindViewById<RadioButton>(R.Ids.With10To20);
      if (gamePreferences.CounterMin == 10)
      {
        rbtn10To20.SetChecked(true);
      }
      rbtn20To50 = FindViewById<RadioButton>(R.Ids.With20To50);
      if (gamePreferences.CounterMin == 20)
      {
        rbtn20To50.SetChecked(true);
      }
      rbtn50To100 = FindViewById<RadioButton>(R.Ids.With50To100);
      if (gamePreferences.CounterMin == 50)
      {
        rbtn50To100.SetChecked(true);
      }

      EnabledButtons();
    }
コード例 #5
0
ファイル: MainActivity.cs プロジェクト: Xtremrules/dot42
        protected override void OnActivityResult(int requestCode, int resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            if (resultCode == RESULT_OK)
            {
                var gamePreferences = new Preferences();
                gamePreferences.RetrievePreferences(GetSharedPreferences("GamePreferences", MODE_MULTI_PROCESS));
                gameParameterFactory.Preferences = gamePreferences;

                game = GameFactory.GetGame(gameType, gameParameterFactory);
                tvQuestion.SetText(game.GetNextAssignment());
            }
        }