view src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLogTest.cs @ 13:4c8932dad7b2

Add Test and only NetworkTreeOperationLogTest.cs not work.
author Kazuma
date Sun, 23 Oct 2016 13:35:21 +0900
parents
children
line wrap: on
line source

using UnityEngine;
using System.Collections;
using MsgPack;

public class NetworkTreeOperationLogTest : MonoBehaviour {

	// Use this for initialization
	void Start () { // not work yet 10/23 13:33
		NetworkAppendChildAtOperation op = new NetworkAppendChildAtOperation(1);
		NetworkNodePath path = new NetworkNodePath();
		NodePath npath = path.add(1).add(2);
		NetworkTreeOperationLog log = new NetworkTreeOperationLog();
		log.add(npath, op);
		log.add(npath, op);
		ObjectPacker pack = new ObjectPacker();
		byte[] value = pack.Pack(log);

		// unpackage
		ObjectPacker unpack = new ObjectPacker();
		NetworkTreeOperationLog mOp = unpack.Unpack<NetworkTreeOperationLog>(value);
		foreach (var m in mOp) {
			print(m.getNodePath().size());
			print(m.getNodeOperation());
		}
	}
}