public IEnumerator UnityFileLoading() { string strFilePath = GlobalConstants.ASSET_PATH + "townNode.xml"; DebugWide.Log("-------------" + strFilePath + "-------------"); MemoryStream memStream = null; { UnityEngine.WWW wwwUrl = new UnityEngine.WWW(strFilePath); while (!wwwUrl.isDone) { if (wwwUrl.error != null) { DebugWide.Log("error : " + wwwUrl.error.ToString()); yield break; } DebugWide.Log("wwwUrl.progress---" + wwwUrl.progress); yield return(null); } if (wwwUrl.isDone) { DebugWide.Log("wwwUrl.isDone---size : " + wwwUrl.size); DebugWide.Log("wwwUrl.isDone---bytesLength : " + wwwUrl.bytes.Length); memStream = new MemoryStream(wwwUrl.bytes); } } _nodeInfo.LoadXMLFromMemory(memStream); //chamto test DebugWide.Log("AsyncLoading complete"); yield return(memStream); }
//WidUseCoroutine 으로 사용해야 동작함. 유니티코루틴으로는 동작안함 //ex) CSingleton<WideUseCoroutine>.Instance.StartCoroutine (t.LoadXML (), null, false, "CTableNodeInfo"); public IEnumerator LoadXML() { //내부 코루틴 부분 //------------------------------------------------------------------------ DebugWide.Log(GlobalConstants.ASSET_PATH + m_strFileName); //chamto test MemoryStream stream = null; yield return(ResourceManager.AsyncFileLoading(GlobalConstants.ASSET_PATH + m_strFileName, value => stream = value)); if (null == stream) { DebugWide.Log("error : failed LoadFromFile : " + GlobalConstants.ASSET_PATH + m_strFileName); yield break; } this.LoadXMLFromMemory(stream); //chamto test //PrintValue (); //SaveXML ("Assets/StreamingAssets/"+"abc.xml", _data); }
void TouchBegan() { //NavGraphNode node = _pathFinder._graph.FindNearNode (Input_Unity.GetTouchWorldPos ()); //Debug.Log ("findNode : "+node); //chamto test //chamto test code - layer collision test bool option = true; option = Physics2D.GetIgnoreLayerCollision(GlobalConstants.Layer.Num.superCat, GlobalConstants.Layer.Num.building); Physics2D.IgnoreLayerCollision(GlobalConstants.Layer.Num.superCat, GlobalConstants.Layer.Num.building, true); if (this.gameObject.layer != GlobalConstants.Layer.Num.superCat) { this.gameObject.layer = GlobalConstants.Layer.Num.superCat; } else { this.gameObject.layer = GlobalConstants.Layer.Num.default0; } DebugWide.Log("began"); }
public void StartCoroutine(IEnumerator routine, coroutineCallBack callBack = null, bool asynchronous = false, string strName = "") { if (null == routine) { return; } coroutineJob job = new coroutineJob(); if (true == asynchronous) { //********* 비동기 ********** job.etorRoot = routine; job.etorCurrentDepth = routine; job.callBack = callBack; listCoroutine.Add(job); } else { //********** 동기 ********** //코루틴 수행 job.etorRoot = routine; job.etorCurrentDepth = routine; //int coroutineCount = 0; //float startTime = 0f; //float endTime = 0f; //float timeElapsed = 0f; //while(true) int processCount = 1; for (int i = 0; i < processCount; i++) //chamto test , while로 무한대로 돌리면 유니티에디터가 정지상태가 됨 { //Time 같은 유니티 전용함수를 쓰면 서버에서 컴파일이 안됨 //startTime = Time.realtimeSinceStartup; //timeElapsed += (endTime - startTime); //--------------------------------------------------------------------------------------------------- if (false == job.etorCurrentDepth.MoveNext()) { //******* 현재 코루틴 완료 ******* if (job.etorRoot == job.etorCurrentDepth) { //최상위 부모 코루틴으로 돌아왔을때 콜백호출후, 코루틴 처리를 마친다. if (null != callBack) { //콜백요청이 있다면 처리해 준다. callBack(job.etorCurrentDepth.Current); } DebugWide.Log("현재 코루틴 완료" + " " + strName); break; } else { processCount++; job.etorCurrentDepth = job.stackPrev.Pop(); } } //--------------------------------------------------------------------------------------------------- else { //******* 현재 코루틴 진행중 ******* processCount++; //DebugWide.Log("현재 코루틴 진행중" + " " + strName); if (null != job.etorCurrentDepth.Current && job.etorCurrentDepth.Current is IEnumerator) { job.stackPrev.Push(job.etorCurrentDepth); job.etorCurrentDepth = job.etorCurrentDepth.Current as IEnumerator; } }//end else //System.Threading.Thread.Sleep(10); //while 문에서 CPU계속 점유하는 현상이 있어 넣어봄 //--------------------------------------------------------------------------------------------------- //endTime = Time.realtimeSinceStartup; } //end while } //end else }
void TouchEnded() { DebugWide.Log("ended"); }
void TouchMoved() { DebugWide.Log("moved"); }