dp-s_doc/Object/AdMsg/AdMsg.md

2.1 KiB
Raw Blame History

AdMsg 类函数文档

类说明 AdMsg类为高级信息类可以便捷的构造出高级信息的Pack包。


函数签名

构造函数

  • AdMsg()

函数签名

私有函数

  • function PutType(Type)

功能

  • 设定消息包的类型

参数

  • Type:消息类型

函数签名

私有函数

  • function PutString(String)

功能

  • 将字符串放入消息中

参数

  • String:字符串

函数签名

私有函数

  • function PutColorString(String,ColorArr)

功能

  • 将带有颜色信息的字符串放入消息中

参数

  • String:字符串消息
  • ColorArr:颜色信息数组

函数签名

私有函数

  • function PutImoticon(Index)

功能

  • 将表情信息放入消息中

参数

  • Indexpvf中标签的编号

函数签名

私有函数

  • function PutEquipment(...)

功能

  • 将装备信息放入消息中(该函数为重载函数)

参数

  • EquObj:装备对象

参数

  • Name:自己提供的装备名字
  • EquObj:装备对象
  • ColorArr:自己提供的名字颜色数组

函数签名

私有函数

  • function Finalize()

功能

  • 完成高级信息的构造

函数签名

私有函数

  • function MakePack()

功能

  • 创建Pack包

函数签名

私有函数

  • function Delete()

功能

  • 销毁Pack包

下面给出一个例子

    local SUser = World.GetUserByUid(1);
    local InvenObj = SUser.GetInven();
    local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, 56);

    local AdMsgObj = AdMsg();
    AdMsgObj.PutType(14);
    AdMsgObj.PutString("测试文字");
    AdMsgObj.PutColorString("测试文字", [255, 85, 0]);
    AdMsgObj.PutImoticon(2);
    AdMsgObj.PutEquipment("主动提供名字", EquObj, [255, 85, 0]);
    AdMsgObj.PutEquipment(EquObj);
    AdMsgObj.Finalize();

    SUser.Send(AdMsgObj.MakePack());
    AdMsgObj.Delete();