Example #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.InfoTank);
            context = Application.Context;
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id._app_bar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetTitle(Resource.String.app_name);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
            var drawerToogle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);

            drawerLayout.AddDrawerListener(drawerToogle);
            drawerToogle.SyncState();
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
            var id = "ca-app-pub-8211072909515345~1945501010";

            Android.Gms.Ads.MobileAds.Initialize(context, id);
            var adView    = FindViewById <AdView>(Resource.Id.adViewInfoTankkk);
            var adRequest = new AdRequest.Builder().Build();

            adView.LoadAd(adRequest);
            //var requestbuilder = new AdRequest.Builder().AddTestDevice("D0BE22F1A4BE27C7470F95A699568FE2");
            //adView.LoadAd(requestbuilder.Build());
            //шрифт
            var font = Typeface.CreateFromAsset(Assets, "dinfont.ttf");

            _InfoSpinnerNation             = FindViewById <Spinner>(Resource.Id.InfoSpinnerNationT);
            _InfoSpinnerRank               = FindViewById <Spinner>(Resource.Id.InfoSpinnerRankT);
            _InfoSpinnerTank               = FindViewById <Spinner>(Resource.Id.InfoSpinnerTank);
            _InfoListView                  = FindViewById <ListView>(Resource.Id.listViewT);
            _InfoSpinnerPotentialEnemyTank = FindViewById <Spinner>(Resource.Id.InfoSpinnerPotentialEnemyTank);
            //Привязка спиннеров к шарп коду

            #region Привязка TextView к коду
            _InfoImage = FindViewById <ImageView>(Resource.Id.InfoImageT);
            _InfoFlag  = FindViewById <ImageView>(Resource.Id.InfoFlagT);

            _ShellAP          = FindViewById <ImageView>(Resource.Id.InfoShellAP);
            _ShellAPHE        = FindViewById <ImageView>(Resource.Id.InfoShellAPHE);
            _ShellHE          = FindViewById <ImageView>(Resource.Id.InfoShellHE);
            _ShellAPCR        = FindViewById <ImageView>(Resource.Id.InfoShellAPCR);
            _ShellAPDS        = FindViewById <ImageView>(Resource.Id.InfoShellAPDS);
            _ShellAPFSDS      = FindViewById <ImageView>(Resource.Id.InfoShellAPFSDS);
            _ShellHEAT        = FindViewById <ImageView>(Resource.Id.InfoShellHEAT);
            _ShellHEATFS      = FindViewById <ImageView>(Resource.Id.InfoShellHEATFS);
            _ShellShrapnel    = FindViewById <ImageView>(Resource.Id.InfoShellShrapnel);
            _ShellHESH        = FindViewById <ImageView>(Resource.Id.InfoShellHESH);
            _ShellATGM        = FindViewById <ImageView>(Resource.Id.InfoShellATGM);
            _ShellSSM         = FindViewById <ImageView>(Resource.Id.InfoShellSSM);
            _ShellHEATGRENADE = FindViewById <ImageView>(Resource.Id.InfoShellHEATGRENADE);
            _ShellHEGRENADE   = FindViewById <ImageView>(Resource.Id.InfoShellHEGRENADE);
            _ShellHEVT        = FindViewById <ImageView>(Resource.Id.InfoShellHEVT);
            _ShellSAM         = FindViewById <ImageView>(Resource.Id.InfoShellSAM);



            _InfoTankTextBR                      = FindViewById <TextView>(Resource.Id.InfoTankTextBR);
            _InfoTankTextType                    = FindViewById <TextView>(Resource.Id.InfoTankTextType);
            _InfoTankTextCharacter               = FindViewById <TextView>(Resource.Id.InfoTankTextPlaneCharacter);
            _InfoTankTextFirstRideYear           = FindViewById <TextView>(Resource.Id.InfoTankTextFirstRideYear);
            _InfoTankTextPatchAdded              = FindViewById <TextView>(Resource.Id.InfoTankTextPatchAdded);
            _InfoTankTextMaxSpeedAtRoad          = FindViewById <TextView>(Resource.Id.InfoTankTextMaxSpeedAtRoad);
            _InfoTankTextMaxSpeedAtTerrain       = FindViewById <TextView>(Resource.Id.InfoTankTextMaxSpeedAtTerrain);
            _InfoTankTextMaxReverseSpeed         = FindViewById <TextView>(Resource.Id.InfoTankTextMaxReverseSpeed);
            _InfoTankTextAccelerationTo100       = FindViewById <TextView>(Resource.Id.InfoTankTextAccelerationTo100);
            _InfoTankTextTurnTurretTime          = FindViewById <TextView>(Resource.Id.InfoTankTextTurnTurretTime);
            _InfoTankTextTurnHullTime            = FindViewById <TextView>(Resource.Id.InfoTankTextTurnHullTime);
            _InfoTankTextEnginePower             = FindViewById <TextView>(Resource.Id.InfoTankTextEnginePower);
            _InfoTankTextWeight                  = FindViewById <TextView>(Resource.Id.InfoTankTextWeight);
            _InfoTankTextPowerToWeightRatio      = FindViewById <TextView>(Resource.Id.InfoTankTextPowerToWeightRatio);
            _InfoTankTextCannonName              = FindViewById <TextView>(Resource.Id.InfoTankTextCannonName);
            _InfoTankTextPenetration             = FindViewById <TextView>(Resource.Id.InfoTankTextPenetration);
            _InfoTankTextShellSpeed              = FindViewById <TextView>(Resource.Id.InfoTankTextShellSpeed);
            _InfoTankTextReloadTime              = FindViewById <TextView>(Resource.Id.InfoTankTextReloadTime);
            _InfoTankTextUpAimAngle              = FindViewById <TextView>(Resource.Id.InfoTankTextUpAimAngle);
            _InfoTankTextDownAimAngle            = FindViewById <TextView>(Resource.Id.InfoTankTextDownAimAngle);
            _InfoTankTextStabilizer              = FindViewById <TextView>(Resource.Id.InfoTankTextStabilizer);
            _InfoTankTextAAMachineGunExist       = FindViewById <TextView>(Resource.Id.InfoTankTextAAMachineGunExist);
            _InfoTankTextReducedArmorFrontTurret = FindViewById <TextView>(Resource.Id.InfoTankTextReducedArmorFrontTurret);
            _InfoTankTextReducedArmorTopSheet    = FindViewById <TextView>(Resource.Id.InfoTankTextReducedArmorTopSheet);
            _InfoTankTextReducedArmorBottomSheet = FindViewById <TextView>(Resource.Id.InfoTankTextReducedBottomTopSheet);

            _InfoTankLabelTextBR                      = FindViewById <TextView>(Resource.Id.InfoTankLabelTextBR);
            _InfoTankLabelTextType                    = FindViewById <TextView>(Resource.Id.InfoTankLabelTextType);
            _InfoTankLabelTextCharacter               = FindViewById <TextView>(Resource.Id.InfoTankLabelTextPlaneCharacter);
            _InfoTankLabelTextFirstRideYear           = FindViewById <TextView>(Resource.Id.InfoTankLabelTextFirstRideYear);
            _InfoTankLabelTextPatchAdded              = FindViewById <TextView>(Resource.Id.InfoTankLabelTextTankPatchAdded);
            _InfoTankLabelTextMaxSpeedAtRoad          = FindViewById <TextView>(Resource.Id.InfoTankLabelTextMaxSpeedAtRoad);
            _InfoTankLabelTextMaxSpeedAtTerrain       = FindViewById <TextView>(Resource.Id.InfoTankLabelTextMaxSpeedAtTerrain);
            _InfoTankLabelTextMaxReverseSpeed         = FindViewById <TextView>(Resource.Id.InfoTankLabelTextMaxReverseSpeed);
            _InfoTankLabelTextAccelerationTo100       = FindViewById <TextView>(Resource.Id.InfoTankLabelTextAccelerationTo100);
            _InfoTankLabelTextTurnTurretTime          = FindViewById <TextView>(Resource.Id.InfoTankLabelTextTurnTurretTime);
            _InfoTankLabelTextTurnHullTime            = FindViewById <TextView>(Resource.Id.InfoTankLabelTextTurnHullTime);
            _InfoTankLabelTextEnginePower             = FindViewById <TextView>(Resource.Id.InfoTankLabelTextEnginePower);
            _InfoTankLabelTextWeight                  = FindViewById <TextView>(Resource.Id.InfoTankLabelTextWeight);
            _InfoTankLabelTextPowerToWeightRatio      = FindViewById <TextView>(Resource.Id.InfoTankLabelTextPowerToWeightRatio);
            _InfoTankLabelTextPenetration             = FindViewById <TextView>(Resource.Id.InfoTankLabelTextPenetration);
            _InfoTankLabelTextShellSpeed              = FindViewById <TextView>(Resource.Id.InfoTankLabelTextShellSpeed);
            _InfoTankLabelTextReloadTime              = FindViewById <TextView>(Resource.Id.InfoTankLabelTextReloadTime);
            _InfoTankLabelTextUpAimAngle              = FindViewById <TextView>(Resource.Id.InfoTankLabelTextUpAimAngle);
            _InfoTankLabelTextDownAimAngle            = FindViewById <TextView>(Resource.Id.InfoTankLabelTextDownAimAngle);
            _InfoTankLabelTextStabilizer              = FindViewById <TextView>(Resource.Id.InfoTankLabelTextStabilizer);
            _InfoTankLabelTextAAMachineGunExist       = FindViewById <TextView>(Resource.Id.InfoTankLabelTextAAMachineGunExist);
            _InfoTankLabelTextReducedArmorFrontTurret = FindViewById <TextView>(Resource.Id.InfoTankLabelTextReducedArmorFrontTurret);
            _InfoTankLabelTextReducedArmorTopSheet    = FindViewById <TextView>(Resource.Id.InfoTankLabelTextReducedArmorTopSheet);
            _InfoTankLabelTextReducedArmorBottomSheet = FindViewById <TextView>(Resource.Id.InfoTankLabelTextReducedArmorBottomSheet);
            _InfoTankShellType = FindViewById <TextView>(Resource.Id.InfoTankShellType);
            #endregion

            #region Изменения шрифта

            _InfoTankLabelTextBR.Typeface                      = font;
            _InfoTankLabelTextType.Typeface                    = font;
            _InfoTankLabelTextCharacter.Typeface               = font;
            _InfoTankLabelTextFirstRideYear.Typeface           = font;
            _InfoTankLabelTextPatchAdded.Typeface              = font;
            _InfoTankLabelTextMaxSpeedAtRoad.Typeface          = font;
            _InfoTankLabelTextMaxSpeedAtTerrain.Typeface       = font;
            _InfoTankLabelTextMaxReverseSpeed.Typeface         = font;
            _InfoTankLabelTextAccelerationTo100.Typeface       = font;
            _InfoTankLabelTextTurnTurretTime.Typeface          = font;
            _InfoTankLabelTextTurnHullTime.Typeface            = font;
            _InfoTankLabelTextEnginePower.Typeface             = font;
            _InfoTankLabelTextWeight.Typeface                  = font;
            _InfoTankLabelTextPowerToWeightRatio.Typeface      = font;
            _InfoTankLabelTextPenetration.Typeface             = font;
            _InfoTankLabelTextShellSpeed.Typeface              = font;
            _InfoTankLabelTextReloadTime.Typeface              = font;
            _InfoTankLabelTextUpAimAngle.Typeface              = font;
            _InfoTankLabelTextDownAimAngle.Typeface            = font;
            _InfoTankLabelTextStabilizer.Typeface              = font;
            _InfoTankLabelTextAAMachineGunExist.Typeface       = font;
            _InfoTankLabelTextReducedArmorFrontTurret.Typeface = font;
            _InfoTankLabelTextReducedArmorTopSheet.Typeface    = font;
            _InfoTankLabelTextReducedArmorBottomSheet.Typeface = font;
            _InfoTankShellType.Typeface = font;

            #endregion

            #region Изменения цвета текста всех TextView


            _InfoTankLabelTextBR.SetTextColor(Color.Black);
            _InfoTankLabelTextType.SetTextColor(Color.Black);
            _InfoTankLabelTextCharacter.SetTextColor(Color.Black);
            _InfoTankLabelTextFirstRideYear.SetTextColor(Color.Black);
            _InfoTankLabelTextPatchAdded.SetTextColor(Color.Black);
            _InfoTankLabelTextMaxSpeedAtRoad.SetTextColor(Color.Black);
            _InfoTankLabelTextMaxSpeedAtTerrain.SetTextColor(Color.Black);
            _InfoTankLabelTextMaxReverseSpeed.SetTextColor(Color.Black);
            _InfoTankLabelTextAccelerationTo100.SetTextColor(Color.Black);
            _InfoTankLabelTextTurnTurretTime.SetTextColor(Color.Black);
            _InfoTankLabelTextTurnHullTime.SetTextColor(Color.Black);
            _InfoTankLabelTextEnginePower.SetTextColor(Color.Black);
            _InfoTankLabelTextWeight.SetTextColor(Color.Black);
            _InfoTankLabelTextPowerToWeightRatio.SetTextColor(Color.Black);
            _InfoTankLabelTextPenetration.SetTextColor(Color.Black);
            _InfoTankLabelTextShellSpeed.SetTextColor(Color.Black);
            _InfoTankLabelTextReloadTime.SetTextColor(Color.Black);
            _InfoTankLabelTextUpAimAngle.SetTextColor(Color.Black);
            _InfoTankLabelTextDownAimAngle.SetTextColor(Color.Black);
            _InfoTankLabelTextStabilizer.SetTextColor(Color.Black);
            _InfoTankLabelTextAAMachineGunExist.SetTextColor(Color.Black);
            _InfoTankLabelTextReducedArmorFrontTurret.SetTextColor(Color.Black);
            _InfoTankLabelTextReducedArmorTopSheet.SetTextColor(Color.Black);
            _InfoTankLabelTextReducedArmorBottomSheet.SetTextColor(Color.Black);

            _InfoTankTextBR.SetTextColor(Color.Black);
            _InfoTankTextType.SetTextColor(Color.Black);
            _InfoTankTextCharacter.SetTextColor(Color.Black);
            _InfoTankTextFirstRideYear.SetTextColor(Color.Black);
            _InfoTankTextPatchAdded.SetTextColor(Color.Black);
            _InfoTankTextMaxSpeedAtRoad.SetTextColor(Color.Black);
            _InfoTankTextMaxSpeedAtTerrain.SetTextColor(Color.Black);
            _InfoTankTextMaxReverseSpeed.SetTextColor(Color.Black);
            _InfoTankTextAccelerationTo100.SetTextColor(Color.Black);
            _InfoTankTextTurnTurretTime.SetTextColor(Color.Black);
            _InfoTankTextTurnHullTime.SetTextColor(Color.Black);
            _InfoTankTextEnginePower.SetTextColor(Color.Black);
            _InfoTankTextWeight.SetTextColor(Color.Black);
            _InfoTankTextPowerToWeightRatio.SetTextColor(Color.Black);
            _InfoTankTextCannonName.SetTextColor(Color.Black);
            _InfoTankTextPenetration.SetTextColor(Color.Black);
            _InfoTankTextShellSpeed.SetTextColor(Color.Black);
            _InfoTankTextReloadTime.SetTextColor(Color.Black);
            _InfoTankTextUpAimAngle.SetTextColor(Color.Black);
            _InfoTankTextDownAimAngle.SetTextColor(Color.Black);
            _InfoTankTextStabilizer.SetTextColor(Color.Black);
            _InfoTankTextAAMachineGunExist.SetTextColor(Color.Black);
            _InfoTankTextReducedArmorFrontTurret.SetTextColor(Color.Black);
            _InfoTankTextReducedArmorTopSheet.SetTextColor(Color.Black);
            _InfoTankTextReducedArmorBottomSheet.SetTextColor(Color.Black);
            _InfoTankShellType.SetTextColor(Color.Black);

            #endregion

            nations       = NationCollection.GetNation();
            AdapterNation = new NationAdapter(this, nations);
            _InfoSpinnerNation.Adapter = AdapterNation;
            _InfoSpinnerNation.SetSelection(5); //Автовыбор
            selectedNation = 5;                 //Автовыбор

            ranks       = RankCollection.GetRank();
            AdapterRank = new RankAdapter(this, ranks);
            _InfoSpinnerRank.Adapter = AdapterRank;
            _InfoSpinnerRank.SetSelection(7); //Автовыбор
            selectedRank = 7;                 //Автовыбор

            potentialTask        = TankTaskCollection.GetTankTask();
            PotentialAdapterTask = new TaskAdapter(this, potentialTask);
            _InfoSpinnerPotentialEnemyTank.Adapter = PotentialAdapterTask;
            _InfoSpinnerPotentialEnemyTank.SetSelection(0); //Автовыбор
            SelectedPotentialTask = 0;                      //Автовыбор

            _InfoSpinnerTank.SetSelection(1);
            //Объявление коллекции наций, рангов и адаптеров

            _InfoSpinnerNation.ItemSelected             += _InfoSpinnerNation_ItemSelected;
            _InfoSpinnerRank.ItemSelected               += _InfoSpinnerRank_ItemSelected;
            _InfoSpinnerTank.ItemSelected               += _InfoSpinnerTank_ItemSelected;
            _InfoSpinnerPotentialEnemyTank.ItemSelected += _InfoSpinnerPotentialEnemyTank_ItemSelected;    //**//
        }