private void SwitchItem(GListItem item, bool on) { if (item != null) { item.IsOn = on; if (on) { GUISound.PlaySoundClip(GUISound.PlayType.RollDown); } else { GUISound.PlaySoundClip(GUISound.PlayType.RollUp); } } }
private void OpenTab(int count, bool needRepos) { if (SubViewTemplate != null && _SubList != null) { if (MainSelected == -1) { count = 0; } float y_oldPos = CalcPosY(MainSelected); _SubList.SetItemCount(count); if (count > 0) { //Vector2 ori_size = SubViewTemplate.sizeDelta; ////Vector2 ori_size = Vector2.zero;//_subList.RectTrans.sizeDelta; //float rows = (count > 5) ? 5.5f : count; //Vector4 vb = GNewUITools.GetScrollViewBorder(_SubList.ScrollRectControl); ////ori_size.x = RectTrans.sizeDelta.x - 2 * _spacing.x; //ori_size.y = _SubList.Spacing.y * Mathf.Floor(rows + 1) + _SubList.CellRect.sizeDelta.y * rows + vb.w + vb.y; //SubViewTemplate.sizeDelta = ori_size; //_SubList.ScrollToStep(SubSelected); GUISound.PlaySoundClip(GUISound.PlayType.RollDown); } else { SubViewTemplate.sizeDelta = new Vector2(SubViewTemplate.sizeDelta.x, 0); } if (needRepos) { RepositionItems(); //fix position after sub list changing, MainSelected will remain in the same place float y_newPos = CalcPosY(MainSelected); ScrollToPosition(_Content.anchoredPosition.y + y_oldPos - y_newPos); } } }
public void PlaySound() { if (null == _selectable || _selectable.IsInteractable()) { if (playType == PlayType.Custom) { if (!string.IsNullOrEmpty(customClipName)) { PlaySoundClip(customClipName); } } else { #if IN_GAME //if (_UISondClips == null) //{ // Debug.LogWarning("GUISound not Init res Path"); // return; //} //int i_pt = (int)playType; //if (i_pt > -1 && i_pt < _UISondClips.Length) //{ // PlaySoundClip(_UISondClips[i_pt]); //} //else //{ // Debug.LogWarning("GUISound PlaySound with unknown type " + i_pt); //} //if (playType == PlayType.Btn_Back || playType == PlayType.Btn_Menu) //{ // GUISound.PlaySoundClip(GUISound.PlayType.Btn_Press); //} //else //{ GUISound.PlaySoundClip(playType); //} #else PlaySoundClip(Btn_Example); #endif } } }