/// <summary> /// Add a unicast handler. /// </summary> /// <param name="handler">The handler for messages when received. Note that this handler will be called with ALL Unicast messages. Always sets a callback handler</param> /// <returns></returns> public bool AddUnicastHandler(Action <MyIGCMessage> handler) { _unicastListener = _gridProgram.IGC.UnicastListener; _unicastListener.SetMessageCallback("UNICAST"); _unicastMessageHandlers.Add(handler); return(true); }
public bool AddUnicastHandler(Action <MyIGCMessage> handler) { myUnicastListener = gridProgram.IGC.UnicastListener; myUnicastListener.SetMessageCallback(); unicastMessageHandlers.Add(handler); return(true); }
/// <summary> /// Add a unicast handler. /// </summary> /// <param name="handler">The handler for messages when received. Note that this handler will be called with ALL Unicast messages. Always sets a callback handler</param> /// <returns></returns> public bool AddUnicastHandler(Action <MyIGCMessage> handler) { _unicastListener = _program.IGC.UnicastListener; _unicastListener.SetMessageCallback("UNICAST"); if (!_unicastMessageHandlers.Contains(handler)) { _unicastMessageHandlers.Add(handler); } return(true); }
public AntennaHandler(Program _program) { parent_program = _program; _myBroadcastListener = parent_program.IGC.RegisterBroadcastListener(_recallRequestTag); _myUnicastListener = parent_program.IGC.UnicastListener; //_myUnicastListener = parent_program.IGC.RegisterBroadcastListener(_responseTag); _myUnicastListener.SetMessageCallback("UNICAST"); _myBroadcastListener.SetMessageCallback(_recallRequestTag); }
//#script begin public ShowCase_Echo() //#ctor { //This is my address. Anyone conneted to same antenna relay as me can send me direct message on this addresss. long myIGCAddress = this.IGC.Me; //This is your unicast listener. You should check your mail so it doesn't go to spam ;) IMyUnicastListener myUnicastListener = this.IGC.UnicastListener; //Let's setup message callback with empty argument myUnicastListener.SetMessageCallback(); }
public Program() { // Echo some information about 'me' when I'm compiled Echo("Creator."); Echo("Me=" + Me.EntityId.ToString()); Echo(Me.CubeGrid.CustomName); // register a broadcast listener _bListener = IGC.RegisterBroadcastListener(BroadcastTag); // What it listens for _bListener.SetMessageCallback(BroadcastTag); // What it will run the PB with once it has a message // save the unicast listener _uListener = IGC.UnicastListener; _uListener.SetMessageCallback(UnicastTag); // set PB callback argument to be used }
public Program() { textPanel = GridTerminalSystem.GetBlockWithName("Docking Display") as IMyTextPanel; List <IMyCockpit> shipControllers = new List <IMyCockpit>(); GridTerminalSystem.GetBlocksOfType(shipControllers); foreach (IMyCockpit cockpit in shipControllers) { //if cockpit is currently controlled by a player if (cockpit.IsMainCockpit) { for (int i = 0; i < cockpit.SurfaceCount; i++) { IMyTextSurface surface = cockpit.GetSurface(i); if (surface.ContentType == ContentType.TEXT_AND_IMAGE) { textPanel = surface; Echo("FOUND TEXT SUFRACE IN COCKPIT"); textPanel.WriteText("DOCK REQUEST CONTROLLER LOADED"); break; } } break; } } List <IMyRadioAntenna> antennas = new List <IMyRadioAntenna>(); GridTerminalSystem.GetBlocksOfType(antennas); antenna = antennas[0]; Echo(String.Format("ANTENNA FOUND: {0}", antenna.CustomName)); antenna.EnableBroadcasting = true; antenna.AttachedProgrammableBlock = Me.EntityId; listener = IGC.UnicastListener; listener.SetMessageCallback("DOCK_MESSAGE"); Echo("CURRENT STATUS: " + Storage); }
public Program() { listener = IGC.UnicastListener; listener.SetMessageCallback(ARG_CALLBACK); }