コード例 #1
0
        /// <summary>
        /// Initialize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoItem item)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Stack size",
                                                                     item.MaxItemsPerStack.ToString()));
            }
            if (ProtoEntity is IProtoItemWithDurability itemWithDurability)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Durability max",
                                                                     itemWithDurability.DurabilityMax));
            }
            if (ProtoEntity is IProtoItemOrganic itemOrganic)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Organic value",
                                                                     itemOrganic.OrganicValue));
            }
            if (ProtoEntity is IProtoItemFuel itemFuel)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Fuel amount",
                                                                     itemFuel.FuelAmount));
            }
            if (ProtoEntity is IProtoItemLiquidStorage liquidStorage)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Capacity",
                                                                     liquidStorage.Capacity));
                EntityInformation.Add(new ViewModelEntityInformation("Liquid type",
                                                                     liquidStorage.LiquidType.ToString()));
            }
        }
コード例 #2
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is TechGroup techGroup)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Tier", techGroup.Tier.ToString()));
                EntityInformation.Add(new ViewModelEntityInformation("LP to unlock", techGroup.LearningPointsPrice));
                if (techGroup.GroupRequirements?.Count > 0)
                {
                    foreach (BaseTechGroupRequirement groupRequirement in techGroup.GroupRequirements)
                    {
                        switch (groupRequirement)
                        {
                        case BaseTechGroupRequirementGroupUnlocked requirementGroup:
                            EntityInformation.Add(new ViewModelEntityInformation(
                                                      "Require " + (requirementGroup.GroupNodesUnlockedPercent * 100) + "%",
                                                      EntityViewModelsManager.GetEntityViewModel(requirementGroup.Group)));
                            break;
                        }
                    }
                }
                if (techGroup.AllNodes?.Count > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Contains nodes",
                                                                         techGroup.AllNodes.Select(EntityViewModelsManager.GetEntityViewModel)));
                }
            }
        }
コード例 #3
0
        public void Update(EntityInformation entityInformation, AbnormalityStorage abnormals)
        {
            EnduranceAbnormality.Items.Clear();
            if (entityInformation == null)
            {
                return;
            }
            if (entityInformation.Interval == 0)
            {
                return;
            }

            EnduranceAbnormality.Items.Add(_header);

            var count = 0;

            foreach (var abnormality in abnormals.Get(entityInformation.Entity))
            {
                EnduranceDebuff abnormalityUi;
                if (_enduranceDebuffsList.Count > count)
                {
                    abnormalityUi = _enduranceDebuffsList[count];
                }
                else
                {
                    abnormalityUi = new EnduranceDebuff();
                    _enduranceDebuffsList.Add(abnormalityUi);
                }

                abnormalityUi.Update(abnormality.Key, abnormality.Value, entityInformation.BeginTime, entityInformation.EndTime);
                EnduranceAbnormality.Items.Add(abnormalityUi);
                count++;
            }
        }
コード例 #4
0
        private string GenerateSetClause(EntityInformation info)
        {
            var primaryKeys  = info.PrimaryKeys.Select(pk => pk.Property).ToList();
            var columnsToSet = info.Columns.Where(column => !primaryKeys.Contains(column.Property) && column.HasSetter);

            return(string.Join(", ", columnsToSet.Select(column => $"{column.ColumnName} = @{column.Name}")));
        }
コード例 #5
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoItemToolLight light)
            {
                if (light.ItemLightConfig?.IsLightEnabled == true)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Light size", "(" +
                                                                         light.ItemLightConfig.Size.X + ", " +
                                                                         light.ItemLightConfig.Size.Y + ")"));
                }

                if (light.ItemFuelConfig != null)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Fuel initial",
                                                                         light.ItemFuelConfig.FuelAmountInitial));
                    EntityInformation.Add(new ViewModelEntityInformation("Fuel max",
                                                                         light.ItemFuelConfig.FuelCapacity));
                    EntityInformation.Add(new ViewModelEntityInformation("Fuel use",
                                                                         light.ItemFuelConfig.FuelUsePerSecond));
                    if (light.ItemFuelConfig.FuelProtoItemsList?.Count > 0)
                    {
                        EntityInformation.Add(new ViewModelEntityInformation("Compatible fuel",
                                                                             light.ItemFuelConfig.FuelProtoItemsList.Select(EntityViewModelsManager
                                                                                                                            .GetEntityViewModel)));
                    }
                }
            }
        }
コード例 #6
0
ファイル: ProtoItemAmmoViewModel.cs プロジェクト: Djekke/CNEI
        /// <summary>
        /// Initialize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoItemAmmo ammo && ammo.DamageDescription != null)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Range",
                                                                     ammo.DamageDescription.RangeMax));
                EntityInformation.Add(new ViewModelEntityInformation("Damage value",
                                                                     ammo.DamageDescription.DamageValue));
                EntityInformation.Add(new ViewModelEntityInformation("Armor piercing coefficient",
                                                                     ammo.DamageDescription.ArmorPiercingCoef));
                EntityInformation.Add(new ViewModelEntityInformation("Final damage multiplier",
                                                                     ammo.DamageDescription.FinalDamageMultiplier));

                if (ammo.DamageDescription?.DamageProportions.Count > 0)
                {
                    foreach (DamageProportion proportion in ammo.DamageDescription.DamageProportions)
                    {
                        EntityInformation.Add(new ViewModelEntityInformation("Damage by " + proportion.DamageType,
                                                                             (proportion.Proportion * 100) + "%"));
                    }
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoItemFood food)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Stay fresh",
                                                                     food.FreshnessDuration == TimeSpan.Zero
                        ? "forever"
                        : ClientTimeFormatHelper.FormatTimeDuration(food.FreshnessDuration)));
                if (Math.Abs(food.FoodRestore) > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Food restore", food.FoodRestore));
                }
                if (Math.Abs(food.WaterRestore) > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Water restore", food.WaterRestore));
                }
                if (Math.Abs(food.HealthRestore) > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Health restore", food.HealthRestore));
                }
                if (Math.Abs(food.StaminaRestore) > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Stamina restore", food.StaminaRestore));
                }
            }

            // TODO: Rework this.
            // Hardcoded information
            AddStatusEffectsInformation();
        }
コード例 #8
0
ファイル: ObjectCorpseViewModel.cs プロジェクト: ash2005/CNEI
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            EntityInformation.Add(new ViewModelEntityInformation("Disapear after",
                                                                 TimeSpan.FromSeconds(ObjectCorpse.CorpseTimeoutSeconds)));
        }
コード例 #9
0
        public Buff(PlayerDamageDealt playerDamageDealt, PlayerAbnormals buffs, EntityInformation entityInformation)
        {
            InitializeComponent();
            _header      = new EnduranceDebuffHeader();
            ContentWidth = 1020;

            EnduranceAbnormality.Items.Clear();
            EnduranceAbnormality.Items.Add(_header);
            var counter = 0;

            foreach (var abnormality in buffs.Times.Where(x => x.Value.Duration(playerDamageDealt.BeginTime, playerDamageDealt.EndTime) > 0))
            {
                EnduranceDebuff abnormalityUi;
                if (_enduranceDebuffsList.Count > counter)
                {
                    abnormalityUi = _enduranceDebuffsList[counter];
                }
                else
                {
                    abnormalityUi = new EnduranceDebuff();
                    _enduranceDebuffsList.Add(abnormalityUi);
                }
                abnormalityUi.Update(abnormality.Key, abnormality.Value, playerDamageDealt.BeginTime, playerDamageDealt.EndTime);
                EnduranceAbnormality.Items.Add(abnormalityUi);

                counter++;
            }
        }
コード例 #10
0
        public override void Update(GameTime gameTime)
        {
            if (GetInformation != null)
            {
                Information = GetInformation();
            }

            if (GetRectangle != null)
            {
                Rectangle = GetRectangle();
            }

            if (GameMouse.Intersects(Rectangle))
            {
                OnHover?.Invoke();
                IsHover = true;

                if (GameMouse.IsLeftClicked)
                {
                    OnSelected?.Invoke();
                    IsSelected = true;
                }
            }
            else
            {
                OffHover.Invoke();
                IsHover = false;

                if (GameMouse.IsLeftClicked && !GameKeyboard.IsKeyDown(Keys.LeftShift))
                {
                    OffSelected?.Invoke();
                    IsSelected = false;
                }
            }
        }
コード例 #11
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is ProtoItemMedical medical)
            {
                //EntityInformation.Add(new ViewModelEntityInformation("Medical toxicity", medical.MedicalToxicity));
                if (Math.Abs(medical.FoodRestore) > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Food restore", medical.FoodRestore));
                }
                if (Math.Abs(medical.WaterRestore) > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Water restore", medical.WaterRestore));
                }
                if (Math.Abs(medical.HealthRestore) > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Health restore", medical.HealthRestore));
                }
                if (Math.Abs(medical.StaminaRestore) > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Stamina restore", medical.StaminaRestore));
                }
                if (medical.MedicalToxicity > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Add effect",
                                                                         EntityViewModelsManager.GetEntityViewModelByType <StatusEffectMedicineOveruse>(),
                                                                         medical.MedicalToxicity));
                }
            }

            // TODO: Rework this.
            // Hardcoded information
            AddStatusEffectsInformation();
        }
コード例 #12
0
        /// <summary>
        /// Initialize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoItemFood food)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Stay fresh",
                                                                     food.FreshnessDuration == TimeSpan.Zero
                        ? "forever"
                        : ClientTimeFormatHelper.FormatTimeDuration(food.FreshnessDuration)));
                if (Math.Abs(food.FoodRestore) > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Food restore", food.FoodRestore));
                }
                if (Math.Abs(food.WaterRestore) > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Water restore", food.WaterRestore));
                }
                if (Math.Abs(food.StaminaRestore) > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Stamina restore", food.StaminaRestore));
                }
                foreach (EffectAction effect in food.Effects)
                {
                    EntityInformation.Add(new ViewModelEntityInformation(effect.Intensity > 0 ? "Add effect" : "Remove effect",
                                                                         EntityViewModelsManager.GetEntityViewModel(effect.ProtoStatusEffect), effect.Intensity));
                }
            }
        }
コード例 #13
0
        public EntityInformation ParseEntity(JObject entity)
        {
            var info = new EntityInformation();

            if (entity.Value <string>("Name") is string entityName)
            {
                info.HasName(entityName, entity.Value <string>("PluralName"));
            }

            if (entity.Value <string>("Alias") is string alias)
            {
                info.HasAlias(alias);
            }

            if (entity.Value <string>("Icon") is string icon)
            {
                info.HasIcon(icon, entity.Value <string?>("IconColor"));
            }

            if (entity.Value <string>("Output") is string outputItems)
            {
                info.ShouldOutput(outputItems.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries));
            }

            if (entity.Value <JObject>("Properties") is JObject propsRoot &&
                propsRoot.Value <JArray>("$values") is JArray properties)
            {
                foreach (var property in properties.OfType <JObject>())
                {
                    info.AddProperty(_propertyParser.ParseProperty(info, property));
                }
            }

            return(info);
        }
コード例 #14
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            EntityInformation.Add(new ViewModelEntityInformation("test", "test"));

            if (ProtoEntity is ProtoZoneDefault zoneDefault)
            {
                if (zoneDefault.AttachedScripts != null)
                {
                    Api.Logger.Dev("yes1");
                    foreach (var attachedScript in zoneDefault.AttachedScripts)
                    {
                        EntityInformation.Add(new ViewModelEntityInformation("Attached script",
                                                                             attachedScript.ShortId));
                    }
                }
            }

            if (ProtoEntity is IProtoZone zone)
            {
                EntityInformation.Add(new ViewModelEntityInformation("name",
                                                                     zone.Name));
                if (zone.AttachedScripts != null)
                {
                    Api.Logger.Dev("yes2");
                    foreach (var attachedScript in zone.AttachedScripts)
                    {
                        EntityInformation.Add(new ViewModelEntityInformation("Attached script",
                                                                             attachedScript.ShortId));
                    }
                }
            }
        }
コード例 #15
0
 public IBuilder GetDatabaseBuilder(Entity entity, EntityInformation entityInformation)
 {
     if (string.IsNullOrEmpty(entity.EntityLocation.overrideKey))
     {
         return(new DapperRepositoryBuilder());
     }
     return(_customBuilderResolver.GetCustomBuilderByKey(entity.EntityLocation.overrideKey));
 }
コード例 #16
0
 /// <summary>
 /// Initialize information about entity - invoked after all entity view Models created,
 /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
 /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
 /// </summary>
 public override void InitInformation()
 {
     base.InitInformation();
     if (ProtoEntity is IProtoItemToolWoodcutting axe)
     {
         EntityInformation.Add(new ViewModelEntityInformation("Damage to tree", axe.DamageToTree));
     }
 }
コード例 #17
0
        private string GenerateWhereClauseWithPrimaryKeys(EntityInformation info)
        {
            var primaryKeyProperties = info.PrimaryKeys.Select(pk => pk.Property).ToList();
            var primaryKeys          = info.Columns
                                       .Where(column => primaryKeyProperties.Contains(column.Property));

            return(string.Join(" AND ", primaryKeys.Select(column => $"{_table}.{column.ColumnName} = @{column.Name}")));
        }
コード例 #18
0
ファイル: TechNodeViewModel.cs プロジェクト: Djekke/CNEI
        /// <summary>
        /// Initialize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is TechNode techNode)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Tier", techNode.Group.Tier.ToString()));
                EntityInformation.Add(new ViewModelEntityInformation("LP to unlock", techNode.LearningPointsPrice));
                EntityInformation.Add(new ViewModelEntityInformation("Tech group",
                                                                     EntityViewModelsManager.GetEntityViewModel(techNode.Group)));
                if (techNode.RequiredNode != null)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Required node",
                                                                         EntityViewModelsManager.GetEntityViewModel(techNode.RequiredNode)));
                }
                if (techNode.DependentNodes?.Count > 0)
                {
                    EntityInformation.Add(new ViewModelEntityInformation("Dependent nodes",
                                                                         techNode.DependentNodes.Select(EntityViewModelsManager.GetEntityViewModel)));
                }
                if (techNode.NodeEffects?.Count > 0)
                {
                    List <ProtoEntityViewModel> tempList = new List <ProtoEntityViewModel>();
                    foreach (BaseTechNodeEffect nodeEffect in techNode.NodeEffects)
                    {
                        switch (nodeEffect)
                        {
                        case TechNodeEffectPerkUnlock techNodeEffectPerkUnlock:
                            tempList.Add(
                                EntityViewModelsManager.GetEntityViewModel(techNodeEffectPerkUnlock.Perk));
                            break;

                        case TechNodeEffectRecipeUnlock techNodeEffectRecipeUnlock:
                            tempList.Add(
                                EntityViewModelsManager.GetEntityViewModel(techNodeEffectRecipeUnlock.Recipe));
                            break;

                        case TechNodeEffectStructureUnlock techNodeEffectStructureUnlock:
                            tempList.Add(
                                EntityViewModelsManager.GetEntityViewModel(techNodeEffectStructureUnlock
                                                                           .Structure));
                            break;

                        case TechNodeEffectVehicleUnlock techNodeEffectVehicleUnlock:
                            tempList.Add(
                                EntityViewModelsManager.GetEntityViewModel(techNodeEffectVehicleUnlock
                                                                           .Vehicle));
                            break;

                        default:
                            Api.Logger.Error("CNEI: Unknown TechNodeEffect " + nodeEffect);
                            break;
                        }
                    }
                    EntityInformation.Add(new ViewModelEntityInformation("Unlocks", tempList));
                }
            }
        }
コード例 #19
0
ファイル: Skills.xaml.cs プロジェクト: RatedNoob/REEEEE
 public Skills(PlayerStats parent, PlayerDamageDealt playerDamageDealt, EntityInformation entityInformation, Database.Structures.Skills skills,
               PlayerAbnormals buffs, bool timedEncounter)
 {
     Owner = GetWindow(parent);
     InitializeComponent();
     _parent           = parent;
     ClassImage.Source = ClassIcons.Instance.GetImage(playerDamageDealt.Source.Class).Source; //BasicTeraData.Instance.ImageDatabase.Close.Source;
     Update(playerDamageDealt, entityInformation, skills, buffs, timedEncounter);
 }
コード例 #20
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoItemToolWateringCan wateringCan)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Water capacity", wateringCan.WaterCapacity));
            }
        }
コード例 #21
0
 public Skills(PlayerStats parent, PlayerDamageDealt playerDamageDealt, EntityInformation entityInformation,
               Database.Structures.Skills skills, PlayerAbnormals buffs, bool timedEncounter)
 {
     InitializeComponent();
     _parent                 = parent;
     CloseWindow.Source      = BasicTeraData.Instance.ImageDatabase.Close.Source;
     BackgroundColor.Opacity = BasicTeraData.Instance.WindowData.SkillWindowOpacity;
     Update(playerDamageDealt, entityInformation, skills, buffs, timedEncounter);
 }
コード例 #22
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoObjectTradingStation tradingStation)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Lots count",
                                                                     tradingStation.LotsCount));
            }
        }
コード例 #23
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoItemPowerBank powerBank)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Energy capacity",
                                                                     powerBank.EnergyCapacity));
            }
        }
コード例 #24
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoItemToolMining pickaxe)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Damage to minerals",
                                                                     pickaxe.DamageToMinerals));
            }
        }
コード例 #25
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoObjectVegetation vegetation)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Grow stage count",
                                                                     vegetation.GrowthStagesCount));
            }
        }
コード例 #26
0
        /// <summary>
        /// Initialize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoItemDroneControl droneControl)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Max drones to control",
                                                                     droneControl.MaxDronesToControl));
            }
        }
コード例 #27
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoItemToolToolbox toolbox)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Construction speed multiplier",
                                                                     toolbox.ConstructionSpeedMultiplier));
            }
        }
コード例 #28
0
        /// <summary>
        /// Initialize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is ProtoItemWeaponRangedEnergy weaponRangedEnergy)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Energy use per shot",
                                                                     weaponRangedEnergy.EnergyUsePerShot));
            }
        }
コード例 #29
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoItemSeed seed)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Will grow into",
                                                                     EntityViewModelsManager.GetEntityViewModel(seed.ObjectPlantProto)));
            }
        }
コード例 #30
0
        /// <summary>
        /// Initilize information about entity - invoked after all entity view Models created,
        /// so you can use links to other entity by using <see cref="EntityViewModelsManager.GetEntityViewModel" />
        /// and <see cref="EntityViewModelsManager.GetAllEntityViewModels" />.
        /// </summary>
        public override void InitInformation()
        {
            base.InitInformation();

            if (ProtoEntity is IProtoObjectFloor floor)
            {
                EntityInformation.Add(new ViewModelEntityInformation("Move speed multiplier",
                                                                     floor.CharacterMoveSpeedMultiplier));
            }
        }
コード例 #31
0
 /// <summary>
 /// Initializes the internal mapping table from a base entity Type. Any type in the same assembly as the given type is considered part of the required entities.
 /// </summary>
 /// <param name="typeOfEntitiyAssembly"></param>
 private void InitializeMappings(Type typeOfEntitiyAssembly)
 {
     var types = typeOfEntitiyAssembly.GetTypeInfo().Assembly.DefinedTypes;
     var entities = new List<EntityInformation>();
     foreach (var typeInfo in types)
     {
         var att = typeInfo.GetCustomAttribute<EntityAttribute>();
         if (att != null)
         {
             var info = new EntityInformation()
             {
                 EntityType = typeInfo.AsType(),
             };
             // find out if any of the properties has a foreignkey attribute
             entities.Add(info);
         }
     }
     _entities = entities;
 }