gamecircle.Whispersync.SetHighNumberListLength

类型 函数
gamecircle.*
返回值
修订 版本 2024.3703
关键词 最高分, 列表, 可同步数字列表, 长度, Whispersync

概述

设置 HighNumber 列表的最大长度。此数字上限为 1,000,由 Amazon GameCircle SDK 限制。默认长度为 5。

语法

gamecircle.Whispersync.SetHighNumberListLength(key, value)
gamecircle.Whispersync.SetHighNumberListLength(key, value)
(必填)

字符串. 用于访问特定最高分的键。

(必填)

数字. 要分配给最高分的值。

示例

local highListKey = "myFirstHighNumberList" 
local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, false, true)  
gamecircle.Whispersync.SetHighNumberListLength(highListKey, 4)  
gamecircle.Whispersync.AddToHighNumberList(highListKey, 10, "INT")  
gamecircle.Whispersync.AddToHighNumberList(highListKey, 1000, "INT")  
gamecircle.Whispersync.AddToHighNumberList(highListKey, 1, "INT")  
gamecircle.Whispersync.AddToHighNumberList(highListKey, 10000, "INT")   
gamecircle.Whispersync.AddToHighNumberList(highListKey, 100, "INT")  
print("Here is the list of numbers as they are stored in the high number list. They should be in the order from highest to lowest.")  
local highList = gamecircle.Whispersync.GetHighNumberList(highListKey)  
for i,entry in ipairs(highList) do  
    print("-" entry.value)  
end  
local keys = gamecircle.Whispersync.GetHighNumberListKeys()  
for i,key in ipairs(keys) do  
    print("-" .. key)  
end