示例#1
0
 public override void onMPChanged(Int32 oldValue)
 {
     // Dbg.DEBUG_MSG(className + "::set_MP: " + old + " => " + v);
     Event.fireOut("set_MP", new object[] { this, MP, MP_Max });
 }
示例#2
0
 public override void onHP_MaxChanged(Int32 oldValue)
 {
     // Dbg.DEBUG_MSG(className + "::set_HP_Max: " + old + " => " + v);
     Event.fireOut("set_HP_Max", new object[] { this, HP_Max, HP });
 }
示例#3
0
 public override void onJump()
 {
     Dbg.DEBUG_MSG(className + "::onJump: " + id);
     Event.fireOut("otherAvatarOnJump", new object[] { this });
 }
示例#4
0
 public override void onRemoveSkill(Int32 skillID)
 {
     Dbg.DEBUG_MSG(className + "::onRemoveSkill(" + skillID + ")");
     Event.fireOut("onRemoveSkill", new object[] { this });
     SkillBox.inst.remove(skillID);
 }
示例#5
0
 public virtual void onLeaveSpace()
 {
     Dbg.DEBUG_MSG(classtype + "::onLeaveSpace: " + id);
     inWorld = false;
     Event.fireOut("onLeaveSpace", new object[] { this });
 }
示例#6
0
 public virtual void onEnterSpace()
 {
     Dbg.DEBUG_MSG(classtype + "::onEnterSpace(" + getDefinedPropterty("uid") + "): " + id);
     inWorld = true;
     Event.fireOut("onEnterSpace", new object[] { this });
 }
示例#7
0
        public void recv()
        {
            if (socket_ == null || socket_.Connected == false)
            {
                throw new ArgumentException("invalid socket!");
            }

            if (socket_.Poll(1000, SelectMode.SelectRead))
            {
                if (socket_ == null || socket_.Connected == false)
                {
                    Dbg.WARNING_MSG("invalid socket!");
                    return;
                }

                byte[] datas = new byte[MemoryStream.BUFFER_MAX];

                int successReceiveBytes = 0;

                try
                {
                    successReceiveBytes = socket_.Receive(datas, MemoryStream.BUFFER_MAX, 0);
                }
                catch (SocketException err)
                {
                    if (err.ErrorCode == 10054 || err.ErrorCode == 10053)
                    {
                        Dbg.DEBUG_MSG(string.Format("NetworkInterface::recv(): disable connect!"));
                        if (socket_ != null && socket_.Connected)
                        {
                            socket_.Close();
                        }
                        socket_ = null;
                        Event.fire("onDisableConnect", new object[] {});
                    }
                    else
                    {
                        Dbg.ERROR_MSG(string.Format("NetworkInterface::recv(): socket error(" + err.ErrorCode + ")!"));
                    }
                }

                if (successReceiveBytes > 0)
                {
                    //	Dbg.DEBUG_MSG(string.Format("NetworkInterface::recv(): size={0}!", successReceiveBytes));
                }
                else if (successReceiveBytes == 0)
                {
                    Dbg.DEBUG_MSG(string.Format("NetworkInterface::recv(): disable connect!"));
                    if (socket_ != null && socket_.Connected)
                    {
                        socket_.Close();
                    }
                    socket_ = null;
                }
                else
                {
                    Dbg.ERROR_MSG(string.Format("NetworkInterface::recv(): socket error!"));
                }

                msgReader.process(datas, (MessageLength)successReceiveBytes);
            }
        }