示例#1
0
        private void RefreshAnalogSpinner()
        {
            Log.Debug(TAG, "RefreshAnalogSpinner");

            var spinner = FindViewById <Spinner>(Resource.Id.analogDirections);

            var set_direction = SwSettings.GetControlMotion(selected_control).directionCount;

            Log.Debug(TAG, "Control = " + CONTROL_TO_STRING_MAP[selected_control] + " directions = " + set_direction.ToString());

            if (!IsAnalogControl(selected_control))
            {
                spinner.Visibility = ViewStates.Invisible;
                spinner.Invalidate();
                return;
            }

            spinner.Visibility = ViewStates.Visible;
            var set_direction_string = "";

            foreach (var key in SwSettings.DIRECTION_TO_STRING_MAP.Keys)
            {
                if (SwSettings.DIRECTION_TO_STRING_MAP[key] == set_direction)
                {
                    set_direction_string = key;
                }
            }

            var adapter          = (ArrayAdapter)spinner.Adapter;
            int spinner_position = adapter.GetPosition(set_direction_string);

            spinner.SetSelection(spinner_position);

            spinner.Invalidate();
        }
示例#2
0
        private void SetInputListener(View vin, SwSettings.ControlId cid)
        {
            var motion  = SwSettings.GetControlMotion(cid);
            var vibrate = SwSettings.GetVibrationEnable();

            vin.SetOnTouchListener(new SwButtonListener(vin, motion, vibrate));
        }
示例#3
0
 private void SetInputBackground(View vin, ControlId id)
 {
     Log.Debug(TAG, "SetInputBackground");
     if (id == selected_control)
     {
         vin.SetBackgroundColor(Android.Graphics.Color.SkyBlue);
     }
     else if (SwSettings.GetControlMotion(id).type == MotionType.Invalid)
     {
         vin.SetBackgroundColor(Android.Graphics.Color.Red);
     }
     else
     {
         vin.SetBackgroundColor(Android.Graphics.Color.Transparent);
     }
 }
示例#4
0
        private void DirectionSpinnerItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            Log.Debug(TAG, "DirectionSpinnerItemSelected");
            // Ignore the initial "Item Selected" calls during UI setup
            if (ignore_spinner_count != 0)
            {
                ignore_spinner_count--;
                return;
            }
            Spinner spinner          = (Spinner)sender;
            var     direction_string = string.Format("{0}", spinner.GetItemAtPosition(e.Position));

            var direction = SwSettings.DIRECTION_TO_STRING_MAP[direction_string];

            var motion = SwSettings.GetControlMotion(selected_control);

            motion.directionCount = direction;
            SwSettings.SetControlMotion(selected_control, motion);
        }
示例#5
0
        private void SetJoystickListener(JoyStickView joystick, SwSettings.ControlId cid)
        {
            var motion = SwSettings.GetControlMotion(cid);

            joystick.SetOnMoveListener(new SwJoystickListener(motion));
        }