Exemple #1
0
 void copyHPacksToUserPrefs()
 {
     for (int i = 0; i < grids[1].itemArray.Count; i++)
     {
         HealthUIObject h = (HealthUIObject)grids[1].itemArray[i];
         DBAccess.instance.userPrefs.hPacks.Insert(i, h.hPack);
     }
 }
Exemple #2
0
    void updateText(SuppliesUIObject sup)
    {
        Type g = typeof(GunUIObject);
        Type h = typeof(HealthUIObject);

        switch (sup.supplyType)
        {
        case SuppliesUIObject._SupplyType.Gun:
            if (g == sup.GetType())
            {
                gun = (GunUIObject)sup;
                switch (gameObject.name)
                {
                case "Item Power":
                    thisLabel.text = "Power : " + gun.gunObj.power;
                    break;

                case "Item Type":
                    thisLabel.text = gun.gunObj.model;
                    break;

                case "Item RPM":
                    thisLabel.text = "firespeed : " + gun.gunObj.firingRate;
                    break;

                default:
                    break;
                }
            }
            break;

        case SuppliesUIObject._SupplyType.Health:
            if (h == sup.GetType())
            {
                health = (HealthUIObject)sup;
                switch (gameObject.name)
                {
                case "Item Power":
                    thisLabel.text = "Health : " + health.hPack.power;
                    break;

                case "Item Type":
                    thisLabel.text = health.hPack.model;
                    break;

                case "Item RPM":
                    thisLabel.text = "Quantity : " + health.hPack.quantity;
                    break;

                default:
                    break;
                }
            }
            break;

        default: break;
        }
    }
    void updateText( SuppliesUIObject sup )
    {
        Type g = typeof(GunUIObject);
        Type h = typeof(HealthUIObject);

        switch( sup.supplyType )
        {
            case SuppliesUIObject._SupplyType.Gun:
                if (g == sup.GetType())
                {
                    gun = (GunUIObject)sup;
                    switch (gameObject.name)
                    {
                        case "Item Power":
                            thisLabel.text = "Power : " + gun.gunObj.power;
                            break;
                        case "Item Type":
                            thisLabel.text = gun.gunObj.model;
                            break;
                        case "Item RPM":
                            thisLabel.text = "firespeed : " + gun.gunObj.firingRate;
                            break;
                        default:
                            break;
                    }
                }
                break;
            case SuppliesUIObject._SupplyType.Health:
                if (h == sup.GetType())
                {
                    health = (HealthUIObject)sup;
                    switch (gameObject.name)
                    {
                        case "Item Power":
                            thisLabel.text = "Health : " + health.hPack.power;
                            break;
                        case "Item Type":
                            thisLabel.text = health.hPack.model;
                            break;
                        case "Item RPM":
                            thisLabel.text = "Quantity : " + health.hPack.quantity;
                            break;
                        default:
                            break;
                    }
                }
                break;
            default: break;
        }
    }
Exemple #4
0
    /// <summary>
    /// Gets the alpha value for DB items.
    /// </summary>
    /// <returns>
    /// The alpha value.
    /// </returns>
    /// <param name='item'>
    /// Item.
    /// </param>
    float getAlphaValue(SuppliesUIObject item)
    {
        Type g = typeof(GunUIObject);
        Type h = typeof(HealthUIObject);
        Type a = typeof(AmmoUIObject);

        Type t = item.GetType();

        if (t == g)
        {
            GunUIObject temp = (GunUIObject)item;
            if (temp.itemLocale == SuppliesUIObject._ItemLocale.StoreGridItem)
            {
                return((temp.gunObj.isPurchased) ? 0.5f : 1f);
            }
        }
        if (t == h)
        {
            HealthUIObject temp = (HealthUIObject)item;
            if (temp.itemLocale == SuppliesUIObject._ItemLocale.StashGridItem)
            {
                return((temp.hPack.quantity > 0) ? 1f : 0.5f);
            }
        }
        if (t == a)
        {
            AmmoUIObject temp  = (AmmoUIObject)item;
            int          index = itemArray.IndexOf(temp);

            if (temp.itemLocale == SuppliesUIObject._ItemLocale.StoreGridItem)
            {
                if (index < 2)
                {
                    return(1f);
                }
                else
                {
                    return((temp.ammo.isPurchased) ? 0.5f : 1f);
                }
            }
            return((temp.ammo.isPurchased) ? 1f : 0.5f);
        }

        return(1f);
    }