/// <summary> /// 设置某个实体整体可用性 /// </summary> /// <param name="view"></param> /// <param name="entityKey"></param> /// <param name="bEnabled"></param> public static void SetEntityEnabled(this IDynamicFormView view, string entityKey, bool bEnabled) { EntityAppearance entityAp = view.LayoutInfo.GetEntityAppearance(entityKey); if (entityAp == null) { return; } foreach (var ap in entityAp.Layoutinfo.Controls) { view.StyleManager.SetEnabled(ap, null, bEnabled); } }
/// <summary> /// Setup SerializedProperty's and any labels used, tools tips etc. /// </summary> /// <param name="property"></param> private void Init(SerializedProperty property) { // Attempt to find an entity type string root = property.propertyPath.Substring(0, property.propertyPath.LastIndexOf('.')); kind = property.serializedObject.FindProperty(root + ".entityType.kind"); domain = property.serializedObject.FindProperty(root + ".entityType.domain"); category = property.serializedObject.FindProperty(root + ".entityType.category"); DetermineAppearanceType(); appearance = property.FindPropertyRelative("appearance"); tmpAppearance = new EntityAppearance(appearance.intValue); }
public override void OnSetLayoutInfo(SetLayoutInfoArgs e) { base.OnSetLayoutInfo(e); // 获取单据体表格的元数据及布局 string entityKey = "FEntity"; //Entity entity = _currBusinessInfo.GetEntity(entityKey); EntityAppearance entityApp = _currLayoutInfo.GetEntityAppearance(entityKey); Entity entity = entityApp.Entity; var textApp = _currLayoutInfo.GetFieldAppearance("FField"); var decimalApp = _currLayoutInfo.GetFieldAppearance("FDecimal"); for (int i = 0; i < entityData.Columns.Count; i++) { string name = "FField_" + (i + 1).ToString(); //FieldAppearance field = new FieldAppearance(); FieldAppearance field; if (i == 0) { field = (FieldAppearance)ObjectUtils.CreateCopy(textApp); } else { field = (FieldAppearance)ObjectUtils.CreateCopy(decimalApp); //添加合计列 GroupSumColumn sumColumn = new GroupSumColumn(); sumColumn.FieldKey = name; sumColumn.Precision = -1; sumColumn.SumType = 1; entity.GroupColumnInfo.AddGroupSumColumn(sumColumn); } field.Key = name; field.Caption = new LocaleValue(entityData.Columns[i].ColumnName); field.Field = _currBusinessInfo.GetField(name); field.Tabindex = i + 1; _currLayoutInfo.Add(field); } _currLayoutInfo.Remove(textApp); _currLayoutInfo.Remove(decimalApp); entityApp.Layoutinfo.Sort(); e.LayoutInfo = _currLayoutInfo; EntryGrid grid = this.View.GetControl <EntryGrid>("FEntity"); grid.SetCustomPropertyValue("AllowLayoutSetting", false); grid.CreateDyanmicList(_currLayoutInfo.GetEntityAppearance("FEntity")); this.View.SendDynamicFormAction(this.View); }
// DECLARING METHODS: BASIC FUNCTIONS /// <summary> /// Constructor of the Archer /// </summary> /// <param name="vArcherPosition" >Startposition of the Archer</param> /// <param name="uID" >ID of the Archer</param> /// <param name="eNewAppearance" >Enum that indicates the texture of the Archer</param> /// <param name="uDamage" >Damage that the Archer inflicts when Player is hit by a Projectile</param> /// <param name="iDistanceDetection">Sight Radius of the Archer</param> /// <param name="bIsBoss" >If true Archer is Boss Type</param> /// <param name="iHealth" >Health of the Archer</param> public Archer(Vector2f vArcherPosition, uint uID, EntityAppearance eNewAppearance, uint uDamage, int iDistanceDetection, bool bIsBoss, int iHealth) { eAppearance = eNewAppearance; // SYNCHRONISING DRAWABLES WITH CONTENTLOADER tEntity = GetAppearanceTexture(); ffont = ContentLoader.fontArial; // INSTANTIATING OBJECTS sEntity = new Sprite(tEntity); sEntity.Origin = new Vector2f(25, 25); rRandom = new Random(); cDetecting = new Clock(); cShooting = new Clock(); cMoving = new Clock(); cSuspecting = new Clock(); lInvisibleProjectileLeft = new List <InvisibleProjectile>(); lInvisibleProjectileMiddle = new List <InvisibleProjectile>(); lInvisibleProjectileRight = new List <InvisibleProjectile>(); lProjectile = new List <EnemyProjectile>(); Closed = new List <Node>(); Path = new List <Node>(); // SETTING VARIABLES vEntityPosition = vArcherPosition; this.iHealth = iHealth; iHealthMax = iHealth; this.uID = uID; this.uDamage = uDamage; this.iDistanceDetection = iDistanceDetection; this.bIsBoss = bIsBoss; fSpeed = 1; for (int x = 0; x < uID; x++) { fAngle = rRandom.Next(0, 360); } sEntity.Rotation = fAngle; bSuspecting = false; iRandomNumber = rRandom.Next(0, 4); fProcentualHealth = (float)iHealth / (float)iHealthMax; }
public void CreateSetInitialAppearance(EntityAppearance appearance) { if (!isEntityImplementationInCreationPhase()) throw new InvalidOperationException("This method can only be used during creation!"); this.appearance = appearance; }
private void addServerCharacters() { // TODO: Implement based on scripts!!! // create npc owyn ServerCharacter npcOwyn = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY_NPC); EntityAppearance appearance = new EntityAppearance(PredefinedModelType.HUMAN_MALE); appearance.Boots = PredefinedModelBoots.BOOTS_BROWN; appearance.Hair = PredefinedModelHair.HAIR_BROWN; appearance.Head = PredefinedModelHead.HEAD_1; appearance.Pants = PredefinedModelPants.PANTS_BLUE; appearance.Shirt = PredefinedModelShirt.SHIRT_LIGHTBROWN; appearance.Skin = PredefinedModelSkin.SKIN_PALE; npcOwyn.Name = "Owyn"; npcOwyn.CreateSetInitialAppearance(appearance); EntityLocation location = new EntityLocation(); location.CurrentMap = mapManager.StartPointMap; location.Z = 0; location.X = 122; location.Y = 125; location.Rotation = 270; location.IsSittingDown = false; npcOwyn.CreateSetInitialLocation(location); // add npc to the world addEntityImplementationToWorld(npcOwyn); npcOwyn.LocationChangeMapAtEnterWorld(); npcOwyn.CreateApplyInitialState(); // create npc cerdiss ServerCharacter npcCerdiss = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY_NPC); EntityAppearance appearanceCerdiss = new EntityAppearance(PredefinedModelType.SKELETON); npcCerdiss.Name = "Cerdiss"; npcCerdiss.CreateSetInitialAppearance(appearanceCerdiss); EntityLocation locationCerdiss = new EntityLocation(); locationCerdiss.CurrentMap = mapManager.StartPointMap; locationCerdiss.Z = 0; locationCerdiss.X = 163; locationCerdiss.Y = 29; locationCerdiss.Rotation = 180; locationCerdiss.IsSittingDown = false; locationCerdiss.Dimension = (int)PredefinedDimension.SHADOWS; npcCerdiss.CreateSetInitialLocation(locationCerdiss); npcCerdiss.CreateApplyInitialState(); // add npc to the world addEntityImplementationToWorld(npcCerdiss); npcCerdiss.LocationChangeMapAtEnterWorld(); for (int i = 0; i < 3; i++) { // create rat ServerCharacter rat1 = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY); EntityAppearance appearancerat = new EntityAppearance(PredefinedModelType.RAT); rat1.CreateSetInitialAppearance(appearancerat); rat1.Name = "Rat"; EntityLocation locationrat = new EntityLocation(); locationrat.CurrentMap = mapManager.StartPointMap; locationrat.Z = 0; locationrat.X = (short)(107 + i); locationrat.Y = (short)(167 + i); locationrat.Rotation = 180; locationrat.IsSittingDown = false; rat1.CreateSetInitialLocation(locationrat); rat1.CreateSetRespawnTime(30000); rat1.MaxCombatXP = 2000; // easy rat1.CreateApplyInitialState(); // AI WonderingDumbNonAggresiveAIImplementation aiImpl = new WonderingDumbNonAggresiveAIImplementation(locationrat.X, locationrat.Y, 15, 2000); rat1.AIAttach(aiImpl); // add rat to the world addEntityImplementationToWorld(rat1); rat1.LocationChangeMapAtEnterWorld(); } for (int i = 0; i < 1; i++) { // create rat ServerCharacter rat1 = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY); EntityAppearance appearancerat = new EntityAppearance(PredefinedModelType.RAT); rat1.CreateSetInitialAppearance(appearancerat); rat1.Name = "Rat"; EntityLocation locationrat = new EntityLocation(); locationrat.CurrentMap = mapManager.StartPointMap; locationrat.Z = 0; locationrat.X = (short)(91 + i); locationrat.Y = (short)(117 + i); locationrat.Rotation = 180; locationrat.IsSittingDown = false; rat1.CreateSetInitialLocation(locationrat); rat1.CreateSetRespawnTime(30000); rat1.MaxCombatXP = 4000; // medium rat1.CreateApplyInitialState(); // AI WonderingDumbNonAggresiveAIImplementation aiImpl = new WonderingDumbNonAggresiveAIImplementation(locationrat.X, locationrat.Y, 10, 2000); rat1.AIAttach(aiImpl); // add rat to the world addEntityImplementationToWorld(rat1); rat1.LocationChangeMapAtEnterWorld(); } for (int i = 0; i < 2; i++) { // create rabbit ServerCharacter rabbit1 = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY); EntityAppearance appearanceRabbit = new EntityAppearance(PredefinedModelType.BROWN_RABBIT); rabbit1.CreateSetInitialAppearance(appearanceRabbit); rabbit1.Name = "Rabbit"; EntityLocation locationRabbit = new EntityLocation(); locationRabbit.CurrentMap = mapManager.StartPointMap; locationRabbit.Z = 0; locationRabbit.X = (short)(54 + i); locationRabbit.Y = (short)(138 + i); locationRabbit.Rotation = 180; locationRabbit.IsSittingDown = false; rabbit1.CreateSetInitialLocation(locationRabbit); rabbit1.CreateSetRespawnTime(40000); rabbit1.MaxCombatXP = 4000; // medium rabbit1.CreateApplyInitialState(); // AI WonderingDumbNonAggresiveAIImplementation aiImpl = new WonderingDumbNonAggresiveAIImplementation(locationRabbit.X, locationRabbit.Y, 30,3000); rabbit1.AIAttach(aiImpl); // add rabbit to the world addEntityImplementationToWorld(rabbit1); rabbit1.LocationChangeMapAtEnterWorld(); } for (int i = 0; i < 2; i++) { // create rabbit ServerCharacter rabbit1 = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY); EntityAppearance appearanceRabbit = new EntityAppearance(PredefinedModelType.BROWN_RABBIT); rabbit1.CreateSetInitialAppearance(appearanceRabbit); rabbit1.Name = "Rabbit"; EntityLocation locationRabbit = new EntityLocation(); locationRabbit.CurrentMap = mapManager.StartPointMap; locationRabbit.Z = 0; locationRabbit.X = (short)(27 + i); locationRabbit.Y = (short)(41 + i); locationRabbit.Rotation = 180; locationRabbit.IsSittingDown = false; rabbit1.CreateSetInitialLocation(locationRabbit); rabbit1.CreateSetRespawnTime(40000); rabbit1.MaxCombatXP = 4000; // medium rabbit1.CreateApplyInitialState(); // AI WonderingDumbNonAggresiveAIImplementation aiImpl = new WonderingDumbNonAggresiveAIImplementation(locationRabbit.X, locationRabbit.Y, 30, 3000); rabbit1.AIAttach(aiImpl); // add rabbit to the world addEntityImplementationToWorld(rabbit1); rabbit1.LocationChangeMapAtEnterWorld(); } for (int i = 0; i < 2; i++) { // create snake ServerCharacter snake1 = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY); EntityAppearance appearancesnake = new EntityAppearance(PredefinedModelType.SNAKE_1); snake1.CreateSetInitialAppearance(appearancesnake); snake1.Name = "Snake"; EntityLocation locationsnake = new EntityLocation(); locationsnake.CurrentMap = mapManager.StartPointMap; locationsnake.Z = 0; locationsnake.X = (short)(149 + i); locationsnake.Y = (short)(131 + i); locationsnake.Rotation = 180; locationsnake.IsSittingDown = false; snake1.CreateSetInitialLocation(locationsnake); snake1.CreateSetRespawnTime(30000); snake1.MaxCombatXP = 6000; // hard snake1.CreateApplyInitialState(); // AI WonderingDumbNonAggresiveAIImplementation aiImpl = new WonderingDumbNonAggresiveAIImplementation(locationsnake.X, locationsnake.Y, 20, 3000); snake1.AIAttach(aiImpl); // add snake to the world addEntityImplementationToWorld(snake1); snake1.LocationChangeMapAtEnterWorld(); } // create troll ServerCharacter troll1 = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY); EntityAppearance appearancetroll = new EntityAppearance(PredefinedModelType.TROLL); troll1.CreateSetInitialAppearance(appearancetroll); troll1.Name = "Troll"; EntityLocation locationtroll = new EntityLocation(); locationtroll.CurrentMap = mapManager.StartPointMap; locationtroll.Z = 0; locationtroll.X = 74; locationtroll.Y = 63; locationtroll.Rotation = 90; locationtroll.IsSittingDown = false; troll1.CreateSetInitialLocation(locationtroll); troll1.CreateSetRespawnTime(60000); troll1.MaxCombatXP = 20000; // Impossible troll1.CreateApplyInitialState(); // add troll to the world addEntityImplementationToWorld(troll1); troll1.LocationChangeMapAtEnterWorld(); // create deer ServerCharacter deer1 = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY); EntityAppearance appearancedeer = new EntityAppearance(PredefinedModelType.DEER); deer1.CreateSetInitialAppearance(appearancedeer); deer1.Name = "Deer"; EntityLocation locationdeer = new EntityLocation(); locationdeer.CurrentMap = mapManager.StartPointMap; locationdeer.Z = 0; locationdeer.X = 104; locationdeer.Y = 19; locationdeer.Rotation = 0; locationdeer.IsSittingDown = false; deer1.CreateSetInitialLocation(locationdeer); deer1.CreateSetRespawnTime(60000); deer1.MaxCombatXP = 6000; // hard deer1.CreateApplyInitialState(); // AI WonderingDumbNonAggresiveAIImplementation aiImplDeer = new WonderingDumbNonAggresiveAIImplementation(locationdeer.X, locationdeer.Y, 50, 5000); deer1.AIAttach(aiImplDeer); // add deer to the world addEntityImplementationToWorld(deer1); deer1.LocationChangeMapAtEnterWorld(); // create beaver ServerCharacter beaver1 = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY); EntityAppearance appearancebeaver = new EntityAppearance(PredefinedModelType.DEER); beaver1.CreateSetInitialAppearance(appearancebeaver); beaver1.Name = "Deer"; EntityLocation locationbeaver = new EntityLocation(); locationbeaver.CurrentMap = mapManager.StartPointMap; locationbeaver.Z = 0; locationbeaver.X = 164; locationbeaver.Y = 42; locationbeaver.Rotation = 0; locationbeaver.IsSittingDown = false; beaver1.CreateSetInitialLocation(locationbeaver); beaver1.CreateSetRespawnTime(60000); beaver1.MaxCombatXP = 4000; // medium beaver1.CreateApplyInitialState(); // AI WonderingDumbNonAggresiveAIImplementation aiImplbeaver = new WonderingDumbNonAggresiveAIImplementation(locationbeaver.X, locationbeaver.Y, 50, 5000); beaver1.AIAttach(aiImplbeaver); // add beaver to the world addEntityImplementationToWorld(beaver1); beaver1.LocationChangeMapAtEnterWorld(); // create armedSkell ServerCharacter armedSkell1 = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY); EntityAppearance appearancearmedSkell = new EntityAppearance(PredefinedModelType.ARMED_SKELETON); armedSkell1.CreateSetInitialAppearance(appearancearmedSkell); armedSkell1.Name = "Armed Skeleton"; EntityLocation locationarmedSkell = new EntityLocation(); locationarmedSkell.CurrentMap = mapManager.StartPointMap; locationarmedSkell.Z = 0; locationarmedSkell.X = 158; locationarmedSkell.Y = 26; locationarmedSkell.Rotation = 0; locationarmedSkell.IsSittingDown = false; locationarmedSkell.Dimension = (int)PredefinedDimension.SHADOWS; armedSkell1.CreateSetInitialLocation(locationarmedSkell); armedSkell1.CreateSetRespawnTime(60000); armedSkell1.MaxCombatXP = 6000; // hard armedSkell1.CreateApplyInitialState(); // AI WonderingDumbNonAggresiveAIImplementation aiImplarmedSkell = new WonderingDumbNonAggresiveAIImplementation(locationarmedSkell.X, locationarmedSkell.Y, 10, 5000); armedSkell1.AIAttach(aiImplarmedSkell); // add armedSkell to the world addEntityImplementationToWorld(armedSkell1); armedSkell1.LocationChangeMapAtEnterWorld(); // create town person ServerCharacter townperson = new ServerCharacter(PredefinedEntityImplementationKind.ENTITY); EntityAppearance appearance2 = new EntityAppearance(PredefinedModelType.DWARF_MALE); appearance2.Boots = PredefinedModelBoots.BOOTS_BROWN; appearance2.Hair = PredefinedModelHair.HAIR_BLOND; appearance2.Head = PredefinedModelHead.HEAD_3; appearance2.Pants = PredefinedModelPants.PANTS_GREEN; appearance2.Shirt = PredefinedModelShirt.SHIRT_BLUE; appearance2.Skin = PredefinedModelSkin.SKIN_PALE; townperson.Name = "Boric"; townperson.CreateSetInitialAppearance(appearance2); EntityLocation location2 = new EntityLocation(); location2.CurrentMap = mapManager.StartPointMap; location2.Z = 0; location2.X = 100; location2.Y = 143; location2.Rotation = 180; location2.IsSittingDown = false; townperson.CreateSetInitialLocation(location2); townperson.CreateSetRespawnTime(0); townperson.MaxCombatXP = 6000; // hard townperson.CreateApplyInitialState(); // AI WonderingDumbNonAggresiveAIImplementation aiImpltownperson = new WonderingDumbNonAggresiveAIImplementation(location2.X, location2.Y, 60, 10000); townperson.AIAttach(aiImpltownperson); // add npc to the world addEntityImplementationToWorld(townperson); townperson.LocationChangeMapAtEnterWorld(); }
private PlayerCharacterSerializer pcSerializer = null; // Used for storing pc data #endregion Fields #region Methods private void handleCreateChar(PlayerCharacter pc, IncommingMessage msg) { if (pc.LoginState == PlayerCharacterLoginState.ClientVersionCorrect) { CreateCharIncommingMessage msgCreateChar = (CreateCharIncommingMessage)msg; // Is acceptable character name if (!pcAuthentication.IsAcceptablePlayerName(msgCreateChar.UserName)) { CreateCharNotOkOutgoingMessage msgCreateCharNotOk = (CreateCharNotOkOutgoingMessage)OutgoingMessagesFactory.Create(OutgoingMessageType.CREATE_CHAR_NOT_OK); msgCreateCharNotOk.Message = "This character name is not acceptable."; pc.PutMessageIntoMyQueue(msgCreateCharNotOk); return; } // Does character exist? if (pcAuthentication.Exists(msgCreateChar.UserName)) { // Character already exists CreateCharNotOkOutgoingMessage msgCreateCharNotOk = (CreateCharNotOkOutgoingMessage)OutgoingMessagesFactory.Create(OutgoingMessageType.CREATE_CHAR_NOT_OK); msgCreateCharNotOk.Message = "A character with that name already exists."; pc.PutMessageIntoMyQueue(msgCreateCharNotOk); return; } // TODO: Add check for appearace values // All ok. Create a character try { pcAuthentication.Create(msgCreateChar.UserName, msgCreateChar.Password); } catch (Exception ex) { logger.LogError(LogSource.World, "Failed to create player " + pc.Name, ex); CreateCharNotOkOutgoingMessage msgCreateCharNotOk = (CreateCharNotOkOutgoingMessage)OutgoingMessagesFactory.Create(OutgoingMessageType.CREATE_CHAR_NOT_OK); msgCreateCharNotOk.Message = "Server could not create the character."; pc.PutMessageIntoMyQueue(msgCreateCharNotOk); return; } // Clear character (current state of character is undefined!) pc.ClearEntityImplementation(); EntityAppearance appearance = new EntityAppearance(msgCreateChar.Type); appearance.Head = msgCreateChar.Head; appearance.Skin = msgCreateChar.Skin; appearance.Hair = msgCreateChar.Hair; appearance.Shirt = msgCreateChar.Shirt; appearance.Pants = msgCreateChar.Pants; appearance.Boots = msgCreateChar.Boots; pc.Name = msgCreateChar.UserName; pc.CreateSetInitialAppearance(appearance); EntityLocation location = new EntityLocation(); short deviation = mapManager.StartPointDeviation; location.X = (short)(mapManager.StartPointX + (sbyte)WorldRNG.Next(-deviation, deviation)); location.Y = (short)(mapManager.StartPointY + (sbyte)WorldRNG.Next(-deviation, deviation)); location.Z = 0; location.Rotation = 0; location.CurrentMap = mapManager.StartPointMap; pc.CreateSetInitialLocation(location); // TODO: Apply race specific factors // Add bonus items ItemDefinition itmDef = null; // Royals itmDef = ItemDefinitionCache.GetItemDefinitionByID(5); if (itmDef != null) { Item itm = new Item(itmDef); itm.Quantity = 100; pc.InventoryUpdateItem(itm); } // Recalculate enerigies pc.CreateRecalculateInitialEnergies(); // Store data try { pc.ForceSerialization(); pc.Serialize(pcSerializer); } catch (Exception ex) { logger.LogError(LogSource.World, "Failed to serialize player " + pc.Name, ex); CreateCharNotOkOutgoingMessage msgCreateCharNotOk = (CreateCharNotOkOutgoingMessage)OutgoingMessagesFactory.Create(OutgoingMessageType.CREATE_CHAR_NOT_OK); msgCreateCharNotOk.Message = "Server could not create the character."; pc.PutMessageIntoMyQueue(msgCreateCharNotOk); return; } // Send char created ok message pc.PutMessageIntoMyQueue(msgStdCreateCharOk); } }
public override int CompareTo(EntityAppearance other) { ConsistencyAppearance that = other as ConsistencyAppearance; return(other != null?IsConsistent.CompareTo(that.IsConsistent) : -1); }
/// <summary> /// Constructs a new StaticDrawable component. /// </summary> public StaticDrawable() { Layer = DrawableLayer.Items; _appearance = new EntityAppearance { '?' }; }