玩家列表 Player List

  • Class:Players

不可创建 Cannot create.
无法使用RWObject:New(Classname)创建此对象,也不在编辑器对象列表中显示。Cannot use RWObject:New(Classname) to create this object. It will not display in editor object list either.

Introduction

游戏运行起来后显示当前在游戏中的玩家列表。是包含玩家目前连接的客户到ReWorld游戏服务器的对象。
Player list will show once the games starts. It is the object that contains the client currently connected to the Player to the ReWorld game server.

游戏运行时,如果开启了玩家列表下的角色是否自动生成,玩家进入游戏时会自动加载其平台角色,作为游戏内玩家操作的角色。
While the game is running, if CharacterAutoLoads under Player Listis on, players will automatically load their platform characters when they enter the game as the characters operated by the players in the game.

如果关闭了玩家列表下的角色是否自动生成,玩家进入游戏时不会自动加载其平台角色,开发者可以自行写脚本控制玩家所使用的角色(比如通过调用LoadCharacter(TarObject)函数实现选择角色,队伍的功能)。
If CharacterAutoLoads under Player Listis closed, players will not automatically load their platform characters when entering the game, developers can write their own script to control the characters the players will use (such as using LoadCharacter(TarObject) to achieve the functions of character and team selection)

Properties

    MaxPlayers     最大人数   int    [只读]
    当前游戏可进入的最大人数
    Maximum amount of players allowed in the game.

    CharacterAutoLoads     角色是否自动生成   bool   
    角色是否自动生成
    Whether character automatically loads.

Inherited from RWObject

    Name     名称   string   
    该对象的自定义名称
    The object’s custome name.

    ClassName     类型   string   
    该对象对应的对象类型名称
    The object’s corresponding object’s class name.

    Parent     父级   RWObject   
    该对象的父级对象
    The object’s parent object.

Functions

    GetPlayerByUserId(PlayerId)
    根据给定的PlayerId获取玩家对象
    Get the player object according to the given PlayerId.

    GetAllPlayers()
    获取自身列表中所有的玩家对象
    Get all player objects from Player list.

    GetLocalPlayer()
    获取本地的玩家对象
    Obtain local player objects.

    GetAvatarAppearance(Playerid)
    通过玩家ID获取玩家平台上的外观,返回一个角色对象,玩家不在游戏也可获取
    Obtain the appearance of the player’s platform through the player ID, and return a character object, which can be obtained even if the player is not in the game.

    GetNameByUid(Playerid)
    通过玩家ID向平台查询玩家名称,玩家不在游戏也可获取
    Obtain player’s name through player ID on player’s platform, which can be obtained even if the player is not in the game.

    GetPlayerIconByUid(Playerid)
    通过玩家ID获取玩家平台上头像,玩家不在游戏也可获取
    Obtain player’s icon through player ID, which can be obtained even if the player is not in the game.

Inherited from RWObject

    DelAllChild()
    删除所有子对象
    Delete all child objects.

    Available()
    检查对象是否可用
    Check if object is available to use.

    GetAncestorByName(Name)
    通过对象名字寻找父级对象
    Find ancestor by object’s name.

    GetAncestorByClassName(className)
    通过对象类型寻找父级对象
    Find ancestor by object’s class.

    GetChildByName(Name,recursive)
    通过对象名字寻找子级对象
    Find child by object’s name.

    GetChildByClassName(className,recursive)
    通过对象类型寻找子级对象
    Find child by object’s class.

    GetAllChild()
    寻找自身所有子级对象,并作为一个列表返回
    Find all child objects and return as a list.

    GetAllDescendant()
    递归寻找自身所有后代,并作为一个列表返回
    Recursively find all descendants of itself and return as a list.

    IsAncestor(TarObj)
    判断自身是否为目标对象的祖先
    Determine whether object itself is the ancestor of the target object.

    IsDescendant(TarObj)
    判断自身是否为目标对象的后代
    Determine whether object itself is the descendant of the target object.

    WaitForChild(childName,timeout)
    寻找自身的子对象。如果没有子对象,在没有填写timeout参数时,会暂停进程直到找到子对象;如果填写了timeout参数,会根据参数时间暂停进程,超出参数时间后,进程照常进行
    Find child of object. If child does not exist when there are no timeout parameters, the process will be paused until child is found. If there are timeout parameters, the process will pause based on the parameter, once process exceeds timeout parameters, the process will continue.

    Child(childName)
    根据给定的名字寻找自身的子对象
    Find object’s child based on name.

    Equals(TarObj)
    判断自身是否为目标对象,结果为真返回True,结果为假返回False;注意克隆、新建同类型、同名对象,equal结果均为假
    Determine whther object itself is target object, if true then will return as True, vice versa for false. Notice that duplicate, new same type, same name objects, and equals will return as false.

    IsClass(className)
    判断自身是否为给定的对象类型
    Determine whether object itself is the given object class.

Events

    PlayerDead(Playerid)
    列表中的玩家死亡时,触发此事件
    This event is triggered when player from the list died.

    PlayerAdded(Playerid)
    当一个玩家进入游戏时,触发此事件
    This event is triggered when a player enters the game.

    PlayerLeave(Playerid)
    玩家离开列表时,触发此事件
    This event is triggered when player leaves the list.

Inherited from RWObject

    Destroyed()
    删除自身时触发
    Triggered when object destroyed itself.

    ChildAdded(childobject)
    添加子对象时触发
    Triggered when child object is added.

    ChildRemoved(childobject)
    移除子对象时触发
    Triggered when child object is removed

    DescendantAdded(descendantobject)
    添加后代时触发
    Triggered when descendant is added.

    DescendantRemoved(descendantobject)
    移除后代时触发
    Triggered when descendant is removed.

    AncestryChanged(AncestryChanged)
    祖先变更时触发
    Triggered when ancestry is changed.

文档更新时间: 2020-10-22 07:00   作者:刘征