Ejemplo n.º 1
0
        private void buttonUnitsLoad_Click(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog();

            dialog.Filter = "*.units|*.units|*.*|*.*";

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                WorldGen.LoadUnitsFromFile(dialog.FileName);
            }
        }
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.PrepareView);
     _somethingButton      = FindViewById <Button>(Resource.Id.doSomethingButton);
     _rowsSeekBar          = FindViewById <SeekBar>(Resource.Id.rowsSeekBar);
     _rankSeekBar          = FindViewById <SeekBar>(Resource.Id.rankSeekBar);
     _totalUnitsEditText   = FindViewById <TextView>(Resource.Id.totalUnits);
     _totalInSquadEditText = FindViewById <TextView>(Resource.Id.totalInSquad);
     _rowText     = FindViewById <TextView>(Resource.Id.rowText);
     _rankText    = FindViewById <TextView>(Resource.Id.rankText);
     _topLayout   = FindViewById <LinearLayout>(Resource.Id.topLayout);
     _cocosLayout = FindViewById <LinearLayout>(Resource.Id.cocosLayout);
     _spinner     = FindViewById <Spinner>(Resource.Id.squadTypeSpinner);
     _view        = new MyView(_cocosLayout.Context);
     _cocosLayout.AddView(_view);
     _rowsSeekBar.Max              = 15;
     _rankSeekBar.Max              = 15;
     _rowsSeekBar.ProgressChanged += _rankSeekBar_ProgressChanged;
     _rankSeekBar.ProgressChanged += _rankSeekBar_ProgressChanged;
     _somethingButton.Click       += _somethingButton_Click;
     _totalInSquadEditText.Text    = (_rankSeekBar.Progress * _rowsSeekBar.Progress).ToString();
     _totalUnitsEditText.Text      = _view.Army.Size.ToString();
     Forms.Init(this, savedInstanceState);
     if (Intent.GetBooleanExtra("ISLOAD", false))
     {
         WorldGen = WorldsGenerator.GetDefault(MyView.SIZE * 3 / 2, MyView.SIZE);
         if (WorldGen.GetWorld().Width != MyView.SIZE)
         {
             WorldGen = null;
         }
         else
         {
             try
             {
                 WorldGen.LoadUnitsFromFile("units.units", true);
             }
             catch
             {
                 WorldGen = null;
             }
         }
     }
     _view.Touch += _view_Touch;
 }