Exemplo n.º 1
0
 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     info.AddValue(nameof(_bankTransform), _bankTransform);
     info.AddValue(nameof(Config), ItemPool.GetAssetLocation(Config));
 }
Exemplo n.º 2
0
 protected virtual UIItemDragDrop SpawnPrefab()
 {
     return(ItemPool.SpawnUIPrefab <UIItemDragDrop>(StringConst.ItemDragDrop, _grid));
 }
Exemplo n.º 3
0
 public CosmeticFlightBanking(SerializationInfo info, StreamingContext context)
 {
     _bankTransform = info.GetValue(nameof(_bankTransform), _bankTransform);
     Config         = ItemPool.LoadAsset <FlightControlConfig>(info.GetValue(nameof(Config), ""));
 }
Exemplo n.º 4
0
        public static void Spawn(string text, float duration, Vector3 start, Vector3 end)
        {
            var spawn = ItemPool.Spawn <FloatingText>("UI/FloatingTextStandard", start, Quaternion.identity, true, false);

            spawn.StartText(text, duration, end);
        }
Exemplo n.º 5
0
 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     info.AddValue(nameof(Config), ItemPool.GetAssetLocation(Config));
     info.AddValue(nameof(CurrentMode), CurrentMode);
     info.AddValue(nameof(EnginesActivated), EnginesActivated);
 }
Exemplo n.º 6
0
        public static void Damage(float amount, Vector3 start)
        {
            var spawn = ItemPool.Spawn <FloatingText>("UI/FloatingTextDamage", start, Quaternion.identity, true, false);

            spawn.StartText(amount.ToString("F0"), 4f, start + DefaultEnd);
        }
Exemplo n.º 7
0
        public static void Message(string message, Vector3 start)
        {
            var spawn = ItemPool.Spawn <FloatingText>("UI/FloatingTextStandard", start, Quaternion.identity, true, false);

            spawn.StartText(message, 4f, start + DefaultEnd);
        }
Exemplo n.º 8
0
 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     info.AddValue(nameof(Value), ItemPool.GetAssetLocation(Value));
 }
Exemplo n.º 9
0
 public ActionFxComponent(SerializationInfo info, StreamingContext context)
 {
     ItemPool.LoadAsset <ActionFx>(info.GetValue(nameof(Value), ""), a => Value = a);
 }
Exemplo n.º 10
0
 public FakeFlightEngine(SerializationInfo info, StreamingContext context)
 {
     ItemPool.LoadAsset <FakeFlightEngineConfig>(info.GetValue(nameof(Config), ""), a => Config = a);
 }
Exemplo n.º 11
0
        IEnumerator Despawn()
        {
            yield return(_time);

            ItemPool.Despawn(gameObject);
        }
Exemplo n.º 12
0
        public static Entity CreateItem(ItemConfig data, int level)
        {
            var entity = Entity.New(data.ID);

            entity.Add(new TypeId(data.ID));
            if (!string.IsNullOrEmpty(data.Icon))
            {
                entity.Add(new IconComponent(ItemPool.LoadAsset <Sprite>(UnityDirs.ItemIcons, data.Icon)));
            }
            else
            {
                entity.Add(new IconComponent(SpriteDatabase.Item));
            }
            entity.Add(new EntityLevelComponent(level));
            if (data.TypeComponents != null)
            {
                World.Get <DataFactory>().AddComponentList(entity, data.Data, data.TypeComponents);
            }
            if (data.Components != null)
            {
                World.Get <DataFactory>().AddComponentList(entity, data.Data, data.Components);
            }
            ItemModifierFactory.AddModifiers(data.ModifierGroup, level, entity);
            StringBuilder sbName  = new StringBuilder();
            StringBuilder sbDescr = new StringBuilder();

            sbDescr.Append(data.Description);
            var prefix = entity.Get <ItemModifierPrefix>();
            var suffix = entity.Get <ItemModifierSuffix>();

            if (prefix != null)
            {
                var prefixLabel = prefix.Data.TryGetValue(DatabaseFields.Name, "");
                if (!string.IsNullOrEmpty(prefixLabel))
                {
                    sbName.Append(prefixLabel);
                    sbName.Append(" ");
                }
                var prefixDescr = prefix.Data.TryGetValue(DatabaseFields.Description, "");
                if (!string.IsNullOrEmpty(prefixDescr))
                {
                    sbDescr.NewLine();
                    sbDescr.Append(prefixDescr);
                }
            }

            sbName.Append(data.Name);
            if (suffix != null)
            {
                var suffixLabel = suffix.Data.TryGetValue(DatabaseFields.Name, "");
                if (!string.IsNullOrEmpty(suffixLabel))
                {
                    sbName.Append(" ");
                    sbName.Append(suffixLabel);
                }
                var suffixDescr = suffix.Data.TryGetValue(DatabaseFields.Description, "");
                if (!string.IsNullOrEmpty(suffixDescr))
                {
                    sbDescr.NewLine();
                    sbDescr.Append(suffixDescr);
                }
            }
            entity.Add(new LabelComponent(sbName.ToString()));
            entity.Add(new DescriptionComponent(sbDescr.ToString()));
            var dataDescr = entity.Add(new DataDescriptionComponent());

            entity.Post(new DataDescriptionAdded(dataDescr));
            return(entity);
        }