티스토리 뷰
요는 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
- 송신기
- Unity3D
- 250
- 스윙팡
- 6bq5
- KT-88
- 웰케라
- transistor
- hybrid
- EP200
- KT88
- iPhone
- 실바웰드
- ep-200
- 유니티3D
- 2a3
- 수신기
- 앰프
- bias
- 프리앰프
- 타격연습기
- 타석스크린
- rx-2404
- gaui
- 진공관
- 하니비
- 하이브리드
- TRex
- 시뮬전용
- 유니티
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 29 | 30 | 31 |
글 보관함