protected override void ServerInitialize(ServerInitializeData data)
        {
            base.ServerInitialize(data);

            if (data.IsFirstTimeInit)
            {
                // just constructed - refresh nearby door types (horizontal/vertical)
                DoorHelper.RefreshNeighborDoorType(data.GameObject.OccupiedTile);
            }

            SharedWallConstructionRefreshHelper.SharedRefreshNeighborObjects(
                data.GameObject.OccupiedTile,
                isDestroy: false);
        }
示例#2
0
        public void GetEncryptionKeyTest()
        {
            var testData = new List <Tuple <BigInteger, BigInteger, BigInteger> >()
            {
                new Tuple <BigInteger, BigInteger, BigInteger>(
                    17807724,
                    5764801,
                    14897079)
            };

            foreach (var testExample in testData)
            {
                var actual = DoorHelper.GetEncryptionKey(testExample.Item1, testExample.Item2);
                Assert.Equal(testExample.Item3, actual);
            }
        }
示例#3
0
        public void GetLoopSizeFromPublicKeyTest()
        {
            var testData = new List <Tuple <BigInteger, int> >()
            {
                new Tuple <BigInteger, int>(
                    5764801,
                    8),
                new Tuple <BigInteger, int>(
                    17807724,
                    11)
            };

            foreach (var testExample in testData)
            {
                var actual = DoorHelper.GetLoopSizeFromPublicKey(testExample.Item1);
                Assert.Equal(testExample.Item2, actual);
            }
        }
示例#4
0
        private static bool SharedIsCompatibleDoor(
            IStaticWorldObject worldObject,
            Tile tile,
            bool isConsiderConstructionSites,
            bool isHorizontal)
        {
            if (worldObject.ProtoWorldObject is IProtoObjectDoor &&
                isHorizontal == worldObject.GetPublicState <ObjectDoorPublicState>().IsHorizontalDoor)
            {
                return(true);
            }

            if (isConsiderConstructionSites &&
                ProtoObjectConstructionSite.SharedIsConstructionOf(worldObject, typeof(IProtoObjectDoor)) &&
                isHorizontal == DoorHelper.IsHorizontalDoorNeeded(tile, checkExistingDoor: true))
            {
                return(true);
            }

            return(false);
        }
示例#5
0
 private static BigInteger GetDay25Part1()
 {
     var(item1, item2) = GetDay25Input();
     return(DoorHelper.GetEncryptionKey(item1, item2));
 }
示例#6
0
 /// <summary>
 /// FindEntriesByDoor.
 /// </summary>
 /// <param name="door">Namnet på en dörr<see cref="string"/>.</param>
 /// <returns>En DataTable<see cref="DataTable"/> med sökresultat.</returns>
 public static DataTable FindEntriesByDoor(string door)
 {
     return(DoorHelper.FindEntriesByDoor(door, MaxEntries));
 }