public List <CollectibleItem> ConvertAssetsToCollectibleItems(CollectionPointAssets assets)
        {
            var output = new List <CollectibleItem>();

            if (assets != null)
            {
                foreach (var asset in assets.ImageAssets)
                {
                    var image = new CollectibleItem();
                    image.Id         = asset.Id == Guid.Empty ? null : asset.Id.ToString();
                    image.ImageUrl   = GenerateImageUrl(asset.Data.ImageAsset?.Iv.FirstOrDefault());
                    image.ValuePairs = Mapper.Map <Dictionary <string, int> >(asset.Data.Values?.Iv);
                    image.Caption    = asset.Data.Caption?.Iv;
                    image.Credit     = asset.Data.Credit?.Iv;
                    if (asset.Data?.ShopifyIcon != null)
                    {
                        image.IconUrl = GenerateImageUrl(asset.Data.ShopifyIcon?.Iv.FirstOrDefault());
                    }
                    output.Add(image);
                }

                foreach (var asset in assets.QuoteAssets)
                {
                    var quote = new CollectibleItem();
                    quote.Id         = asset.Id == Guid.Empty ? null : asset.Id.ToString();
                    quote.ValuePairs = Mapper.Map <Dictionary <string, int> >(asset.Data.Values?.Iv);
                    if (asset.Data?.ShopifyIcon != null)
                    {
                        quote.IconUrl = GenerateImageUrl(asset.Data.ShopifyIcon?.Iv.FirstOrDefault());
                    }
                    output.Add(quote);
                }
            }
            return(output);
        }
Ejemplo n.º 2
0
 public Location GetLocationByItem(CollectibleItem item)
 {
     using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
     {
         return(conn.Table <Location>().Where(x => item.Location.Contains(x.LocationName)).FirstOrDefault());
     }
 }
Ejemplo n.º 3
0
    void OnGUI()
    {
        //draw stuff
        if (IsInsideMenuArea())
        {
            exitArea = true;
        }

        if (exitArea)
        {
            if (fadingIn)
            {
                StartFadingIn();
            }
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), blackTexture);
        }

        if (fadingOut)                  //fading in to black is finished
        {
            CollectibleItem.resetCollectedItems();
            fadingOut = false;
            if (_once)
            {
                return;
            }
            _once = true;
            SceneManager.LoadScene("Launcher");
        }
    }
Ejemplo n.º 4
0
    public ItemSlot TakeItem(CollectibleItem item)
    {
        if (item == null)
        {
            return(null);
        }

        WeaponSlot weapon = WeaponsSlots.Find(lambdaExpression =>
                                              lambdaExpression.BulletType == item.ItemType);

        if (weapon != null)
        {
            AddAmmo(weapon, item.Quantity);
            return(null);
        }

        if (item.ItemType == ItemType.Nothing)
        {
            return(null);
        }

        if (item.ItemInstance == null && !item.Unequipable)
        {
            return(null);
        }

        return(AddItem(item));
    }
Ejemplo n.º 5
0
        private void CheckBox_CheckedChanged(object sender, CheckedChangedEventArgs e)
        {
            var             cis         = new CollectibleItemsService();
            var             itemChecked = (CheckBox)sender;
            CollectibleItem item        = itemChecked.BindingContext as CollectibleItem;

            cis.UpdateItemCheck(itemChecked.IsChecked, item);
        }
Ejemplo n.º 6
0
    //Spawn new object in the slot
    public void ChangeItem(ItemObject item)
    {
        var obj = Instantiate(item.Prefab, gameObject.transform.position, Quaternion.identity, gameObject.transform);

        obj.GetComponent <Rigidbody>().isKinematic = true;
        obj.GetComponent <Collider>().enabled      = false;
        _storedItem         = obj.GetComponent <CollectibleItem>();
        _storedItem.enabled = false;
    }
Ejemplo n.º 7
0
 public void UpdateItemCheck(bool check, CollectibleItem item)
 {
     using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
     {
         var result = conn.Table <CollectibleItem>().Where(x => x.ID == item.ID).FirstOrDefault();
         result.Check = check;
         conn.Update(result);
     }
 }
Ejemplo n.º 8
0
        public CollectibleItemPage(CollectibleItem item)
        {
            Item = item;
            InitializeComponent();
            var cis = new CollectibleItemsService();

            ItemLocation        = cis.GetLocationByItem(Item);
            this.BindingContext = new CollectibleItemViewModel(Item);
        }
Ejemplo n.º 9
0
    // Unsnap stored item's gameObject
    public void UnsnapItem()
    {
        _storedItem.enabled = true;

        _storedItem.gameObject.GetComponent <MouseMoveableObj>().Toggle(true);
        _storedItem.gameObject.transform.parent = null;
        _storedItem.gameObject.GetComponent <Rigidbody>().isKinematic = false;
        _storedItem = null;
    }
Ejemplo n.º 10
0
 public void FillItem(CollectibleItem item)
 {
     name         = item.Name;
     Description  = item.Description;
     quantity     = item.Quantity;
     id           = item.Id;
     type         = item.ItemType;
     Unequipable  = item.Unequipable;
     itemInstance = item.ItemInstance;
     RenderItem();
 }
Ejemplo n.º 11
0
 public int CheckItem(CollectibleItem itemType)
 {
     if (Inventory.ContainsKey(itemType))
     {
         return(Inventory[itemType].Count);
     }
     else
     {
         return(0);
     }
 }
Ejemplo n.º 12
0
 // Check if there is free space for the item and set appropriate material as highlight
 public void CheckPlace(CollectibleItem collectibleItem)
 {
     _hasPlace = _backpack.CheckPlace(collectibleItem.Item, collectibleItem.ItemAmount);
     if (_hasPlace)
     {
         _meshRenderer.material = greenMaterial;
     }
     else
     {
         _meshRenderer.material = redMaterial;
     }
 }
Ejemplo n.º 13
0
 public override void Damage(float amount)
 {
     base.Damage(amount);
     if (curHealth <= 0)
     {
         BlockingDoor.isBossDefeated = true;
         for (int i = 0; i < 3; i++)
         {
             CollectibleItem item = Instantiate(keyPrefab, transform.position, Quaternion.identity);
         }
     }
 }
Ejemplo n.º 14
0
        public CollectibleItemViewModel(CollectibleItem item)
        {
            Item = item;
            var cis          = new CollectibleItemsService();
            var itemLocation = cis.GetLocationByItem(Item);

            if (itemLocation == null)
            {
                return;
            }
            HasLocationLink = true;
        }
Ejemplo n.º 15
0
    void OnGUI()
    {
        int dist           = 10;
        int left           = marginLeft;
        int collectedItems = CollectibleItem.getCollectedItems();

        if (collectedItems > 0)
        {
            GUI.DrawTexture(new Rect(left, marginTop, texW, texH), tex);
            left = left + texW + dist;
            GUI.Label(new Rect(left, marginTop + 5, 200, texH), " x " + collectedItems, counterStyle);
        }
    }
Ejemplo n.º 16
0
    public void OnReceived(EBEvent e)
    {
        switch (e.type)
        {
        case EBEventType.RoomSpawningTrigger:
            RoomSpawningTriggerEvent rstee = (e as RoomSpawningTriggerEvent);
            if (rstee.action == TriggerAction.Enter)
            {
                if ((rstee.roomEntryId == id) && spawningEnabled)
                {
                    roomsManager.DisableAllRoomScenes();
                    RoomScene room = roomsManager.GetRandomRoomScene();
                    AttachRoom(room);
                    SetSpawningEnabled(false);

                    room.ClearCollectibles();
                    Transform itemPlace = room.GetCollectiblePlaceholder();
                    if (itemPlace != null)
                    {
                        CollectibleItem item = itemsManager.GetItem();
                        if (item != null)
                        {
                            item.transform.parent   = itemPlace;
                            item.transform.position = itemPlace.position;
                            item.transform.rotation = itemPlace.rotation;
                            item.SetRoomScene(room);
                            item.gameObject.SetActive(true);
                        }
                    }
                }

                if (rstee.roomEntryId != id)
                {
                    SetSpawningEnabled(true);
                }
            }
            break;

        case EBEventType.DoorClosingTrigger:
            DoorClosingTriggerEvent dcte = (e as DoorClosingTriggerEvent);
            if ((dcte.roomEntryId == id) && (dcte.action == TriggerAction.Exit))
            {
                CloseDoor();
            }
            break;

        case EBEventType.HallMovingTriggerEntered:
            CloseDoor();
            break;
        }
    }
Ejemplo n.º 17
0
    public bool Pick(CollectibleItem item)
    {
        if (items.Count < sizeLimit)
        {
            items.Add(item);
            Debug.Log(items.Count);

            UpdateInventoryLabel(item.itemType, 1);

            return(true);
        }

        return(false);
    }
Ejemplo n.º 18
0
    /// <summary>
    /// Spawned function that takes Player's GUID to spawn collectible.
    /// </summary>
    /// <param name="withGuid">GUID of player to whom collectible is being spawned.</param>
    /// <returns>Spawned collectible script object.</returns>
    public CollectibleItem spawnCollectible(System.Guid withGuid)
    {
        if (collectiblesPrefab.Count == 0)
        {
            return(null);
        }
        Vector2 randNormalizedPt = Random.insideUnitCircle;
        Vector3 spawnLoc         = new Vector3(spawnZone.center.x + (spawnZone.extents.x * randNormalizedPt.x),
                                               spawnZone.center.y + (spawnZone.extents.y * randNormalizedPt.y), 0);
        GameObject      go   = Instantiate(collectiblesPrefab[Random.Range(0, collectiblesPrefab.Count)], spawnLoc, Quaternion.identity);
        CollectibleItem item = go.GetComponent <CollectibleItem>();

        item.userId = withGuid;
        return(item);
    }
Ejemplo n.º 19
0
    void Awake()
    {
        instance = this;

        GameObject keysObject = Instantiate(keyPrefab);

        keysObject.SetActive(false);
        keys = keysObject.GetComponent <CollectibleItem>();

        booksPool = new CollectibleItem[bookPrefabs.Length];
        for (int i = 0; i < bookPrefabs.Length; ++i)
        {
            GameObject book = Instantiate(bookPrefabs[i]);
            book.SetActive(false);
            booksPool[i] = book.GetComponent <CollectibleItem>();
        }
    }
Ejemplo n.º 20
0
    // Add collcetible to inventory
    public void AddItem(CollectibleItem collectibleItem)
    {
        // Add item to inventory
        _backpack.AddItem(collectibleItem.Item, collectibleItem.ItemAmount);
        _meshRenderer.material = defaultMaterial;

        // Get potential item-slnapping-slot
        var backpackSlot = GetBackpackSlot(collectibleItem.Item.Type);

        if (backpackSlot.isEmpty)
        {
            backpackSlot.SnapItem(collectibleItem);
            return;
        }

        // if we do not snap object, then put it in inventory and destroy gameObject
        Destroy(collectibleItem.gameObject);
    }
Ejemplo n.º 21
0
        public async Task <IActionResult> PutCollectibleItem(int id, CollectibleItem collectibleItem)
        {
            if (id != collectibleItem.Id)
            {
                return(BadRequest());
            }

            if (await _service.GetEntity(id) == null)
            {
                await _service.InsertEntity(collectibleItem);
            }
            else
            {
                await _service.UpdateEntity(collectibleItem);
            }

            return(NoContent());
        }
Ejemplo n.º 22
0
    public bool Drop(CollectibleItem item, DropHandler handler = null)
    {
        if (item != null)
        {
            if (handler != null)
            {
                handler.Invoke(item);
            }
            UpdateInventoryLabel(item.itemType, -1);

            items.Remove(item);
            return(true);
        }
        else
        {
            return(false);
        }
    }
        private static List <CollectibleItem> GetExpectedCollectabileItems()
        {
            List <CollectibleItem> expected = new List <CollectibleItem>();
            var item = new CollectibleItem()
            {
                Id         = "c8ad4314-fd8b-4200-994c-366bfd87ae12",
                Credit     = "Thank you tamar",
                Caption    = "Tamar test",
                IconUrl    = null,
                ValuePairs = new Dictionary <string, int>()
                {
                    { "hope", 1 }, { "Fait", 2 }, { "Unity", 3 }
                },
                ImageUrl = "https://cloud.squidex.io/api/assets/fldc-prod/c8ad4314-fd8b-4200-994c-366bfd87ae13"
            };

            expected.Add(item);
            return(expected);
        }
Ejemplo n.º 24
0
    // Snaps item's gameObject to the slot point
    public void SnapItem(CollectibleItem item)
    {
        item.gameObject.transform.parent = gameObject.transform;
        // Set isKinematic=false so the item won't fall
        item.gameObject.GetComponent <Rigidbody>().isKinematic = true;

        // Set target for magnite movement and enable movement
        var tmp = item.gameObject.GetComponent <MagnetMovement>();

        tmp.Target  = gameObject;
        tmp.enabled = true;

        // Turn Mouse Drag&drop off
        item.gameObject.GetComponent <MouseMoveableObj>().Toggle(false);
        // Turn collectible off
        item.enabled = false;

        // Save stored item ref
        _storedItem = item;
    }
Ejemplo n.º 25
0
    private ItemSlot AddItem(CollectibleItem item)
    {
        var inventoryItem = ItensSlots.Find(lambdaExpression => lambdaExpression.Type == item.ItemType);

        if (inventoryItem != null)
        {
            inventoryItem.Quantity += item.Quantity;
            inventoryItem.RenderItem();
            return(inventoryItem);
        }
        for (int i = 0; i < ItensSlots.Count; i++)
        {
            if (ItensSlots[i].Type == ItemType.Nothing)
            {
                ItensSlots[i].FillItem(item);
                return(ItensSlots[i]);
            }
        }
        return(null);
    }
Ejemplo n.º 26
0
    bool Collisions(Vector3Int direction)
    {
        Vector3Int newPosition = new Vector3Int((int)transform.position.x, (int)transform.position.y, (int)transform.position.z) + direction;

        Tile tileToMoveTo = Level.GetTileAt(newPosition.x, newPosition.y);

        if (tileToMoveTo.Type == TileType.WALL)
        {
            return(true);
        }
        else if (tileToMoveTo.itemOnTop != null)
        {
            switch (tileToMoveTo.itemOnTop.tag)
            {
            case "MovableItem":
                MovableItem item = tileToMoveTo.itemOnTop.GetComponent <MovableItem>();
                // You add direction again because this is what the item will be moving to. Basically checking your position + 2
                if (item.CanMoveItem(newPosition + direction))
                {
                    // If you can move the item that direction then move it and move character
                    item.MoveItem(newPosition + direction);
                }
                else
                {
                    // If you can't move the item that direction then don't do anything
                    return(true);
                }
                break;

            case "CollectibleItem":
                CollectibleItem collectible = tileToMoveTo.itemOnTop.GetComponent <CollectibleItem>();

                collectible.CollectItem();
                break;
            }
        }

        return(false);
    }
Ejemplo n.º 27
0
 public void GainItem(CollectibleItem itemType, Collectible collectible)
 {
     if (Inventory.ContainsKey(itemType))
     {
         Inventory[itemType].Add(collectible);
         UpdateUI();
     }
     else
     {
         Inventory.Add(itemType, new List <Collectible>());
         Inventory[itemType].Add(collectible);
     }
     if (Inventory.ContainsKey(CollectibleItem.Medkit))
     {
         List <Collectible> medkits = Inventory[CollectibleItem.Medkit];
         while (medkits.Count > 0)
         {
             Medkit medkit = medkits[0] as Medkit;
             Director.Instance.PlayerHealth.HealthSync += medkit.HealAmount;
             medkits.Remove(medkit);
         }
     }
     UpdateUI();
 }
Ejemplo n.º 28
0
        public async Task <ActionResult <CollectibleItem> > PostCollectibleItem(CollectibleItem collectibleItem)
        {
            await _service.InsertEntity(collectibleItem);

            return(CreatedAtAction("GetCollectibleItem", new { id = collectibleItem.Id }, collectibleItem));
        }
Ejemplo n.º 29
0
 public void BurnWood(CollectibleItem item)
 {
     heat = maxHeat;
     Debug.Log("Heat is now " + heat);
 }
Ejemplo n.º 30
0
 public void Shroomerge(CollectibleItem item)
 {
     size += item.ShroomGrowth;
     Debug.Log("Mushroom is now size " + size);
 }