コード例 #1
0
        public void TestCustomRW()
        {
            QuestMessage message = new QuestMessage()
            {
                quest = new MockQuest(100)
            };

            byte[] data = MessagePackerTest.PackToByteArray(message);

            QuestMessage unpacked = MessagePacker.Unpack <QuestMessage>(data);

            Assert.That(unpacked.quest.Id, Is.EqualTo(100));
        }
コード例 #2
0
        public void TestWriteScriptableObject()
        {
            ScriptableObjectMessage message = new ScriptableObjectMessage
            {
                scriptableObject = ScriptableObject.CreateInstance <MyScriptableObject>()
            };

            message.scriptableObject.someData = 10;

            byte[] data = MessagePackerTest.PackToByteArray(message);

            ScriptableObjectMessage unpacked = MessagePackerTest.UnpackFromByteArray <ScriptableObjectMessage>(data);

            Assert.That(unpacked.scriptableObject, Is.Not.Null);
            Assert.That(unpacked.scriptableObject.someData, Is.EqualTo(10));
        }