private void ModifyCurrentList(ref List <MyGuiControlListbox.Item> list, bool Add)
 {
     Debug.Assert(list != null, "Adding NULL from list");
     m_allowCurrentListUpdate = false;
     if (list != null)
     {
         foreach (var val in list)
         {
             Debug.Assert(val.UserData != null, "User data is null");
             MyDefinitionId?id = val.UserData as MyDefinitionId?;
             if (id != null)
             {
                 ChangeListId((MyDefinitionId)id, Add);
                 continue;
             }
             byte?b = val.UserData as byte?;
             if (b == null)
             {
                 Debug.Assert(false, "Should not be here");
                 continue;
             }
             ChangeListType((byte)b, Add);
         }
     }
     m_allowCurrentListUpdate = true;
     currentList.UpdateVisual();
     addToSelectionButton.UpdateVisual();
     removeFromSelectionButton.UpdateVisual();
 }
Esempio n. 2
0
 private void DoChangeListId(SerializableDefinitionId id, bool add)
 {
     if (add)
     {
         this.m_inventoryConstraint.Add(id);
     }
     else
     {
         this.m_inventoryConstraint.Remove(id);
     }
     base.CubeGrid.GridSystems.ConveyorSystem.FlagForRecomputation();
     if (this.m_allowCurrentListUpdate)
     {
         currentList.UpdateVisual();
     }
 }
Esempio n. 3
0
		public override void AddControls(List<Sandbox.ModAPI.Interfaces.Terminal.IMyTerminalControl> controls)
		{
			MyTerminalControlTextbox<MyShipController> textBox = new MyTerminalControlTextbox<MyShipController>("BlockName", MyStringId.GetOrCompute("Block name"),
				MyStringId.GetOrCompute("Blocks with names containing this string will run the action."));
			textBox.Getter = block => m_targetBlock;
			textBox.Setter = (block, value) => m_targetBlock = value;
			controls.Add(textBox);

			IMyTerminalControlListbox actionList = new MyTerminalControlListbox<MyShipController>("ActionList", MyStringId.GetOrCompute("Action"), MyStringId.NullOrEmpty);
			actionList.ListContent = ListContent;
			actionList.ItemSelected = ItemSelected;

			MyTerminalControlButton<MyShipController> searchButton = new MyTerminalControlButton<MyShipController>("SearchButton", MyStringId.GetOrCompute("Search"),
				MyStringId.GetOrCompute("Search for actions"), block => actionList.UpdateVisual());

			controls.Add(searchButton);
			controls.Add(actionList);

			MyTerminalControlTextbox<MyShipController> actionParams = new MyTerminalControlTextbox<MyShipController>("ActionParams", MyStringId.GetOrCompute("Action Params"),
				MyStringId.GetOrCompute("Comma separated list of parameters to pass to action"));
			actionParams.Getter = block => m_actionParams;
			actionParams.Setter = (block, value) => m_actionParams = value;
			controls.Add(actionParams);
		}
Esempio n. 4
0
        public override void AddControls(List <Sandbox.ModAPI.Interfaces.Terminal.IMyTerminalControl> controls)
        {
            MyTerminalControlTextbox <MyShipController> textBox = new MyTerminalControlTextbox <MyShipController>("BlockName", MyStringId.GetOrCompute("Block name"),
                                                                                                                  MyStringId.GetOrCompute("Blocks with names containing this string will have their property set."));

            textBox.Getter = block => m_targetBlock;
            textBox.Setter = (block, value) => m_targetBlock = value;
            controls.Add(textBox);

            IMyTerminalControlListbox propertyList = new MyTerminalControlListbox <MyShipController>("PropertyList", MyStringId.GetOrCompute("Property"), MyStringId.NullOrEmpty);

            propertyList.ListContent  = ListContent;
            propertyList.ItemSelected = ItemSelected;

            MyTerminalControlButton <MyShipController> searchButton = new MyTerminalControlButton <MyShipController>("SearchButton", MyStringId.GetOrCompute("Search"),
                                                                                                                     MyStringId.GetOrCompute("Search for properties"), block => propertyList.UpdateVisual());

            controls.Add(searchButton);
            controls.Add(propertyList);

            AddValueControl(controls);
        }