void IHandler <Start> .Handle(FrameArgs frame, Start e) { _cam = new Camera2D(e.Size, 1000f, Camera2DOrigin.LowerLeft); // create our UI root. adding it to the scene allows events // like touch and resize to filter through the UI hierarchy. // it also automatically disposes the hierarchy. _root = new RootView(e.Size, 0f); this.Add(_root); // create our custom progress bar to stretch across most // of the screen _bar = new ProgressBarView(new LayoutSpec { Top = p => (e.Size.Y - 30f) / 2f, Height = p => 30f, Left = p => 50, Right = p => 50 }); _root.AddView(_bar); // spin up a coroutine to animate the progress bar // keeping a reference to the coroutine list allows us to // access frame args from within coroutines _co = new CoroutineList <FrameArgs>(); this.Add(_co); _co.Start(this.CoAnimateBar()); }
void IHandler <Start> .Handle(FrameArgs frame, Start e) { var musicChannel = new StreamingSoundChannel(); var music = new StreamingOpusFile("mario.opus"); var co = new CoroutineList <FrameArgs>(); // make sure this all gets disposed/tracked this.AddMany(musicChannel, music, co); // start the music musicChannel.PlaySound(music); // loop will handle the sound effect co.Start(this.CoPlayRepeat()); }
IEnumerator LoadResourcesAssetsData(ResourceInfo info, string[] names) { var path = CreateResourcesDirectoryPath(info.path); info.assets = new UnityEngine.Object[names.Length]; var cl = new CoroutineList(); for (int i = 0; i < names.Length; ++i) { var co = LoadResourcesAssetData( Path.Combine(path, Path.GetFileNameWithoutExtension(names[i])), info.assets, i); cl.Add(co); } yield return(cl.WaitForCoroutine(this)); info.CallLoadEnd(); }
IEnumerator LoadAssetBundleAssetsData(ResourceInfo info, string[] names) { var assetBundleInfo = info.assetBundleInfo; yield return(LoadAssetBundleBase(assetBundleInfo, info.path)); info.assets = new UnityEngine.Object[names.Length]; var cl = new CoroutineList(); for (int i = 0; i < names.Length; ++i) { cl.Add(LoadAssetBundleAssetsData(assetBundleInfo.ab, names[i], info.assets, i)); } yield return(cl.WaitForCoroutine(this)); info.CallLoadEnd(); assetBundleInfo.locked = false; }
public void AddCoroutine(MonoBehaviour Mono, Updater Routine, float fDelay, bool bFirstUpdate = true) { //IEnumerator Key = Routine.m_Iterator; int nMonoKey = Mono.GetInstanceID(); CoroutineList RoutineList; ///해당 객체가 없다면 if (!m_ObjectList.ContainsKey(nMonoKey)) { CoroutineList NewList = new CoroutineList(); m_ObjectList.Add(nMonoKey, NewList); #if UNITY_EDITOR g_ObjectList.Add(new SimpleObjectInfo(nMonoKey, Mono)); g_nObjectCount++; #endif } RoutineList = m_ObjectList[nMonoKey]; ///중복 방지 if (RoutineList.m_CoroutineList.ContainsKey(Routine.m_Iterator)) { //Debugs.Log("[실패] Add New Coroutine ", Routine.GetHashCode()); return; } RoutineList.m_CoroutineList.Add(Routine.m_Iterator, Routine); #if UNITY_EDITOR SimpleObjectInfo Info = g_ObjectList.Find(x => x.m_nMonoKey == nMonoKey); Info.m_CoroutineList.Add(Routine); g_nCoroutineCount++; //if (g_bPrintLog) // Debugs.Log("[코루틴매니저-코루틴추가] 성공! 카운트[", RoutineList.m_CoroutineList.Count, "]", nMonoKey.ToString(), " ", Routine.m_Iterator.GetHashCode()); if (RoutineList.m_CoroutineList.Count >= 5) { //if (g_bPrintLog) //Debugs.LogError("[코루틴매니저-코루틴추가] 이 객체가 활성화 중인 코루틴이 너무 많습니다! 카운트[전체 객체 수", m_ObjectList.Count, "][이 객체의 활성화 코루틴 수", RoutineList.m_CoroutineList.Count, "]"); } #endif m_LastRoutine = Routine.m_Iterator; InitRoutine(Routine, nMonoKey, fDelay, bFirstUpdate); }
void IHandler <Start> .Handle(FrameArgs frame, Start e) { _cam = new Camera2D(e.Size, 1000f, Camera2DOrigin.Center); // we'll use a solid red material _mat = new SpriteMaterial(new SolidColorShader(), null) { Color = new Vector4(1, 0, 0, 1) }; // create a quad with an origin at the center and unit size _quad = new Quad(_mat, new Vector4(-0.5f, -0.5f, 0.5f, 0.5f), Vector4.One); _pos = new Vector3(-200, 0, 0); // fire up the coroutine var co = new CoroutineList <FrameArgs>(); this.Add(co); co.Start(this.CoAnimate()); }
public void Clear() { for (int i = 0; i < m_ObjectList.Count; i++) { CoroutineList List = m_ObjectList.ElementAt(i); for (int j = 0; j < List.m_CoroutineList.Count; j++) { List.m_CoroutineList.ElementAt(j).RemoveThis(); j--; } } m_ObjectList.Clear(); m_FadeCoroutineList.Clear(); m_LastRoutine = null; #if UNITY_EDITOR g_ObjectList.Clear(); g_nObjectCount = 0; g_nCoroutineCount = 0; g_nGlobalCoroutineCount = 0; #endif // Debugs.Log("[CoroutineManager] 코루틴 초기화 완료!"); }
// Use this for initialization void Awake() { textPanel.SetActive(false); c_Queue = this.GetComponent <CoroutineList>(); Init(); }
// Use this for initialization void Awake() { textPanel.SetActive(false); c_Queue = this.GetComponent<CoroutineList>(); Init(); }
// Use this for initialization protected void Start() { playerManager = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerManager>(); isNearing = isLeaving = isPlayerHeading = isNpcHeading = false; prevDistSquared = float.MaxValue; coroutineList = new CoroutineList(); }