/// <summary> /// 播放音效 /// </summary> /// <param name="type"></param> /// <param name="?"></param> /// <param name="weight"></param> void PlaySound(CardsType type, Weight weight) { LandlordsModel.Instance.PlaySound(AudioManager.AudioSoundType.popCard); AudioManager.AudioSoundType soundType = AudioManager.AudioSoundType.None; if (type == CardsType.Single || type == CardsType.Double) { soundType = LandlordsSoundModel.PlayPlayerPopSound(player.playerInfo.uid, type, weight); } else { soundType = LandlordsSoundModel.PlayPlayerPopSound(player.playerInfo.uid, type); } LandlordsModel.Instance.PlaySound(soundType); //就剩2张牌 if (player.CardsCount == 2) { AudioManager.Instance.PlayTempSound(AudioManager.AudioSoundType.warring, PageManager.Instance.CurrentPage.name); LandlordsModel.Instance.PlaySound(player.Six == Six.boy ? AudioManager.AudioSoundType.boyTwocard : AudioManager.AudioSoundType.girlTwocard); } else if (player.CardsCount == 1) { LandlordsModel.Instance.PlaySound(player.Six == Six.boy ? AudioManager.AudioSoundType.boyOnecard : AudioManager.AudioSoundType.girlOnecard); } if (player.CardsCount <= 2 && player.CardsCount > 0) { LandlordsPage.Instance.LandlordsWarning(player.playerInfo.uid, player.CardsCount, true); } }
public void PlaySound(AudioManager.AudioSoundType audioType) { if (SetNode.read == 1) { AudioManager.Instance.PlayTempSound(audioType, PageManager.Instance.CurrentPage.name); } }
int columnMax = 6;//出牌堆每行最大牌数 2人玩法每行15张牌,起始位置x=-5.8 public void OutMj(MaJangModel mjm = null, Mj mj = null, bool playAnimation = true) { if (mjm || mj != null) { #region 打牌音效 //point // 点数 1- 9 //type // 类型 0万,1筒,2条 3中 //0男1女 if (mjm) { string soundString = (sex == 0 ? "boy" : "girl") + mjm.mj.type + mjm.mj.point; AudioManager.AudioSoundType audioType = GetSoundType(soundString); PlaySound(audioType); } else if (mj != null) { string soundString = (sex == 0 ? "boy" : "girl") + mj.type + mj.point; AudioManager.AudioSoundType audioType = GetSoundType(soundString); PlaySound(audioType); } #endregion if (!mjm) { mjm = handMjList[tingIcon.activeInHierarchy ? handMjList.Count - 1 : Random.Range(0, handMjList.Count)]; mjm.Init(mj, this); } int index = handMjList.IndexOf(mjm); int row = Mathf.CeilToInt((outParent.childCount + 1f) / columnMax) - 1; int column = outParent.childCount % columnMax; mjm.transform.SetParent(outParent); mjm.transform.localPosition = new Vector3(column * MaJangScene.mjSize.x, 0, -row * MaJangScene.mjSize.y); mjm.transform.localEulerAngles = Vector3.right * ConstantUtils.const90; StartCoroutine(ShowMj(mjm.mjNo.ToString()));//显示打出的牌 isOutNewCard = false; handMjList.Remove(mjm); MaJangPage.Instance.SetLastOutMj(mjm); PlaySound(AudioManager.AudioSoundType.mjoutcard); if (isCurrentPlayer) { UIUtils.SetAllChildrenLayer(mjm.transform, ConstantUtils.modelLayer); if (statu == 1) { for (int i = 0; i < handMjList.Count; i++) { handMjList[i].SetStatu(false); } statu = 2; } } if (playAnimation && index < handMjList.Count) { MjMoveAnimation(index); } isFinishAction = true; } }
public static UGUIEventListener Get(GameObject go, AudioManager.AudioSoundType clickAudio = AudioManager.AudioSoundType.BtnClick) { UGUIEventListener listener = go.GetComponent <UGUIEventListener>(); if (listener == null) { listener = go.AddComponent <UGUIEventListener>(); } listener.m_AudioType = clickAudio; return(listener); }
public void PlaySound() { if ((LandlordsEventAniType)aniType != LandlordsEventAniType.ChunTian || (LandlordsEventAniType)aniType != LandlordsEventAniType.FanChunTian) { if ((LandlordsEventAniType)aniType == LandlordsEventAniType.DoubleStraight) { aniType = LandlordsEventAniType.Straight; } AudioManager.AudioSoundType soundType = GameTool.StrToEnum <AudioManager.AudioSoundType>(aniType.ToString()); AudioManager.Instance.PlayTempSound(soundType, PageManager.Instance.CurrentPage.name); } }