public override void BuildPacket() { PushIntoStack(worshipLv); PushIntoStack(itemName.ToNotNullString()); PushIntoStack(worshipInfo == null ? 0 : worshipInfo.ItemNum); PushIntoStack(worshipInfo == null ? 0 : worshipInfo.GameCoin); PushIntoStack(worshipInfo == null ? 0 : worshipInfo.ObtainNum); PushIntoStack(TrumpHelper.IsUpWorshLv(ContextUser) ? (short)1 : (short)0); PushIntoStack(worshipInfoInfoArray.Length); int propertycount = 0; foreach (var item in worshipInfoInfoArray) { short isFull = 0; GeneralProperty property = GetPropertyType(ContextUser.UserID, propertycount); if (property != null && property.AbilityLv >= TrumpPropertyInfo.MaxTrumpPropertyLv) { isFull = 1; } DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack(property == null ? 0 : (int)property.AbilityType); dsItem.PushIntoStack(property == null ? (short)0 : (short)property.AbilityLv); dsItem.PushIntoStack(totalNum > propertycount ? (short)1 : (short)0); dsItem.PushIntoStack(worshipLv >= item.WorshipLv ? (short)1 : (short)0); dsItem.PushIntoStack(isFull); PushIntoStack(dsItem); propertycount++; } this.PushIntoStack((short)isItem); this.PushIntoStack((short)isCoin); this.PushIntoStack((short)isObtain); PushIntoStack(successNum.ToNotNullString()); }
public override bool TakeAction() { GeneralProperty property = null; UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.PropertyInfo.Count > 0) { property = userTrump.PropertyInfo.Find(m => m.AbilityType == propertyID); } if (property == null) { return(false); } if (ops == 1) { ErrorCode = ops; ErrorInfo = LanguageManager.GetLang().St1467_WorshipGridNotEnough; return(false); } else if (ops == 2) { ErrorCode = ops; userTrump.PropertyInfo.Remove(property); var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID); if (usergeneral != null) { usergeneral.RefreshMaxLife(); } } return(true); }
/// <summary> /// 升级加属性 /// </summary> /// <param name="general"></param> /// <param name="property"></param> public static void UpdateGeneralPro(UserGeneral general, AbilityType type, decimal num) { if (type == AbilityType.Potential) { general.Potential = MathUtils.Addition(general.Potential, num).ToInt(); } var property = general.Attribute.Find(s => s.AbilityType == type); if (property != null) { general.Attribute.UpdateNotify(obj => { property.AbilityValue = MathUtils.Addition(property.AbilityValue, num); return(true); }); //property.UpdateNotify(obj => //{ // property.AbilityValue = num; // return true; //}); } else { property = new GeneralProperty(); property.AbilityType = type; property.AbilityValue = num; general.Attribute.Add(property); } }
private void RegisterProperty(Type entityType, PropertyInfo property) { //关联属性,即关联实体或子实体集属性 if (typeof(IEntity).IsAssignableFrom(property.PropertyType) || typeof(IEntitySet).IsAssignableFrom(property.PropertyType)) { var mapping = property.GetCustomAttributes <PropertyMappingAttribute>().FirstOrDefault(); var options = mapping != null && mapping.GetFlag(PropertyMappingAttribute.SetMark.LoadBehavior) ? new RelationOptions(mapping.LoadBehavior) : null; PropertyUnity.RegisterSupposedProperty(property.Name, property.PropertyType, entityType, options: options); } else { var gp = new GeneralProperty() { Name = property.Name, Type = property.PropertyType, EntityType = entityType, Info = new PropertyMapInfo { ReflectionInfo = property, FieldName = property.Name } }; var mapping = property.GetCustomAttributes <PropertyMappingAttribute>().FirstOrDefault(); if (mapping != null) { InitMapInfo(mapping, gp.Info); } PropertyUnity.RegisterProperty(entityType, gp); } }
public override bool TakeAction() { UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.PropertyInfo.Count > 0) { GeneralProperty property = userTrump.PropertyInfo.Find(m => m.AbilityType == propertyID); if (property != null) { if (property.AbilityLv >= TrumpPropertyInfo.MaxTrumpPropertyLv) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1466_OutPropertyMaxLv; return(false); } TrumpPropertyInfo trumpProperty = new ConfigCacheSet <TrumpPropertyInfo>().FindKey(property.AbilityType, property.AbilityLv); if (trumpProperty != null) { int upItemNum = TrumpHelper.GetUserItemNum(ContextUser.UserID, trumpProperty.ItemID); if (upItemNum < trumpProperty.ItemNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1462_ItemNumNotEnough; return(false); } if (ContextUser.GameCoin < trumpProperty.GameCoin) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GameCoinNotEnough; return(false); } if (ContextUser.ObtainNum < trumpProperty.ObtainNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_ObtainNumNotEnough; return(false); } ContextUser.ObtainNum = MathUtils.Subtraction(ContextUser.ObtainNum, trumpProperty.ObtainNum); ContextUser.GameCoin = MathUtils.Subtraction(ContextUser.GameCoin, trumpProperty.GameCoin); UserItemHelper.UseUserItem(ContextUser.UserID, trumpProperty.ItemID, trumpProperty.ItemNum); short upLv = MathUtils.Addition(property.AbilityLv, (short)1, (short)TrumpPropertyInfo.MaxTrumpPropertyLv); TrumpPropertyInfo uptrumpProperty = new ConfigCacheSet <TrumpPropertyInfo>().FindKey(property.AbilityType, upLv); property.UpdateNotify(obj => { property.AbilityLv = MathUtils.Addition(property.AbilityLv, (short)1, TrumpPropertyInfo.MaxTrumpPropertyLv); property.AbilityValue = uptrumpProperty.PropertyNum; return(true); }); var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID); if (usergeneral != null) { usergeneral.RefreshMaxLife(); } ErrorCode = 0; ErrorInfo = LanguageManager.GetLang().St1464_UpgradeWasSsuccessful; } } } return(true); }
public GeneralProperty GetPropertyType(string userID, int procount) { GeneralProperty property = null; UserTrump userTrump = new PersonalCacheStruct <UserTrump>().FindKey(userID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.PropertyInfo.Count > procount) { property = userTrump.PropertyInfo[procount]; } return(property); }
private GeneralProperty GetPropertyType(string userID, int procount) { GeneralProperty property = null; UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(userID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.PropertyInfo.Count > procount) { property = userTrump.PropertyInfo[procount]; } return(property); }
public string GenerateBaseFile(GeneralProperty GeneralProperty, string Namespace, string Language) { CodeCompileUnit ccu = new CodeCompileUnit(); System.CodeDom.CodeNamespace cns = _getNamespace(GeneralProperty, Namespace); CodeTypeDeclaration model = _getType(GeneralProperty); cns.Types.Add(model); ccu.Namespaces.Add(cns); return(_getString(ccu, Language)); }
public void AddProperties(PropertyOwner owner) { BGImage.Position = new Point(1590, 100); BGImage.Initialize(); AddPanelProperties(); if (owner != PropertyOwner.SLIDER && owner != PropertyOwner.TOGGLE) { _textProperties = new TextProperty(this); _textProperties.AddProperties(owner); foreach (var item in _textProperties.Properties) { _properties.Add(item.Key, item.Value); } } if (owner != PropertyOwner.LABEL) { _surfaceProperties = new SurfaceProperty(this); _surfaceProperties.AddProperties(owner); foreach (var item in _surfaceProperties.Properties) { _properties.Add(item.Key, item.Value); } } if (owner == PropertyOwner.COMBOBOX) { _advancedProperties = new AdvancedProperty(this); _advancedProperties.AddProperties(owner); foreach (var item in _advancedProperties.Properties) { _properties.Add(item.Key, item.Value); } } _generalProperties = new GeneralProperty(this); _generalProperties.AddProperties(owner); foreach (var item in _generalProperties.Properties) { _properties.Add(item.Key, item.Value); } _search.FieldWidth = 320; _search.SampleText = "Search for an item here..."; _search.StickSampleText = true; _search.TextColor = Color.White; AddEvents(); }
/// <summary> /// 注册基本的实体属性。 /// </summary> /// <param name="propertyInfo">属性信息。</param> /// <param name="entityType">实体类型。</param> /// <param name="info">属性映射信息。</param> /// <returns>一个 <see cref="IProperty"/> 对象。</returns> private static IProperty RegisterProperty(PropertyInfo propertyInfo, Type entityType, PropertyMapInfo info = null) { var property = new GeneralProperty { Name = propertyInfo.Name, Type = propertyInfo.PropertyType, EntityType = entityType, Info = InitPropertyInfo(info, propertyInfo) }; return(RegisterProperty(entityType, property)); }
/// <summary> /// 先攻值 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static int GetGeneralpriorityNum(string userID, int generalID) { int priorityNum = 0; List <GeneralProperty> propertiList = GetAbility(userID, generalID, new UserGeneral()); GeneralProperty property = propertiList.Find(m => m.AbilityType == AbilityType.FirstStrike); if (property != null) { priorityNum = property.AbilityValue.ToInt(); } return(priorityNum); }
protected override void OnConfiguring(EntityContextOptionsBuilder builder) { var map = new PropertyMapInfo { IsPrimaryKey = true, DataType = System.Data.DbType.Boolean, Description = "dd" }; var p = new GeneralProperty { Info = map }; PropertyUnity.RegisterProperty(typeof(SysUser), p); builder.UseSqlServer(connstr); }
public void TestBuild() { #if !NETCOREAPP2_0 var assBuilder = new DynamicAssemblyBuilder("test_dll", "e:\\test.dll"); var typeBuilder = new EntityTypeBuilder("TestEntity", assBuilder); #else var typeBuilder = new EntityTypeBuilder("testclass"); #endif var pName = new GeneralProperty() { Name = "Name", Info = new PropertyMapInfo { FieldName = "name" }, Type = typeof(string) }; typeBuilder.Properties.Add(pName); typeBuilder.Properties.Add(new GeneralProperty() { Name = "Age", Info = new PropertyMapInfo { FieldName = "age" }, Type = typeof(int?) }); typeBuilder.Properties.Add(new GeneralProperty() { Name = "Sex", Info = new PropertyMapInfo { FieldName = "sex" }, Type = typeof(Sex) }); typeBuilder.DefineValidateRule(pName, () => new System.ComponentModel.DataAnnotations.MaxLengthAttribute(15)); var type = typeBuilder.Create(); #if !NETCOREAPP2_0 assBuilder.Save(); #endif var e = type.New <IEntity>(); e.SetValue("Name", "fireasy"); e.SetValue("Age", 12); e.SetValue("Sex", Sex.M); Assert.AreEqual(e.GetValue("Name"), "fireasy"); Assert.AreEqual(e.GetValue("Age"), 12); Assert.AreEqual(e.GetValue("Sex"), Sex.M); ValidationUnity.Validate(e); var property = PropertyUnity.GetProperty(type, "Name"); Assert.IsNotNull(property); Assert.AreEqual(type.GetProperty("Name").GetValue(e), "fireasy"); }
private System.CodeDom.CodeNamespace _getNamespace(GeneralProperty gp, string Namespace) { System.CodeDom.CodeNamespace cns = new System.CodeDom.CodeNamespace(Namespace); cns.Imports.Add(new CodeNamespaceImport("System")); cns.Imports.Add(new CodeNamespaceImport("Burst")); cns.Imports.Add(new CodeNamespaceImport("Burst.Data")); cns.Imports.Add(new CodeNamespaceImport("Burst.Data.Entity")); if (gp != null && gp.IsWebUserModel) { cns.Imports.Add(new CodeNamespaceImport("Burst.Web")); } return(cns); }
/// <summary> /// 法宝技能——属性转换 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static TList <GeneralProperty> AttributeConversion(string userID, decimal powerNum, decimal soulNum, decimal intellectNum) { decimal changeNum = 0; TList <GeneralProperty> propertyList = new TList <GeneralProperty>(); UserGeneral general = UserGeneral.GetMainGeneral(userID); if (general == null) { return(propertyList); } UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(userID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.LiftNum > 0 && userTrump.SkillInfo.Count > 0) { foreach (SkillInfo skillInfo in userTrump.SkillInfo) { AbilityInfo abilityInfo = new ConfigCacheSet <AbilityInfo>().FindKey(skillInfo.AbilityID); if (abilityInfo != null && abilityInfo.AttackType == AttackType.Change) { SkillLvInfo skillLvInfo = new ConfigCacheSet <SkillLvInfo>().FindKey(skillInfo.AbilityID, skillInfo.AbilityLv); if (skillLvInfo == null) { break; } switch (abilityInfo.ChangeAbility) { case AbilityType.PowerNum: changeNum = powerNum; break; case AbilityType.SoulNum: changeNum = soulNum; break; case AbilityType.IntelligenceNum: changeNum = intellectNum; break; default: changeNum = 0; break; } GeneralProperty property = new GeneralProperty(); property.AbilityType = abilityInfo.AfterAbility; property.AbilityValue = changeNum * skillLvInfo.Coefficient; propertyList.Add(property); } } } return(propertyList); }
/// <summary> /// 法宝基础属性 /// </summary> /// <param name="trumpInfo"></param> /// <param name="abilityType"></param> /// <returns></returns> public static short GetTrumpProperty(TrumpInfo trumpInfo, AbilityType abilityType) { short propertyNum = 0; if (trumpInfo.Property.Count > 0) { GeneralProperty property = trumpInfo.Property.Find(m => m.AbilityType == abilityType); if (property != null) { propertyNum = (short)property.AbilityValue; } } return(propertyNum); }
public override void BuildPacket() { this.PushIntoStack(trumpLv); this.PushIntoStack(growth.ToNotNullString()); this.PushIntoStack((short)matureType); this.PushIntoStack(currLiftNum); this.PushIntoStack((short)powerNum); this.PushIntoStack((short)soulNum); this.PushIntoStack((short)intelligenceNum); this.PushIntoStack(upLiftNum); this.PushIntoStack((short)upPower); this.PushIntoStack((short)upSoul); this.PushIntoStack((short)upIntelligence); this.PushIntoStack(worshipInfoInfoArray.Length); foreach (var item in worshipInfoInfoArray) { short isOpen = 0; GeneralProperty gProperty = null; if (userTrump != null && userTrump.PropertyInfo.Count > propertycount) { gProperty = userTrump.PropertyInfo[propertycount]; } if (worshipLv >= item.WorshipLv) { isOpen = 1; } DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack(gProperty == null ? (short)AbilityType.Empty : (short)gProperty.AbilityType); dsItem.PushIntoStack(gProperty == null ? (short)0 : (short)gProperty.AbilityLv); dsItem.PushIntoStack(gProperty == null ? AbilityType.Empty.ToNotNullString() : gProperty.AbilityValue.ToNotNullString()); dsItem.PushIntoStack(isOpen); dsItem.PushIntoStack(totalNum > propertycount ? (short)1 : (short)0); this.PushIntoStack(dsItem); propertycount++; } this.PushIntoStack(trumpInfoArray.Length); for (int i = 0; i < trumpInfoArray.Length; i++) { AbilityInfo abilityInfo = TrumpHelper.GetAbilityInfo(ContextUser.UserID, i);; DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack(abilityInfo == null ? (short)0 : (short)abilityInfo.AbilityID); dsItem.PushIntoStack(abilityInfo == null ? string.Empty : abilityInfo.AbilityName.ToNotNullString()); dsItem.PushIntoStack(abilityInfo == null ? string.Empty : abilityInfo.AbilityDesc.ToNotNullString()); dsItem.PushIntoStack(skcount > i ? (short)1 : (short)0); this.PushIntoStack(dsItem); } PushIntoStack(trumpLv >= GameConfigSet.MaxTrumpLv ? (short)1 : (short)0); }
/// <summary> /// 法宝附加属性 /// </summary> /// <param name="trumpInfo"></param> /// <param name="abilityType"></param> /// <returns></returns> public static decimal TrumpGeneralProperty(string userID, int generalID, AbilityType abilityType) { decimal propertyNum = 0; UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(userID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.LiftNum > 0 && generalID == LanguageManager.GetLang().GameUserGeneralID&& userTrump.PropertyInfo.Count > 0) { GeneralProperty property = userTrump.PropertyInfo.Find(m => m.AbilityType == abilityType); if (property != null) { propertyNum = property.AbilityValue; } } return(propertyNum); }
private void button2_Click(object sender, EventArgs e) { List <string> res = new List <string>(); foreach (DataGridViewRow row in dataGridView1.Rows) { if (bool.Parse(row.Cells[0].Value.ToString())) { res.Add(row.Cells[1].Value as string); } } Dictionary <string, GFieldInfo[]> gfiss = new Dictionary <string, GFieldInfo[]>(); foreach (var t in Wizard.Schema.AllTables) { if (res.Contains(t.Name)) { var Fields = new List <GFieldInfo>(); foreach (var c in t.Columns.Values) { var c_i = new GFieldInfo(); c_i.Name = c.Name; c_i.Type = c.Type.ToString(); c_i._db_type = c.DbType; Fields.Add(c_i); } gfiss.Add(t.Name, Fields.ToArray()); } } List <GeneralProperty> ths = new List <GeneralProperty>(); foreach (KeyValuePair <string, GFieldInfo[]> gfis in gfiss) { GeneralProperty gp = new GeneralProperty(); gp.Fields = new List <GFieldInfo>(gfis.Value); gp.OwnerFields = new List <OwnerFieldInfo>(); gp.TableName = gfis.Key; ths.Add(gp); } Wizard.Tables = ths.ToArray(); Wizard.NextStep(); }
/// <summary> /// 好感度加成属性 /// </summary> /// <param name="userID"></param> /// <param name="generalID"></param> /// <param name="abilityType"></param> /// <returns></returns> public static int FeelEffectNum(string userID, int generalID, AbilityType abilityType) { int effectNum = 0; UserGeneral general = new PersonalCacheStruct <UserGeneral>().FindKey(userID, generalID); if (general != null) { FeelLvInfo lvInfo = new ShareCacheStruct <FeelLvInfo>().FindKey(general.FeelLv); if (lvInfo != null) { GeneralProperty property = lvInfo.Property.Find(m => m.AbilityType.Equals(abilityType)); if (property != null) { effectNum = property.AbilityValue.ToInt(); } } } return(effectNum); }
/// <summary> /// 下一级属性数值 /// </summary> /// <param name="userID"></param> /// <param name="generalID"></param> /// <param name="abilityType"></param> /// <returns></returns> public static int FeelUpPropertyNum(string userID, int generalID, AbilityType abilityType) { int upPropertyNum = 0; UserGeneral userGeneral = new PersonalCacheStruct <UserGeneral>().FindKey(userID, generalID); if (userGeneral != null) { short maxFeelLv = ConfigEnvSet.GetInt("Gift.MaxFeelLv").ToShort(); short feelLv = MathUtils.Addition(userGeneral.FeelLv, (short)1, maxFeelLv); FeelLvInfo upfeelLvInfo = new ShareCacheStruct <FeelLvInfo>().FindKey(feelLv); if (upfeelLvInfo != null && upfeelLvInfo.Property.Count > 0) { GeneralProperty property = upfeelLvInfo.Property.Find(m => m.AbilityType == abilityType); if (property != null) { upPropertyNum = property.AbilityValue.ToInt(); } } } return(upPropertyNum); }
private CodeTypeDeclaration _getType(GeneralProperty gp) { CodeTypeDeclaration model = new CodeTypeDeclaration(gp.ClassName); if (gp.IsWebUserModel) { model.BaseTypes.Add( new CodeTypeReference("UserBase", new CodeTypeReference[] { new CodeTypeReference(gp.ClassName) })); } else { model.BaseTypes.Add( new CodeTypeReference("DataEntity", new CodeTypeReference[] { new CodeTypeReference(gp.ClassName) })); } model.TypeAttributes = TypeAttributes.Public; model.IsPartial = true; return(model); }
public override bool TakeAction() { UserTrump userTrump = new PersonalCacheStruct <UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.PropertyInfo.Count > 0) { GeneralProperty property = userTrump.PropertyInfo.Find(m => m.AbilityType == propertyID); if (property != null) { abilityLv = property.AbilityLv; // short upLv = MathUtils.Addition(property.AbilityLv, (short)1, TrumpPropertyInfo.MaxTrumpPropertyLv); //trumpProperty = new ShareCacheStruct<TrumpPropertyInfo>().FindKey(property.AbilityType, upLv); trumpProperty = new ShareCacheStruct <TrumpPropertyInfo>().FindKey(property.AbilityType, property.AbilityLv); if (trumpProperty != null) { int upItemNum = TrumpHelper.GetUserItemNum(ContextUser.UserID, trumpProperty.ItemID); if (upItemNum >= trumpProperty.ItemNum) { isItem = 1; } if (ContextUser.GameCoin >= trumpProperty.GameCoin) { isCoin = 1; } if (ContextUser.ObtainNum >= trumpProperty.ObtainNum) { isObtain = 1; } successNum = trumpProperty.SuccessNum.ToString(); ItemBaseInfo itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(trumpProperty.ItemID); if (itemInfo != null) { itemName = itemInfo.ItemName; } } } } return(true); }
public ushort this[GeneralProperty prop] => generalProps[(int)prop];
/// <summary> /// 佣兵属性集合 /// </summary> /// <param name="userID"></param> /// <param name="generalID"></param> /// <returns></returns> public static List <GeneralProperty> GetAbility(string userID, int generalID, UserGeneral userGeneral) { List <GeneralProperty> gPropertyList = new List <GeneralProperty>(); var cacheSetUserEmbattle = new PersonalCacheStruct <UserEmbattle>(); GeneralProperty generalProperty = new GeneralProperty(); var userMagic = new PersonalCacheStruct <UserMagic>().Find(userID, s => s.IsEnabled); CombatGeneral combatGeneral = new CombatGeneral() { UserID = userID, GeneralID = generalID, ExtraAttack = new CombatProperty(), ExtraDefense = new CombatProperty(), LifeNum = userGeneral.LifeNum, LifeMaxNum = userGeneral.LifeMaxNum }; var userEmbattleList = cacheSetUserEmbattle.FindAll(userID, s => s.MagicID == (userMagic != null ? userMagic.MagicID : 0)); UserEmbattleQueue.embattleList = userEmbattleList; UserEmbattleQueue.KarmaAddition(userID, combatGeneral); userGeneral.TLifeNum = combatGeneral.LifeNum; userGeneral.TLifeMaxNun = combatGeneral.LifeMaxNum; //int LifeReply = 0; // 生命回复 //物理攻击 generalProperty = GetAbilityProperty(userID, generalID, AbilityType.WuLiGongJi); generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraAttack.AdditionWuliNum); gPropertyList.Add(generalProperty); //物理防御 generalProperty = GetAbilityProperty(userID, generalID, AbilityType.WuLiFangYu); generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionWuliNum); gPropertyList.Add(generalProperty); //魂技攻击 generalProperty = GetAbilityProperty(userID, generalID, AbilityType.HunJiGongJi); generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraAttack.AdditionHunjiNum); gPropertyList.Add(generalProperty); //魂技防御 generalProperty = GetAbilityProperty(userID, generalID, AbilityType.HunJiFangYu); generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionHunjiNum); gPropertyList.Add(generalProperty); //魔法攻击 generalProperty = GetAbilityProperty(userID, generalID, AbilityType.MoFaGongJi); generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraAttack.AdditionMofaNum); gPropertyList.Add(generalProperty); //魔法防御 generalProperty = GetAbilityProperty(userID, generalID, AbilityType.MoFaFangYu); generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionMofaNum); gPropertyList.Add(generalProperty); //暴击 gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.BaoJi)); //命中 gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.MingZhong)); //破击 gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.PoJi)); //韧性 gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.RenXing)); //闪避 gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.ShanBi)); //格挡 gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.GeDang)); //必杀 gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.BiSha)); //先攻 gPropertyList.Add(new GeneralProperty() { AbilityType = AbilityType.FirstStrike, AbilityValue = (decimal)TotalPriorityNum(userID, generalID) }); return(gPropertyList); }
public string GenerateFieldsFile(GeneralProperty GeneralProperty, string Namespace, string Language) { CodeCompileUnit ccu = new CodeCompileUnit(); System.CodeDom.CodeNamespace cns = _getNamespace(GeneralProperty, Namespace); CodeTypeDeclaration model = _getType(GeneralProperty); model.CustomAttributes.Add( new CodeAttributeDeclaration("DataEntity", new CodeAttributeArgument(new CodePrimitiveExpression(GeneralProperty.TableName)), new CodeAttributeArgument(new CodePrimitiveExpression(GeneralProperty.UseCache)) ) ); CodeMemberMethod setvalue = new CodeMemberMethod(); setvalue.Attributes = MemberAttributes.Override | MemberAttributes.Family; setvalue.Name = "SetValue"; setvalue.Parameters.Add( new CodeParameterDeclarationExpression(typeof(string), "Key") ); setvalue.Parameters.Add( new CodeParameterDeclarationExpression(typeof(object), "Value") ); int _startIndex = 0; if (GeneralProperty.IsWebUserModel) { _startIndex = 4; } for (int i = _startIndex; i < GeneralProperty.Fields.Count; i++) { var fieldinfo = GeneralProperty.Fields[i]; setvalue.Statements.Add(new CodeConditionStatement( new CodeBinaryOperatorExpression( new CodeArgumentReferenceExpression("Key"), CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression(fieldinfo.Name) ), new CodeAssignStatement( new CodeFieldReferenceExpression( new CodeThisReferenceExpression(), "__" + fieldinfo.Name ), new CodeCastExpression( _addField(fieldinfo, model), new CodeArgumentReferenceExpression("Value") ) ) )); } setvalue.Statements.Add( new CodeExpressionStatement( new CodeMethodInvokeExpression( new CodeBaseReferenceExpression(), "SetValue", new CodeExpression[] { new CodeArgumentReferenceExpression("Key"), new CodeArgumentReferenceExpression("Value") } ) ) ); model.Members.Add(setvalue); cns.Types.Add(model); ccu.Namespaces.Add(cns); Entities.Add(GeneralProperty.ClassName); return(_getString(ccu, Language)); }
public frmFields(GeneralProperty GeneralProperty) { InitializeComponent(); pgMain.SelectedObject = GeneralProperty; }
public override bool TakeAction() { if (!TrumpHelper.IsLearnProperty(ContextUser)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1466_WorshipPropertyNotEnough; return(false); } UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID); if (userTrump == null) { return(false); } UserItemInfo userItem = null; var package = UserItemPackage.Get(ContextUser.UserID); if (package != null) { userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID == userItemID); if (userItem == null || (userItem.ItemType != ItemType.DaoJu && userItem.PropType == 13)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1466_ItemPropertyNotEnough; return(false); } ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(userItem.ItemID); if (itemInfo != null) { GeneralProperty property = null; if (userTrump.PropertyInfo.Count > 0) { property = userTrump.PropertyInfo.Find(m => m.AbilityType == itemInfo.AbilityType); if (property != null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1466_ItemPropertyExite; return(false); } } else { userTrump.PropertyInfo.Clear(); } short baseLv = 1; TrumpPropertyInfo trumpProperty = new ConfigCacheSet <TrumpPropertyInfo>().FindKey(itemInfo.AbilityType, baseLv); if (trumpProperty != null) { property = new GeneralProperty(); property.AbilityType = itemInfo.AbilityType; property.AbilityLv = 1; property.AbilityValue = trumpProperty.PropertyNum; userTrump.PropertyInfo.Add(property); TraceProperty(userTrump); UserItemHelper.UseUserItem(ContextUser.UserID, userItem.ItemID, trumpProperty.ItemNum); var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID); if (usergeneral != null) { usergeneral.RefreshMaxLife(); } ErrorCode = 0; ErrorInfo = LanguageManager.GetLang().St1466_LearningSuccess; } } } return(true); }
public void TestBuild() { var assemblyBuilder = new DynamicAssemblyBuilder("TestAssembly"); var empBuilder = new EntityTypeBuilder("Employee", assemblyBuilder) { Mapping = new EntityMappingAttribute("employee") }; empBuilder.SetCustomAttribute(() => new EntityMappingAttribute("employee")); var empId = new GeneralProperty() { Name = "EmployeeId", Info = new PropertyMapInfo { FieldName = "emp_id", IsPrimaryKey = true, GenerateType = IdentityGenerateType.AutoIncrement }, Type = typeof(int) }; var empName = new GeneralProperty() { Name = "Name", Info = new PropertyMapInfo { FieldName = "name" }, Type = typeof(string) }; var empAge = new GeneralProperty() { Name = "Age", Info = new PropertyMapInfo { FieldName = "age" }, Type = typeof(int?) }; var empSex = new GeneralProperty() { Name = "Sex", Info = new PropertyMapInfo { FieldName = "sex" }, Type = typeof(Sex) }; empBuilder.Properties.Add(empName); empBuilder.Properties.Add(empAge); empBuilder.Properties.Add(empSex); empBuilder.DefineValidateRule(empName, () => new RequiredAttribute()); empBuilder.DefineValidateRule(empName, () => new MaxLengthAttribute(15)); var ordBuilder = new EntityTypeBuilder("Orders", assemblyBuilder); var ordId = new GeneralProperty() { Name = "Id", Info = new PropertyMapInfo { FieldName = "id", IsPrimaryKey = true, GenerateType = IdentityGenerateType.AutoIncrement }, Type = typeof(int) }; var ordOrderDate = new GeneralProperty() { Name = "OrderDate", Info = new PropertyMapInfo { FieldName = "order_date" }, Type = typeof(DateTime) }; var ordEmpId = new GeneralProperty() { Name = "EmployeeId", Info = new PropertyMapInfo { FieldName = "emp_id" }, Type = typeof(int?) }; //Employee的主键是Id,而Orders中外键为EmployeeId,两者不一致,不能自动映射关系 var pext = new PropertyExtension(ordEmpId); pext.SetCustomAttribute(() => new RelationshipAssignAttribute("Id", "EmployeeId")); var ordEmp = new EntityProperty() { Name = "Employee", Type = empBuilder.EntityType, RelationalType = empBuilder.EntityType }; ordBuilder.Properties.Add(ordId); ordBuilder.Properties.Add(ordOrderDate); ordBuilder.Properties.Add(ordEmpId); ordBuilder.Properties.Add(ordEmp); assemblyBuilder.Create(); var assembly = assemblyBuilder.AssemblyBuilder; Assert.AreEqual("Employee", assembly.GetType("Employee").Name); Assert.AreEqual("Orders", assembly.GetType("Orders").Name); using (var db = new DbContext()) { var entityType = assembly.GetType("Employee"); var parExp = Expression.Parameter(entityType, "s"); var memExp = Expression.MakeMemberAccess(parExp, entityType.GetProperty("Sex")); var valExp = Expression.Constant(Sex.M); var binExp = Expression.Equal(memExp, valExp); var lambdaExp = Expression.Lambda(binExp, parExp); var enumerable = (IEnumerable)db.Set(entityType).Where(lambdaExp).Select("Sex", "Name"); foreach (dynamic item in enumerable) { Console.WriteLine(item.Name); } } }
private int GetMaxLife() { int genLv = 0; int currMaxLv = 0; GameUser userinfo = new GameDataCacheSet <GameUser>().FindKey(UserID); if (userinfo != null) { currMaxLv = userinfo.UserLv; } if (currMaxLv > 0 && GeneralLv > currMaxLv) { genLv = userinfo.UserLv; } else { genLv = GeneralLv; } //��ʼ����+(�ȼ�-1)*ְҵ�ӳ� + װ������+����ˮ������+ħ����������+������+��ħ���� int lifeNum = 0; CareerInfo careerInfo = new ConfigCacheSet <CareerInfo>().FindKey(CareerID); if (careerInfo == null) { return(lifeNum); } var tempLv = MathUtils.Subtraction(genLv, 1, 0); if (IsUserGeneral) { lifeNum = MathUtils.Addition(careerInfo.LifeNum, careerInfo.LifeIncreaseNum * tempLv, int.MaxValue); } else { GeneralInfo generalInfo = new ConfigCacheSet <GeneralInfo>().FindKey(GeneralID); if (generalInfo != null) { lifeNum = MathUtils.Addition(generalInfo.LifeNum, careerInfo.LifeIncreaseNum * tempLv, int.MaxValue); } } //����ˮ������ var packageCrystal = UserCrystalPackage.Get(UserID); if (packageCrystal != null && packageCrystal.CrystalPackage != null) { UserCrystalInfo[] crystalList = packageCrystal.CrystalPackage.FindAll(m => m.GeneralID.Equals(GeneralID)).ToArray(); foreach (UserCrystalInfo item in crystalList) { short upLv = 0; if (item.CrystalLv < 10) { upLv = item.CrystalLv; //item.CrystalLv.Addition(1, short.MaxValue); } else { upLv = 10; } //AbilityType abilityType = new ConfigCacheSet<CrystalInfo>().FindKey(item.CrystalID).AbilityID; var cacheSetCrystal = new ConfigCacheSet <CrystalInfo>(); var crystalInfo = cacheSetCrystal.FindKey(item.CrystalID); AbilityType abilityType = crystalInfo != null ? crystalInfo.AbilityID : AbilityType.AttackLife; decimal effectNum = 0; CrystalLvInfo lvInfo = new ConfigCacheSet <CrystalLvInfo>().FindKey(item.CrystalID, upLv); if (lvInfo != null) { effectNum = lvInfo.AbilityNum; } if (abilityType == AbilityType.ShengMing) { lifeNum = MathUtils.Addition(lifeNum, effectNum.ToInt(), int.MaxValue); } } } //װ������ var package = UserItemPackage.Get(UserID); if (package != null && package.ItemPackage != null) { var equList = package.ItemPackage.FindAll(m => !m.IsRemove && m.GeneralID.Equals(GeneralID) && m.ItemStatus.Equals(ItemStatus.YongBing)); foreach (var item in equList) { ItemEquAttrInfo equAttr = new ConfigCacheSet <ItemEquAttrInfo>().FindKey(item.ItemID, AbilityType.ShengMing); if (equAttr != null) { lifeNum = MathUtils.Addition(lifeNum, equAttr.GetEffectNum(item.ItemLv), int.MaxValue); } //��������� var user = new GameDataCacheSet <GameUser>().FindKey(UserID); if (user != null && user.SparePartList != null && user.SparePartList.Count > 0) { var sparepartList = user.SparePartList.FindAll(m => string.Equals(m.UserItemID, item.UserItemID)); foreach (var sparepart in sparepartList) { foreach (var property in sparepart.Propertys) { if (property.AbilityType == AbilityType.ShengMing) { lifeNum = MathUtils.Addition(lifeNum, property.Num.ToInt()); } } } } } } //ħ������������������ var userMagicList = new GameDataCacheSet <UserMagic>().FindAll(UserID, u => u.MagicID != 1); foreach (UserMagic item in userMagicList) { //�����ȼ�Ϊ10�� int mlv = 0; if (item.MagicType == MagicType.MoFaZhen && item.MagicLv > 10) { mlv = 10; } else if (item.MagicType == MagicType.JiNeng && item.MagicLv > currMaxLv) { mlv = currMaxLv; } else { mlv = item.MagicLv; } MagicLvInfo magicLvItem = new ConfigCacheSet <MagicLvInfo>().FindKey(item.MagicID, mlv); if (magicLvItem != null && magicLvItem.AbilityType == AbilityType.ShengMing) { int errNum = magicLvItem.EffectNum.ToInt(); lifeNum = MathUtils.Addition(lifeNum, errNum, int.MaxValue); } } // Ӷ���øжȵȼ��ӳ����� FeelLvInfo fellLvInfo = new ConfigCacheSet <FeelLvInfo>().FindKey(FeelLv); if (fellLvInfo != null && fellLvInfo.Property != null) { GeneralProperty property = fellLvInfo.Property.Find(m => m.AbilityType.Equals(AbilityType.ShengMing)); if (property != null) { int effectNum = property.AbilityValue.ToInt(); lifeNum = MathUtils.Addition(lifeNum, effectNum, int.MaxValue); } } //���������ӳ� UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(UserID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.LiftNum > 0 && GeneralID == LanguageManager.GetLang().GameUserGeneralID) { TrumpInfo trumpInfo = new ConfigCacheSet <TrumpInfo>().FindKey(TrumpInfo.CurrTrumpID, userTrump.TrumpLv); if (trumpInfo != null && trumpInfo.Property != null && trumpInfo.Property.Count > 0) { int maxMatureNum = ConfigEnvSet.GetInt("Trump.MaxMatrueNum"); decimal mature = (decimal)userTrump.MatureNum / maxMatureNum; GeneralProperty property = trumpInfo.Property.Find(m => m.AbilityType == AbilityType.ShengMing); if (property != null) { lifeNum = MathUtils.Addition(lifeNum, (int)Math.Floor(mature * property.AbilityValue)); } } if (userTrump.PropertyInfo.Count > 0) { GeneralProperty property = userTrump.PropertyInfo.Find(m => m.AbilityType == AbilityType.ShengMing); if (property != null) { lifeNum = MathUtils.Addition(lifeNum, (int)property.AbilityValue); } } } //��ħ���� var itempackage = UserItemPackage.Get(UserID); var enchantPackage = UserEnchant.Get(UserID); if (itempackage != null && itempackage.ItemPackage != null && enchantPackage != null && enchantPackage.EnchantPackage != null) { var useritem = itempackage.ItemPackage.Find(m => !m.IsRemove && m.GeneralID == GeneralID && m.Equparts == EquParts.WuQi); if (useritem != null) { var enchantList = enchantPackage.EnchantPackage.FindAll(m => m.UserItemID == useritem.UserItemID && m.AbilityType == AbilityType.ShengMing); foreach (var info in enchantList) { EnchantLvInfo enchantLvInfo = new ConfigCacheSet <EnchantLvInfo>().FindKey(info.EnchantID, info.EnchantLv); if (enchantLvInfo != null) { int maxEnchantMature = ConfigEnvSet.GetInt("Enchant.MaxEnchantMature"); decimal growthrate = enchantLvInfo.Num * info.MaxMature / maxEnchantMature * info.EnchantLv; lifeNum = MathUtils.Addition(lifeNum, (int)growthrate); } } } } //Ӷ���������� if (Attribute.Count > 0) { var generalPro = Attribute.Find(s => s.AbilityType == AbilityType.ShengMing); if (generalPro != null) { lifeNum = MathUtils.Addition(lifeNum, generalPro.AbilityValue.ToInt()); } } return(lifeNum); }