Ejemplo n.º 1
0
    protected override void setActiveGrid(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit)
    {
        if (clicked != null)
        {
            // Temporary bypass to prevent user from purchasing bullets
            if (clicked.supplyType == SuppliesUIObject._SupplyType.Ammo)
            {
                //clicked.mWidget.alpha = 0.5f;
                return;
            }

            if (clicked.supplyType == SuppliesUIObject._SupplyType.Gun ||
                clicked.supplyType == SuppliesUIObject._SupplyType.Health ||
                clicked.supplyType == SuppliesUIObject._SupplyType.Ammo)
            {
                int j = 0;
                for (int i = 0; i < grids.Length; i++)
                {
                    if (grids[i].itemArray[0].supplyType == clicked.supplyType)
                    {
                        grids[i].isActive = true;
                        j = i;
                    }
                    else
                    {
                        grids[i].isActive = false;
                    }
                }
                StartCoroutine(setCenterToCurPos(j));
            }
        }
    }
Ejemplo n.º 2
0
    // Announces selected GunUIObject's compatibleAmmo[] to Store for UI Updating
    void forwardAmmoToStore(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit)
    {
        if (clicked.itemLocale == SuppliesUIObject._ItemLocale.StashBottom)
        {
            if (grids[0].isActive)
            {
                int index;
                switch (clicked.name)
                {
                case "Ammo Type 1":
                    index = 0;
                    break;

                case "Ammo Type 2":
                    index = 1;
                    break;

                case "Ammo Type 3":
                    index = 2;
                    break;

                default:
                    index = 0;
                    break;
                }
                onStashSelection((GunUIObject)grids[0].itemArray[grids[0].curPos], index);
            }
        }
    }
Ejemplo n.º 3
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;
        }
    }
Ejemplo n.º 4
0
 protected override void onSelection(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit)
 {
     if (clicked != null)
     {
         if (clicked.gameObject == gameObject)
         {
             moveStoreLeft(state);
             tweenArrow(-20f, state);
         }
     }
 }
Ejemplo n.º 5
0
 protected override void onSelection(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit)
 {
     if (clicked != null)
     {
         if (clicked.gameObject == gameObject)
         {
             moveStoreLeft(state);
             tweenArrow(-20f, state);
         }
     }
 }
Ejemplo n.º 6
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;
        }
    }
Ejemplo n.º 7
0
    void onPurchasing(SuppliesUIObject item, GameObject tag)
    {
        if (tag.tag == "GoldButton")
        {
            Debug.Log(tag.name);

            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                ChartBoostBinding.trackEvent("Gold Buy Attempt");
            }

            if (tag.name == "Gold")
            {
                tweenIn();
            }
            else if (tag.name == "GoldButtonBG")
            {
                tweenOut();
            }
            else if (tag.name == "Coins_L1")
            {
#if UNITY_ANDROID || UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
                tweenOut();
#elif UNITY_IPHONE
                EtceteraBinding.showBezelActivityViewWithLabel("Connecting to iTunes Store...");
                StoreKitBinding.purchaseProduct(MainMenuController.GOLD_200, 1);
#endif
            }
            else if (tag.name == "Coins_L2")
            {
#if UNITY_ANDROID || UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
                tweenOut();
#elif UNITY_IPHONE
                EtceteraBinding.showBezelActivityViewWithLabel("Connecting to iTunes Store...");
                StoreKitBinding.purchaseProduct(MainMenuController.GOLD_500, 1);
#endif
            }
            else if (tag.name == "Coins_L3")
            {
#if UNITY_ANDROID || UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
                tweenOut();
#elif UNITY_IPHONE
                EtceteraBinding.showBezelActivityViewWithLabel("Connecting to iTunes Store...");
                StoreKitBinding.purchaseProduct(MainMenuController.GOLD_4000, 1);
#endif
            }
        }
    }
Ejemplo n.º 8
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);
    }
Ejemplo n.º 9
0
    void onSelection(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit)
    {
        if (clicked != null)
        {
            // Temporary bypass to prevent user from purchasing bullets
            if (clicked.supplyType == SuppliesUIObject._SupplyType.Ammo)
            {
                GameObject bullet;
                bullet = GameObject.Find("Top Ammo");
                return;
            }

            if (state != MainMenuController.MenuState.InTransition && clicked.itemLocale == SuppliesUIObject._ItemLocale.StoreTop)
            {
                MainMenuController.instance.menuState = MainMenuController.MenuState.InTransition;

                iTween.MoveTo(gameObject, iTween.Hash(
                                  "x", clicked.transform.localPosition.x,
                                  "time", 0.4f,
                                  "islocal", true,
                                  "easetype", iTween.EaseType.easeOutExpo
                                  )
                              );
                iTween.ScaleTo(clicked.gameObject, iTween.Hash(
                                   "x", clicked.transform.localScale.x * 1.5f,
                                   "y", clicked.transform.localScale.y * 1.5f,
                                   "time", 0.2f,
                                   "easetype", iTween.EaseType.easeOutExpo
                                   )
                               );
                iTween.ScaleTo(clicked.gameObject, iTween.Hash(
                                   "x", clicked.transform.localScale.x,
                                   "y", clicked.transform.localScale.y,
                                   "time", 0.2f,
                                   "delay", 0.2f,
                                   "oncompletetarget", gameObject,
                                   "oncomplete", "stopAnimating",
                                   "oncompleteparams", state,
                                   "easetype", iTween.EaseType.easeInExpo
                                   )
                               );
            }
        }
    }
Ejemplo n.º 10
0
    void onSelection(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit )
    {
        if (clicked != null)
        {
			// Temporary bypass to prevent user from purchasing bullets 
			if (clicked.supplyType == SuppliesUIObject._SupplyType.Ammo) {
				GameObject bullet;
				bullet = GameObject.Find("Top Ammo");
				return;
			}

            if (state != MainMenuController.MenuState.InTransition && clicked.itemLocale == SuppliesUIObject._ItemLocale.StoreTop)
            {
                MainMenuController.instance.menuState = MainMenuController.MenuState.InTransition;

                iTween.MoveTo(gameObject, iTween.Hash(
                        "x", clicked.transform.localPosition.x,
                        "time", 0.4f,
                        "islocal", true,
                        "easetype", iTween.EaseType.easeOutExpo
                    )
                );
                iTween.ScaleTo(clicked.gameObject, iTween.Hash(
                        "x", clicked.transform.localScale.x * 1.5f,
                        "y", clicked.transform.localScale.y * 1.5f,
                        "time", 0.2f,
                        "easetype", iTween.EaseType.easeOutExpo
                    )
                );
                iTween.ScaleTo(clicked.gameObject, iTween.Hash(
                        "x", clicked.transform.localScale.x,
                        "y", clicked.transform.localScale.y,
                        "time", 0.2f,
                        "delay", 0.2f,
                        "oncompletetarget", gameObject,
                        "oncomplete", "stopAnimating",
                        "oncompleteparams", state,
                        "easetype", iTween.EaseType.easeInExpo
                    )
                );
            }
        }
    }
Ejemplo n.º 11
0
	void onPurchasing( SuppliesUIObject item, GameObject tag )
	{
		if( tag.tag == "GoldButton" )
		{
			Debug.Log(tag.name);
			
			if( Application.platform == RuntimePlatform.IPhonePlayer )
				ChartBoostBinding.trackEvent( "Gold Buy Attempt" );
			
			if( tag.name == "Gold" )
				tweenIn();
			else if( tag.name == "GoldButtonBG" )
				tweenOut();
			else if( tag.name == "Coins_L1" )
			{
#if UNITY_ANDROID || UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
				tweenOut();
#elif UNITY_IPHONE
				EtceteraBinding.showBezelActivityViewWithLabel("Connecting to iTunes Store...");
				StoreKitBinding.purchaseProduct( MainMenuController.GOLD_200, 1 );
#endif
			}
			else if( tag.name == "Coins_L2" )
			{
#if UNITY_ANDROID || UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
				tweenOut();
#elif UNITY_IPHONE
				EtceteraBinding.showBezelActivityViewWithLabel("Connecting to iTunes Store...");
				StoreKitBinding.purchaseProduct( MainMenuController.GOLD_500, 1 );
#endif
			}
			else if( tag.name == "Coins_L3" )
			{
#if UNITY_ANDROID || UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
				tweenOut();
#elif UNITY_IPHONE
				EtceteraBinding.showBezelActivityViewWithLabel("Connecting to iTunes Store...");
				StoreKitBinding.purchaseProduct( MainMenuController.GOLD_4000, 1 );
#endif
			}
		}
	}
Ejemplo n.º 12
0
    void onSelection(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit)
    {
        if (clicked != null)
        {
            if (state == MainMenuController.MenuState.Store && clicked.itemLocale == SuppliesUIObject._ItemLocale.StashTop)
            {
                MainMenuController.instance.menuState = MainMenuController.MenuState.InTransition;

                iTween.MoveTo(gameObject, iTween.Hash(
                                  "x", clicked.transform.localPosition.x,
                                  "time", 0.4f,
                                  "islocal", true,
                                  "easetype", iTween.EaseType.easeOutExpo
                                  )
                              );

                iTween.ScaleTo(clicked.gameObject, iTween.Hash(
                                   "x", clicked.transform.localScale.x * 1.5f,
                                   "y", clicked.transform.localScale.y * 1.5f,
                                   "time", 0.2f,
                                   "easetype", iTween.EaseType.easeOutExpo
                                   )
                               );

                iTween.ScaleTo(clicked.gameObject, iTween.Hash(
                                   "x", clicked.transform.localScale.x,
                                   "y", clicked.transform.localScale.y,
                                   "time", 0.2f,
                                   "delay", 0.2f,
                                   "oncompletetarget", gameObject,
                                   "oncomplete", "stopAnimating",
                                   "oncompleteparams", state,
                                   "easetype", iTween.EaseType.easeInExpo
                                   )
                               );
            }
        }
    }
Ejemplo n.º 13
0
    void onSelection(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit)
    {
        if (clicked != null)
        {
            if (state == MainMenuController.MenuState.Store && clicked.itemLocale == SuppliesUIObject._ItemLocale.StashTop )
            {
                MainMenuController.instance.menuState = MainMenuController.MenuState.InTransition;

                iTween.MoveTo(gameObject, iTween.Hash(
                    "x", clicked.transform.localPosition.x,
                    "time", 0.4f,
                    "islocal", true,
                    "easetype", iTween.EaseType.easeOutExpo
                    )
                );

                iTween.ScaleTo(clicked.gameObject, iTween.Hash(
                    "x", clicked.transform.localScale.x * 1.5f,
                    "y", clicked.transform.localScale.y * 1.5f,
                    "time", 0.2f,
                    "easetype", iTween.EaseType.easeOutExpo
                    )
                );

                iTween.ScaleTo(clicked.gameObject, iTween.Hash(
                    "x", clicked.transform.localScale.x,
                    "y", clicked.transform.localScale.y,
                    "time", 0.2f,
                    "delay", 0.2f,
                    "oncompletetarget", gameObject,
                    "oncomplete", "stopAnimating",
                    "oncompleteparams", state,
                    "easetype", iTween.EaseType.easeInExpo
                    )
                );
            }
        }
    }
Ejemplo n.º 14
0
 /// <summary>
 /// Sets the active grid in instance of SupplyWindow
 /// </summary>
 /// <param name='clicked'>
 /// Clicked.
 /// </param>
 /// <param name='state'>
 /// State.
 /// </param>
 /// <param name='hit'>
 /// Hit.
 /// </param>
 protected override void setActiveGrid(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit)
 {
     if (clicked != null)
     {
         if (clicked.supplyType == SuppliesUIObject._SupplyType.Gun || clicked.supplyType == SuppliesUIObject._SupplyType.Health)
         {
             int j = 0;
             for (int i = 0; i < grids.Length; i++)
             {
                 if (grids[i].itemArray[0].supplyType == clicked.supplyType)
                 {
                     grids[i].isActive = true;
                     j = i;
                 }
                 else
                 {
                     grids[i].isActive = false;
                 }
             }
             StartCoroutine(setCenterToCurPos(j));
         }
     }
 }
Ejemplo n.º 15
0
	/// <summary>
	/// Sets the active grid in instance of SupplyWindow
	/// </summary>
	/// <param name='clicked'>
	/// Clicked.
	/// </param>
	/// <param name='state'>
	/// State.
	/// </param>
	/// <param name='hit'>
	/// Hit.
	/// </param>
    protected override void setActiveGrid(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit)
    {
        if (clicked != null)
        {
            if (clicked.supplyType == SuppliesUIObject._SupplyType.Gun || clicked.supplyType == SuppliesUIObject._SupplyType.Health)
            {
                int j = 0;
                for (int i = 0; i < grids.Length; i++)
                {
                    if (grids[i].itemArray[0].supplyType == clicked.supplyType)
                    {
                        grids[i].isActive = true;
                        j = i;
                    }
                    else { grids[i].isActive = false; }
                }
                StartCoroutine(setCenterToCurPos(j));
            }
        }
    }
Ejemplo n.º 16
0
 /* Used to call abstractly declared delegates to signal StashController
  * to move the grid and update information accordingly. */
 protected abstract void onSelection(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit);
Ejemplo n.º 17
0
	/* Used to call abstractly declared delegates to signal StashController
	 * to move the grid and update information accordingly. */
    protected abstract void onSelection(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit);
Ejemplo n.º 18
0
    void onPurchasing(SuppliesUIObject item, GameObject tag)
    {
        if (tag.tag == "BuyButton")
        {
            Type t = item.GetType();

            AmmoUIObject   a;
            HealthUIObject h;
            GunUIObject    g;

            if (tag.name == "Button Background")
            {
                tweenIn();

                if (t == typeof(AmmoUIObject))
                {
                    a = (AmmoUIObject)item;
                    itemInQuestion.spriteName = a.ammo.spriteName;
                    itemDescription.text      = a.ammo.ammoName;
                    s = a;
                    p = a.ammo;
                }
                if (t == typeof(GunUIObject))
                {
                    g = (GunUIObject)item;
                    itemInQuestion.spriteName = g.gunObj.model + "_Icon";
                    itemDescription.text      = g.gunObj.model;
                    s = g;
                    p = g.gunObj;
                }
                if (t == typeof(HealthUIObject))
                {
                    h = (HealthUIObject)item;
                    itemInQuestion.spriteName = "HealthIcon";
                    itemDescription.text      = h.hPack.model;
                    s = h;
                    p = h.hPack;
                }
            }
            if (tag.name == "Label OK")
            {
                if (p.GetType() == typeof(Ammo))
                {
                    Ammo a2 = (Ammo)p;

                    if (DBAccess.instance.userPrefs.Gold >= a2.price)
                    {
                        DBAccess.instance.userPrefs.findAmmoAndSetAsPurchased(a2);
                        DBAccess.instance.userPrefs.Gold -= a2.price;
                    }
                }
                if (p.GetType() == typeof(Gun))
                {
                    Gun g2 = (Gun)p;

                    if (DBAccess.instance.userPrefs.Gold >= g2.price)
                    {
                        DBAccess.instance.userPrefs.findGunAndSetAsPurchased((Gun)p);
                        DBAccess.instance.userPrefs.Gold -= g2.price;
                    }
                }
                if (p.GetType() == typeof(HealthPack))
                {
                    HealthPack h2 = (HealthPack)p;

                    if (DBAccess.instance.userPrefs.Gold >= h2.price)
                    {
                        DBAccess.instance.userPrefs.findHealthPackAndSetAsPurchased((HealthPack)p);
                        DBAccess.instance.userPrefs.Gold -= h2.price;
                    }
                }

                if (onPurchased != null)
                {
                    Debug.Log("onPurchased");
                    onPurchased(s);
                }

                tweenOut();
            }
            if (tag.name == "Label Back")
            {
                tweenOut();
            }
        }
    }
Ejemplo n.º 19
0
    protected override void setActiveGrid(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit)
    {
			
        if (clicked != null)
        {
			// Temporary bypass to prevent user from purchasing bullets 
			if (clicked.supplyType == SuppliesUIObject._SupplyType.Ammo) {
				//clicked.mWidget.alpha = 0.5f;
				return;
			}

            if ( clicked.supplyType == SuppliesUIObject._SupplyType.Gun || 
                 clicked.supplyType == SuppliesUIObject._SupplyType.Health || 
                 clicked.supplyType == SuppliesUIObject._SupplyType.Ammo ) {   
                int j = 0;
                for (int i = 0; i < grids.Length; i++)
                {
                    if (grids[i].itemArray[0].supplyType == clicked.supplyType)
                    {
                        grids[i].isActive = true;
                        j = i;
                    }
                    else { grids[i].isActive = false; }
                }
                StartCoroutine(setCenterToCurPos(j));
            }
        }
    }
Ejemplo n.º 20
0
 protected abstract void setActiveGrid(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit);
Ejemplo n.º 21
0
	void onPurchasing( SuppliesUIObject item, GameObject tag )
	{
		if( tag.tag == "BuyButton" )
		{
			Type t = item.GetType();
			
			AmmoUIObject a;
			HealthUIObject h;
			GunUIObject g;
			
			if( tag.name == "Button Background" )
			{
				tweenIn();

				if( t == typeof(AmmoUIObject) )
				{
					a = (AmmoUIObject)item;
					itemInQuestion.spriteName = a.ammo.spriteName;
					itemDescription.text = a.ammo.ammoName;
					s = a;
					p = a.ammo;
				}
				if( t == typeof(GunUIObject) )
				{
					g= (GunUIObject)item;
					itemInQuestion.spriteName = g.gunObj.model + "_Icon";
					itemDescription.text = g.gunObj.model;
					s = g;
					p = g.gunObj;
				}
				if( t == typeof(HealthUIObject) )
				{
					h = (HealthUIObject)item;
					itemInQuestion.spriteName = "HealthIcon";
					itemDescription.text = h.hPack.model;
					s = h;
					p = h.hPack;
				}
			}
			if( tag.name == "Label OK" )
			{
				if( p.GetType() == typeof(Ammo) )
				{
					Ammo a2 = (Ammo)p;
					
					if( DBAccess.instance.userPrefs.Gold >= a2.price )
					{
						DBAccess.instance.userPrefs.findAmmoAndSetAsPurchased(a2);
						DBAccess.instance.userPrefs.Gold -= a2.price;
					}
				}
				if( p.GetType() == typeof(Gun) )
				{
					Gun g2 = (Gun)p;
					
					if( DBAccess.instance.userPrefs.Gold >= g2.price )
					{
						DBAccess.instance.userPrefs.findGunAndSetAsPurchased((Gun)p);
						DBAccess.instance.userPrefs.Gold -= g2.price;
					}
				}
				if( p.GetType() == typeof(HealthPack) )
				{
					HealthPack h2 = (HealthPack)p;
					
					if( DBAccess.instance.userPrefs.Gold >= h2.price )
					{
						DBAccess.instance.userPrefs.findHealthPackAndSetAsPurchased((HealthPack)p);
						DBAccess.instance.userPrefs.Gold -= h2.price;
					}
				}
				
				if( onPurchased != null )
				{
					Debug.Log("onPurchased");
					onPurchased(s);
				}
				
				tweenOut();
			}
			if( tag.name == "Label Back" )
			{
				tweenOut();
			}
		}
	}
Ejemplo n.º 22
0
 void onPurchased(SuppliesUIObject bought)
 {
     thisLabel.text = DBAccess.instance.userPrefs.Gold.ToString() + " Gold";
 }
Ejemplo n.º 23
0
	void onPurchased(SuppliesUIObject bought)
	{
		thisLabel.text = DBAccess.instance.userPrefs.Gold.ToString() + " Gold";
	}
Ejemplo n.º 24
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;
	}
Ejemplo n.º 25
0
    void updateText(SuppliesUIObject sup)
    {
        Type g = typeof(GunUIObject);
        Type h = typeof(HealthUIObject);
        Type a = typeof(AmmoUIObject);

        switch (sup.supplyType)
        {
        case SuppliesUIObject._SupplyType.Gun:
            if (g == sup.GetType())
            {
                GunUIObject gun;
                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;

                case "Item Cost":
                    thisLabel.text = +gun.gunObj.price + "G";
                    break;

                default: break;
                }
            }
            break;

        case SuppliesUIObject._SupplyType.Health:
            if (h == sup.GetType())
            {
                HealthUIObject health;
                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;

                case "Item Cost":
                    thisLabel.text = health.hPack.price + "G";
                    break;
                }
            }
            break;

        case SuppliesUIObject._SupplyType.Ammo:
            if (a == sup.GetType())
            {
                AmmoUIObject ammo;
                ammo = (AmmoUIObject)sup;
                switch (gameObject.name)
                {
                case "Item Power":
                    thisLabel.text = "Power : " + ammo.ammo.dmgModifier;
                    break;

                case "Item Type":
                    thisLabel.text = ammo.ammo.ammoName;
                    break;

                case "Item RPM":
                    thisLabel.text = "Clip Size: " + ammo.ammo.magSize;
                    break;

                case "Item Cost":
                    thisLabel.text = ammo.ammo.price + "G";
                    break;
                }
            }
            break;

        default: break;
        }
    }
Ejemplo n.º 26
0
	// Announces selected GunUIObject's compatibleAmmo[] to Store for UI Updating
	void forwardAmmoToStore(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit)
	{
		if( clicked.itemLocale == SuppliesUIObject._ItemLocale.StashBottom )
		{
			if( grids[0].isActive )
			{
				int index;
				switch( clicked.name )
				{
				case "Ammo Type 1":
					index = 0;
					break;
				case "Ammo Type 2":
					index = 1;
					break;
				case "Ammo Type 3":
					index = 2;
					break;
				default:
					index = 0;
					break;
				}
				onStashSelection( (GunUIObject)grids[0].itemArray[grids[0].curPos], index );
			}
		}
	}
Ejemplo n.º 27
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;
	}
Ejemplo n.º 28
0
 protected abstract void setActiveGrid(SuppliesUIObject clicked, MainMenuController.MenuState state, GameObject hit);