コード例 #1
0
        public void StartGooeyProgramming()
        {
            Log.DebugLog("entered");

            using (MainLock.AcquireSharedUsing())
            {
                m_currentCommand = null;
                m_listCommands   = true;
                m_commandList.Clear();
                m_syntaxErrors.Clear();

                MyTerminalControls.Static.CustomControlGetter += CustomControlGetter;
                m_block.AppendingCustomInfo += m_block_AppendingCustomInfo;

                Commands = AutopilotTerminal.GetAutopilotCommands(m_block).ToString();
                foreach (ACommand comm in ParseCommands(Commands))
                {
                    m_commandList.Add(comm);
                }
                if (m_syntaxErrors.Length != 0)
                {
                    m_block.UpdateCustomInfo();
                }
                m_block.RebuildControls();
            }
        }
コード例 #2
0
ファイル: HarvestVoxel.cs プロジェクト: zrisher/ARMS
        private void ItemSelected(IMyTerminalBlock autopilot, List <MyTerminalControlListBoxItem> selected)
        {
            if (m_addingOres)
            {
                if (selected.Count == 0)
                {
                    return;
                }
                Ore ore;
                if (!TryGetOre(selected[0], out ore))
                {
                    throw new Exception("Selected item not found in all ores. Selected item: " + selected[0].Text.ToString());
                }
                m_activeOres.Add(ore);
                m_addingOres = false;
                autopilot.RebuildControls();
                return;
            }

            if (selected.Count == 0)
            {
                m_selected = null;
            }
            else
            {
                TryGetOre(selected[0], out m_selected);
            }
        }
コード例 #3
0
        public RotorPicker(IMyTerminalBlock cockpit, string rotorName, ControlRotorParams rotorParams, SetControlRotors onComplete)
        {
            m_block      = cockpit;
            m_onComplete = onComplete;

            IEnumerable <IMyMotorStator> selected;

            rotorParams(out selected, out m_sensitivity, out m_trim);
            m_trim = MathHelper.ToDegrees(m_trim);

            m_listbox              = new MyTerminalControlListbox <MyCockpit>("Arms_RotorPicker", MyStringId.GetOrCompute(rotorName + " Rotors"), MyStringId.NullOrEmpty, true, 14);
            m_listbox.ListContent  = ListContent;
            m_listbox.ItemSelected = ItemSelected;

            m_sensitivitySlider = new MyTerminalControlSlider <MyCockpit>("Arms_RotorPickerSensitivity", MyStringId.GetOrCompute("Control Sensitivity"), MyStringId.GetOrCompute("How sensitive the ship will be to input"));
            m_sensitivitySlider.DefaultValue = 1f;
            m_sensitivitySlider.Getter       = b => m_sensitivity;
            m_sensitivitySlider.Setter       = (b, value) => m_sensitivity = value;
            m_sensitivitySlider.SetLogLimits(0.01f, 100f);
            m_sensitivitySlider.Writer = (b, sb) => sb.Append(m_sensitivity);

            m_trimSlider = new MyTerminalControlSlider <MyCockpit>("Arms_RotorPickerTrim", MyStringId.GetOrCompute("Trim"), MyStringId.GetOrCompute("Default angle of rotors"));
            m_trimSlider.DefaultValue = 0f;
            m_trimSlider.Getter       = b => m_trim;
            m_trimSlider.Setter       = (b, value) => m_trim = value;
            m_trimSlider.SetLimits(-45f, 45f);
            m_trimSlider.Writer = (b, sb) => {
                sb.Append(m_trim);
                sb.Append('°');
            };

            m_save = new MyTerminalControlButton <MyCockpit>("Arms_RotorPickerSave", MyStringId.GetOrCompute("Save & Exit"), MyStringId.NullOrEmpty, SaveAndExit);

            CubeGridCache cache = CubeGridCache.GetFor(m_block.CubeGrid);

            if (cache == null)
            {
                return;
            }

            foreach (IMyMotorStator stator in cache.BlocksOfType(typeof(MyObjectBuilder_MotorStator)))
            {
                MyGuiControlListbox.Item item = new MyGuiControlListbox.Item(new StringBuilder(stator.DisplayNameText), userData: stator);
                m_allItems.Add(item);
                if (selected.Contains(stator))
                {
                    m_selected.Add(item);
                }
            }

            MyTerminalControls.Static.CustomControlGetter += CustomControlGetter;
            cockpit.RebuildControls();
        }
コード例 #4
0
        private static void Set_AeroTerminal(IMyTerminalBlock block, bool value)
        {
            CockpitTerminal cockpitTerminal;

            if (!Registrar.TryGetValue(block, out cockpitTerminal))
            {
                Logger.AlwaysLog("Failed lookup of block: " + block.getBestName(), Logger.severity.WARNING);
                return;
            }

            cockpitTerminal.m_aeroShow = value;
            block.RebuildControls();
        }
コード例 #5
0
        private static void Set_Helper(IMyTerminalBlock block, bool value)
        {
            CockpitTerminal cockpitTerminal;

            if (!Registrar.TryGetValue(block, out cockpitTerminal))
            {
                Logger.AlwaysLog("Failed lookup of block: " + block.getBestName(), Logger.severity.WARNING);
                return;
            }

            if (value)
            {
                cockpitTerminal.m_controlHelper = new FlightControlAssist(cockpitTerminal.m_cockpit);
                block.RebuildControls();
            }
            else
            {
                cockpitTerminal.m_controlHelper.Disable();
                cockpitTerminal.m_controlHelper = null;
            }
        }
コード例 #6
0
        private void ItemSelected(IMyTerminalBlock autopilot, List <MyTerminalControlListBoxItem> selected)
        {
            if (m_addingResponse)
            {
                if (selected.Count == 0)
                {
                    return;
                }
                m_activeResponses.Add((EnemyFinder.Response)selected[0].UserData);
                m_addingResponse = false;
                autopilot.RebuildControls();
                return;
            }

            if (selected.Count == 0)
            {
                m_selected = EnemyFinder.Response.None;
            }
            else
            {
                m_selected = (EnemyFinder.Response)selected[0].UserData;
            }
        }
コード例 #7
0
ファイル: HarvestVoxel.cs プロジェクト: zrisher/ARMS
 private void AddOre(IMyTerminalBlock block)
 {
     m_addingOres = true;
     block.RebuildControls();
 }
コード例 #8
0
 private void AddResponse(IMyTerminalBlock block)
 {
     m_addingResponse = true;
     block.RebuildControls();
 }