Beispiel #1
0
        public async Task <PlaneType> Add(PlaneType item)
        {
            string obj  = JsonConvert.SerializeObject(item);
            string json = await PostAsync(endPoint, obj);

            return(JsonConvert.DeserializeObject <PlaneType>(json));
        }
Beispiel #2
0
        // Устанавливает текущую плоскость и систему координат на основе заданной команды.
        private void SetCoordinateSystemOrPlaneType(string command)
        {
            switch (command)
            {
            case "G91":
            case "G92":
                coordinateSystem = command == "G91" ? CoordinateSystem.Absolute : CoordinateSystem.Relative;
                break;

            case "G16":
                plane = PlaneType.XY;
                break;

            case "G17":
                plane = PlaneType.XZ;
                break;

            case "G18":
                plane = PlaneType.YZ;
                break;

            case "G678":
                plane = PlaneType.XYZ;
                break;
            }
        }
Beispiel #3
0
    // セットアップ
    //  設定後直ちにChangeChunkCallbackに最初のアクティブ情報が返ります。
    //  chunkSize      : 正方形チャンクの辺の長さ
    //  activeLayerNum : ターゲットがいるチャンクを中心とした時のアクティブ化するチャンクの層数
    //  planeType      : 平面指定
    //  idx0ChunkPos   : (0, 0, 0)に該当するチャンクの左下座標
    //  initTargetPos  : 初期ターゲットポジション
    public void setup(
        float chunkSize,
        int activeLayerNum,
        PlaneType planeType,
        Vector3 idx0ChunkPos,
        Vector3 initTargetPos
        )
    {
        size_          = chunkSize;
        offset_        = idx0ChunkPos;
        activeLayerNum = (activeLayerNum <= 0 ? 1 : activeLayerNum);
        switch (planeType)
        {
        case PlaneType.XY:
            calcPlaneChunkId_ = calcPlaneXYChunkId;
            break;

        case PlaneType.XZ:
            calcPlaneChunkId_ = calcPlaneXZChunkId;
            break;

        case PlaneType.YZ:
            calcPlaneChunkId_ = calcPlaneYZChunkId;
            break;
        }
        initChunkCallback(initTargetPos);
        bInitialized_ = true;
    }
Beispiel #4
0
        public static IPlane CreatePlane(PlaneType type)
        {
            switch (type)
            {
            case PlaneType.Test:
                return(new TestPlane.TestPlane());

            case PlaneType.FSDefault:
                return(new FSDefault.FSDefaultPlane());

            case PlaneType.PMDG737:
                return(new PMDG.PMDGPlane());

            case PlaneType.iFly737:
                return(new iFly737.iFly737Plane());

            case PlaneType.ProSim737:
                return(new ProSim737.ProSim737Plane());

            case PlaneType.PMDG737NGX:
                return(new PMDG737NGX.Plane());

            default:
                return(new DummyPlane.DummyPlane());
            }
        }
Beispiel #5
0
 public async Task AddNew(PlaneType type)
 {
     if (type is PlaneType)
     {
         await service.CreatePlaneTypeAsync(type);
     }
 }
Beispiel #6
0
        public void RemoveSector(Sector s, PlaneType pt)
        {
            Debug.WriteLine("Removing from Sector " + s.Index.ToString() + ": " + pt.ToString());

            if (sectorplanes.ContainsKey(s))
            {
                if (sectors.Contains(s) && sectorplanes[s] == pt)
                {
                    sectors.Remove(s);
                    sectorplanes.Remove(s);
                }
                else
                {
                    sectorplanes[s] &= ~pt;
                }
            }

            if ((pt & PlaneType.Floor) == PlaneType.Floor)
            {
                s.FloorSlope       = new Vector3D();
                s.FloorSlopeOffset = 0;
                s.Fields.Remove("user_floorplane_id");
            }

            if ((pt & PlaneType.Ceiling) == PlaneType.Ceiling)
            {
                s.CeilSlope       = new Vector3D();
                s.CeilSlopeOffset = 0;
                s.Fields.Remove("user_ceilingplane_id");
            }
        }
        public void Update_Valid()
        {
            //arange
            PlaneTypesService service = new PlaneTypesService(unitOfWork, mapper, validator);

            var expected = new PlaneType
            {
                Id = 1, Model = "AN140", Capacity = 5000, Seats = 23, Range = 2345, ServiceLife = new TimeSpan(200, 0, 0, 0)
            };

            var DtoToMake = new PlaneTypeDto
            {
                Id = 1, Model = "AN140", Capacity = 5000, Seats = 23, Range = 2345, ServiceLife = new TimeSpan(200, 0, 0, 0)
            };


            //act
            service.Update(DtoToMake);

            var actual = (unitOfWork.Set <PlaneType>() as FakeRpository <PlaneType>).updatedItem;

            //assert
            Assert.AreEqual(expected.Id, actual.Id);
            Assert.AreEqual(expected.Capacity, actual.Capacity);
            Assert.AreEqual(expected.Model, actual.Model);
            Assert.AreEqual(expected.Range, actual.Range);
            Assert.AreEqual(expected.Seats, actual.Seats);
            Assert.AreEqual(expected.ServiceLife, actual.ServiceLife);
        }
Beispiel #8
0
            private int ReadDC(BitStream bits, ushort version, PlaneType plane)
            {
                // Version 2 just has its coefficient as 10-bits
                if (version == 2)
                {
                    return(ReadSignedCoefficient(bits));
                }

                // Version 3 has it stored as huffman codes as a difference from the previous DC value

                var huffman = (plane == PlaneType.Y) ? _dcHuffmanLuma : _dcHuffmanChroma;

                uint symbol = huffman.GetSymbol(bits);
                int  dc     = 0;

                if (GET_DC_BITS(symbol) != 0)
                {
                    bool negative = (bits.GetBit() == 0);
                    dc = (int)bits.GetBits(GET_DC_BITS(symbol) - 1);

                    if (negative)
                    {
                        dc -= GET_DC_NEG(symbol);
                    }
                    else
                    {
                        dc += GET_DC_POS(symbol);
                    }
                }

                _lastDC[(int)plane] += dc * 4; // convert from 8-bit to 10-bit
                return(_lastDC[(int)plane]);
            }
Beispiel #9
0
        public void CreateEntity_Should_Create_planeType_typeof_PlaneType()
        {
            // Arrange
            PlaneTypeDTO planeTypeDTO = new PlaneTypeDTO
            {
                Id       = 1,
                Carrying = 240000,
                Model    = "Passenger's",
                Seats    = 200
            };
            PlaneType planeType = new PlaneType
            {
                Id       = 1,
                Carrying = 240000,
                Model    = "Passenger's",
                Seats    = 200
            };

            var planeTypeRepository = new FakeRepository <PlaneType>();
            var planeTypeService    = new PlaneTypeService(planeTypeRepository);

            // Act
            planeTypeService.CreateEntity(planeTypeDTO);
            var result = planeTypeRepository.Get(1);

            // Assert
            Assert.AreEqual(planeType, result);
        }
Beispiel #10
0
        public static string PlaneTypeToName(PlaneType type)
        {
            switch (type)
            {
            case PlaneType.None:
                return("dummy plane");

            case PlaneType.Test:
                return("TEST mode");

            case PlaneType.FSDefault:
                return("FS Default");

            case PlaneType.PMDG737:
                return("PMDG B737");

            case PlaneType.iFly737:
                return("iFly B737");

            case PlaneType.ProSim737:
                return("ProSim737");

            case PlaneType.PMDG737NGX:
                return("PMDG 737NGX");

            default:
                return("unknown");
            }
        }
Beispiel #11
0
        public async Task <HttpStatusCode> CreatePlaneTypeAsync(PlaneType type)
        {
            var result = await httpclient.PostAsJsonAsync(path, type).ConfigureAwait(false);

            result.EnsureSuccessStatusCode();
            return(result.StatusCode);
        }
        public void AssertExceptionThrownWhenNoSpaceFound(int jumboV, int jumboO, int jetV, int jetO, int propV,
                                                          int propO, PlaneType planeType)
        {
            var parkingService = new ParkingService(CreateParking(jumboV, jumboO, jetV, jetO, propV, propO));

            Assert.Throws <ParkingSpaceException>(() => parkingService.ParkPlaneInFirstSlot(planeType));
        }
Beispiel #13
0
        async void Delete()
        {
            await PlaneTypeservice.Delete(PlaneType.Id);

            PlaneType = new PlaneType();
            await LoadEntity().ConfigureAwait(false);
        }
Beispiel #14
0
    public static void Save(PlaneType pt, Vector3 pos, Vector3 angle)
    {
        if (CameraConfig == null)
        {
            loadCameraConfig();
        }

        if (!CameraConfig.ContainsKey(pt))
        {
            CameraConfig[pt] = new Vector3[2];
        }
        CameraConfig[pt][0] = pos;
        CameraConfig[pt][1] = angle;
        string path = Application.dataPath + "/../config/camera.txt";

        using (StreamWriter sw = new StreamWriter(path, false, System.Text.Encoding.UTF8)) {
            foreach (var kv in CameraConfig)
            {
                string s = string.Format("{0}, {1} {2} {3}, {4} {5} {6}", (int)kv.Key, kv.Value[0].x, kv.Value[0].y, kv.Value[0].z, kv.Value[1].x, kv.Value[1].y, kv.Value[1].z);
                sw.WriteLine(s);
            }
        }

        Debug.Log("save ok...");
    }
Beispiel #15
0
 public static Predicate <Achievement> GetAchievementByEnemyPlaneType(PlaneType planeType)
 {
     return(delegate(Achievement achievement) {
         return (planeType == PlaneType.A6M && achievement.Type == AchievementType.EnemyFighters) ||
         (planeType == PlaneType.Betty && achievement.Type == AchievementType.EnemyBombers);
     });
 }
        async void Delete()
        {
            await _planeTypeService.Delete(PlaneType.Id);

            PlaneType = new PlaneType();
            await LoadPlaneTypes().ConfigureAwait(false);
        }
Beispiel #17
0
        public void Create_When_entity_is_invalid_Then_bad_request_exception_is_thrown()
        {
            // Arrange
            var planeTypeMock = new PlaneType()
            {
                Id       = 2,
                Model    = "AAABBBCCC",
                Seats    = 500,
                Carrying = 400
            };

            var planeTypeDTOToCreate = new PlaneTypeDTO()
            {
                Model    = "AAABBBCCC",
                Seats    = 500,
                Carrying = 400
            };

            var planeTypeRepositoryFake = A.Fake <IPlaneTypeRepository>();

            A.CallTo(() => planeTypeRepositoryFake.Create(A <PlaneType> ._)).Returns(planeTypeMock);

            var unitOfWorkFake = A.Fake <IUnitOfWork>();

            A.CallTo(() => unitOfWorkFake.Set <PlaneType>()).Returns(planeTypeRepositoryFake);

            var planeTypeService = new PlaneTypeService(unitOfWorkFake, AlwaysInValidValidator);

            // Act + Assert
            var exception = Assert.Throws <BadRequestException>(() => planeTypeService.Create(planeTypeDTOToCreate), "");

            Assert.AreEqual(exception.Message, "Is Invalid");
        }
Beispiel #18
0
 public async Task Update(PlaneType type)
 {
     if (type is PlaneType)
     {
         await service.UpdatePlaneTypeAsync(type);
     }
 }
Beispiel #19
0
        public void UpdateEntity_Should_Update_planeType_typeof_PlaneType()
        {
            // Arrange
            PlaneTypeDTO planeTypeDTO = new PlaneTypeDTO
            {
                Id       = 1,
                Carrying = 240000,
                Model    = "Passenger's",
                Seats    = 200
            };
            PlaneType planeType = new PlaneType
            {
                Id       = 1,
                Carrying = 240000,
                Model    = "Passenger's",
                Seats    = 200
            };

            var planeTypeRepository = A.Fake <IRepository <PlaneType> >();

            A.CallTo(() => planeTypeRepository.Get(A <int> ._)).Returns(new PlaneType {
                Id = 1
            });

            var planeTypeService = new PlaneTypeService(planeTypeRepository);

            //Act
            planeTypeService.UpdateEntity(1, planeTypeDTO);
            var result = planeTypeRepository.Get(1);


            // Assert
            Assert.AreEqual(planeType, result);
        }
Beispiel #20
0
        private void cmb_PlaneTypeId_DropDown(object sender, EventArgs e)
        {
            PlaneType planeTypes = new PlaneType();

            cmb_PlaneTypeId.DataSource    = planeTypes.Examples();
            cmb_PlaneTypeId.ValueMember   = "Id";
            cmb_PlaneTypeId.DisplayMember = "Name";
        }
Beispiel #21
0
 static bool TestMapping(PlaneType planeType)
 {
     if (planeType != null && planeType is PlaneType)
     {
         return(true);
     }
     return(false);
 }
        public void GetAllPossibleVacantParkingSpacesReturnsEmpty(int jumboV, int jumboO, int jetV, int jetO, int propV,
                                                                  int propO, PlaneType planeType)
        {
            var parkingService = new ParkingService(CreateParking(jumboV, jumboO, jetV, jetO, propV, propO));
            var result         = parkingService.GetAllPossibleVacantParkingSpaces(planeType);

            Assert.Empty(result);
        }
Beispiel #23
0
 public void UpdateType(PlaneTypeDTO planeType)
 {
     if (planeType != null)
     {
         PlaneType updtPlaneType = mapper.Map <PlaneTypeDTO, PlaneType>(planeType);
         unitOfWork.TypeRepository.Insert(updtPlaneType);
     }
 }
Beispiel #24
0
 public void CreatePlaneType(PlaneTypeDTO planeType)
 {
     if (planeType != null)
     {
         PlaneType newPlaneType = mapper.Map <PlaneTypeDTO, PlaneType>(planeType);
         unitOfWork.TypeRepository.Create(newPlaneType);
     }
 }
Beispiel #25
0
 string GetPlanePrefabPath(PlaneType _type)
 {
     if (mapPlanePrefabPath.ContainsKey(_type) == false)
     {
         string name = "prefab/" + _type.ToString();
         mapPlanePrefabPath.Add(_type, name);
     }
     return(mapPlanePrefabPath[_type]);
 }
Beispiel #26
0
        public void DeletePlaneType(int id)
        {
            PlaneType typeToDelete = unitOfWork.TypeRepository.GetById(id);

            if (typeToDelete != null)
            {
                unitOfWork.TypeRepository.Delete(id);
            }
        }
Beispiel #27
0
        private async void Create()
        {
            var created = await airportConnector.PlaneTypeEndpoint.Create(newPlaneType);

            PlaneTypes.Add(created);
            newPlaneType = new PlaneType();
            RaisePropertyChanged(() => PlaneTypes);
            RaisePropertyChanged(() => NewPlaneType);
        }
Beispiel #28
0
		public void Delete(int id)
		{
			PlaneType temp = planetypes.FirstOrDefault(t => t.Id == id);
			if (temp != null)
			{
				planetypes.Remove(temp);
				SaveChanges();
			}				
		}
Beispiel #29
0
 private PlaneType getPlaneType()
 {
     if ((Ammunition.Owner is Model.Level.Planes.Plane))
     {
         PlaneType type = (Ammunition.Owner as Model.Level.Planes.Plane).PlaneType;
         return(type);
     }
     return(PlaneType.P47);
 }
Beispiel #30
0
    void go()
    {
        interval++;
        if (interval < speed)
        {
            return;
        }
        interval = 0;

        for (int i = 0; i < snake.Count; i++)
        {
            snake[i].go.transform.localPosition = snake[i].targetPos;
            snake[i].lastPos = snake[i].targetPos;
            snake[i].go.transform.localEulerAngles = snake[i].targetAngle;
            snake[i].lastRotateAngle = snake[i].targetRotateAngle;
        }
        updateCameraParam();

        bool eat = Foods.Instance.Eat(snake[0].targetPos);

        if (eat)
        {
            GameObject body = clone(Config.Instance.PrefabBody, gameObject);
            SnakePart  part = new SnakePart(body);
            part.Clone(snake[snake.Count - 2]);
            snake.Insert(snake.Count - 1, part);
        }

        Vector3   dest     = Vector3.zero;
        PlaneType newPlane = mapPlane[currPlane].Move(snake[0].lastPos, ref newDirect, ref dest);

        snake[0].SetTargetPos(dest);
        Vector3 angle;

        if (currPlane == newPlane)
        {
            angle = mapPlane[currPlane].Rotate(currDirect, newDirect);
        }
        else
        {
            angle = mapPlane[newPlane].Enter(currPlane);
        }
        snake[0].SetRotateAngle(angle);
        currPlane = newPlane;

        int count = eat ? snake.Count - 2 : snake.Count;

        for (int i = 1; i < count; i++)
        {
            snake[i].SetTargetPos(snake[i - 1].lastPos);
            snake[i].targetRotateAngle = snake[i - 1].lastRotateAngle;
            snake[i].targetAngle       = snake[i - 1].go.transform.localEulerAngles;
        }

        lastFixedTime = Time.time;
        currDirect    = newDirect;
    }
Beispiel #31
0
 public BSPNode(byte[] inData)
 {
     using (MemoryStream ms = new MemoryStream(inData))
     {
         using (BinaryReader br = new BinaryReader(ms))
         {
             this.Type = (PlaneType) br.ReadUInt16();
             this.FirstChildIndex = br.ReadInt16();
             this.SecondChildIndex = br.ReadInt16();
             this.FaceCount = br.ReadUInt16();
             this.FirstFaceIndex = br.ReadUInt32();
             this.DistanceFromCenter = br.ReadSingle();
         }
     }
 }
 public Plane(PlaneType type)
 {
     _type = type;
     Reincarnate();
 }
Beispiel #33
0
 public Plane(string id, PlaneType type, float time = 0)
 {
     this.ID = id;
     this.Type = type;
     this.Time = time;
 }
Beispiel #34
0
 public ServerPlane(string planeID, PlaneType type)
     : base(planeID, type)
 {
 }
            private void DecodeBlock(BitStream bits, byte[] block, int offset, int pitch, ushort scale, ushort version, PlaneType plane)
            {
                // Version 2 just has signed 10 bits for DC
                // Version 3 has them huffman coded
                int[] coefficients = new int[8 * 8];
                coefficients[0] = ReadDC(bits, version, plane);
                ReadAC(bits, coefficients, 1); // Read in the AC

                // Dequantize
                float[] dequantData = new float[8 * 8];
                DequantizeBlock(coefficients, dequantData, scale);

                // Perform IDCT
                float[] idctData = new float[8 * 8];
                Idct(dequantData, idctData);

                // Now output the data
                for (int y = 0; y < 8; y++)
                {
                    var dst = offset + pitch * y;

                    // Convert the result to be in the range [0, 255]
                    for (int x = 0; x < 8; x++)
                        block[dst++] = (byte)(ScummHelper.Clip(idctData[y * 8 + x], -128.0f, 127.0f) + 128);
                }
            }
            private int ReadDC(BitStream bits, ushort version, PlaneType plane)
            {
                // Version 2 just has its coefficient as 10-bits
                if (version == 2)
                    return ReadSignedCoefficient(bits);

                // Version 3 has it stored as huffman codes as a difference from the previous DC value

                var huffman = (plane == PlaneType.Y) ? _dcHuffmanLuma : _dcHuffmanChroma;

                uint symbol = huffman.GetSymbol(bits);
                int dc = 0;

                if (GET_DC_BITS(symbol) != 0)
                {
                    bool negative = (bits.GetBit() == 0);
                    dc = (int)bits.GetBits(GET_DC_BITS(symbol) - 1);

                    if (negative)
                        dc -= GET_DC_NEG(symbol);
                    else
                        dc += GET_DC_POS(symbol);
                }

                _lastDC[(int)plane] += dc * 4; // convert from 8-bit to 10-bit
                return _lastDC[(int)plane];
            }
Beispiel #37
0
 public NewPlaneMessage(string planeID, PlaneType planeType, Direction direction, float y, Vector2D velocity, float time)
     : base(MessageType.NewPlane, Tag, planeID)
 {
     m_direction = direction;
     m_y = y;
     m_velocity = velocity;
     m_planeType = planeType;
     m_time = time;
 }
 public virtual uint ErasePlane(PlaneType plane_type, bool all)
 {
     return Npc_ErasePlane(thisptr, (int)plane_type, all);
 }
 public virtual bool IsCurPlane(PlaneType plane_type)
 {
     return Npc_IsCurPlane(thisptr, (int)plane_type);
 }
Beispiel #40
0
 public ClientPlane(string id, PlaneType type)
     : base(id, type)
 {
 }