Exemple #1
0
    IEnumerator _SummaryPot(ResponseResultSummary data, float timeEffect)
    {
        PokerPotItem thisPot = currentPots.Find(p => data.potId == p.Pot.id);

        if (thisPot != null && thisPot.gameObject != null)
        {
            List <PokerPotItem>          listPotItems  = new List <PokerPotItem>();
            List <ResponseMoneyExchange> winnerPlayers = new List <ResponseMoneyExchange>(System.Array.FindAll <ResponseMoneyExchange>(data.players, p => p.winner));
            foreach (ResponseMoneyExchange exchange in winnerPlayers)
            {
                PokerPlayerUI uiPlayer = playmat.GetPlayerUI(exchange.userName);
                if (exchange.moneyExchange > 0 && uiPlayer != null)
                {
                    PokerPotItem pot = NGUITools.AddChild(thisPot.gameObject, thisPot.gameObject).GetComponent <PokerPotItem>();
                    pot.gameObject.transform.parent = uiPlayer.transform.parent;
                    pot.OnMove();
                    listPotItems.Add(pot);
                }
            }

            currentPots.Remove(thisPot);
            GameObject.Destroy(thisPot.gameObject);

            foreach (PokerPotItem pot in listPotItems)
            {
                iTween.MoveTo(pot.gameObject, iTween.Hash("islocal", true, "time", timeEffect, "position", Vector3.zero));
            }

            StartCoroutine(PlaySound());

            yield return(new WaitForSeconds(timeEffect));

            for (int i = listPotItems.Count - 1; i >= 0; i--)
            {
                GameObject.Destroy(listPotItems[i].gameObject);
            }
            listPotItems.Clear();
            yield return(new WaitForEndOfFrame());
        }
        yield return(new WaitForEndOfFrame());

        tablePot.Reposition();
    }
    IEnumerator _SummaryPot(ResponseResultSummary data, float timeEffect)
    {
        PokerPotItem thisPot = currentPots.Find(p => data.potId == p.Pot.id);
        if (thisPot != null && thisPot.gameObject != null)
        {
            List<PokerPotItem> listPotItems = new List<PokerPotItem>();
            List<ResponseMoneyExchange> winnerPlayers = new List<ResponseMoneyExchange>(System.Array.FindAll<ResponseMoneyExchange>(data.players, p => p.winner));
            foreach(ResponseMoneyExchange exchange in winnerPlayers)
            {
                PokerPlayerUI uiPlayer = playmat.GetPlayerUI(exchange.userName);
                if (exchange.moneyExchange > 0 && uiPlayer != null)
                {
                    PokerPotItem pot = NGUITools.AddChild(thisPot.gameObject, thisPot.gameObject).GetComponent<PokerPotItem>();
                    pot.gameObject.transform.parent = uiPlayer.transform.parent;
                    pot.OnMove();
                    listPotItems.Add(pot);
                }
            }

            currentPots.Remove(thisPot);
            GameObject.Destroy(thisPot.gameObject);

            foreach (PokerPotItem pot in listPotItems)
                iTween.MoveTo(pot.gameObject, iTween.Hash("islocal", true, "time", timeEffect, "position", Vector3.zero));

            StartCoroutine(PlaySound());

            yield return new WaitForSeconds(timeEffect);
            for (int i = listPotItems.Count - 1; i >= 0; i--)
            {
                GameObject.Destroy(listPotItems[i].gameObject);
            }
            listPotItems.Clear();
            yield return new WaitForEndOfFrame();

        }
        yield return new WaitForEndOfFrame();
        tablePot.Reposition();
    }
 public void SummaryPot(ResponseResultSummary data, float timeEffect)
 {
     StartCoroutine(_SummaryPot(data, timeEffect));
 }
Exemple #4
0
 public void SummaryPot(ResponseResultSummary data, float timeEffect)
 {
     StartCoroutine(_SummaryPot(data, timeEffect));
 }