public virtual IEnumerable <Entity> Generate(EntitySystem entitySystem, EntityFieldModel entityDefinition, EntityFieldPositionModel entityPlacing, Vector3 position) { return(new List <Entity> { entitySystem.CreateEntityFromDataModel(entityDefinition.Entity, entityPlacing, position) }); }
public virtual IEnumerable<Entity> Generate(EntitySystem entitySystem, EntityFieldModel entityDefinition, EntityFieldPositionModel entityPlacing, Vector3 position) { return new List<Entity> { entitySystem.CreateEntityFromDataModel(entityDefinition.Entity, entityPlacing, position) }; }
public JsonResult GetEntityTableFields(string table) { var entityBO = BusinessLogic.Core.GetFactory().GetInstance <IEntityBO>(); var columns = entityBO.GetColumns(table); List <EntityFieldModel> entityFieldList = (List <EntityFieldModel>)Session["EntityFieldList"]; entityFieldList.RemoveAll(o => !o.UserDefined); StringBuilder sb = new StringBuilder(); foreach (var item in columns) { EntityFieldModel model = new EntityFieldModel(); model.UserDefined = false; model.Name = item.Key; model.Type = entityBO.GetColumnType(item.Value); var entity = entityFieldList.Where(o => o.Name.Equals(item.Key, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); if (entity != null) { entity.UserDefined = false; entity.Name = item.Key; } else { entityFieldList.Add(model); } sb.Append(HtmlHelperExtender.RenderPartialViewToString(this, "Partial/NewEntityField", model)); } Session["EntityFieldList"] = entityFieldList; return(Json(sb.ToString(), JsonRequestBehavior.AllowGet)); }
private static void AppendFieldCode(this EntityFieldModel entityField, StringBuilder code) { string newValue = entityField.FieldName; if (!string.IsNullOrWhiteSpace(entityField.FieldDisplayName)) { code.AppendLine(""); code.AppendLine("\t\t/// <summary>"); code.AppendLine("\t\t/// {{PropAnnotation}}"); code.AppendLine("\t\t/// </summary>"); newValue = entityField.FieldDisplayName; } if (entityField.FieldTypeStr.Contains("ICollection<")) { entityField.FieldTypeStr = entityField.FieldTypeStr.Replace("ICollection<", "List<"); } entityField.FieldTypeStrFirstCharToLower = entityField.FieldTypeStr.FirstCharToLower(); if (entityField.MaxLength != null) { string text = entityField.AttributesList.Find((string o) => o.StartsWith("[MaxLength(")); if (text != null) { code.AppendLine(text); } else { code.AppendLine("\t\t[MaxLength({{MaxLength}}, ErrorMessage=\"{{PropAnnotation}}超出最大长度\")]"); } } if (entityField.MinLength != null) { string text2 = entityField.AttributesList.Find((string o) => o.StartsWith("[MinLength(")); if (text2 != null) { code.AppendLine(text2); } else { code.AppendLine("\t\t[MinLength({{MinLength}}, ErrorMessage=\"{{PropAnnotation}}小于最小长度\")]"); } } if (!string.IsNullOrWhiteSpace(entityField.RegularExpression)) { code.AppendLine("\t\t[RegularExpression(\"{{RegularExpression}}\",ErrorMessage=\"{{PropAnnotation}}格式错误\")]"); } if (entityField.Required) { code.AppendLine("\t\t[Required(ErrorMessage=\"{{PropAnnotation}}不能为空\")]"); } if (entityField.FieldName == "Id") { code.AppendLine("\t\tpublic {{PropType}}? {{PropName}} { get; set; }"); } else { code.AppendLine("\t\tpublic {{PropType}} {{PropName}} { get; set; }"); } code = code.Replace("{{PropAnnotation}}", newValue).Replace("{{MaxLength}}", entityField.MaxLength.GetValueOrDefault(0).ToString()).Replace("{{MinLength}}", entityField.MinLength.GetValueOrDefault(0).ToString()).Replace("{{RegularExpression}}", entityField.RegularExpression).Replace("{{PropType}}", entityField.FieldTypeStr).Replace("{{PropName}}", entityField.FieldName); code.Append("\r\n\r\n"); }
public bool ProcessGameObject(GameObject gameObject) { TotalEntityCount++; if (HasRelevantComponents(gameObject)) { var entityFieldModel = new EntityFieldModel(); _mapModel.Entities.Add(entityFieldModel); entityFieldModel.Placing.Add(CreatePositioningFromTransform(gameObject.transform)); entityFieldModel.Entity = new EntityModel(); MayAttachVisualModel(entityFieldModel.Entity, gameObject); ExportedEntityCount++; return(true); } return(false); }
public ActionResult AddEntityField(string field, string type) { var model = new EntityFieldModel { Name = field, Type = type, UserDefined = true, EditMode = true }; List <EntityFieldModel> entityFieldList = (List <EntityFieldModel>)Session["EntityFieldList"]; foreach (var item in entityFieldList) { if (item.Name.Equals(field, StringComparison.CurrentCultureIgnoreCase)) { throw new Exception("Campo já adicionado"); } } entityFieldList.Add(model); Session["EntityFieldList"] = entityFieldList; return(View("Partial/NewEntityField", model)); }
public List <Entity> PlaceEntities(EntityFieldModel entityDefinition, EntityFieldPositionModel entityPlacing, Vector3 offset) { var entities = new List <Entity>(); for (var x = 0; x < (int)entityPlacing.Size.X; x++) { for (var y = 0; y < (int)entityPlacing.Size.Y; y++) { for (var z = 0; z < (int)entityPlacing.Size.Z; z++) { var position = entityPlacing.Position.GetVector3() + new Vector3(x * entityPlacing.Steps.X, y * entityPlacing.Steps.Y, z * entityPlacing.Steps.Z) + offset; entities.Add(CreateEntityFromDataModel(entityDefinition.Entity, entityPlacing, position)); } } } return(entities); }
public List<Entity> PlaceEntities(EntityFieldModel entityDefinition, EntityFieldPositionModel entityPlacing, Vector3 offset) { var entities = new List<Entity>(); for (var x = 0; x < (int)entityPlacing.Size.X; x++) { for (var y = 0; y < (int)entityPlacing.Size.Y; y++) { for (var z = 0; z < (int)entityPlacing.Size.Z; z++) { var position = entityPlacing.Position.GetVector3() + new Vector3(x * entityPlacing.Steps.X, y * entityPlacing.Steps.Y, z * entityPlacing.Steps.Z) + offset; entities.Add(CreateEntityFromDataModel(entityDefinition.Entity, entityPlacing, position)); } } } return entities; }
public override IEnumerable <Entity> Generate(EntitySystem entitySystem, EntityFieldModel entityDefinition, EntityFieldPositionModel entityPlacing, Vector3 position) { // scale of the entity is the entire cube's scale. // generate 6 entities from the one definition that is passed in // the definition has to hold either 1, 5 or 6 textures. // if there are only 5 textures, then do not generate a bottom. // This is an option, because often times, there is no bottom needed. // if there is only 1 texture, it gets put on all 6 sides. //int? textureEnumLength = entityDefinition?.Entity?.RenderMode?.Textures?.Length; //if (textureEnumLength.HasValue && (textureEnumLength.Value == 1 || textureEnumLength.Value == 5 || textureEnumLength.Value == 6)) //{ // TextureSourceModel[] textures = null; // if (textureEnumLength.Value == 1) // { // textures = new TextureSourceModel[] // { // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[0] // }; // } // else if (textureEnumLength.Value == 5) // { // textures = new TextureSourceModel[] // { // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[1], // entityDefinition.Entity.RenderMode.Textures[2], // entityDefinition.Entity.RenderMode.Textures[3], // entityDefinition.Entity.RenderMode.Textures[4] // }; // } // else if (textureEnumLength.Value == 6) // { // textures = new TextureSourceModel[] // { // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[1], // entityDefinition.Entity.RenderMode.Textures[2], // entityDefinition.Entity.RenderMode.Textures[3], // entityDefinition.Entity.RenderMode.Textures[4], // entityDefinition.Entity.RenderMode.Textures[5] // }; // } // // Front side: // var frontEntityModel = entityDefinition.Entity.CloneModel(); // var frontEntityPlacing = new EntityFieldPositionModel(); // frontEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[0] }; // frontEntityPlacing.CardinalRotation = true; // frontEntityPlacing.Rotation = new Vector3Model() // { // X = 0, // Y = 0, // Z = 0 // }; // frontEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var frontEntityPosition = new Vector3() // { // X = position.X, // Y = position.Y, // Z = position.Z + entityPlacing.Scale.Z / 2 // }; // yield return entitySystem.CreateEntityFromDataModel(frontEntityModel, frontEntityPlacing, frontEntityPosition); // // Back side: // var backEntityModel = entityDefinition.Entity.CloneModel(); // var backEntityPlacing = new EntityFieldPositionModel(); // backEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[1] }; // backEntityPlacing.CardinalRotation = true; // backEntityPlacing.Rotation = new Vector3Model() // { // X = 0, // Y = 2, // Z = 0 // }; // backEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var backEntityPosition = new Vector3() // { // X = position.X, // Y = position.Y, // Z = position.Z - entityPlacing.Scale.Z / 2 // }; // yield return entitySystem.CreateEntityFromDataModel(backEntityModel, backEntityPlacing, backEntityPosition); // //Left side: // var leftEntityModel = entityDefinition.Entity.CloneModel(); // var leftEntityPlacing = new EntityFieldPositionModel(); // leftEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[2] }; // leftEntityPlacing.CardinalRotation = true; // leftEntityPlacing.Rotation = new Vector3Model() // { // X = 0, // Y = 3, // Z = 0 // }; // leftEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var leftEntityPosition = new Vector3() // { // X = position.X - entityPlacing.Scale.X / 2, // Y = position.Y, // Z = position.Z // }; // yield return entitySystem.CreateEntityFromDataModel(leftEntityModel, leftEntityPlacing, leftEntityPosition); // //right side: // var rightEntityModel = entityDefinition.Entity.CloneModel(); // var rightEntityPlacing = new EntityFieldPositionModel(); // rightEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[3] }; // rightEntityPlacing.CardinalRotation = true; // rightEntityPlacing.Rotation = new Vector3Model() // { // X = 0, // Y = 1, // Z = 0 // }; // rightEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var rightEntityPosition = new Vector3() // { // X = position.X + entityPlacing.Scale.X / 2, // Y = position.Y, // Z = position.Z // }; // yield return entitySystem.CreateEntityFromDataModel(rightEntityModel, rightEntityPlacing, rightEntityPosition); // //top: // var topEntityModel = entityDefinition.Entity.CloneModel(); // var topEntityPlacing = new EntityFieldPositionModel(); // topEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[4] }; // topEntityPlacing.CardinalRotation = true; // topEntityPlacing.Rotation = new Vector3Model() // { // X = 3, // Y = 0, // Z = 0 // }; // topEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var topEntityPosition = new Vector3() // { // X = position.X, // Y = position.Y + entityPlacing.Scale.Y / 2, // Z = position.Z // }; // yield return entitySystem.CreateEntityFromDataModel(topEntityModel, topEntityPlacing, topEntityPosition); // //bottom: // if (textureEnumLength.Value != 5) // { // var bottomEntityModel = entityDefinition.Entity.CloneModel(); // var bottomEntityPlacing = new EntityFieldPositionModel(); // bottomEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[5] }; // bottomEntityPlacing.CardinalRotation = true; // bottomEntityPlacing.Rotation = new Vector3Model() // { // X = 1, // Y = 0, // Z = 0 // }; // bottomEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var bottomEntityPosition = new Vector3() // { // X = position.X, // Y = position.Y - entityPlacing.Scale.Y / 2, // Z = position.Z // }; // yield return entitySystem.CreateEntityFromDataModel(bottomEntityModel, bottomEntityPlacing, bottomEntityPosition); // } //} throw new NotImplementedException(); }
public override IEnumerable<Entity> Generate(EntitySystem entitySystem, EntityFieldModel entityDefinition, EntityFieldPositionModel entityPlacing, Vector3 position) { // scale of the entity is the entire cube's scale. // generate 6 entities from the one definition that is passed in // the definition has to hold either 1, 5 or 6 textures. // if there are only 5 textures, then do not generate a bottom. // This is an option, because often times, there is no bottom needed. // if there is only 1 texture, it gets put on all 6 sides. //int? textureEnumLength = entityDefinition?.Entity?.RenderMode?.Textures?.Length; //if (textureEnumLength.HasValue && (textureEnumLength.Value == 1 || textureEnumLength.Value == 5 || textureEnumLength.Value == 6)) //{ // TextureSourceModel[] textures = null; // if (textureEnumLength.Value == 1) // { // textures = new TextureSourceModel[] // { // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[0] // }; // } // else if (textureEnumLength.Value == 5) // { // textures = new TextureSourceModel[] // { // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[1], // entityDefinition.Entity.RenderMode.Textures[2], // entityDefinition.Entity.RenderMode.Textures[3], // entityDefinition.Entity.RenderMode.Textures[4] // }; // } // else if (textureEnumLength.Value == 6) // { // textures = new TextureSourceModel[] // { // entityDefinition.Entity.RenderMode.Textures[0], // entityDefinition.Entity.RenderMode.Textures[1], // entityDefinition.Entity.RenderMode.Textures[2], // entityDefinition.Entity.RenderMode.Textures[3], // entityDefinition.Entity.RenderMode.Textures[4], // entityDefinition.Entity.RenderMode.Textures[5] // }; // } // // Front side: // var frontEntityModel = entityDefinition.Entity.CloneModel(); // var frontEntityPlacing = new EntityFieldPositionModel(); // frontEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[0] }; // frontEntityPlacing.CardinalRotation = true; // frontEntityPlacing.Rotation = new Vector3Model() // { // X = 0, // Y = 0, // Z = 0 // }; // frontEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var frontEntityPosition = new Vector3() // { // X = position.X, // Y = position.Y, // Z = position.Z + entityPlacing.Scale.Z / 2 // }; // yield return entitySystem.CreateEntityFromDataModel(frontEntityModel, frontEntityPlacing, frontEntityPosition); // // Back side: // var backEntityModel = entityDefinition.Entity.CloneModel(); // var backEntityPlacing = new EntityFieldPositionModel(); // backEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[1] }; // backEntityPlacing.CardinalRotation = true; // backEntityPlacing.Rotation = new Vector3Model() // { // X = 0, // Y = 2, // Z = 0 // }; // backEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var backEntityPosition = new Vector3() // { // X = position.X, // Y = position.Y, // Z = position.Z - entityPlacing.Scale.Z / 2 // }; // yield return entitySystem.CreateEntityFromDataModel(backEntityModel, backEntityPlacing, backEntityPosition); // //Left side: // var leftEntityModel = entityDefinition.Entity.CloneModel(); // var leftEntityPlacing = new EntityFieldPositionModel(); // leftEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[2] }; // leftEntityPlacing.CardinalRotation = true; // leftEntityPlacing.Rotation = new Vector3Model() // { // X = 0, // Y = 3, // Z = 0 // }; // leftEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var leftEntityPosition = new Vector3() // { // X = position.X - entityPlacing.Scale.X / 2, // Y = position.Y, // Z = position.Z // }; // yield return entitySystem.CreateEntityFromDataModel(leftEntityModel, leftEntityPlacing, leftEntityPosition); // //right side: // var rightEntityModel = entityDefinition.Entity.CloneModel(); // var rightEntityPlacing = new EntityFieldPositionModel(); // rightEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[3] }; // rightEntityPlacing.CardinalRotation = true; // rightEntityPlacing.Rotation = new Vector3Model() // { // X = 0, // Y = 1, // Z = 0 // }; // rightEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var rightEntityPosition = new Vector3() // { // X = position.X + entityPlacing.Scale.X / 2, // Y = position.Y, // Z = position.Z // }; // yield return entitySystem.CreateEntityFromDataModel(rightEntityModel, rightEntityPlacing, rightEntityPosition); // //top: // var topEntityModel = entityDefinition.Entity.CloneModel(); // var topEntityPlacing = new EntityFieldPositionModel(); // topEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[4] }; // topEntityPlacing.CardinalRotation = true; // topEntityPlacing.Rotation = new Vector3Model() // { // X = 3, // Y = 0, // Z = 0 // }; // topEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var topEntityPosition = new Vector3() // { // X = position.X, // Y = position.Y + entityPlacing.Scale.Y / 2, // Z = position.Z // }; // yield return entitySystem.CreateEntityFromDataModel(topEntityModel, topEntityPlacing, topEntityPosition); // //bottom: // if (textureEnumLength.Value != 5) // { // var bottomEntityModel = entityDefinition.Entity.CloneModel(); // var bottomEntityPlacing = new EntityFieldPositionModel(); // bottomEntityModel.RenderMode.Textures = new TextureSourceModel[] { textures[5] }; // bottomEntityPlacing.CardinalRotation = true; // bottomEntityPlacing.Rotation = new Vector3Model() // { // X = 1, // Y = 0, // Z = 0 // }; // bottomEntityPlacing.Scale = new Vector3Model() // { // X = entityPlacing.Scale.X, // Y = entityPlacing.Scale.Y, // Z = 1 // }; // var bottomEntityPosition = new Vector3() // { // X = position.X, // Y = position.Y - entityPlacing.Scale.Y / 2, // Z = position.Z // }; // yield return entitySystem.CreateEntityFromDataModel(bottomEntityModel, bottomEntityPlacing, bottomEntityPosition); // } //} throw new NotImplementedException(); }
private static void LoadEntityInfos() { string text = Path.Combine(Global.SolutionInfo.SolutionPath, "52abp_code_power"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(Global.SolutionInfo.CurrentSelectFilePath); EntityModel entityModel = LoadEntityService.LoadEntityInConfigJson(Path.Combine(text, fileNameWithoutExtension + ".json"), fileNameWithoutExtension); EntityModel entityModel2 = LoadEntityService.LoadEntityInfoInCurrentSelectFile(Global.SolutionInfo.CurrentSelectFilePath, fileNameWithoutExtension); string directoryName = Path.GetDirectoryName(Global.SolutionInfo.CurrentSelectFilePath); string parentDirName = (directoryName != null) ? directoryName.Split(new char[] { '\\', '/' }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault <string>() : null; if (entityModel == null) { if (Global.LGOption.IsLGFeature) { entityModel2.UseLGFeature(); } Global.Entity = entityModel2; Global.Entity.ParentDirName = parentDirName; return; } using (List <EntityFieldModel> .Enumerator enumerator = entityModel2.Properties.GetEnumerator()) { while (enumerator.MoveNext()) { EntityFieldModel item = enumerator.Current; if (!entityModel.Properties.Exists((EntityFieldModel o) => o.FieldName == item.FieldName)) { entityModel.Properties.Add(item); } } } List <EntityFieldModel> list = new List <EntityFieldModel>(); using (List <EntityFieldModel> .Enumerator enumerator = entityModel.Properties.GetEnumerator()) { while (enumerator.MoveNext()) { EntityFieldModel item = enumerator.Current; if (!entityModel2.Properties.Exists((EntityFieldModel o) => o.FieldName == item.FieldName)) { list.Add(item); } } } foreach (EntityFieldModel item2 in list) { entityModel.Properties.Remove(item2); } entityModel.Namespace = entityModel2.Namespace; entityModel.NameSplit = entityModel2.NameSplit; entityModel.EntityKeyName = entityModel2.EntityKeyName; entityModel.BaseClassDtoName = entityModel2.BaseClassDtoName; entityModel.BaseClassName = entityModel2.BaseClassName; entityModel.BaseClassNameList = entityModel2.BaseClassNameList; Global.Entity = entityModel; Global.Entity.ParentDirName = parentDirName; }