public UserActionProvider(IFacebookClientProvider facebookClientProvider, IPlayerReadModel playerReadModel, IPlayerSession playerSession, ICommandSender bus) { _facebookClientProvider = facebookClientProvider; _playerReadModel = playerReadModel; _playerSession = playerSession; _bus = bus; }
public void Setup() { _session = Substitute.For<IPlayerSession>(); _bus = Substitute.For<ICommandSender>(); _playerReadModel = Substitute.For<IPlayerReadModel>(); _target = new NativeUserActions(_session, _bus, _playerReadModel); }
public void Setup() { _session = Substitute.For<IPlayerSession>(); var locator = Substitute.For<IServiceLocator>(); locator.GetInstance<IPlayerSession>().Returns(_session); ServiceLocator.SetLocatorProvider(() => locator); _target = new PlayerRequired(); }
public override void SetParameter(ComponentParameter parameter) { switch (parameter.MemberName) { case "playersession": //TODO this shouldnt be a parameter. playerSession = parameter.GetValue<IPlayerSession>(); break; default: base.SetParameter(parameter); break; } }
public void SpawnPlayerMob(IPlayerSession s) { //Spawn the player's entity. There's probably a much better place to do this. Entity a = server.EntityManager.SpawnEntity("HumanMob"); Entity human = a; a.GetComponent<ITransformComponent>(ComponentFamily.Transform).TranslateTo(new Vector2(0, 0)); if (s.assignedJob != null) { foreach ( Entity newItem in s.assignedJob.SpawnEquipment.Select(def => server.EntityManager.SpawnEntity(def.ObjectType))) { newItem.GetComponent<ITransformComponent>(ComponentFamily.Transform).TranslateTo( human.GetComponent<ITransformComponent>(ComponentFamily.Transform).Position); human.GetComponent<IEquipmentComponent>(ComponentFamily.Equipment).RaiseEquipItem(newItem); } } s.AttachToEntity(a); }
public NativeUserActions(IPlayerSession session, ICommandSender bus, IPlayerReadModel playerReadModel) { _session = session; _bus = bus; _playerReadModel = playerReadModel; }
/// <summary> /// Detaches this player from its attached entity, if any. /// </summary> /// <param name="player">The player session that will be detached from any attached entities.</param> /// <returns>Whether the player is now detached from any entities. /// This returns true if the player wasn't attached to any entity.</returns> public bool Detach(IPlayerSession player) { var uid = player.AttachedEntityUid; return(uid == null || Detach(uid.Value)); }
private void UpdateSurgeryUIBodyPartSlotRequest(IPlayerSession session, Dictionary <string, int> options) { UserInterface?.SendMessage(new RequestBodyPartSlotSurgeryUIMessage(options), session); }
//Called by SendMap() after sending everything. public virtual void SpawnPlayer(IPlayerSession player) { //This should be handled differently!!!. IoCManager.Resolve<IPlayerManager>().SpawnPlayerMob(player); }
public bool CanScript(IPlayerSession session) { return(Implementation?.CanScript(session) ?? false); }
public ViewSubscriberRemovedEvent(EntityUid view, IPlayerSession subscriber) { View = view; Subscriber = subscriber; }
public bool CanScript(IPlayerSession session) { return(IsLocal(session)); }
public bool CanCommand(IPlayerSession session, string cmdName) { return(Implementation?.CanCommand(session, cmdName) ?? false); }
public bool CanCommand(IPlayerSession session, string cmdName) { return(IsLocal(session)); }
public bool CanViewVar(IPlayerSession session) { return(IsLocal(session)); }
private static string FormatPlayerString(IPlayerSession session) { return(session != null ? $"{session.Name}" : "[HOST]"); }
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args) { var ticker = IoCManager.Resolve <IGameTicker>(); ticker.RestartRound(); }
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args) { if (args.Length == 0) { shell.SendText(player, Help); return; } if (player.AttachedEntity == null) { shell.SendText(player, "You don't have a player!"); return; } var compFactory = IoCManager.Resolve <IComponentFactory>(); if (args[0] == "?") { // Get all components that implement the ISpeechComponent except var speeches = compFactory.GetAllRefTypes() .Where(c => typeof(IAccentComponent).IsAssignableFrom(c) && c.IsClass); var msg = ""; foreach (var s in speeches) { msg += $"{compFactory.GetRegistration(s).Name}\n"; } shell.SendText(player, msg); } else { var name = args[0]; // Try to get the Component Type type; try { var comp = compFactory.GetComponent(name); type = comp.GetType(); } catch (Exception) { shell.SendText(player, $"Accent {name} not found. Try {Command} ? to get a list of all appliable accents."); return; } // Check if that already exists try { var comp = player.AttachedEntity.GetComponent(type); shell.SendText(player, "You already have this accent!"); return; } catch (Exception) { // Accent not found } // Generic fuckery var ensure = typeof(IEntity).GetMethod("AddComponent"); if (ensure == null) { return; } var method = ensure.MakeGenericMethod(type); method.Invoke(player.AttachedEntity, null); } }
public AdminReg(IPlayerSession session, AdminData data) { Data = data; Session = session; }
public bool CanAdminMenu(IPlayerSession session) { return(IsLocal(session)); }
private void UpdatePlayerStatus(IPlayerSession session) { UserInterface?.SendMessage(new BlockGameMessages.BlockGameUserStatusMessage(_player == session), session); }
public bool CanAdminReloadPrototypes(IPlayerSession session) { return(IsLocal(session)); }
public bool CanViewVar(IPlayerSession session) { return(Implementation?.CanViewVar(session) ?? false); }
public void OpenUserInterface(IPlayerSession session) { UserInterface?.Open(session); }
public bool CanAdminMenu(IPlayerSession session) { return(Implementation?.CanAdminMenu(session) ?? false); }
public ServerBoundUserInterfaceMessage(BoundUserInterfaceMessage message, IPlayerSession session) { Message = message; Session = session; }
private void OpenSurgeryUI(IPlayerSession session) { UserInterface?.Open(session); }
internal void SendToSession(IPlayerSession session, BoundUserInterfaceMessage message, object uiKey) { SendNetworkMessage(new BoundInterfaceMessageWrapMessage(message, uiKey), session.ConnectedClient); }
private void CloseSurgeryUI(IPlayerSession session) { UserInterface?.Close(session); }
public PlayerDetachedEvent(IEntity entity, IPlayerSession player) { Entity = entity; EntityUid = entity.Uid; Player = player; }
public void SpawnPlayer(IPlayerSession player) { if (!_ready) return; CurrentGameMode.SpawnPlayer(player); CurrentGameMode.PlayerJoined(player); }
public virtual void PlayerJoined(IPlayerSession player) { }
public void SpawnPlayerMob(IPlayerSession s) { //Spawn the player's entity. There's probably a much better place to do this. Entity a = server.EntityManager.SpawnEntity("HumanMob"); Entity human = a; a.GetComponent<ITransformComponent>(ComponentFamily.Transform).TranslateTo(new Vector2(160, 160)); if (s.assignedJob != null) { foreach ( Entity newItem in s.assignedJob.SpawnEquipment.Select(def => server.EntityManager.SpawnEntity(def.ObjectType))) { newItem.GetComponent<ITransformComponent>(ComponentFamily.Transform).TranslateTo( human.GetComponent<ITransformComponent>(ComponentFamily.Transform).Position); //This is not neccessary once the equipment component is built. human.SendMessage(this, ComponentMessageType.EquipItem, newItem); } } s.AttachToEntity(a); }
public AttachPlayerEvent(EntityUid uid, IPlayerSession player, bool force = false) { Uid = uid; Player = player; Force = force; }
private void OnPlayerStatusChanged(IPlayerSession session, SessionStatus oldStatus, SessionStatus newStatus) { PlayerStatusChanged?.Invoke(this, new SessionStatusEventArgs(session, oldStatus, newStatus)); }
/// <summary> /// Attaches a player session to an entity, optionally kicking any sessions already attached to it. /// </summary> /// <param name="uid">The entity to attach the player to</param> /// <param name="player">The player to attach to the entity</param> /// <param name="force">Whether to kick any existing players from the entity</param> /// <returns>Whether the attach succeeded, or not.</returns> public bool Attach(EntityUid uid, IPlayerSession player, bool force = false) { return(Attach(uid, player, false, out _)); }
public virtual void SpawnPlayer(IPlayerSession player) //Called by SendMap() after sending everything. { //This should be handled differently!!!. IoCManager.Resolve<IPlayerManager>().SpawnPlayerMob(player); }
public SessionStatusEventArgs(IPlayerSession session, SessionStatus oldStatus, SessionStatus newStatus) { Session = session; OldStatus = oldStatus; NewStatus = newStatus; }
public virtual void PlayerDied(IPlayerSession player) { IoCManager.Resolve<IChatManager>().SendChatMessage(ChatChannel.Server, "Gamemode: Player died!", null, player.AttachedEntityUid); }
public void OpenSurgeryUI(IPlayerSession session) { _userInterface.Open(session); }
public void CloseSurgeryUI(IPlayerSession session) { _userInterface.Close(session); }
/// <summary> /// Attaches a player session to an entity, optionally kicking any sessions already attached to it. /// </summary> /// <param name="entity">The entity to attach the player to</param> /// <param name="player">The player to attach to the entity</param> /// <param name="force">Whether to kick any existing players from the entity</param> /// <returns>Whether the attach succeeded, or not.</returns> public bool Attach(IEntity entity, IPlayerSession player, bool force = false) { return(Attach(entity, player, false, out _)); }