public void FadeInOrOut(bool isIn) { if (isIn) { UICollection.AlphaFadeImg(gameObject, isIn, 0.7f); } }
public void ChangeItem(ItemData item) { itemData = item; if (itemData.itemName != "") { string imagePath = "Sprites/DrinkItem/" + itemData.imgName; Sprite spr = Resources.Load <Sprite>(imagePath); UICollection.SetImage(spr, GetComponent <Image>()); UICollection.AlphaFadeImg(gameObject, true); colliderObj.isAllowDrag = true; try { colliderObj.ChangeBindItem(this, spr); } catch (Exception e) { Debug.Log("刚启动时绑定拖拽物品CraftItemCollider,好像会报错"); Debug.Log("报错为:" + e); } } else { gameObject.GetComponent <Image>().sprite = null; UICollection.AlphaFadeImg(gameObject, false); colliderObj.isAllowDrag = false; } }
public void ChangeDisc(CdBoxControl control) { //切换歌曲列表 track = control.track; musicList.Clear(); foreach (CdData.OneMusic music in track.musicList) { AudioClip clip = Resources.Load <AudioClip>("Musics/" + music.musicName); musicList.Add(clip); } Image cdSmallImage = control.cdSmallImage; StartCoroutine(DelayToInvoke.DelayToInvokeDo(() => { UICollection.MoveToPos(cdSmallImage.gameObject, control.MoveTargetPos, 0.2f); }, 0.0f)); StartCoroutine(DelayToInvoke.DelayToInvokeDo(() => { UICollection.AlphaFadeImg(cdSmallImage.gameObject, false); }, 0.2f)); StartCoroutine(DelayToInvoke.DelayToInvokeDo(() => { NeedleOut(); UICollection.AlphaFadeImg(discImage.gameObject, false); DiscStopRotating(); }, 1f)); StartCoroutine(DelayToInvoke.DelayToInvokeDo(() => { NeedleIn(5.0f); UICollection.SetImage(control.cdSmallImage.sprite, discImage); UICollection.AlphaFadeImg(discImage.gameObject, true); control.isChanging = false; control.isSelected = true; }, 2f)); StartCoroutine(DelayToInvoke.DelayToInvokeDo(() => { DiscStartRotating(); audioSource.Play(); musicNameText.text = audioSource.clip.name; ChangeToPauseSpr(); UICollection.SetImage(pauseBtn.upSpr, pauseBtn.gameObject.GetComponent <Image>()); }, 2.5f)); }