private void OnUnitAttrModifyString(PacketBase packet) { ss2ws.NotifyUpdatePlayerAttribString msg = packet as ss2ws.NotifyUpdatePlayerAttribString; Unit unit = UnitManager.Instance.GetUnitByIdx(msg.char_idx); if (unit != null) { unit.UpdateAttribute(msg.type, msg.value); } }
/// <summary> /// 发给ws-string /// </summary> /// <param name="type"></param> /// <param name="nValue"></param> private void Send2WS(eUnitModType type, string nValue) { Player player = m_owner_unit as Player; if (player == null) { return; } ss2ws.NotifyUpdatePlayerAttribString msg = PacketPools.Get(ss2ws.msg.UNIT_MODIFY_STRING) as ss2ws.NotifyUpdatePlayerAttribString; msg.char_idx = player.char_idx; msg.type = type; msg.value = nValue; ServerNetManager.Instance.Send2WS(msg); }