public void DisplayArenaRewards(LootItemList loots)
	{
		allLoots = loots;
		Enable();
		DisplayRewards();
		isArena = true;
		//display rewards
		//display badge
		//end
	}
	public void DisplayMinigameRewards(LootItemList loots, int newScore)
	{
		allLoots = loots;
		score = newScore;
		Enable();
		DisplayMinigameResults();
		isMinigame = true;

		Debug.Log(score);
		//display score first
		//display badge
		//display reward items
		//end
	}
	public void DisplayQuestRewardItems(LootItemList loots)
	{
		questItemsGrid.SetActive(true);
		questItems.Clear();
		for (int i = 0; i < loots.items.Count; i++) {
			questItems.Add(loots.items[i]);
		}

		int num = loots.items.Count - itemTiles.Count;
		if(num>0)
		{
			for (int i = 0; i < num; i++) {
				GameObject itemTile = NGUITools.AddChild(questItemsGrid, itemTilePrefab);
				ItemTileButton tileButton = itemTile.GetComponent<ItemTileButton>();
				itemTiles.Add(tileButton);
				tileButton.index = itemTiles.Count-1;
			}
		}
		for (int i = 0; i < itemTiles.Count; i++) {
			if(i>=questItems.Count)
			{

				itemTiles[i].gameObject.SetActive(false);
				//questItemsPanelGrid.Reposition();
			}
			else
			{
				itemTiles[i].gameObject.SetActive(true);
				itemTiles[i].LoadItemTile(questItems[i], this, InventoryGUIType.Quest, i);
				//questItemsPanelGrid.Reposition();
				//itemTiles[i].LoadItemTile(questItems[i], this, inventoryType, i);
			}
		}

		int n = loots.currencies.Count - currencyTiles.Count;
		if(n > 0)
		{
			for (int i = 0; i < n; i++) {
				GameObject itemTile = NGUITools.AddChild(questItemsGrid, currencyTilePrefab);
				CurrencyTilebutton tileButton = itemTile.GetComponent<CurrencyTilebutton>();
				currencyTiles.Add(tileButton);
			}
		}
		for (int i = 0; i < currencyTiles.Count; i++) {
			if(i>=loots.currencies.Count)
			{
				
				currencyTiles[i].gameObject.SetActive(false);
				//questItemsPanelGrid.Reposition();
			}
			else
			{
				currencyTiles[i].gameObject.SetActive(true);
				currencyTiles[i].Load(loots.currencies[i]);
				//questItemsPanelGrid.Reposition();
				//itemTiles[i].LoadItemTile(questItems[i], this, inventoryType, i);
			}
		}

		questItemsPanelGrid.Reposition();
	}
예제 #4
0
	public void DisplayMinigameRewards(LootItemList items, int score)
	{
		EnterGUIState(UIState.reward);
		rewardsGUI.DisplayMinigameRewards(items, score);
	}
예제 #5
0
	public void DisplayArenaRewards(LootItemList items)
	{
		EnterGUIState(UIState.reward);
		rewardsGUI.DisplayArenaRewards(items);
	}
예제 #6
0
	public IEnumerator AddRewardItems(LootItemList loots)
	{
		yield return new WaitForSeconds (0.5f);
		for (int i = 0; i < loots.items.Count; i++) {
			Hero.AddItem(loots.items[i]);
		}
		for (int i = 0; i < loots.currencies.Count; i++) {
			Hero.AddRPGCurrency(loots.currencies[i]);
		}
		for (int i = 0; i < loots.badges.Count; i++) {
			Hero.AddBadge(loots.badges[i]);
		}
	}
예제 #7
0
	//party leader send to party members when they join
	public LootItemList GiveRewards(List<LootItem> allLoots, int maxNumberOfLoots)
	{
		LootItemList lootItemList = new LootItemList();  
		int num = 0;
		for (int i = 0; i < allLoots.Count; i++) { 
			if(!allLoots[i].Validate())
				continue;
			float chance = UnityEngine.Random.Range(0.0f, 1.0f);
			if(chance <= allLoots[i].dropRate)
			{
				int index = UnityEngine.Random.Range(0, allLoots[i].itemID.Count);
				if(allLoots[i].itemType == ItemType.Currency)
				{
					RPGCurrency currency = Storage.LoadById<RPGCurrency>(allLoots[i].itemID[index], new RPGCurrency());
					currency.amount = UnityEngine.Random.Range(allLoots[i].minQuantity, allLoots[i].maxQuantity);
					lootItemList.currencies.Add(currency);
				}
				else if(allLoots[i].itemType == ItemType.Badge)
				{
					RPGBadge badge = Storage.LoadById<RPGBadge>(allLoots[i].itemID[index], new RPGBadge());
					if(!Hero.HasBadge(badge))
						lootItemList.badges.Add(badge);
				}
				else 
				{
					InventoryItem newItem = new InventoryItem();
					if(allLoots[i].itemType == ItemType.Armor)
					{
						RPGArmor armor = Storage.LoadById<RPGArmor>(allLoots[i].itemID[index], new RPGArmor());
						newItem.rpgItem = armor;
					}
					else
					{
						RPGItem item = Storage.LoadById<RPGItem>(allLoots[i].itemID[index], new RPGItem());
						newItem.rpgItem = item;
					}
					newItem.CurrentAmount = UnityEngine.Random.Range(allLoots[i].minQuantity, allLoots[i].maxQuantity);
					newItem.UniqueItemId = newItem.rpgItem.UniqueId;
					newItem.Level = UnityEngine.Random.Range(1, allLoots[i].itemLevel);
					lootItemList.items.Add(newItem);
				}
				if(!allLoots[i].definiteDrop)
					num ++;
			}
			if(maxNumberOfLoots > 0 && num >= maxNumberOfLoots)
				break;
		}
		StartCoroutine (AddRewardItems (lootItemList));
		return lootItemList;

	}