예제 #1
0
파일: Entity.cs 프로젝트: gameogre/kbengine
        public virtual void set_state(object old)
        {
            object v = getDefinedPropterty("state");

            Dbg.DEBUG_MSG(classtype + "::set_state: " + v);
            Event.fire("set_state", new object[] { this, v });
        }
예제 #2
0
파일: Entity.cs 프로젝트: gameogre/kbengine
        public virtual void set_moveSpeed(object old)
        {
            object v = getDefinedPropterty("moveSpeed");

            Dbg.DEBUG_MSG(classtype + "::set_moveSpeed: " + v);
            Event.fire("set_moveSpeed", new object[] { this, v });
        }
예제 #3
0
파일: Entity.cs 프로젝트: gameogre/kbengine
        public virtual void set_MP(object old)
        {
            object mp = getDefinedPropterty("MP");

            Dbg.DEBUG_MSG(classtype + "::set_MP: " + mp);
            Event.fire("set_MP", new object[] { this, mp });
        }
예제 #4
0
        public void onRemoveAvatar(UInt64 dbid)
        {
            Dbg.DEBUG_MSG("Account::onRemoveAvatar: dbid=" + dbid);

            avatars.Remove(dbid);
            Event.fire("onRemoveAvatar", new object[] { dbid });
        }
        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;
                }

                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);
            }
        }
예제 #6
0
        public virtual void set_modelID(object old)
        {
            object v = getDefinedPropterty("modelID");

            Dbg.DEBUG_MSG(classtype + "::set_modelID: " + old + " => " + v);
            Event.fire("set_modelID", new object[] { this, v });
        }
예제 #7
0
        public void send(byte[] datas)
        {
            if (socket_ == null || socket_.Connected == false)
            {
                throw new ArgumentException("invalid socket!");
            }

            if (datas == null || datas.Length == 0)
            {
                throw new ArgumentException("invalid datas!");
            }

            try
            {
                socket_.Send(datas);
            }
            catch (SocketException err)
            {
                if (err.ErrorCode == 10054 || err.ErrorCode == 10053)
                {
                    Dbg.DEBUG_MSG(string.Format("NetworkInterface::send(): disable connect!"));
                    if (socket_ != null && socket_.Connected)
                    {
                        socket_.Close();
                    }
                    socket_ = null;
                    Event.fire("onDisableConnect", new object[] {});
                }
                else
                {
                    Dbg.ERROR_MSG(string.Format("NetworkInterface::send(): socket error(" + err.ErrorCode + ")!"));
                }
            }
        }
예제 #8
0
파일: Entity.cs 프로젝트: gameogre/kbengine
        public virtual void set_HP(object old)
        {
            object hp = getDefinedPropterty("HP");

            Dbg.DEBUG_MSG(classtype + "::set_HP: " + hp);
            Event.fire("set_HP", new object[] { this, hp });
        }
예제 #9
0
        public void onReqAvatarList(Dictionary <string, object> infos)
        {
            avatars.Clear();

            List <object> listinfos = (List <object>)infos["values"];

            Dbg.DEBUG_MSG("Account::onReqAvatarList: avatarsize=" + listinfos.Count);
            for (int i = 0; i < listinfos.Count; i++)
            {
                Dictionary <string, object> info = (Dictionary <string, object>)listinfos[i];
                Dbg.DEBUG_MSG("Account::onReqAvatarList: name" + i + "=" + (string)info["name"]);
                avatars.Add((UInt64)info["dbid"], info);
            }

            // ui event
            Dictionary <UInt64, Dictionary <string, object> > avatarList = new Dictionary <ulong, Dictionary <string, object> >(avatars);

            Event.fire("onReqAvatarList", new object[] { avatarList });

            if (listinfos.Count == 0)
            {
                return;
            }

            // selectAvatarGame(avatars.Keys.ToList()[0]);
        }
예제 #10
0
        public virtual void recvDamage(Int32 attackerID, Int32 skillID, Int32 damageType, Int32 damage)
        {
            Dbg.DEBUG_MSG(classtype + "::recvDamage: attackerID=" + attackerID + ", skillID=" + skillID + ", damageType=" + damageType + ", damage=" + damage);

            Entity entity = KBEngineApp.app.findEntity(attackerID);

            Event.fire("recvDamage", new object[] { this, entity, skillID, damageType, damage });
        }
예제 #11
0
파일: Entity.cs 프로젝트: gameogre/kbengine
        public void set_direction(object old)
        {
            Vector3 v = (Vector3)getDefinedPropterty("direction");

            direction = v;
            Dbg.DEBUG_MSG(classtype + "::set_direction: " + v);
            Event.fire("set_direction", new object[] { this });
        }
예제 #12
0
        public void onRemoveAvatar(UInt64 dbid)
        {
            Dbg.DEBUG_MSG("Account::onRemoveAvatar: dbid=" + dbid);

            avatars.Remove(dbid);

            // ui event
            Dictionary <UInt64, Dictionary <string, object> > avatarList = new Dictionary <ulong, Dictionary <string, object> >(avatars);

            Event.fire("onRemoveAvatar", new object[] { dbid, avatars });
        }
예제 #13
0
        public virtual void set_direction(object old)
        {
            Vector3 v = (Vector3)getDefinedPropterty("direction");

            v.x = v.x * 360 / ((float)System.Math.PI * 2);
            v.y = v.y * 360 / ((float)System.Math.PI * 2);
            v.z = v.z * 360 / ((float)System.Math.PI * 2);

            direction = v;

            Dbg.DEBUG_MSG(classtype + "::set_direction: " + old + " => " + v);
            Event.fire("set_direction", new object[] { this });
        }
예제 #14
0
        public virtual void set_position(object old)
        {
            Vector3 v = (Vector3)getDefinedPropterty("position");

            position = v;
            Dbg.DEBUG_MSG(classtype + "::set_position: " + old + " => " + v);

            if (isPlayer())
            {
                KBEngineApp.app.entityServerPos = position;
            }

            Event.fire("set_position", new object[] { this });
        }
예제 #15
0
        public void onCreateAvatarResult(Byte retcode, object info)
        {
            if (retcode == 0)
            {
                avatars.Add((UInt64)((Dictionary <string, object>)info)["dbid"], (Dictionary <string, object>)info);
                Dbg.DEBUG_MSG("Account::onCreateAvatarResult: name=" + (string)((Dictionary <string, object>)info)["name"]);
            }
            else
            {
                Dbg.ERROR_MSG("Account::onCreateAvatarResult: retcode=" + retcode);
            }

            Event.fire("onCreateAvatarResult", new object[] { retcode, info });
        }
예제 #16
0
        public virtual void onAddSkill(Int32 skillID)
        {
            Dbg.DEBUG_MSG(classtype + "::onAddSkill(" + skillID + ")");
            Event.fire("onAddSkill", new object[] { this });

            Skill skill = new Skill();

            skill.id   = skillID;
            skill.name = skillID + " ";
            switch (skillID)
            {
            case 1:
                break;

            case 1000101:
                skill.canUseDistMax = 20f;
                break;

            case 2000101:
                skill.canUseDistMax = 20f;
                break;

            case 3000101:
                skill.canUseDistMax = 20f;
                break;

            case 4000101:
                skill.canUseDistMax = 20f;
                break;

            case 5000101:
                skill.canUseDistMax = 20f;
                break;

            case 6000101:
                skill.canUseDistMax = 20f;
                break;

            default:
                break;
            }
            ;

            SkillBox.inst.add(skill);
        }
예제 #17
0
 public override void __init__()
 {
     Event.fire("onLoginSuccessfully", new object[] { KBEngineApp.app.entity_uuid, id, this });
     baseCall("reqAvatarList", new object[0]);
 }
예제 #18
0
 public virtual void leaveWorld()
 {
     Dbg.DEBUG_MSG(classtype + "::leaveWorld: " + id);
     inWorld = false;
     Event.fire("onLeaveWorld", new object[] { this });
 }
예제 #19
0
 public virtual void enterWorld()
 {
     Dbg.DEBUG_MSG(classtype + "::enterWorld(" + getDefinedPropterty("uid") + "): " + id);
     inWorld = true;
     Event.fire("onEnterWorld", new object[] { this });
 }
예제 #20
0
 public override void __init__()
 {
     Event.fire("onAvatarEnterWorld", new object[] { KBEngineApp.app.entity_uuid, id, this });
     combat = new CombatImpl(this);
 }
예제 #21
0
 public virtual void onJump()
 {
     Dbg.DEBUG_MSG(classtype + "::onJump: " + id);
     Event.fire("otherAvatarOnJump", new object[] { this });
 }
예제 #22
0
 public virtual void onRemoveSkill(Int32 skillID)
 {
     Dbg.DEBUG_MSG(classtype + "::onRemoveSkill(" + skillID + ")");
     Event.fire("onRemoveSkill", new object[] { this });
     SkillBox.inst.remove(skillID);
 }