Пример #1
0
        static void Sample_simple_append_extract_struct2()
        {
            // Declare) 임시로 사용할 List를 선언한다.
            TEST2 temp = new TEST2();

            temp.a = 10;
            //temp.b;				// 생성하지 않았다! (이 변수는 null일 것이다.)
            temp.c   = new TEST();
            temp.c.x = 10;
            temp.c.y = 1.0f;
            //temp.c.z = "temp string";
            temp.c.w = new List <int> {
                10, 20, 30
            };

            // 1) byte[256]를 생성해서 설정한다.
            CGD.buffer bufTemp = new CGD.buffer(new byte[256]);

            // APPEND 1) List<int>를 추가한다.
            bufTemp.append(temp);

            // EXTRACT 1) 추가했던 문자열을 읽어낸다.
            var tempRead = bufTemp.extract <TEST2>();

            // 4) 출력한다.
            Console.WriteLine(tempRead.a);
            Console.WriteLine(tempRead.b);
            Console.WriteLine(tempRead.c.x);
            Console.WriteLine(tempRead.c.y);
            Console.WriteLine(tempRead.c.z);
            foreach (var iter in tempRead.c.w)
            {
                Console.WriteLine(iter.ToString());
            }
        }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        TEST2 t = new TEST2();

        StartCoroutine(t.A());
        StartCoroutine(t.B());
    }
Пример #3
0
        static void Sample_simple_append_extract_struct2()
        {
            // Declare) 임시로 사용할 List를 선언한다.
            TEST2 temp = new TEST2();
            temp.a = 10;
            //temp.b;				// 생성하지 않았다! (이 변수는 null일 것이다.)
            temp.c = new TEST();
            temp.c.x = 10;
            temp.c.y = 1.0f;
            //temp.c.z = "temp string";
            temp.c.w = new List<int> { 10, 20, 30 };

            // 1) byte[256]를 생성해서 설정한다.
            CGD.buffer bufTemp = new CGD.buffer(new byte[256]);

            // APPEND 1) List<int>를 추가한다.
            bufTemp.append(temp);

            // EXTRACT 1) 추가했던 문자열을 읽어낸다.
            var tempRead = bufTemp.extract<TEST2>();

            // 4) 출력한다.
            Console.WriteLine(tempRead.a);
            Console.WriteLine(tempRead.b);
            Console.WriteLine(tempRead.c.x);
            Console.WriteLine(tempRead.c.y);
            Console.WriteLine(tempRead.c.z);
            foreach (var iter in tempRead.c.w) { Console.WriteLine(iter.ToString()); }
        }