public override void HandleMessage(EuiMessageBase msg) { if (msg is SpawnExplosionEuiMsg.Close) { Close(); return; } if (msg is not SpawnExplosionEuiMsg.PreviewRequest request) { return; } if (request.TotalIntensity <= 0 || request.IntensitySlope <= 0) { return; } var explosion = EntitySystem.Get <ExplosionSystem>().GenerateExplosionPreview(request); if (explosion == null) { Logger.Error("Failed to generate explosion preview."); return; } SendMessage(new SpawnExplosionEuiMsg.PreviewData(explosion, request.IntensitySlope, request.TotalIntensity)); }
public override void HandleMessage(EuiMessageBase msg) { switch (msg) { case AdminAddReagentEuiMsg.Close: Close(); break; case AdminAddReagentEuiMsg.DoAdd doAdd: // Double check that user wasn't de-adminned in the mean time... // Or the target was deleted. if (!_adminManager.HasAdminFlag(Player, ReqFlags) || _target.Deleted) { Close(); return; } _target.TryAddReagent(doAdd.ReagentId, doAdd.Amount, out _); StateDirty(); if (doAdd.CloseAfter) { Close(); } break; } }
public override void HandleMessage(EuiMessageBase msg) { switch (msg) { case EditSolutionsEuiMsg.Close: Close(); break; } }
protected void SendMessage(EuiMessageBase msg) { var netMsg = _netManager.CreateNetMessage <MsgEuiMessage>(); netMsg.Id = Id; netMsg.Message = msg; _netManager.ClientSendMessage(netMsg); }
public void SendMessage(EuiMessageBase message) { var netMgr = IoCManager.Resolve <IServerNetManager>(); var msg = netMgr.CreateNetMessage <MsgEuiMessage>(); msg.Id = Id; msg.Message = message; netMgr.ServerSendMessage(msg, Player.ConnectedClient); }
public override void ReadFromBuffer(NetIncomingMessage buffer) { Id = buffer.ReadUInt32(); var ser = IoCManager.Resolve <IRobustSerializer>(); var len = buffer.ReadVariableInt32(); var stream = buffer.ReadAlignedMemory(len); Message = ser.Deserialize <EuiMessageBase>(stream); }
public override void HandleMessage(EuiMessageBase msg) { base.HandleMessage(msg); switch (msg) { case MakeGhostRoleWindowClosedMessage _: Closed(); break; } }
public override void HandleMessage(EuiMessageBase msg) { base.HandleMessage(msg); if (msg is not AcceptCloningChoiceMessage choice || choice.Button == AcceptCloningUiButton.Deny || _newMob.Deleted) { Close(); return; } Player.ContentData()?.Mind?.TransferTo(_newMob); Close(); }
public override void HandleMessage(EuiMessageBase msg) { base.HandleMessage(msg); switch (msg) { case GhostRoleTakeoverRequestMessage req: EntitySystem.Get <GhostRoleSystem>().Takeover(Player, req.Identifier); break; case GhostRoleWindowCloseMessage _: Closed(); break; } }
public override void HandleMessage(EuiMessageBase msg) { base.HandleMessage(msg); if (msg is not AcceptCloningChoiceMessage choice || choice.Button == AcceptCloningUiButton.Deny || !EntitySystem.TryGet <CloningSystem>(out var cloningSystem)) { Close(); return; } cloningSystem.TransferMindToClone(_mind); Close(); }
public override void HandleMessage(EuiMessageBase msg) { switch (msg) { case AdminAddReagentEuiMsg.Close: Close(); break; case AdminAddReagentEuiMsg.DoAdd doAdd: // Double check that user wasn't de-adminned in the mean time... // Or the target was deleted. if (!_adminManager.HasAdminFlag(Player, AdminFlags.Fun) || _target.Deleted) { Close(); return; } var id = doAdd.ReagentId; var amount = doAdd.Amount; var solutionsSys = EntitySystem.Get <SolutionContainerSystem>(); if (_target.TryGetComponent(out InjectableSolutionComponent? injectable) && solutionsSys.TryGetSolution(_target, injectable.Name, out var targetSolution)) { var solution = new Solution(id, amount); solutionsSys.Inject(_target.Uid, targetSolution, solution); } else { //TODO decide how to find the solution if (solutionsSys.TryGetSolution(_target, "default", out var solution)) { solutionsSys.TryAddReagent(_target.Uid, solution, id, amount, out _); } } StateDirty(); if (doAdd.CloseAfter) { Close(); } break; }
public override void HandleMessage(EuiMessageBase msg) { base.HandleMessage(msg); switch (msg) { case NewLogs { Replace: true } newLogs: LogsControl.SetLogs(newLogs.Logs); break; case NewLogs { Replace: false } newLogs: LogsControl.AddLogs(newLogs.Logs); break; } }
public override void HandleMessage(EuiMessageBase msg) { base.HandleMessage(msg); switch (msg) { case NewLogs newLogs: if (newLogs.Replace) { LogsControl.SetLogs(newLogs.Logs); } else { LogsControl.AddLogs(newLogs.Logs); } LogsControl.NextButton.Disabled = !newLogs.HasNext; break; } }
public override void HandleMessage(EuiMessageBase msg) { switch (msg) { case AdminAddReagentEuiMsg.Close: Close(); break; case AdminAddReagentEuiMsg.DoAdd doAdd: // Double check that user wasn't de-adminned in the mean time... // Or the target was deleted. if (!_adminManager.HasAdminFlag(Player, ReqFlags) || _target.Deleted) { Close(); return; } var id = doAdd.ReagentId; var amount = doAdd.Amount; if (_target.TryGetComponent(out SolutionContainerComponent? container)) { container.TryAddReagent(id, amount, out _); } else if (_target.TryGetComponent(out ISolutionInteractionsComponent? interactions)) { var solution = new Solution(id, amount); interactions.Inject(solution); } StateDirty(); if (doAdd.CloseAfter) { Close(); } break; } }
/// <summary> /// Receive explosion preview data and add a client-side explosion preview overlay /// </summary> /// <param name="msg"></param> public override void HandleMessage(EuiMessageBase msg) { if (msg is not SpawnExplosionEuiMsg.PreviewData data) { return; } if (_debugOverlay == null) { _debugOverlay = new(); _overlayManager.AddOverlay(_debugOverlay); } _debugOverlay.Tiles = data.Explosion.Tiles; _debugOverlay.SpaceTiles = data.Explosion.SpaceTiles; _debugOverlay.Intensity = data.Explosion.Intensity; _debugOverlay.Slope = data.Slope; _debugOverlay.TotalIntensity = data.TotalIntensity; _debugOverlay.Map = data.Explosion.Epicenter.MapId; _debugOverlay.SpaceMatrix = data.Explosion.SpaceMatrix; _debugOverlay.SpaceTileSize = data.Explosion.SpaceTileSize; }
public override void HandleMessage(EuiMessageBase msg) { switch (msg) { case AdminAnnounceEuiMsg.Close: Close(); break; case AdminAnnounceEuiMsg.DoAnnounce doAnnounce: if (!_adminManager.HasAdminFlag(Player, AdminFlags.Admin)) { Close(); break; } switch (doAnnounce.AnnounceType) { case AdminAnnounceType.Server: _chatManager.DispatchServerAnnouncement(doAnnounce.Announcement); break; // TODO: Per-station announcement support case AdminAnnounceType.Station: _chatSystem.DispatchGlobalAnnouncement(doAnnounce.Announcement, doAnnounce.Announcer, colorOverride: Color.Gold); break; } StateDirty(); if (doAnnounce.CloseAfter) { Close(); } break; } }
public override void HandleMessage(EuiMessageBase msg) { switch (msg) { case AdminAnnounceEuiMsg.Close: Close(); break; case AdminAnnounceEuiMsg.DoAnnounce doAnnounce: if (!_adminManager.HasAdminFlag(Player, AdminFlags.Admin)) { Close(); break; } switch (doAnnounce.AnnounceType) { case AdminAnnounceType.Server: _chatManager.DispatchServerAnnouncement(doAnnounce.Announcement); break; case AdminAnnounceType.Station: _chatManager.DispatchStationAnnouncement(doAnnounce.Announcement, doAnnounce.Announcer); break; } StateDirty(); if (doAnnounce.CloseAfter) { Close(); } break; } }
public virtual void HandleMessage(EuiMessageBase msg) { }