コード例 #1
0
ファイル: HOTASAxis.cs プロジェクト: joekolodz/SierraHOTAS
        private void CreateSingleActionButtonMapList()
        {
            for (var i = ButtonMap.Count; i > 1; i--)
            {
                ButtonMap.RemoveAt(i - 1);
            }

            for (var i = ReverseButtonMap.Count; i > 1; i--)
            {
                ReverseButtonMap.RemoveAt(i - 1);
            }

            if (ButtonMap.Count == 0)
            {
                ButtonMap.Add(new HOTASButton()
                {
                    MapId = 1, MapName = $"Axis Button 1", Type = HOTASButton.ButtonType.Button
                });
            }

            if (IsDirectional)
            {
                if (ReverseButtonMap.Count == 0)
                {
                    ReverseButtonMap.Add(new HOTASButton()
                    {
                        MapId = 1, MapName = $"Reverse Axis Button 1", Type = HOTASButton.ButtonType.Button
                    });
                }
            }
        }
コード例 #2
0
ファイル: HOTASAxis.cs プロジェクト: joekolodz/SierraHOTAS
        private void CreateMultiActionButtonMapList(int segments)
        {
            //try not to lose any macros already established. if more segments, then don't lose any macros. if less segments only trim from bottom of list
            if (segments < ButtonMap.Count)
            {
                for (var i = ButtonMap.Count; i > segments; i--)
                {
                    ButtonMap.RemoveAt(i - 1);
                }
            }
            else
            {
                for (var i = ButtonMap.Count + 1; i <= segments; i++)
                {
                    ButtonMap.Add(new HOTASButton()
                    {
                        MapId = i, MapName = $"Axis Button {i}", Type = HOTASButton.ButtonType.Button
                    });
                }
            }

            if (IsDirectional)
            {
                if (segments < ReverseButtonMap.Count)
                {
                    for (var i = ReverseButtonMap.Count; i > segments; i--)
                    {
                        ReverseButtonMap.RemoveAt(i - 1);
                    }
                }
                else
                {
                    for (var i = ReverseButtonMap.Count + 1; i <= segments; i++)
                    {
                        ReverseButtonMap.Add(new HOTASButton()
                        {
                            MapId = i, MapName = $"Reverse Axis Button {i}", Type = HOTASButton.ButtonType.Button
                        });
                    }
                }
            }
        }