Example #1
0
        public async Task <ActionResult <RoadModel> > Update(int id, RoadModel model)
        {
            var road = await _roadRepository.GetByIdAsync(id);

            if (road == null)
            {
                return(NotFound());
            }

            // TODO: Validate road type and parent

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            road.RoadTypeId = model.RoadTypeId;
            road.ParentId   = model.ParentId;
            road.Name       = model.Name;
            // Slug cannot be updated via API
            road.ReportingMarks = model.ReportingMarks;

            await _roadRepository.UpdateAsync(road);

            return(Ok(model));
        }
 private void Construct(PlayerModel playerModel, GameOverModel gameOverModel, RoadModel roadModel, QuadTools quadTools)
 {
     _roadModel     = roadModel;
     _playerModel   = playerModel;
     _gameOverModel = gameOverModel;
     _quadTools     = quadTools;
 }
Example #3
0
        /// <summary>
        /// 获取货道配置
        /// </summary>
        /// <returns></returns>
        public static RoadModelCollection GetRoadsConfig(int box)
        {
            RoadModelCollection roadModelCollection = new RoadModelCollection();

            List <string> list  = BoxConfigUtil.GetConfig(MachineType.金码, box);
            int           start = list.FindIndex(item => item.Trim() == "[roads]") + 1;

            int floor = 1;

            for (int i = start; i < list.Count; i++)
            {
                if (string.IsNullOrWhiteSpace(list[i]))
                {
                    break;
                }

                string   strfloor = list[i].Split('=')[1];
                string[] strroads = strfloor.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string strroad in strroads)
                {
                    RoadModel road = new RoadModel();
                    road.Floor = floor;
                    road.Num   = int.Parse(strroad);
                    roadModelCollection.RoadList.Add(road);
                }

                floor++;
            }

            roadModelCollection.FloorCount = floor - 1;
            return(roadModelCollection);
        }
    private void Construct(Vector2 modelPos, QuadModel quadModel, PlayerModel player, RoadModel roadModel, QuadTools quadTools)
    {
        quadModel.Position.Value = modelPos;

        _roadModel   = roadModel;
        _playerModel = player;
        _quadModel   = quadModel;
        _quadTools   = quadTools;
        SetModel(_quadModel);
    }
Example #5
0
        public SimpleRoadModel(Function center_, Function left_, Function right_)
        {
            if (center_ == null || left_ == null || right_ == null)
                type = RoadModel.Invalid;

            center = center_;
            leftLane = left_;
            rightLane = right_;
            type = RoadModel.TwoLane;
        }
Example #6
0
        private void roadDownHandler(RoadModel road, int index, int count)
        {
            MethodInvoker invoker = delegate
            {
                for (int i = 0; i < road.paths.Count; i++)
                {
                    m++;
                    DataRow row = this.RoaddataTable.NewRow();
                    row[0] = road.name;
                    row[1] = road.width;
                    row[2] = road.type;
                    row[3] = road.paths[i];
                    //row["WGSPATH"] = road.getWgsPath(i);


                    //row["length"] = 0;
                    //row["car"] = 1;
                    //row["walk"] = road.IsHeightWay ? 0 : 1;
                    //row["speed"] = road.getSpeed();
                    //row["highspeed"] = road.IsHeightWay ? 1 : 0;
                    //row["np_level"] = road.getNpLevel();

                    this.RoaddataTable.Rows.Add(row);
                }
                SVCHelper.ExportToSvc(
                    this.RoaddataTable,
                    this.roadSavePath + "\\" + this.roadCurrentCity + "_道路.csv");
                this.progressBar.Value = index * 100 / count;
                this.labMessage.Text   = "已下载完道路:" + road.name;
                this.progressBar.Update();
            };

            if ((!base.IsDisposed) && base.InvokeRequired)
            {
                base.Invoke(invoker);
            }
            else
            {
                invoker();
            }
        }
Example #7
0
        public async Task <ActionResult <RoadModel> > Create(RoadModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var road = new Road
            {
                RoadTypeId     = model.RoadTypeId, // TODO: validate
                ParentId       = model.ParentId,   // TODO: validate
                Name           = model.Name,
                Slug           = model.Slug,       // TODO: auto generate
                ReportingMarks = model.ReportingMarks
            };

            await _roadRepository.CreateAsync(road);

            model = _mapper.Map <RoadModel>(road);

            return(CreatedAtAction(nameof(GetById), new { id = road.Id }, model));
        }
Example #8
0
 public RoadView(RoadModel model, Matrix world)
 {
     this.model = model;
     this.roadID = model.GetRoadID();
     this.pickRoadColor = new Color(0.0f, 1.0f - roadID / 256.0f, 0.0f);
     this.world = Matrix.CreateTranslation(new Vector3(0.0f, 0.012f, 0.0f)) * Matrix.CreateScale(0.1f) * world;
     worldShape = Matrix.CreateTranslation(new Vector3(0.0f, 0.03f, 0.0f)) * Matrix.CreateScale(0.25f) * world;
     pickVars = new PickVariables(pickRoadColor);
     isBuildView = false;
 }
Example #9
0
 public RoadPanel(int id)
 {
     road  =new RoadModel();
     road.RoadID = id.ToString() ;
 }
Example #10
0
 public RoadPanel(RoadModel r)
 {
     road = r;
 }
Example #11
0
 private void SB3_Click(object sender, EventArgs e)
 {
     SB3.Visible = false;
     models[2]   = new RoadModel(crashServices[1]);
     Panel3.Invalidate();
 }