예제 #1
0
        /// <summary>
        /// 网络回调
        /// </summary>
        /// <param name="obj_arr"></param>
        protected override void GetNetworkMsgCallBack(params object[] obj_arr)
        {
            try
            {
                NetworkMessage message = (NetworkMessage)obj_arr[0];

                if (message.type == 4 && IP.Equals(message.ip))
                {
                    TransformMessage tr = TransformMessage.GetMessage(message.message);
                    //同步位置
                    player.SetTarget(tr);
                }
                else if (message.type == 5 && message.ip == IP)
                {
                    AddMessage(message);
                }
                else if (message.type == 6 && message.ip == IP)
                {
                    AddMessage(message);
                }
                else if (message.type == 18 && message.ip == IP)
                {
                    AddMessage(message);
                }
            }
            catch (System.Exception e)
            {
                Debug.LogError(e.ToString());
            }
        }