コード例 #1
0
        public void GetAllAsync_DoorActionsExist_DoorActionsRetrieved()
        {
            // Arrange
            var doorAction1 = new DoorAction
            {
                Id           = 1,
                DoorReaderId = 1,
                CardId       = 1,
                Status       = DoorActionStatusType.Success,
                TimeStamp    = new DateTime(2000, 1, 1),
            };

            var doorAction2 = new DoorAction
            {
                Id           = 2,
                DoorReaderId = 1,
                CardId       = 1,
                Status       = DoorActionStatusType.Error,
                TimeStamp    = new DateTime(2000, 1, 2),
            };

            _applicationContext.DoorActions.AddRange(doorAction1, doorAction2);
            _applicationContext.SaveChanges();

            // Act
            var receivedDoorActionDtos = _doorActionManager
                                         .GetAllAsync()
                                         .GetAwaiter()
                                         .GetResult();

            // Assert
            Assert.Equal(2, receivedDoorActionDtos.Count());
            Assert.Single(receivedDoorActionDtos.Where(doorActionDto => doorActionDto.Id == doorAction1.Id));
            Assert.Single(receivedDoorActionDtos.Where(doorActionDto => doorActionDto.Id == doorAction2.Id));
        }
コード例 #2
0
        // Initialize variables
        void Start()
        {
            UIMan            = UIManager.Inst;
            GameMan          = GameManager.Inst;
            hasHealed        = false;
            posseDeltsLoaded = false;
            majorSelected    = false;
            hasTriggered     = false;
            HouseSwitchIn    = null;
            HouseDeltIndex   = -1;
            PosseDeltIndex   = -1;
            houseMove        = -1;
            posseMove        = -1;
            majorQuery       = new List <MajorClass>();
            queryResults     = new List <DeltemonData>();

            itemQuery  = false;
            levelQuery = 1;
            nameQuery  = "";
            pinQuery   = 1;

            // Set door to go to back to last town
            DoorAction           shopDoor  = this.transform.GetChild(0).GetComponent <DoorAction>();
            TownRecoveryLocation townRecov = GameMan.FindTownRecov();

            shopDoor.xCoordinate = townRecov.RecovX;
            shopDoor.yCoordinate = townRecov.RecovY;
            shopDoor.sceneName   = townRecov.townName;
        }
コード例 #3
0
ファイル: Door.cs プロジェクト: zunath/NWN.FinalFantasy
 /// <summary>
 ///   - oTargetDoor
 ///   - nDoorAction: DOOR_ACTION_*
 ///   * Returns TRUE if nDoorAction can be performed on oTargetDoor.
 /// </summary>
 public static int GetIsDoorActionPossible(uint oTargetDoor, DoorAction nDoorAction)
 {
     Internal.NativeFunctions.StackPushInteger((int)nDoorAction);
     Internal.NativeFunctions.StackPushObject(oTargetDoor);
     Internal.NativeFunctions.CallBuiltIn(337);
     return(Internal.NativeFunctions.StackPopInteger());
 }
コード例 #4
0
        public void Action_Set_Get(DoorAction action)
        {
            var packet = new DoorToggle();

            packet.Action = action;

            Assert.Equal(action, packet.Action);
        }
コード例 #5
0
ファイル: LineDefType.cs プロジェクト: eclipseanu/UnityDoom
 public LineDefDoorType(Trigger trigger, Repeatable repeatable, Lock lockType, Speed speed, int wait, MonsterActivate monsterActivate, DoorAction doorAction) : base(Category.Door)
 {
     this.trigger         = trigger;
     this.repeatable      = repeatable;
     this.lockType        = lockType;
     this.speed           = speed;
     this.wait            = wait;
     this.monsterActivate = monsterActivate;
     this.doorAction      = doorAction;
 }
コード例 #6
0
    private void Execute(DoorAction p_action, GameObject p_activator)
    {
        switch (p_action)
        {
        case DoorAction.OPEN:
            OpenDoors(p_activator);
            break;

        case DoorAction.CLOSE:
            CloseDoors(p_activator);
            break;
        }
    }
コード例 #7
0
        public ScriptDoorCommand(XElement Def)
        {
            Door = Def.AttributeValue <string>("door");
            string Action = Def.AttributeValue <string>("action").ToLower().Trim();

            if (Action.StartsWith("o"))
            {
                this.Action = DoorAction.Open;
            }
            else
            {
                this.Action = DoorAction.Close;
            }
            Delay = Def.AttributeValue <int>("delay");
        }
コード例 #8
0
        public bool HandleDoorUse(
            TSPlayer player, DPoint tileLocation, DoorAction action, NPC npc = null, Direction direction = Direction.Unknown
            )
        {
            try {
                bool isOpening = (action == DoorAction.OpenDoor || action == DoorAction.OpenTallGate || action == DoorAction.OpenTrapdoor);
                this.ProcessCircuit(player, tileLocation, AdvancedCircuits.BoolToSignal(isOpening), false);
            } catch (Exception ex) {
                this.PluginTrace.WriteLineError(
                    "DoorUse for \"{0}\" at {1} failed. See inner exception for details.\n{2}",
                    TerrariaUtils.Tiles.GetBlockTypeName(TerrariaUtils.Tiles[tileLocation]), tileLocation, ex.ToString()
                    );
            }

            return(false);
        }
コード例 #9
0
        public void GetAllAsync_DoorActionsExist_DoorActionRetrievedByUserIdsFilter()
        {
            // Arrange
            var doorAction1 = new DoorAction
            {
                Id           = 1,
                DoorReaderId = 1,
                CardId       = 1,
                Status       = DoorActionStatusType.Success,
                TimeStamp    = new DateTime(2000, 1, 1),
            };

            var doorAction2 = new DoorAction
            {
                Id           = 2,
                DoorReaderId = 1,
                CardId       = 1,
                Status       = DoorActionStatusType.Error,
                TimeStamp    = new DateTime(2000, 1, 2),
            };

            var card1 = new Card
            {
                Id           = 1,
                UserId       = "QWERTY123",
                UniqueNumber = "123-45",
                Status       = CardStatusType.Active,
                Level        = LevelType.Admin,
            };

            _applicationContext.DoorActions.AddRange(doorAction1, doorAction2);
            _applicationContext.Cards.Add(card1);
            _applicationContext.SaveChanges();

            // Act
            var receivedDoorActionDtos = _doorActionManager
                                         .GetAllAsync(userIds: new string[] { card1.UserId })
                                         .GetAwaiter()
                                         .GetResult();

            // Assert
            Assert.Equal(2, receivedDoorActionDtos.Count());
            Assert.Single(receivedDoorActionDtos.Where(doorActionDto => doorActionDto.Id == doorAction1.Id));
            Assert.Single(receivedDoorActionDtos.Where(doorActionDto => doorActionDto.Id == doorAction2.Id));
        }
コード例 #10
0
        public bool HandleDoorUse(
            TSPlayer player, DPoint tileLocation, DoorAction action, NPC npc = null, Direction direction = Direction.Unknown
            )
        {
            try {
            bool isOpening = false;
            if (action == DoorAction.OpenDoor || action == DoorAction.OpenTallGate || action == DoorAction.OpenTrapdoor)
              isOpening = true;
            this.ProcessCircuit(player, tileLocation, AdvancedCircuits.BoolToSignal(isOpening), false);
              } catch (Exception ex) {
            this.PluginTrace.WriteLineError(
              "DoorUse for \"{0}\" at {1} failed. See inner exception for details.\n{2}",
              TerrariaUtils.Tiles.GetBlockTypeName((BlockType)TerrariaUtils.Tiles[tileLocation].type), tileLocation, ex.ToString()
            );
              }

              return false;
        }
コード例 #11
0
        public void GetAllAsync_DoorActionsExist_DoorActionRetrievedWithPagination()
        {
            // Arrange
            var pageFilter = new PageHelper
            {
                Page     = 1,
                PageSize = 1,
            };

            var doorAction1 = new DoorAction
            {
                Id           = 1,
                DoorReaderId = 1,
                CardId       = 1,
                Status       = DoorActionStatusType.Success,
                TimeStamp    = new DateTime(2000, 1, 1),
            };

            var doorAction2 = new DoorAction
            {
                Id           = 2,
                DoorReaderId = 1,
                CardId       = 1,
                Status       = DoorActionStatusType.Error,
                TimeStamp    = new DateTime(2000, 1, 2),
            };

            _applicationContext.DoorActions.AddRange(doorAction1, doorAction2);
            _applicationContext.SaveChanges();

            // Act
            var receivedDoorActionDtos = _doorActionManager
                                         .GetAllAsync(pageFilter: pageFilter)
                                         .GetAwaiter()
                                         .GetResult();

            // Assert
            Assert.Single(receivedDoorActionDtos);
        }
コード例 #12
0
        // Initialize values
        void Start()
        {
            startDialogues = new string[] {
                "Hey there... what can I get ya, good lookin'?",
                "Come here often?",
                "Guns, ammo, puns. You name it, I'll sell it.",
                "If you don't like my prices, check your privelege",
                "What's cookin', good lookin?",
                "I'm buyin' what you're sellin' if you're buyin' what I'm sellin'",
                "Give me your money, honey!",
                "I'm selling the goods, if you would sell me your heart.",
                "Look at this PYT... Price You Treasure",
                "I'll price you digits if you give me yours"
            };
            UIMan                   = UIManager.Inst;
            GameMan                 = GameManager.Inst;
            allItemsLoaded          = false;
            hasTriggered            = false;
            hasBought               = false;
            hasInteracted           = false;
            allSellItemsLoaded      = false;
            isAnimating             = false;
            isBuying                = true;
            hasSold                 = false;
            CurrentPlayerCoins.text = "" + GameMan.coins;

            // Set door to go to back to last town
            DoorAction           shopDoor  = this.transform.GetChild(0).GetComponent <DoorAction>();
            TownRecoveryLocation townRecov = GameMan.FindTownRecov();

            shopDoor.xCoordinate = townRecov.ShopX;
            shopDoor.yCoordinate = townRecov.ShopY;
            shopDoor.sceneName   = townRecov.townName;

            SortItems();
        }
コード例 #13
0
    /// <summary>Begins the opening the door process.</summary>
    public void Activate(DoorAction da, GameObject play)
    {
        if (!activated)
        {
            player = play;
            if (da == DoorAction.OPEN)
            {
                count         = 0;
                openDoor      = true;
                intervalCount = interval;
                gameObject.transform.GetChild(0).GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 0f);
            }
            else
            {
                count         = animationTime;
                openDoor      = false;
                intervalCount = animationTime - interval;
                gameObject.transform.GetChild(numberOfDoorPieces - 1).GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 1f);
            }

            activated     = true;
            animationOver = false;
        }
    }
コード例 #14
0
 /// <summary>
 /// Determines whether the specified action can be performed on this door.
 /// </summary>
 /// <param name="action">The action to check.</param>
 /// <returns>true if the specified action can be performed, otherwise false.</returns>
 public bool IsDoorActionPossible(DoorAction action)
 => NWScript.GetIsDoorActionPossible(this, (int)action).ToBool();
コード例 #15
0
ファイル: Door.cs プロジェクト: zunath/NWN.FinalFantasy
 /// <summary>
 ///   Perform nDoorAction on oTargetDoor.
 /// </summary>
 public static void DoDoorAction(uint oTargetDoor, DoorAction nDoorAction)
 {
     Internal.NativeFunctions.StackPushInteger((int)nDoorAction);
     Internal.NativeFunctions.StackPushObject(oTargetDoor);
     Internal.NativeFunctions.CallBuiltIn(338);
 }
コード例 #16
0
        public void GetAllAsync_DoorActionsExist_DoorActionRetrievedByDateRangeFilter()
        {
            // Arrange
            var defaultStartDate = new DateTime(2000, 1, 2);
            var defaultEndDate   = new DateTime(2000, 1, 3);

            var dateRange = new DateRangeHelper(defaultStartDate, defaultEndDate);

            var doorAction1 = new DoorAction
            {
                Id           = 1,
                DoorReaderId = 1,
                CardId       = 1,
                Status       = DoorActionStatusType.Success,
                TimeStamp    = new DateTime(2000, 1, 1),
            };

            var doorAction2 = new DoorAction
            {
                Id           = 2,
                DoorReaderId = 1,
                CardId       = 1,
                Status       = DoorActionStatusType.Error,
                TimeStamp    = defaultStartDate,
            };

            var doorAction3 = new DoorAction
            {
                Id           = 3,
                DoorReaderId = 1,
                CardId       = 1,
                Status       = DoorActionStatusType.Error,
                TimeStamp    = defaultEndDate,
            };

            var doorAction4 = new DoorAction
            {
                Id           = 4,
                DoorReaderId = 1,
                CardId       = 1,
                Status       = DoorActionStatusType.Error,
                TimeStamp    = new DateTime(2000, 1, 4),
            };

            _applicationContext.DoorActions.AddRange(
                doorAction1,
                doorAction2,
                doorAction3,
                doorAction4);

            _applicationContext.SaveChanges();

            // Act
            var receivedDoorActionDtos = _doorActionManager
                                         .GetAllAsync(dateRangeFilter: dateRange)
                                         .GetAwaiter()
                                         .GetResult();

            // Assert
            Assert.Equal(2, receivedDoorActionDtos.Count());
            Assert.Single(receivedDoorActionDtos.Where(doorActionDto => doorActionDto.Id == doorAction2.Id));
            Assert.Single(receivedDoorActionDtos.Where(doorActionDto => doorActionDto.Id == doorAction3.Id));
        }
コード例 #17
0
 public DoorUseEventArgs(TSPlayer player, DPoint location, DoorAction action, Direction direction)
     : base(player, location)
 {
     this.action    = action;
     this.Direction = direction;
 }
コード例 #18
0
 public DoorUseEventArgs(TSPlayer player, DPoint location, DoorAction action, Direction direction)
     : base(player, location)
 {
     this.action = action;
       this.Direction = direction;
 }
コード例 #19
0
        public void GetAllAsync_DoorActionsExist_DoorActionRetrievedWithIncludes()
        {
            // Arrange
            var card = new Card
            {
                Id           = 1,
                UserId       = "QWERTY123",
                UniqueNumber = "123-45",
                Status       = CardStatusType.Active,
                Level        = LevelType.Admin,
            };

            var door = new Door
            {
                Id          = 1,
                Name        = "Door1",
                Description = "DoorDescription1",
                Level       = LevelType.Admin,
                Status      = DoorStatusType.Active,
            };

            var doorReader = new DoorReader
            {
                Id           = 1,
                SerialNumber = "123-01",
                DoorId       = door.Id,
                Type         = DoorReaderType.Entrance,
            };

            var doorAction = new DoorAction
            {
                Id           = 1,
                DoorReaderId = doorReader.Id,
                CardId       = card.Id,
                Status       = DoorActionStatusType.Success,
                TimeStamp    = new DateTime(2000, 1, 1),
            };

            _applicationContext.Cards.Add(card);
            _applicationContext.Doors.Add(door);
            _applicationContext.DoorReaders.Add(doorReader);
            _applicationContext.DoorActions.Add(doorAction);
            _applicationContext.SaveChanges();

            // Act
            var includes = new string[]
            {
                nameof(DoorActionDto.Card),
                nameof(DoorActionDto.DoorReader),
                nameof(DoorReader.Door)
            };

            var receivedDoorActionDtos = _doorActionManager
                                         .GetAllAsync(includes: includes)
                                         .GetAwaiter()
                                         .GetResult();

            // Assert
            Assert.Single(receivedDoorActionDtos.Where(doorActionDto => doorActionDto.Id == doorAction.Id));
            Assert.Single(receivedDoorActionDtos.Where(doorActionDto => doorActionDto.Card.Id == card.Id));
            Assert.Single(receivedDoorActionDtos.Where(doorActionDto => doorActionDto.DoorReader.Id == doorReader.Id));
            Assert.Single(receivedDoorActionDtos.Where(doorActionDto => doorActionDto.DoorReader.Door.Id == door.Id));
        }