示例#1
0
        public static CarSaveModel ConvertToCarModel(object data)
        {
            var carModel = new CarSaveModel();
            var dictData = data as Dictionary <string, object>;

            if (dictData == null)
            {
                return(null);
            }

            carModel.PosX = Convert.ToSingle(dictData["PosX"]);
            carModel.PosY = Convert.ToSingle(dictData["PosY"]);
            carModel.PosZ = Convert.ToSingle(dictData["PosZ"]);

            carModel.RotX = Convert.ToSingle(dictData["RotX"]);
            carModel.RotY = Convert.ToSingle(dictData["RotY"]);
            carModel.RotZ = Convert.ToSingle(dictData["RotZ"]);

            carModel.Petrol = Convert.ToSingle(dictData["Petrol"]);

            return(carModel);
        }