123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class ResultDrop : MonoBehaviour
- {
- public ResultPanel resultPanel;
- public Animator animator;
- public ResultDropItem[] itemArr;
- private List<int> dropList;
- private int extraPrice;
- public bool mixed;
- private bool waitingReward;
- // Use this for initialization
- void Start ()
- {
-
- }
- public void Show(List<int> dropList, int extraPrice)
- {
- this.dropList = dropList;
- this.extraPrice = extraPrice;
- List<int> list = new List<int> ();
- for(int i=0; i<dropList.Count; i++)
- {
- int index = Random.Range (0, list.Count);
- list.Insert (index, dropList[i]);
- }
- for(int i=0; i<list.Count; i++)
- {
- itemArr [i].data = list [i];
- itemArr [i].HideOpen ();
- }
- animator.Play ("DropShow");
- }
- public void Mix()
- {
- for(int i=0; i<dropList.Count; i++)
- {
- itemArr [i].data = 0;
- }
- animator.Play ("DropMix");
- }
-
- public void MixComplete()
- {
- mixed = true;
- for(int i=0; i<itemArr.Length; i++)
- {
- itemArr [i].ShowOpen (0);
- }
- }
- public void Select(int index)
- {
- if(mixed && !waitingReward && (int)(itemArr[index].data) == 0)
- {
- waitingReward = true;
- itemArr [index].Shake (true);
- resultPanel.SelectDrop (index);
- }
- }
- public void Reward(int index, int dropIndex)
- {
- waitingReward = false;
- for(int i=0; i<itemArr.Length; i++)
- {
- ResultDropItem item = itemArr [i];
- if(i == index)
- {
- item.Shake (false);
- item.data = dropList [dropIndex];
- item.HideOpen ();
- }
- else if((int)(item.data) == 0)
- {
- item.ShowOpen (extraPrice);
- }
- }
- }
- public void RewardFaild(int index)
- {
- waitingReward = false;
- itemArr [index].Shake (false);
- }
- }
|