Beispiel #1
0
        public bool OnMarkerClick(Marker marker)
        {
            // Ignore player
            if (marker.Tag?.ToString() == "player")
            {
                return(true);
            }

            if (marker.Tag is EnemyTag tag)
            {
                var enemy = tag.Enemy;

                // Set icon
                battleInfoView.FindViewById <ImageView>(Resource.Id.image_battle_info)
                .SetImageBitmap(AssetLoader.GetEnemyBitmap(enemy));

                // Set title
                battleInfoView.FindViewById <TextView>(Resource.Id.text_battle_info_title).Text =
                    $"Level {enemy.Level} {enemy.Name}";

                // Set description
                battleInfoView.FindViewById <TextView>(Resource.Id.text_battle_info_description).Text = enemy.Info;

                // Set stats
                battleInfoView.FindViewById <TextView>(Resource.Id.text_battle_info_health).Text = $"{enemy.Health}";
                battleInfoView.FindViewById <TextView>(Resource.Id.text_battle_info_armor).Text  = $"{enemy.Armor}";
                battleInfoView.FindViewById <TextView>(Resource.Id.text_battle_info_attack).Text = $"{enemy.Attack}";
            }

            selectedMarker = marker;

            battleInfo.State = BottomSheetBehavior.StateCollapsed;

            var isWithinRange = LocationHandler.GetDistance(userLocation.ToLatLng(), marker.Position) < battleRange;

            battleInfoView.FindViewById <Button>(Resource.Id.button_battle_info_fight).Enabled = isWithinRange && AccountManager.CurrentUser.IsAlive;
            battleInfoView.FindViewById <Button>(Resource.Id.button_battle_info_fight).Alpha   = isWithinRange && AccountManager.CurrentUser.IsAlive ? 1 : 0.5f;

            return(true);
        }