메뉴 건너뛰기

라이온하트 2nd edition

홈페이지를 새롭게 리뉴얼합니다.

?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

1. 먼저 클래스 직렬화로 만들기


using UnityEngine;
using System.Collections;
using System;


// ( 이것 때문에 하루 걸렸다 ㅠ 클래스 앞에 꼭 [Serializable] 붙이기 )

[Serializable]
public class Sm_mlevel_st_entry
{
    private string stl1;
    private string stl2;
    private string stl3;
    private string stl4;
    private string stl5;

   public Sm_mlevel_st_entry(string _stl1, string _stl2, string _stl3, string _stl4, string _stl5)
   {
        this.stl1 = _stl1; //ml_level
        this.stl2 = _stl2; //ml_1
        this.stl3 = _stl3; //ml_2
        this.stl4 = _stl4; //ml_3
        this.stl5 = _stl5; //ml_4
    }

    public string getStl1()
    {
        return stl1;
    }
    public string getStl2()
    {
        return stl2;
    }
    public string getStl3()
    {
        return stl3;
    }
    public string getStl4()
    {
        return stl4;
    }
    public string getStl5()
    {
        return stl5;
    }

}


2. 저장 및 로드 함수


    public object LoadData(string file_Name)
    {
        if (File.Exists(Application.dataPath + "/Sm_data_table/" + file_Name + ".dat"))
        {
            var b = new BinaryFormatter();
            var f = File.Open(Application.dataPath + "/Sm_data_table/" + file_Name + ".dat", FileMode.Open);
            object obj = b.Deserialize(f);
            f.Close();
            return obj;
        }
        else
        {
            return null;
        }
    }

    public void SaveData( string file_Name, object tmp_list )
    {
        var b = new BinaryFormatter();
        var f = File.Create(Application.dataPath + "/Sm_data_table/" + file_Name + ".dat");
        b.Serialize(f, tmp_list);
        f.Close();
    }


3. 사용하기


        List<Sm_mlevel_st_entry> tmpList = new List<Sm_mlevel_st_entry>();


        for (int i = 0; i < 5; i++)
        {
            Sm_mlevel_st_entry entry1 = new Sm_mlevel_st_entry("1q " + i.ToString(), "2w " + i.ToString(), "3e " + i.ToString(), "4r " + i.ToString(), "5t " + i.ToString());
            tmpList.Add(entry1);
        }


        Sm_data_table.instance.SaveData("sm_mlevel_st", tmpList); // 세이브


        List<Sm_mlevel_st_entry> tmpList2 = new List<Sm_mlevel_st_entry>();


        tmpList2 = (List<Sm_mlevel_st_entry>) Sm_data_table.instance.LoadData("sm_mlevel_st"); // 로드


  1. [CentOS] NTFS마운트하기

  2. CentOS 6.x 설치 시 BIOS RAID metadata 문제

  3. XE 속도개선 (XE 캐시파일 초기화 시간 줄이는 팁) - 다국어 제거

  4. Chrome on Centos

  5. INSTALLING NVIDIA LINUX DRIVERS IN A XEN ENABLED KERNEL

  6. Install NVIDIA Drivers in XEN Kernel

  7. XE 속도 개선팁 모음

  8. memcached 설치 및 설정

  9. XE 쇼핑몰 솔루션

  10. 알아두면 유용한 무료사이트 20선

  11. Ubuntu, HWP 2008 installation on x86 and x64 (only Link)

  12. USB 저장장치에 의한 데이터 유출 방지 방법

  13. 파일검색 루틴 (개발용)

  14. Realtek 8723be-bt 무선랜 드라이버 (한성 u44x )

  15. [LINK] 윈도우 8 관리자 권한 설정으로 항상 관리자 권한 얻기

  16. C# How to make a simple MP3 player in C#

  17. [ 유니티3D엔진 ] FPS 프레임 조절

  18. [ OS X ] 폴더 숨김파일 표시

  19. C#에서 무료 TTS 사용하기

  20. 우분투 sudo 비밀번호 안물어보게 하기

Board Pagination ‹ Prev 1 ... 3 4 5 6 7 8 9 10 11 12 Next ›
/ 12