Beispiel #1
0
    public List <CardDrawSound> GetList(int id)
    {
        List <CardDrawSound> list = new List <CardDrawSound>();

        string[] name = Utility.EnumUtility.GetEnumName(typeof(CardDrawSound));
        for (int i = 0; i < name.Length; i++)
        {
            CardDrawSound e = ConvertSoundCardDraw(name[i]);
            if (id == Utility.EnumUtility.GetAttribute <AttributeCardDrawSound>(e).CardId)
            {
                list.Add(e);
            }
        }
        return(list);
    }
Beispiel #2
0
    public void PlayerShowCard(int cardID, bool next)
    {
        List <CardDrawSound>   listSoundDraw      = GetList(cardID);
        CardDrawSound          e                  = listSoundDraw[0];
        AttributeCardDrawSound attributeCardSound = Utility.EnumUtility.GetAttribute <AttributeCardDrawSound>(e);

        if (attributeCardSound.SoundId != -1)
        {
            if (dicSound.ContainsKey(attributeCardSound.CardId))
            {
                if (next)
                {
                    if (dicSound[attributeCardSound.CardId] == listSoundDraw.Count - 1)
                    {
                        dicSound[attributeCardSound.CardId] = attributeCardSound.IndexSoundOfCard;
                        AudioManager.Instance.PlaySoundDrawCard(attributeCardSound.SoundId);
                    }
                    else
                    {
                        dicSound[attributeCardSound.CardId] = dicSound[attributeCardSound.CardId] + 1;
                        CardDrawSound nextSound = listSoundDraw.Find(c => Utility.EnumUtility.GetAttribute <AttributeCardDrawSound>(c).IndexSoundOfCard == dicSound  [attributeCardSound.CardId]);
                        AudioManager.Instance.PlaySoundDrawCard(Utility.EnumUtility.GetAttribute <AttributeCardDrawSound>(nextSound).SoundId);
                    }
                }
                else
                {
                    CardDrawSound nextSound = listSoundDraw.Find(c => Utility.EnumUtility.GetAttribute <AttributeCardDrawSound>(c).IndexSoundOfCard == dicSound[attributeCardSound.CardId]);
                    AudioManager.Instance.PlaySoundDrawCard(Utility.EnumUtility.GetAttribute <AttributeCardDrawSound>(nextSound).SoundId);
                }
            }
            else
            {
                dicSound.Add(attributeCardSound.CardId, attributeCardSound.IndexSoundOfCard);
                AudioManager.Instance.PlaySoundDrawCard(attributeCardSound.SoundId);
                soundCardId = attributeCardSound.SoundId;
            }
        }
    }