コード例 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.TheBestShip);
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
            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();
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\ 
            Context context = Application.Context;
            var     id      = "ca-app-pub-8211072909515345~1945501010";

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

            adView.LoadAd(adRequest);
            //var requestbuilder = new AdRequest.Builder().AddTestDevice("D0BE22F1A4BE27C7470F95A699568FE2");
            //adView.LoadAd(requestbuilder.Build());

            _TheBestSpinnerNation = FindViewById <Spinner>(Resource.Id.TheBestSpinnerNationS);
            _TheBestSpinnerRank   = FindViewById <Spinner>(Resource.Id.TheBestSpinnerRankS);
            _TheBestSpinnerTask   = FindViewById <Spinner>(Resource.Id.TheBestSpinnerTaskS);
            _TheBestListView      = FindViewById <ListView>(Resource.Id.TheBestlistViewS);

            //Привязка спиннеров к шарп коду
            theBestNations                = NationCollection.GetNation();
            TheBestAdapterNation          = new NationAdapter(this, theBestNations);
            _TheBestSpinnerNation.Adapter = TheBestAdapterNation;
            _TheBestSpinnerNation.SetSelection(0);  //Автовыбор
            selectedNation = 100;

            theBestRanks                = RankCollection.GetRank();
            TheBestAdapterRank          = new RankAdapter(this, theBestRanks);
            _TheBestSpinnerRank.Adapter = TheBestAdapterRank;
            _TheBestSpinnerRank.SetSelection(4); //Автовыбор
            selectedRank = 4;                    //Автовыбор

            theBestTask                 = ShipTaskCollection.GetTask();
            TheBestAdapterTask          = new TaskAdapter(this, theBestTask);
            _TheBestSpinnerTask.Adapter = TheBestAdapterTask;
            _TheBestSpinnerTask.SetSelection(0); //Автовыбор
            SelectedTask = 0;                    //Автовыбор

            _TheBestSpinnerNation.ItemSelected += _TheBestSpinnerNation_ItemSelected;
            _TheBestSpinnerRank.ItemSelected   += _TheBestSpinnerRank_ItemSelected;
            _TheBestSpinnerTask.ItemSelected   += _TheBestSpinnerTask_ItemSelected;
        }
コード例 #2
0
        ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\



        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.InfoShip);
            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.adViewInfoShip);
            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.InfoSpinnerNationS);
            _InfoSpinnerRank               = FindViewById <Spinner>(Resource.Id.InfoSpinnerRankS);
            _InfoSpinnerShip               = FindViewById <Spinner>(Resource.Id.InfoSpinnerShip);
            _InfoListView                  = FindViewById <ListView>(Resource.Id.listViewS);
            _InfoSpinnerPotentialEnemyShip = FindViewById <Spinner>(Resource.Id.InfoSpinnerPotentialEnemyShip);
            //Привязка спиннеров к шарп коду

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

            _InfoHandingRocket       = FindViewById <ImageView>(Resource.Id.InfoShipHandingRocket);
            _InfoHandlingDepthCharge = FindViewById <ImageView>(Resource.Id.InfoShipHandingDepthCharge);
            _InfoHandlingTorpedo     = FindViewById <ImageView>(Resource.Id.InfoShipHandingTorpedo);
            _InfoHandingMine         = FindViewById <ImageView>(Resource.Id.InfoShipHandingMine);

            _InfoMCShellAP       = FindViewById <ImageView>(Resource.Id.InfoShipMCShellAP);
            _InfoMCShellAPHE     = FindViewById <ImageView>(Resource.Id.InfoShipMCShellAPHE);
            _InfoMCShellAPCR     = FindViewById <ImageView>(Resource.Id.InfoShipMCShellAPCR);
            _InfoMCShellHE       = FindViewById <ImageView>(Resource.Id.InfoShipMCShellHE);
            _InfoMCShellHEVT     = FindViewById <ImageView>(Resource.Id.InfoShipMCShellHEVT);
            _InfoMCShellHEDF     = FindViewById <ImageView>(Resource.Id.InfoShipMCShellHEDF);
            _InfoMCShellFOG      = FindViewById <ImageView>(Resource.Id.InfoShipMCShellFOG);
            _InfoMCShellShrapnel = FindViewById <ImageView>(Resource.Id.InfoShipMCShellShrapnel);
            _InfoAUShellShrapnel = FindViewById <ImageView>(Resource.Id.InfoShipAUShellShrapnel);
            _InfoAUShellAP       = FindViewById <ImageView>(Resource.Id.InfoShipAUShellAP);
            _InfoAUShellAPHE     = FindViewById <ImageView>(Resource.Id.InfoShipAUShellAPHE);
            _InfoAUShellAPCR     = FindViewById <ImageView>(Resource.Id.InfoShipAUShellAPCR);
            _InfoAUShellHE       = FindViewById <ImageView>(Resource.Id.InfoShipAUShellHE);
            _InfoAUShellHEVT     = FindViewById <ImageView>(Resource.Id.InfoShipAUShellHEVT);
            _InfoAUShellHEDF     = FindViewById <ImageView>(Resource.Id.InfoShipAUShellHEDF);
            _InfoAUShellFOG      = FindViewById <ImageView>(Resource.Id.InfoShipAUShellFOG);
            _InfoAAAShellAP      = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellAP);
            _InfoAAAShellAPHE    = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellAPHE);
            _InfoAAAShellAPCR    = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellAPCR);
            _InfoAAAShellHE      = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellHE);
            _InfoAAAShellHEVT    = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellHEVT);
            _InfoAAAShellHEDF    = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellHEDF);
            _InfoAAAShellFOG     = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellFOG);

            _InfoShipLabelTextFirstLaunch = FindViewById <TextView>(Resource.Id.InfoShipLabelTextShipLaunched);
            _InfoShipLabelTextPatchAdded  = FindViewById <TextView>(Resource.Id.InfoShipLabelTextPatchAdded);
            _InfoShipLabelTextType        = FindViewById <TextView>(Resource.Id.InfoShipLabelTextType);
            _InfoShipLabelTextCharacter   = FindViewById <TextView>(Resource.Id.InfoShipLabelTextCharacter);
            _InfoShipLabelTextBR          = FindViewById <TextView>(Resource.Id.InfoShipLabelTextBR);

            _InfoShipTextFirstLaunch = FindViewById <TextView>(Resource.Id.InfoShipTextShipLaunched);
            _InfoShipTextPatchAdded  = FindViewById <TextView>(Resource.Id.InfoShipTextPatchAdded);
            _InfoShipTextType        = FindViewById <TextView>(Resource.Id.InfoShipTextType);
            _InfoShipTextCharacter   = FindViewById <TextView>(Resource.Id.InfoShipTextCharacter);
            _InfoShipTextBR          = FindViewById <TextView>(Resource.Id.InfoShipTextBR);


            _InfoShipTextMainCaliberName        = FindViewById <TextView>(Resource.Id.InfoShipTextMainCaliber);
            _InfoShipTextMainCaliberReload      = FindViewById <TextView>(Resource.Id.InfoShipTextMainCaliberReload);
            _InfoShipTextMainCaliberTNT         = FindViewById <TextView>(Resource.Id.InfoShipTextMainCaliberTNT);
            _InfoShipTextAuxiliaryCaliberName   = FindViewById <TextView>(Resource.Id.InfoShipTextAuxiliaryCaliber);
            _InfoShipTextAuxiliaryCaliberReload = FindViewById <TextView>(Resource.Id.InfoShipTextAuxiliaryCaliberReload);
            _InfoShipTextAAACaliberName         = FindViewById <TextView>(Resource.Id.InfoShipTextAAACaliber);
            _InfoShipTextAAACaliberReload       = FindViewById <TextView>(Resource.Id.InfoShipTextAAACaliberReload);
            _InfoShipTextTorpedoName            = FindViewById <TextView>(Resource.Id.InfoShipTextTorpedo);
            _InfoShipTextTorpedoItem            = FindViewById <TextView>(Resource.Id.InfoShipTextTorpedoItem);
            _InfoShipTextTorpedoMaxSpeed        = FindViewById <TextView>(Resource.Id.InfoShipTextTorpedoMaxSpeed);
            _InfoShipTextTorpedoTNT             = FindViewById <TextView>(Resource.Id.InfoShipTextTorpedoTNT);
            _InfoShipTextMaxSpeed     = FindViewById <TextView>(Resource.Id.InfoShipTextMaxSpeed);
            _InfoShipTextReverseSpeed = FindViewById <TextView>(Resource.Id.InfoShipTextReverseSpeed);
            _InfoShipTextAcceleration = FindViewById <TextView>(Resource.Id.InfoShipTextAcceleration);
            _InfoShipTextBrakingTime  = FindViewById <TextView>(Resource.Id.InfoShipTextBrakingTime);
            _InfoShipTextTurn360      = FindViewById <TextView>(Resource.Id.InfoShipTextTurn360);
            _InfoShipTextDisplacement = FindViewById <TextView>(Resource.Id.InfoShipTextDisplacement);
            _InfoShipTextCrewCount    = FindViewById <TextView>(Resource.Id.InfoShipTextCrewCount);

            _InfoShipLabelTextMainCaliberReload      = FindViewById <TextView>(Resource.Id.InfoShipLabelMainCaliberReload);
            _InfoShipLabelTextMainCaliberTNT         = FindViewById <TextView>(Resource.Id.InfoShipLabelMainCaliberTNT);
            _InfoShipLabelTextAuxiliaryCaliberReload = FindViewById <TextView>(Resource.Id.InfoShipLabelAuxiliaryCaliberReload);
            _InfoShipLabelTextAAACaliberReload       = FindViewById <TextView>(Resource.Id.InfoShipLabelAAACaliberReload);
            _InfoShipLabelTextTorpedoItem            = FindViewById <TextView>(Resource.Id.InfoShipLabelTorpedoItem);
            _InfoShipLabelTextTorpedoMaxSpeed        = FindViewById <TextView>(Resource.Id.InfoShipLabelTorpedoMaxSpeed);
            _InfoShipLabelTextTorpedoTNT             = FindViewById <TextView>(Resource.Id.InfoShipLabelTorpedoTNT);
            _InfoShipLabelTextMaxSpeed     = FindViewById <TextView>(Resource.Id.InfoShipLabelMaxSpeed);
            _InfoShipLabelTextReverseSpeed = FindViewById <TextView>(Resource.Id.InfoShipLabelReverseSpeed);
            _InfoShipLabelTextAcceleration = FindViewById <TextView>(Resource.Id.InfoShipLabelAcceleration);
            _InfoShipLabelTextBrakingTime  = FindViewById <TextView>(Resource.Id.InfoShipLabelBrakingTime);
            _InfoShipLabelTextTurn360      = FindViewById <TextView>(Resource.Id.InfoShipLabelTurn360);
            _InfoShipLabelTextDisplacement = FindViewById <TextView>(Resource.Id.InfoShipLabelDisplacement);
            _InfoShipLabelTextCrewCount    = FindViewById <TextView>(Resource.Id.InfoShipLabelCrewCount);
            _InfoShipLabelTextMCShellType  = FindViewById <TextView>(Resource.Id.InfoShipLabelMCShellType);
            _InfoShipLabelTextAUShellType  = FindViewById <TextView>(Resource.Id.InfoShipLabelAUShellType);
            _InfoShipLabelTextAAAShellType = FindViewById <TextView>(Resource.Id.InfoShipLabelAAAShellType);
            _InfoShipLabelTextAdditional   = FindViewById <TextView>(Resource.Id.InfoShipLabelAdditionalWeapon);
            #endregion

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

            _InfoShipLabelTextMainCaliberReload.Typeface      = font;
            _InfoShipLabelTextMainCaliberTNT.Typeface         = font;
            _InfoShipLabelTextAuxiliaryCaliberReload.Typeface = font;
            _InfoShipLabelTextAAACaliberReload.Typeface       = font;
            _InfoShipLabelTextTorpedoItem.Typeface            = font;
            _InfoShipLabelTextTorpedoMaxSpeed.Typeface        = font;
            _InfoShipLabelTextTorpedoTNT.Typeface             = font;
            _InfoShipLabelTextMaxSpeed.Typeface     = font;
            _InfoShipLabelTextReverseSpeed.Typeface = font;
            _InfoShipLabelTextAcceleration.Typeface = font;
            _InfoShipLabelTextBrakingTime.Typeface  = font;
            _InfoShipLabelTextTurn360.Typeface      = font;
            _InfoShipLabelTextDisplacement.Typeface = font;
            _InfoShipLabelTextCrewCount.Typeface    = font;

            _InfoShipLabelTextFirstLaunch.Typeface  = font;
            _InfoShipLabelTextPatchAdded.Typeface   = font;
            _InfoShipLabelTextType.Typeface         = font;
            _InfoShipLabelTextCharacter.Typeface    = font;
            _InfoShipLabelTextBR.Typeface           = font;
            _InfoShipLabelTextMCShellType.Typeface  = font;
            _InfoShipLabelTextAUShellType.Typeface  = font;
            _InfoShipLabelTextAAAShellType.Typeface = font;
            _InfoShipLabelTextAdditional.Typeface   = font;


            _InfoShipLabelTextMainCaliberReload.SetTextColor(Color.Black);
            _InfoShipLabelTextMainCaliberTNT.SetTextColor(Color.Black);
            _InfoShipLabelTextAuxiliaryCaliberReload.SetTextColor(Color.Black);
            _InfoShipLabelTextAAACaliberReload.SetTextColor(Color.Black);
            _InfoShipLabelTextTorpedoItem.SetTextColor(Color.Black);
            _InfoShipLabelTextTorpedoMaxSpeed.SetTextColor(Color.Black);
            _InfoShipLabelTextTorpedoTNT.SetTextColor(Color.Black);
            _InfoShipLabelTextMaxSpeed.SetTextColor(Color.Black);
            _InfoShipLabelTextReverseSpeed.SetTextColor(Color.Black);
            _InfoShipLabelTextAcceleration.SetTextColor(Color.Black);
            _InfoShipLabelTextBrakingTime.SetTextColor(Color.Black);
            _InfoShipLabelTextTurn360.SetTextColor(Color.Black);
            _InfoShipLabelTextDisplacement.SetTextColor(Color.Black);
            _InfoShipLabelTextCrewCount.SetTextColor(Color.Black);


            _InfoShipTextMainCaliberName.SetTextColor(Color.Black);
            _InfoShipTextMainCaliberReload.SetTextColor(Color.Black);
            _InfoShipTextMainCaliberTNT.SetTextColor(Color.Black);
            _InfoShipTextAuxiliaryCaliberName.SetTextColor(Color.Black);
            _InfoShipTextAuxiliaryCaliberReload.SetTextColor(Color.Black);
            _InfoShipTextAAACaliberName.SetTextColor(Color.Black);
            _InfoShipTextAAACaliberReload.SetTextColor(Color.Black);
            _InfoShipTextTorpedoName.SetTextColor(Color.Black);
            _InfoShipTextTorpedoItem.SetTextColor(Color.Black);
            _InfoShipTextTorpedoMaxSpeed.SetTextColor(Color.Black);
            _InfoShipTextTorpedoTNT.SetTextColor(Color.Black);
            _InfoShipTextMaxSpeed.SetTextColor(Color.Black);
            _InfoShipTextReverseSpeed.SetTextColor(Color.Black);
            _InfoShipTextAcceleration.SetTextColor(Color.Black);
            _InfoShipTextBrakingTime.SetTextColor(Color.Black);
            _InfoShipTextTurn360.SetTextColor(Color.Black);
            _InfoShipTextDisplacement.SetTextColor(Color.Black);
            _InfoShipTextCrewCount.SetTextColor(Color.Black);

            _InfoShipLabelTextFirstLaunch.SetTextColor(Color.Black);
            _InfoShipLabelTextPatchAdded.SetTextColor(Color.Black);
            _InfoShipLabelTextType.SetTextColor(Color.Black);
            _InfoShipLabelTextCharacter.SetTextColor(Color.Black);
            _InfoShipLabelTextBR.SetTextColor(Color.Black);


            _InfoShipTextFirstLaunch.SetTextColor(Color.Black);
            _InfoShipTextPatchAdded.SetTextColor(Color.Black);
            _InfoShipTextType.SetTextColor(Color.Black);
            _InfoShipTextCharacter.SetTextColor(Color.Black);
            _InfoShipTextBR.SetTextColor(Color.Black);
            #endregion

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

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

            potentialTask            = ShipTaskCollection.GetTask();
            PotentialAdapterTaskShip = new TaskAdapter(this, potentialTask);
            _InfoSpinnerPotentialEnemyShip.Adapter = PotentialAdapterTaskShip;
            _InfoSpinnerPotentialEnemyShip.SetSelection(0); //Автовыбор
            SelectedPotentialTaskShip = 0;                  //Автовыбор

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

            _InfoSpinnerNation.ItemSelected             += _InfoSpinnerNation_ItemSelected;
            _InfoSpinnerRank.ItemSelected               += _InfoSpinnerRank_ItemSelected;
            _InfoSpinnerShip.ItemSelected               += _InfoSpinnerShip_ItemSelected;
            _InfoSpinnerPotentialEnemyShip.ItemSelected += _InfoSpinnerPotentialEnemyShip_ItemSelected;
        }