示例#1
0
 void ShowEffect()
 {
     for (byte i = 0; i < cardsObj.Length; i++)
     {
         GameObject go = (GameObject)GameObject.Instantiate(m_EffectLoad);
         GlobalEffectMgr.SetTrailEffectOnTopWnd(go);
         GlobalEffectMgr.SetMeshRendererOnTopWnd(go);
         go.transform.SetParent(cardsObj[i].transform.GetChild(0), false);
         go.transform.localPosition = Vector3.zero;
     }
 }
示例#2
0
    public void Update(float deltaTime)
    {
        if (isCount && m_CoundDownObj != null)
        {
            m_CoundDownObj.SetActive(true);
            count         -= deltaTime;
            CountDown.text = ((int)count).ToString();
            if (count <= 0)
            {
                isCount = false;
                count   = 11;
                m_CoundDownObj.SetActive(false);
                if (m_Btn[0].activeSelf)
                {
                    BeginChooseCard(m_Btn[0]);
                }
                else if (m_Btn[1].activeSelf)
                {
                    CloseClick(null);
                }
                else
                {
                    ChooseCard(cardsObj[0].transform.GetChild(0).gameObject);
                }
            }
        }

        if (cardTurnBack)
        {
            countCard += deltaTime;
            if (countCard >= 0.1f)
            {
                cardsObj[numCard].transform.GetChild(0).GetComponent <Animator>().SetBool("frontToBack", true);
                cardsObj[numCard].transform.GetChild(0).GetChild(0).gameObject.SetActive(false);
                numCard++;
                countCard = 0;
                //if (numCard==1)
                {
                    GlobalAudioMgr.Instance.PlayOrdianryMusic(Audio.OrdianryMusic.m_lottery2);
                }
                if (numCard > 5)
                {
                    cardTurnBack      = false;
                    showShuffleCount  = 0.0f;
                    isShowShuffleCard = true;
                    numCard           = 0;
                }
            }
        }

        if (isShowOtherCard)
        {
            ShowOtherCount += deltaTime;
            if (ShowOtherCount >= 0.3f)
            {
                m_Btn[1].SetActive(true);
                ShowOtherCard(chooseID);
                isShowOtherCard = false;
                GameObject go     = (GameObject)GameObject.Instantiate(m_EffectLoad);
                GameObject effect = (GameObject)GameObject.Instantiate(m_EffectCardTrunLoad);
                GlobalEffectMgr.SetTrailEffectOnTopWnd(go);
                GlobalEffectMgr.SetMeshRendererOnTopWnd(go);
                go.transform.SetParent(chooseCard.transform, false);
                go.transform.localPosition = Vector3.zero;
                effect.transform.SetParent(chooseCard.transform, false);
                effect.transform.localPosition = Vector3.zero;

                UISprite[] sprite = chooseCard.transform.GetChild(0).GetComponentsInChildren <UISprite>();
                UILabel[]  label  = chooseCard.transform.GetComponentsInChildren <UILabel>();
                foreach (UISprite s in sprite)
                {
                    s.depth = 121;
                }
                chooseCard.transform.GetChild(0).GetComponent <UISprite>().depth = 120;
                foreach (UILabel l in label)
                {
                    l.depth = 121;
                }
                m_mask.GetComponent <UITexture>().depth = 119;
                isCount = true;
                count   = 11;
            }
        }

        if (isShowShuffleCard)
        {
            showShuffleCount += deltaTime;
            if (showShuffleCount >= 0.5f)
            {
                ShuffleCard();
            }
            if (showShuffleCount >= 3)
            {
                isShowEffect      = true;
                showEffectCount   = 0.0f;
                cardIndex         = 0;
                isCount           = true;
                count             = 11;
                isShowShuffleCard = false;
                m_Effect[0].SetActive(true);
            }
        }
        if (isShowEffect)
        {
            showEffectCount += deltaTime;
            if (showEffectCount >= 0.1f)
            {
                GameObject go = (GameObject)GameObject.Instantiate(m_EffectLoad);
                GlobalEffectMgr.SetTrailEffectOnTopWnd(go);
                GlobalEffectMgr.SetMeshRendererOnTopWnd(go);
                go.transform.SetParent(cardsObj[cardIndex].transform.GetChild(0), false);
                go.transform.localPosition = Vector3.zero;
                if (cardIndex == 5)
                {
                    for (byte i = 0; i < cardsObj.Length; i++)
                    {
                        UIEventListener.Get(cardsObj[i].transform.GetChild(0).gameObject).onClick = ChooseCard;
                    }
                    isShowEffect = false;
                }
                else
                {
                    cardIndex++;
                    showEffectCount = 0.0f;
                }
            }
        }
    }