public DoorWidget(IDoor door) { this.door = door; door.DoorClosed += HandleDoorEvent; door.DoorOpened += HandleDoorEvent; StartAnimation(); }
/* * (non-Javadoc) * * @see * eu.jpereira.trainings.designpatterns.structural.adapter.DoorController * #addDoor * (eu.jpereira.trainings.designpatterns.structural.adapter.model.Door) */ public void AddDoor(IDoor managedDoor) { if (!_managedDoors.Contains(managedDoor)) { _managedDoors.Add(managedDoor); } }
private IDoor GetDoor(IDoor door) { // throws DoorNotManagedException { if (_managedDoors.Contains(door)) { return _managedDoors.ElementAt(_managedDoors.IndexOf(door)); } throw new DoorNotManagedException(); }
public void update(IDoor obj) { if (obj.getControllerType() != DoorControllerType.Standalone) return; if(CrossPlatformInputManager.GetButtonDown("Use")){ switch(obj.getState()){ case DoorState.Closed: obj.openDoor(); break; case DoorState.Locked: break; case DoorState.Opened: obj.closeDoor(); break; } } }
public virtual void SendDoorState(Region region, IDoor door) { using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.DoorState))) { ushort zone = (ushort)(door.DoorID / 1000000); int doorType = door.DoorID / 100000000; uint flag = door.Flag; // by default give all unflagged above ground non keep doors a default sound (excluding TrialsOfAtlantis zones) if (flag == 0 && doorType != 7 && region != null && region.IsDungeon == false && region.Expansion != (int)eClientExpansion.TrialsOfAtlantis) { flag = 1; } pak.WriteInt((uint)door.DoorID); pak.WriteByte((byte)(door.State == eDoorState.Open ? 0x01 : 0x00)); pak.WriteByte((byte)flag); pak.WriteByte(0xFF); pak.WriteByte(0x0); SendTCP(pak); } }
public DIP_DoorSolution(IDoor myDoor) { this.myDoor = myDoor; }
public Car(IDoor door) { this.Door = door; }
private static void UnlockDoor(IUser player, IDoor door) { IMessage message = new Message(); message.InstigatorID = player.UserID.ToString(); message.InstigatorType = player.Player.IsNPC == false ? ObjectType.Player : ObjectType.Npc; if (!player.Player.InCombat) { IRoom room = Room.GetRoom(player.Player.Location); bool hasKey = false; if (!room.IsDark) { if (door.Lockable) { if (door.RequiresKey) { //let's see if the player has the key in his inventory or a skeleton key (opens any door) List<IItem> inventory = player.Player.Inventory.GetInventoryAsItemList(); List<IItem> keyList = inventory.Where(i => i.ItemType.ContainsKey(ItemsType.KEY)).ToList(); IKey key = null; foreach (IItem keys in keyList) { key = keys as IKey; if (key.DoorID == door.Id || key.SkeletonKey) { hasKey = true; break; } } } if (!door.Open && !door.Destroyed && ((door.RequiresKey && hasKey) || !door.RequiresKey)) { door.Locked = false; door.UpdateDoorStatus(); //I may end up putting these strings in the general collection and then each method just supplies the verb message.Self = String.Format("You unlock {0} {1}.", GetArticle(door.Description[0]), door.Description); message.Room = String.Format("{0} unlocks {1} {2}.", player.Player.FirstName, GetArticle(door.Description[0]), door.Description); } else if (door.Destroyed) { message.Self ="Why would you want to unlock something that is in pieces?"; } else if (!hasKey) { message.Self ="You don't have the key to unlock this door."; } else { message.Self ="It can't be unlocked, the door is open."; } } else { message.Self = "It can't be unlocked."; } } else { message.Self = "You can't see anything! Let alone what you are trying to unlock."; } if (player.Player.IsNPC) { player.MessageHandler(message); } else { player.MessageHandler(message.Self); } room.InformPlayersInRoom(message, new List<ObjectId>() { player.UserID }); } else { player.MessageHandler("You are in the middle of combat there are more pressing matters at hand than unlocking something."); } }
public void Open(IDoor door) { door.Open(); }
private static void OpenADoor(IDoor door) { door.Open = true; door.UpdateDoorStatus(); }
private static void CloseADoor(IDoor door) { door.Open = false; door.UpdateDoorStatus(); }
public void AddDoor(IDoor door) => Doors.Add(door);
public DoorPosition GetDoorPosition(IDoor door) { return(_doorsPositions[Array.IndexOf(_doors, door)]); }
private static double CalculateDefense(IDoor door) { //TODO:some doors may have some resistance to damage add that here double result = 0.0; return result; }
static void Main(string[] args) { //set up DI ServiceProvider ServiceProvider; ServiceCollection services = new ServiceCollection(); //register services and build service provider ConfigureServices(services); ServiceProvider = services.BuildServiceProvider(); //get instances IDoor door = ServiceProvider.GetService <IDoor>(); IRfidReader rfidReader = ServiceProvider.GetService <IRfidReader>(); IDisplay Display = ServiceProvider.GetService <IDisplay>(); StationControl _stationControl = ServiceProvider.GetService <StationControl>(); //local vars bool finish = false; do { Display.NotifyStation("Indtast E, O, C, R: "); string input = Display.ReadInput(); if (string.IsNullOrEmpty(input)) { continue; } switch (input[0]) { case 'E': finish = true; break; case 'O': door.OpenDoor(); break; case 'C': door.CloseDoor(); break; case 'R': Display.NotifyStation("Input RFID id: "); string idString = Display.ReadInput(); //fix maybe? try { int id = Convert.ToInt32(idString); rfidReader.Read(id); } catch (FormatException e) { Display.NotifyStation("You must input a valid number!"); } break; default: break; } } while (!finish); }
public void RemapLinks(IDoor obj, IReadOnlyDictionary <FormKey, FormKey> mapping) { base.RemapLinks(obj, mapping); }
private void Awake() { door = doorGameObject.GetComponent <IDoor>(); }
static void Main(string[] args) { uint userFaildAttempts; // Число попыток неудачного ввода параметров получить из настроек if (!uint.TryParse(ConfigurationManager.AppSettings["UserAttempts"], out userFaildAttempts)) { Console.WriteLine("Неверные настройки программы!"); Console.ReadLine(); return; } Console.WriteLine("Создание автомобиля..."); Console.Write("Введите название автомобиля: "); string carModelName = Console.ReadLine(); uint carWheelsNum; if (Utils.Utils.TryGetUint(userFaildAttempts, "Введите число колес автомобиля: ", out carWheelsNum)) { uint carDoorsNum; if (Utils.Utils.TryGetUint(userFaildAttempts, "Введите число дверей автомобиля: ", out carDoorsNum)) { Car car = new Car(carModelName, carWheelsNum, carDoorsNum); do { Console.Write("\nВыберите действие: M - Move, O - Open door: "); switch (Console.ReadLine()) { case "M": foreach (var detail in car.carDetailsArray) { (detail as IRotatable)?.Move(car.Model); } break; case "O": uint doorNum; if (Utils.Utils.TryGetUint(userFaildAttempts, "Введите номер двери или 0 для рамы: ", out doorNum)) { IDoor openableDetail = car.carDetailsArray.Where(detail => detail is IDoor) .Cast <IDoor>() .SingleOrDefault(idoorItem => doorNum == 0 ? idoorItem is Body : (idoorItem as Door)?.Number == doorNum); if (openableDetail == null) { Console.WriteLine("Введен неверный номер двери!"); break; } openableDetail.Open(car.Model); } break; default: Console.WriteLine("Введено неверное действие!"); break; } Console.Write("Для повтора введите 'r', для выхода - любой символ : "); }while (Console.ReadLine() == "r"); } } Console.ReadLine(); }
/// <summary> /// Send Game Doors Depening on last refresh time. /// </summary> /// <param name="player"></param> /// <param name="nowTicks"></param> private static void UpdatePlayerDoors(GamePlayer player, long nowTicks) { // Get All Game Doors in Range var doors = player.GetDoorsInRadius(WorldMgr.OBJ_UPDATE_DISTANCE).Cast <IDoor>().OfType <GameObject>().Where(o => o.IsVisibleTo(player)).ToArray(); try { // Clean Cache foreach (var objEntry in player.Client.GameObjectUpdateArray) { var objKey = objEntry.Key; GameObject obj = WorldMgr.GetRegion(objKey.Item1).GetObject(objKey.Item2); // We have a Door in cache that is not in vincinity if (obj is IDoor && !doors.Contains(obj) && nowTicks - objEntry.Value >= GetPlayerItemUpdateInterval) { long dummy; player.Client.GameObjectUpdateArray.TryRemove(objKey, out dummy); } } } catch (Exception e) { if (log.IsErrorEnabled) { log.Error($"Error while Cleaning Doors cache for Player : {player.Name}, Exception : {e}"); } } try { // Now Send remaining doors foreach (IDoor ldoor in doors) { IDoor door = ldoor; // Get last update time long lastUpdate; if (player.Client.GameObjectUpdateArray.TryGetValue(new Tuple <ushort, ushort>(((GameObject)door).CurrentRegionID, (ushort)door.ObjectID), out lastUpdate)) { // This Door Needs Update if (nowTicks - lastUpdate >= GetPlayerItemUpdateInterval) { player.SendDoorUpdate(door); } } else { // Not in cache, Door entering in range, sending update will add it to cache. player.SendDoorUpdate(door); } } } catch (Exception e) { if (log.IsErrorEnabled) { log.Error($"Error while updating Doors for Player : {player.Name}, Exception : {e}"); } } }
public Lift(FloorConfiguration floorConfiguration, IDoor door) { Initialize(floorConfiguration, door); }
public DoorControl(ICardDB cardDB, IDoor door, IBeeper beeper ) { _CardDB = cardDB; _Door = door; _Beeper = beeper; }
public bool HasKey(IDoor door) { return(this.keys > 0); }
private static void OpenDoor(IUser player, IDoor door) { IMessage message = new Message(); message.InstigatorID = player.UserID.ToString(); message.InstigatorType = player.Player.IsNPC == false ? ObjectType.Player : ObjectType.Npc; IRoom room = Room.GetRoom(player.Player.Location); if (!player.Player.InCombat) { if (!room.IsDark) { if (door.Openable) { if (!door.Open && !door.Locked && !door.Destroyed) { door.Open = true; door.UpdateDoorStatus(); message.Self = String.Format("You open {0} {1}.", GetArticle(door.Description[0]), door.Description); message.Room = String.Format("{0} opens {1} {2}.", player.Player.FirstName, GetArticle(door.Description[0]), door.Description); } else if (door.Open && !door.Destroyed) { message.Self = "It's already open."; } else if (door.Locked && !door.Destroyed) { message.Self ="You can't open it because it is locked."; } else if (door.Destroyed) { message.Self = "It's more than open it's in pieces!"; } } else { message.Self ="It can't be opened."; } } else { message.Self ="You can't see anything! Let alone what you are trying to open."; } } else { player.MessageHandler("You are in the middle of combat, there are more pressing matters at hand than opening something."); } if (player.Player.IsNPC) { player.MessageHandler(message); } else { player.MessageHandler(message.Self); } room.InformPlayersInRoom(message, new List<ObjectId>() { player.UserID }); }
public void DestroyKey(IDoor door) { this.keys -= 1; }
private static void CloseDoor(IUser player, IDoor door) { IMessage message = new Message(); IRoom room = Room.GetRoom(player.Player.Location); message.InstigatorID = player.UserID.ToString(); message.InstigatorType = player.Player.IsNPC == false ? ObjectType.Player : ObjectType.Npc; if (!player.Player.InCombat) { if (!room.IsDark) { if (door.Openable) { if (door.Open && !door.Destroyed) { door.Open = false; door.UpdateDoorStatus(); //I may end up putting these strings in the general collection and then each method just supplies the verb message.Self = String.Format("You close {0} {1}.", GetArticle(door.Description[0]), door.Description); message.Room = String.Format("{0} closes {1} {2}.", player.Player.FirstName, GetArticle(door.Description[0]), door.Description); } else if (door.Destroyed) { message.Self = "You can't close it because it is in pieces!"; } else { message.Self = "It's already closed."; } } else { message.Self = "It can't be closed."; } } else { message.Self = "You can't see anything! Let alone what you are trying to close."; } } else { message.Self = "You are in the middle of combat, there are more pressing matters at hand than closing something."; } if (player.Player.IsNPC) { player.MessageHandler(message); } else { player.MessageHandler(message.Self); } room.InformPlayersInRoom(message, new List<ObjectId>() { player.UserID }); }
/* (non-Javadoc) * @see eu.jpereira.trainings.designpatterns.structural.adapter.DoorController#closeDoor(eu.jpereira.trainings.designpatterns.structural.adapter.model.Door) */ public void CloseDoor(IDoor door) { // throws DoorNotManagedException { GetDoor(door).Close(); }
private void Awake() { doorA = doorGameObjectA.GetComponent <IDoor>(); doorB = doorGameObjectB.GetComponent <IDoor>(); doorC = doorGameObjectC.GetComponent <IDoor>(); }
private void Awake() { doorA = door.GetComponent <IDoor>(); }
public void SendDoorState(Region region, IDoor door) { if (SendDoorStateMethod != null) SendDoorStateMethod(this, region, door); }
public void printLabel(IDoor doorObject) { onResizeWindow(); if (doorObject.getTextDisplayed() == TextDisplayed.None) return; GUI.Label(objectTitleRectangle,"["+doorObject.getName()+"]\n",titleStyle); GUI.Label(objectCaptionRectangle,doorObject.getCaption(),captionStyle); switch(doorObject.getState()){ case DoorState.Opened: doorStateStyle.normal.textColor = stateOpenedColor; break; case DoorState.Closed: doorStateStyle.normal.textColor = stateClosedColor; break; case DoorState.Locked: doorStateStyle.normal.textColor = stateLockedColor; break; } GUI.Label(objectStateRectangle,stateToString(doorObject.getState()),doorStateStyle); }
public void SetHeldDoorPair(IDoor door) { throw new System.NotImplementedException(); }
public DoorControlClass(IDoor door, IUserValidation userValidation, IEntryNotification entryNotification) { _door = door; _userValidation = userValidation; _entryNotification = entryNotification; }
/* * (non-Javadoc) * * @see * eu.jpereira.trainings.designpatterns.structural.adapter.DoorController * #openDoor * (eu.jpereira.trainings.designpatterns.structural.adapter.model.Door) */ public void OpenDoor(IDoor door, String doorCode) { // throws DoorNotManagedException, IncorrectDoorCodeException{ GetDoor(door).Open(doorCode); }
public void Setup() { _uut = new Door(); }
public void SendDoorState(Region region, IDoor door) { }
public Client(IDoor door) { this.door = door; }
public DoorDistEntry(IDoor d, int distance) { Door = d; Distance = distance; }
public void unlockNextDoor(int direction) { switch (direction) { case 0: foreach (IObject block in rooms[roomKey].GetBlocks()) { if ((block is CaveDoor || block is ClosedDoor || block is OpenDoor || block is LockedDoor)) { IDoor door = (IDoor)block; //make sure door on the other side of the other room is also open if (door.getSide() == 3) { door.openDoor(); } } } break; case 1: foreach (IObject block in rooms[roomKey].GetBlocks()) { if ((block is CaveDoor || block is ClosedDoor || block is OpenDoor || block is LockedDoor)) { IDoor door = (IDoor)block; //make sure door on the other side of the other room is also open if (door.getSide() == 2) { door.openDoor(); } } } break; case 2: foreach (IObject block in rooms[roomKey].GetBlocks()) { if ((block is CaveDoor || block is ClosedDoor || block is OpenDoor || block is LockedDoor)) { IDoor door = (IDoor)block; //make sure door on the other side of the other room is also open if (door.getSide() == 1) { door.openDoor(); } } } break; case 3: foreach (IObject block in rooms[roomKey].GetBlocks()) { if ((block is CaveDoor || block is ClosedDoor || block is OpenDoor || block is LockedDoor)) { IDoor door = (IDoor)block; //make sure door on the other side of the other room is also open if (door.getSide() == 0) { door.openDoor(); } } } break; } }
public SecretDoor(IDoor door) => _door = door;
public static void RegisterDoor(IDoor door) { if (!m_doors.ContainsKey(door.DoorID)) { List<IDoor> createDoorList = new List<IDoor>(); m_doors.Add(door.DoorID, createDoorList); } List<IDoor> addDoorList = m_doors[door.DoorID] as List<IDoor>; addDoorList.Add(door); }
public Cabin(TextBox txtElevator, int height) { _txtElevator = txtElevator; _cabinHeight = height; _cabinDoor = new CabinDoor(_txtElevator); }