private void printPropertiesAndActions(IMyTerminalBlock block) { List <ITerminalProperty> prop = new List <ITerminalProperty>(); block.GetProperties(prop); Echo("Properties:"); foreach (ITerminalProperty p in prop) { Echo("ID: " + p.Id); Echo("Type: " + p.TypeName); } List <ITerminalAction> acts = new List <ITerminalAction>(); block.GetActions(acts); Echo("Actions:"); foreach (ITerminalAction a in acts) { //Echo("Icon: " + a.Icon); Echo("ID: " + a.Id); Echo("Name: " + a.Name); } }
public void updateSlave(IMyTerminalBlock Master, IMyTerminalBlock Slave) { if (Master.BlockDefinition.TypeIdString.Equals(Slave.BlockDefinition.TypeIdString)) { List <ITerminalProperty> Properties = new List <ITerminalProperty>(); Master.GetProperties(Properties); for (int pi = 0; pi < Properties.Count; pi++) { ITerminalProperty Property = Properties[pi]; switch (Property.TypeName) { case "Boolean": Property.AsBool().SetValue(Slave, Property.AsBool().GetValue(Master)); break; case "Single": Property.AsFloat().SetValue(Slave, Property.AsFloat().GetValue(Master)); break; case "Color": Property.AsColor().SetValue(Slave, Property.AsColor().GetValue(Master)); break; default: break; } } } }
public void PrintProperties(IMyTerminalBlock block) { List<ITerminalProperty> results = new List<ITerminalProperty>(); block.GetProperties(results); for (int i=0; i<results.Count; i++) Println(results[i].Id); }
public void ParserProperty(IMyTerminalBlock block) { WriteText($"=== Properties Info ===", true); List <ITerminalProperty> propertyList = new List <ITerminalProperty>(); block.GetProperties(propertyList, null); propertyList.ForEach(delegate(ITerminalProperty property) { if (property.Is <float>()) { WriteText($"{property.Id}={block.GetValueFloat(property.Id)}", true); } if (property.Is <bool>()) { WriteText($"{property.Id}={block.GetValueBool(property.Id)}", true); } }); }
private void echoPropertiesAndActions(IMyTerminalBlock blk) { var props = new List <ITerminalProperty>(); blk.GetProperties(props); foreach (var p in props) { Echo("ID: " + p.Id + " | Type: " + p.TypeName); } var actions = new List <ITerminalAction>(); blk.GetActions(actions); foreach (var a in actions) { Echo("ID: " + a.Id + " | Name: " + a.Name); } }
private void printPropertiesAndActions(IMyTerminalBlock block) { List<ITerminalProperty> prop = new List<ITerminalProperty>(); block.GetProperties(prop); Echo("Properties:"); foreach (ITerminalProperty p in prop) { Echo("ID: " + p.Id); Echo("Type: " + p.TypeName); } List<ITerminalAction> acts = new List<ITerminalAction>(); block.GetActions(acts); Echo("Actions:"); foreach (ITerminalAction a in acts) { //Echo("Icon: " + a.Icon); Echo("ID: " + a.Id); Echo("Name: " + a.Name); } }
void Main() { var actions = new List <ITerminalAction>(); var properties = new List <ITerminalProperty>(); jd.GetProperties(properties); string log = ""; log += "---Properties"; foreach (var i in properties) { log += "\n" + i.Id; } jd.GetActions(actions); log += "\n\n---Actions"; foreach (var i in actions) { log += "\n" + i.Id; } LCDPB.WriteText(log); }
public TerminalBlock(IMyTerminalBlock block, bool light = true) { Name = block.CustomName; var def = block.BlockDefinition; Type = $"{def.TypeId}/{def.SubtypeId}"; Id = block.EntityId; if (light) { return; } if (block.HasInventory) { var count = block.InventoryCount; for (var i = 0; i < count; i++) { Inventories.Add(new Inventory(block.GetInventory(i))); } } block.GetProperties(new List <ITerminalProperty>(), p => { var prop = new BlockProperty(p, block); if (prop.IsValid) { Properties.Add(prop); } return(false); }); foreach (var action in MyTerminalControlFactory.GetActions(block.GetType())) { Actions.Add(action.Id); } }
public void Main(string argument, UpdateType updateSource) { var actions = new List <ITerminalAction>(); var properties = new List <ITerminalProperty>(); block.GetProperties(properties); block.GetActions(actions); StringBuilder sb = new StringBuilder(); sb.Append("--- properties"); foreach (var item in properties) { sb.Append("\n").Append(item.Id); } sb.Append("\n--- actions"); foreach (var item in actions) { sb.Append("\n").Append(item.Id); } Me.GetSurface(0).WriteText(sb.ToString()); Echo(block.ToString()); }
private void ListContent(IMyTerminalBlock autopilot, List <MyTerminalControlListBoxItem> items, List <MyTerminalControlListBoxItem> selected) { string blockName = m_targetBlock.ToString().Trim(); if (string.IsNullOrWhiteSpace(blockName)) { return; } HashSet <ITerminalProperty <T> > termProps = new HashSet <ITerminalProperty <T> >(); foreach (IMyCubeBlock block in AttachedGrid.AttachedCubeBlocks((IMyCubeGrid)autopilot.CubeGrid, AttachedGrid.AttachmentKind.Permanent, true)) { if (!block.DisplayNameText.Contains(blockName, StringComparison.InvariantCultureIgnoreCase)) { continue; } IMyTerminalBlock term = block as IMyTerminalBlock; if (term == null) { continue; } term.GetProperties(null, property => { ITerminalProperty <T> propT = property as ITerminalProperty <T>; if (propT == null) { return(false); } if (termProps.Add(propT)) { items.Add(new MyTerminalControlListBoxItem(MyStringId.GetOrCompute(propT.Id), MyStringId.NullOrEmpty, propT)); } return(false); }); } }