//オーディオクリップをSEとして再生 SoundSe PlaySeClip(AudioClip clip, float volume, string label, SoundPlayMode playMode) { if (string.IsNullOrEmpty(label)) { label = clip.name; } switch (playMode) { case SoundPlayMode.Add: break; case SoundPlayMode.Cancel: if (IsPlayingSe(label)) { Debug.Log("Cancel"); StopSe(label, 0.02f); } break; case SoundPlayMode.NoPlay: if (IsPlayingSe(label)) { return(null); } break; } GameObject go = UtageToolKit.AddChild(CachedTransform, new GameObject(label)); SoundSe se = go.AddComponent <SoundSe>(); se.Init(clip, volume); return(se); }
/// <summary> /// アイテムを追加 /// </summary> /// <param name="itemNum">アイテムの数</param> /// <param name="callbackCreateItem">アイテムが作成されるときに呼ばれるコールバック</param> public void AddItems(List <GameObject> items) { foreach (var item in items) { UtageToolKit.AddChild(Content, item); } }
SoundStreamFade CreateSoundStreamFade(string name) { GameObject go = UtageToolKit.AddChild(this.transform, new GameObject(name)); SoundStreamFade stream = go.AddComponent <SoundStreamFade>(); return(stream); }
//オーディオクリップをSEとして再生 AudioSource PlaySeClip(AudioClip clip, float volume) { GameObject go = UtageToolKit.AddChild(this.transform, new GameObject(GameObjectNameSe)); AudioSource source = go.AddComponent <AudioSource>(); source.clip = clip; source.volume = volume; source.Play(); Destroy(go, clip.length); return(source); }
//選択肢を作成 void CreateItems() { ClearAll(); List <GameObject> listViewItems = new List <GameObject>(); foreach (var data in SelectionManager.Selections) { GameObject go = GameObject.Instantiate(GetPrefab(data)) as GameObject; AdvUguiSelection selection = go.GetComponentInChildren <AdvUguiSelection>(); if (selection) { selection.Init(data, OnTap); } switch (selectedColorMode) { case SelectedColorMode.Change: if (Engine.SystemSaveData.SelectionData.Check(data)) { go.SendMessage("OnInitSelected", selectedColor); } break; case SelectedColorMode.None: default: break; } Items.Add(go); //X,Y座標の指定がないならリストビューに追加 if (data.X == null || data.Y == null) { listViewItems.Add(go); } else { UtageToolKit.AddChild(this.transform, go, new Vector3(data.X.Value, data.Y.Value, 0)); } } ListView.AddItems(listViewItems); ListView.Reposition(); }
void Awake() { childRoot = UtageToolKit.AddChild(this.transform, new GameObject("root")); childRoot.transform.localEulerAngles = Vector3.up * 180; }
/// <summary> /// 子の追加 /// </summary> /// <param name="parent">親</param> /// <param name="go">子</param> /// <param name="localPosition">子に設定するローカル座標</param> /// <returns>追加済みの子</returns> public static GameObject AddChild(Transform parent, GameObject go, Vector3 localPosition) { return(UtageToolKit.AddChild(parent, go, localPosition, Vector3.one)); }
/// <summary> /// 子の追加 /// </summary> /// <param name="parent">親</param> /// <param name="go">子</param> /// <returns>追加済みの子</returns> public static GameObject AddChild(Transform parent, GameObject go) { return(UtageToolKit.AddChild(parent, go, Vector3.zero, Vector3.one)); }