티스토리 뷰
요는 byte Streaming 밖에 안되기 땜시 byte[] 형태로 변환 후 억세스가 가능하다.
using UnityEngine;
using System.Collections;
using System.IO;
using System.Runtime.InteropServices;
public static void SaveNote ( BufferedStream bs, _st_NOTE nn )
{
bs.Write( System.BitConverter.GetBytes(nn.ID), 0, 4 );
bs.Write( System.BitConverter.GetBytes( nn.PlayTime ), 0, 4 );
bs.Write( System.BitConverter.GetBytes(nn.MeasureCount), 0, 4 );
//bs.Write( System.BitConverter.GetBytes(nn.Level), 0, 4 );
}
public static void SaveNoteList ( string fName )
{
FileStream file = new FileStream( fName, FileMode.OpenOrCreate, FileAccess.Write );
BufferedStream bs = new BufferedStream( file );
bs.Write( System.BitConverter.GetBytes(noteList.Count), 0, 4 );
foreach( _st_NOTE nn in noteList )
{
SaveNote( bs, nn );
}
bs.Close();
}
public static bool LoadNote ( BufferedStream bs, _st_NOTE nn )
{
byte[] rBuffer = new byte[4];
bs.Read( rBuffer, 0, 4 );
nn.ID = System.BitConverter.ToInt32( rBuffer, 0 );
bs.Read( rBuffer, 0, 4 );
nn.PlayTime = System.BitConverter.ToSingle( rBuffer, 0 );
bs.Read( rBuffer, 0, 4 );
nn.MeasureCount = System.BitConverter.ToInt32( rBuffer, 0 );
bs.Read( rBuffer, 0, 4 );
nn.Level = System.BitConverter.ToInt32( rBuffer, 0 );
string dbgStr = nn.ID.ToString() +" : "+ nn.MeasureCount.ToString() +" : "+ nn.Level.ToString();
print( dbgStr );
return true;
}
public static bool LoadNoteList ( string fName )
{
byte[] rBuffer = new byte[4];
FileStream file = new FileStream( fName, FileMode.Open, FileAccess.Read );
BufferedStream bs = new BufferedStream( file );
// Readm List Count
bs.Read( rBuffer, 0, 4 );
int listCount = System.BitConverter.ToInt32( rBuffer, 0 );
for( int wi=0 ; wi<listCount ; wi++ )
{
AddNode( new _st_NOTE(wi) );
}
foreach( _st_NOTE nn in noteList )
{
LoadNote( bs, nn );
}
bs.Close();
return true;
}
'Programming > Unity3D' 카테고리의 다른 글
신규 케릭 테스트 (0) | 2010.10.25 |
---|---|
yield 란 놈은... 참.. (0) | 2010.10.13 |
File 읽어오기 (0) | 2010.10.08 |
댄스... (0) | 2010.09.20 |
Airplay 처음 접하고... (0) | 2010.08.27 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- gaui
- 유니티3D
- hybrid
- ep-200
- 송신기
- 250
- 하니비
- 웰케라
- EP200
- 앰프
- 프리앰프
- 타석스크린
- TRex
- Unity3D
- iPhone
- 실바웰드
- 2a3
- bias
- KT88
- 6bq5
- transistor
- 스윙팡
- 유니티
- 하이브리드
- KT-88
- 수신기
- 진공관
- 시뮬전용
- rx-2404
- 타격연습기
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함