public static void SendMessage(UnityChoseKun.MessageID id)
        {
            var memory = new MemoryStream();
            var writer = new BinaryWriter(memory);

            try
            {
                writer.Write((int)id);
                var bytes = memory.ToArray();
                EditorConnection.instance.Send(UnityChoseKun.kMsgSendEditorToPlayer, bytes);
            }
            finally
            {
                writer.Close();
                memory.Close();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// PlayerからEditorへの送信
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <param name="obj"></param>
        public static void SendMessage <T>(UnityChoseKun.MessageID id, T obj) where T : ISerializerKun
        {
            //UnityChoseKun.Log("UnityChoseKunPlayer.SendMessage<T>("+ id + ",obj)" );
            MemoryStream memoryStream = new MemoryStream();
            BinaryWriter binaryWriter = new BinaryWriter(memoryStream);

            try
            {
                binaryWriter.Write((int)id);
                obj.Serialize(binaryWriter);
                byte[] bytes = memoryStream.ToArray();
                PlayerConnection.instance.Send(UnityChoseKun.kMsgSendPlayerToEditor, bytes);
            }
            finally
            {
                binaryWriter.Close();
                memoryStream.Close();
            }
        }
        public static void SendMessage <T>(UnityChoseKun.MessageID id, T obj) where T : ISerializerKun
        {
            var memory = new MemoryStream();
            var writer = new BinaryWriter(memory);

            try
            {
                writer.Write((int)id);
                if (obj != null)
                {
                    obj.Serialize(writer);
                }
                var bytes = memory.ToArray();
                EditorConnection.instance.Send(UnityChoseKun.kMsgSendEditorToPlayer, bytes);
            }
            finally
            {
                writer.Close();
                memory.Close();
            }
        }
Esempio n. 4
0
 public AssetPlayer(UnityChoseKun.MessageID messageID)
 {
     m_messageID = messageID;
 }