Пример #1
0
        /// <summary>
        /// 属性改变
        /// </summary>
        private void OnUnitAttrModifyInt(PacketBase packet)
        {
            ss2c.NotifyUpdatePlayerAttribInteger msg = packet as ss2c.NotifyUpdatePlayerAttribInteger;

            Player player = UnitManager.Instance.GetUnitByIdx(msg.unit_idx.obj_idx) as Player;

            if (player != null)
            {
                switch (msg.type)
                {
                case eUnitModType.UMT_char_type: player.char_type = (byte)msg.value; break;

                case eUnitModType.UMT_flags: player.flags = (uint)msg.value; break;

                case eUnitModType.UMT_model_idx: player.model_idx = (uint)msg.value; break;

                case eUnitModType.UMT_job: player.job = (byte)msg.value; break;

                case eUnitModType.UMT_level: player.level = (ushort)msg.value; break;

                case eUnitModType.UMT_exp: player.exp = (uint)msg.value; break;

                case eUnitModType.UMT_energy: player.energy = (uint)msg.value; break;

                case eUnitModType.UMT_gold: player.gold = (uint)msg.value; break;

                case eUnitModType.UMT_coin: player.coin = (uint)msg.value; break;

                case eUnitModType.UMT_hp: player.hp = (uint)msg.value; break;

                case eUnitModType.UMT_vip_grade: player.vip_grade = (uint)msg.value; break;

                case eUnitModType.UMT_vip_flags: player.vip_flags = (uint)msg.value; break;

                case eUnitModType.UMT_base_energy: player.energy = (uint)msg.value; break;

                case eUnitModType.UMT_base_hurt: player.hurt = (uint)msg.value; break;

                case eUnitModType.UMT_base_run_speed: player.run_speed = (uint)msg.value; break;

                case eUnitModType.UMT_hp_max: player.hp_max = (uint)msg.value; break;

                case eUnitModType.UMT_hurt: player.hurt = (uint)msg.value; break;

                case eUnitModType.UMT_range: player.range = (uint)msg.value; break;

                case eUnitModType.UMT_run_speed: player.run_speed = (uint)msg.value; break;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 发给客户端-int
        /// </summary>
        /// <param name="type"></param>
        /// <param name="nValue"></param>
        private void Send2Client(eUnitModType type, long nValue, eUnitAttrAction action)
        {
            Player player = m_owner_unit as Player;

            if (player == null)
            {
                return;
            }

            ss2c.NotifyUpdatePlayerAttribInteger msg = PacketPools.Get(ss2c.msg.UNIT_MODIFY_INT) as ss2c.NotifyUpdatePlayerAttribInteger;
            msg.client_uid = player.client_uid;
            msg.unit_idx.Set(player.unit_type, player.obj_type, player.char_idx);
            msg.action = action;
            msg.type   = type;
            msg.value  = nValue;
            Send2Client(type, msg);
        }