private void OnUnitAttrModifyString(PacketBase packet)
        {
            ss2c.NotifyUpdatePlayerAttribString msg = packet as ss2c.NotifyUpdatePlayerAttribString;

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

            if (player != null)
            {
                switch (msg.type)
                {
                case eUnitModType.UMT_char_name: player.char_name = msg.value; break;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 发给客户端-string
        /// </summary>
        /// <param name="type"></param>
        /// <param name="nValue"></param>
        private void Send2Client(eUnitModType type, string nValue, eUnitAttrAction action)
        {
            Player player = m_owner_unit as Player;

            if (player == null)
            {
                return;
            }

            ss2c.NotifyUpdatePlayerAttribString msg = PacketPools.Get(ss2c.msg.UNIT_MODIFY_STRING) as ss2c.NotifyUpdatePlayerAttribString;
            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);
        }