コード例 #1
0
ファイル: StoreController.cs プロジェクト: swrn365/Duel-Off
    /** Update Ammo Grid ( grids[1] ) depending on the selection sent from the event
     *  from StashController.
     */
    void updateAmmoGrid(GunUIObject selection, int index)
    {
        if (index == -1)
        {
            for (int i = 0; i < 3; i++)
            {
                AmmoUIObject ammo = (AmmoUIObject)grids[1].itemArray[i];
                ammo.ammo = selection.gunObj.compatibleAmmo[i];
                ammo.mWidget.spriteName = selection.gunObj.compatibleAmmo[i].spriteName;

                // If ammo grid is already active, and the current ammo is displayed, update Description
                if (grids[1].isActive && grids[1].curPos == i)
                {
                    onSelection(ammo);
                }
            }
        }
        else
        {
            if (grids[1].isActive)
            {
                moveGridTo(index, MainMenuController.instance.menuState);
            }
        }
    }
コード例 #2
0
ファイル: StashTextUpdate.cs プロジェクト: swrn365/Duel-Off
    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;
        }
    }
コード例 #3
0
ファイル: AmmoUIObject.cs プロジェクト: Avatarchik/Duel-Off
	public void updateAmmo(GunUIObject selected, int ammoIndex)
	{
		if( itemLocale == SuppliesUIObject._ItemLocale.StashBottom )
		{
			switch( gameObject.name )
			{
			case "Ammo Type 1": 
				ammo = selected.gunObj.compatibleAmmo[1];
				mWidget.spriteName = ammo.spriteName;
				mWidget.alpha = ( ammo.amountOwned > 0 && ammo.isPurchased) ? 1f : 0.5f;
				break;
			case "Ammo Type 2":
				ammo = selected.gunObj.compatibleAmmo[2];
				mWidget.spriteName = ammo.spriteName;
				mWidget.alpha = ( ammo.amountOwned > 0 && ammo.isPurchased) ? 1f : 0.5f;
				break;
			case "Ammo Type 3":
				ammo = selected.gunObj.compatibleAmmo[3];
				mWidget.spriteName = ammo.spriteName;
				mWidget.alpha = ( ammo.isPurchased ) ? 1f : 0.5f;
				break;
			default:
				break;
			}
		}
		if( itemLocale == SuppliesUIObject._ItemLocale.StoreGridItem )
		{
			SupplyGrid parentGrid = transform.parent.GetComponent<SupplyGrid>();
			switch( gameObject.name )
			{
			case "Ammo0":
				ammo = selected.gunObj.compatibleAmmo[1];
				mWidget.spriteName = ammo.spriteName;
				if( parentGrid.isActive )
					mWidget.alpha = ( ammo.amountOwned > 0 & ammo.isPurchased) ? 1f : 0.5f;
				break;
			case "Ammo1":
				ammo = selected.gunObj.compatibleAmmo[2];
				mWidget.spriteName = ammo.spriteName;
				if( parentGrid.isActive )
					mWidget.alpha = ( ammo.amountOwned > 0 && ammo.isPurchased) ? 1f : 0.5f;
				break;
			case "Ammo2":
				ammo = selected.gunObj.compatibleAmmo[3];
				mWidget.spriteName = ammo.spriteName;
				if( parentGrid.isActive )
					mWidget.alpha = ( ammo.isPurchased) ? 0.5f : 1f;
				break;
			default:
				break;
			}
		}
	}
コード例 #4
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;
        }
    }
コード例 #5
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);
    }
コード例 #6
0
    void copyGunToUserPrefs()
    {
        GunUIObject g = (GunUIObject)grids[0].itemArray[grids[0].curPos];

        DBAccess.instance.userPrefs.userGun = g.gunObj;
    }
コード例 #7
0
ファイル: AmmoUIObject.cs プロジェクト: swrn365/Duel-Off
    public void updateAmmo(GunUIObject selected, int ammoIndex)
    {
        if (itemLocale == SuppliesUIObject._ItemLocale.StashBottom)
        {
            switch (gameObject.name)
            {
            case "Ammo Type 1":
                ammo = selected.gunObj.compatibleAmmo[1];
                mWidget.spriteName = ammo.spriteName;
                mWidget.alpha      = (ammo.amountOwned > 0 && ammo.isPurchased) ? 1f : 0.5f;
                break;

            case "Ammo Type 2":
                ammo = selected.gunObj.compatibleAmmo[2];
                mWidget.spriteName = ammo.spriteName;
                mWidget.alpha      = (ammo.amountOwned > 0 && ammo.isPurchased) ? 1f : 0.5f;
                break;

            case "Ammo Type 3":
                ammo = selected.gunObj.compatibleAmmo[3];
                mWidget.spriteName = ammo.spriteName;
                mWidget.alpha      = (ammo.isPurchased) ? 1f : 0.5f;
                break;

            default:
                break;
            }
        }
        if (itemLocale == SuppliesUIObject._ItemLocale.StoreGridItem)
        {
            SupplyGrid parentGrid = transform.parent.GetComponent <SupplyGrid>();
            switch (gameObject.name)
            {
            case "Ammo0":
                ammo = selected.gunObj.compatibleAmmo[1];
                mWidget.spriteName = ammo.spriteName;
                if (parentGrid.isActive)
                {
                    mWidget.alpha = (ammo.amountOwned > 0 & ammo.isPurchased) ? 1f : 0.5f;
                }
                break;

            case "Ammo1":
                ammo = selected.gunObj.compatibleAmmo[2];
                mWidget.spriteName = ammo.spriteName;
                if (parentGrid.isActive)
                {
                    mWidget.alpha = (ammo.amountOwned > 0 && ammo.isPurchased) ? 1f : 0.5f;
                }
                break;

            case "Ammo2":
                ammo = selected.gunObj.compatibleAmmo[3];
                mWidget.spriteName = ammo.spriteName;
                if (parentGrid.isActive)
                {
                    mWidget.alpha = (ammo.isPurchased) ? 0.5f : 1f;
                }
                break;

            default:
                break;
            }
        }
    }
コード例 #8
0
	/** Update Ammo Grid ( grids[1] ) depending on the selection sent from the event
	 *  from StashController. 
	 */
	void updateAmmoGrid( GunUIObject selection, int index )
	{
		if( index == -1 )
		{
			for( int i = 0; i < 3 ; i++ )
			{
				AmmoUIObject ammo = (AmmoUIObject)grids[1].itemArray[i];
				ammo.ammo = selection.gunObj.compatibleAmmo[i];
				ammo.mWidget.spriteName = selection.gunObj.compatibleAmmo[i].spriteName;
				
				// If ammo grid is already active, and the current ammo is displayed, update Description
				if( grids[1].isActive && grids[1].curPos == i )
					onSelection(ammo);
			}
		} else {
			if( grids[1].isActive )
				moveGridTo(index, MainMenuController.instance.menuState);
		}
	}
コード例 #9
0
    /// <summary>
    /// Adds purchased items from DB to instance of SupplyWindow.
    /// </summary>
    /// <param name='type'>
    /// Type.
    /// </param>
    /// <param name='locale'>
    /// Locale.
    /// </param>
    public void AddPurchasedItems(SuppliesUIObject._SupplyType type, SuppliesUIObject._ItemLocale locale)
    {
        if (type == SuppliesUIObject._SupplyType.Gun && locale == SuppliesUIObject._ItemLocale.StashGridItem)
        {
            List <System.Object[]> read = DBAccess.instance.getWeapons(true);

            for (int i = 0; i < read.Count; i++)
            {
                GameObject temp = (GameObject)Instantiate(Resources.Load("Prefabs/UI/Supply/StashGunUIObject"));
                temp.transform.parent = transform;
                temp.name             = "StashGunUIObject" + i.ToString();

                GunUIObject g = temp.GetComponent <GunUIObject>();
                g.gunObj = new Gun(read[i]);
                g.transform.localScale       = g.cachedLocalScale;
                g.transform.localPosition    = g.cachedLocalPosition;
                g.transform.localEulerAngles = Vector3.zero;
                g.model = g.gunObj.model;

                itemArray.Insert(i, g);
                itemArray[i].mWidget.spriteName = g.model + "_Icon";
            }
        }
        else if (type == SuppliesUIObject._SupplyType.Gun && locale == SuppliesUIObject._ItemLocale.StoreGridItem)
        {
            List <System.Object[]> read = DBAccess.instance.getWeapons(false);

            for (int i = 0; i < read.Count; i++)
            {
                GameObject temp = (GameObject)Instantiate(Resources.Load("Prefabs/UI/Supply/StoreGunUIObject"));
                temp.transform.parent = transform;
                temp.name             = "StoreGunUIObject" + i.ToString();

                GunUIObject g = temp.GetComponent <GunUIObject>();
                g.gunObj = new Gun(read[i]);
                g.transform.localScale       = g.cachedLocalScale;
                g.transform.localPosition    = g.cachedLocalPosition;
                g.transform.localEulerAngles = Vector3.zero;
                g.model = g.gunObj.model;

                itemArray.Insert(i, g);
                itemArray[i].mWidget.spriteName = g.model + "_Icon";
            }
        }
        else if (type == SuppliesUIObject._SupplyType.Health)
        {
            List <System.Object[]> read = DBAccess.instance.getPurchasedHealthpacks();

            HealthUIObject[] buffer = GetComponentsInChildren <HealthUIObject>();

            for (int i = 0; i < read.Count; i++)
            {
                if (buffer[i].name.Contains(i.ToString()))
                {
                    buffer[i].hPack = new HealthPack(read[i]);
                    buffer[i].hPack.setIsPurchased(buffer[i].mWidget, buffer[i].hPack.isPurchased);
                    itemArray.Insert(i, buffer[i]);
                }
            }
        }
        else
        {
            AmmoUIObject[] buffer = GetComponentsInChildren <AmmoUIObject>();

            for (int i = 0; i < buffer.Length; i++)
            {
                if (buffer[i].name.Contains(i.ToString()))
                {
                    itemArray.Insert(i, buffer[i]);
                }
            }
        }

        length        = itemArray.Count;
        repositionNow = true;
    }