/// <summary> /// 属性改变 /// </summary> private void OnUnitAttrModifyInt(PacketBase packet) { ss2ws.NotifyUpdatePlayerAttribInteger msg = packet as ss2ws.NotifyUpdatePlayerAttribInteger; Unit unit = UnitManager.Instance.GetUnitByIdx(msg.char_idx); if (unit != null) { unit.UpdateAttribute(msg.type, msg.value); } }
/// <summary> /// 发给ws /// </summary> /// <param name="type"></param> /// <param name="nValue"></param> private void Send2WS(eUnitModType type, long nValue) { Player player = m_owner_unit as Player; if (player == null) { return; } ss2ws.NotifyUpdatePlayerAttribInteger msg = PacketPools.Get(ss2ws.msg.UNIT_MODIFY_INT) as ss2ws.NotifyUpdatePlayerAttribInteger; msg.char_idx = player.char_idx; msg.type = type; msg.value = nValue; ServerNetManager.Instance.Send2WS(msg); }