This commit is contained in:
lx
2026-07-06 14:01:11 -04:00
commit c4f97d729d
16468 changed files with 935321 additions and 0 deletions
@@ -0,0 +1,31 @@
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local Analytics = {}
function Analytics.new()
local service = {}
setmetatable(service, {
__tostring = function()
return "Service(Analytics)"
end
})
function service.reportRobuxUpsellStarted()
return MarketplaceService:ReportRobuxUpsellStarted()
end
function service.signalPurchaseSuccess(id, infoType, salePrice, result)
if infoType == Enum.InfoType.Product then
MarketplaceService:SignalClientPurchaseSuccess(result.receipt, Players.LocalPlayer.UserId, id)
else
MarketplaceService:ReportAssetSale(id, salePrice)
end
end
return service
end
return Analytics
@@ -0,0 +1,34 @@
local RunService = game:GetService("RunService")
local GuiService = game:GetService("GuiService")
local ExternalSettings = {}
function ExternalSettings.new()
local service = {}
setmetatable(service, {
__tostring = function()
return "Service(ExternalSettings)"
end,
})
function service.isStudio()
return RunService:IsStudio()
end
function service.getFlagRestrictSales2()
return settings():GetFFlag("RestrictSales2")
end
function service.getFlagOrder66()
return settings():GetFFlag("Order66")
end
function service.isTenFootInterface()
return GuiService:IsTenFootInterface()
end
return service
end
return ExternalSettings
@@ -0,0 +1,142 @@
local strict = require(script.Parent.Parent.strict)
local function makeImageData(path, sliceCenter)
return {
Path = "rbxasset://textures/" .. path,
SliceCenter = sliceCenter,
}
end
local LayoutValues = {}
LayoutValues.__tostring = function()
return "Service(LayoutValues)"
end
function LayoutValues.generate(isTenFoot)
local scaleFactor = isTenFoot and 3 or 1
local ButtonHeight = 44 * scaleFactor
local PostTextHeight = 30 * scaleFactor
local RobuxIconPadding = 6 * scaleFactor
local RobuxIconWidth = 20 * scaleFactor
local RobuxIconHeight = 20 * scaleFactor
local ProductDescriptionPaddingTop = 18 * scaleFactor
local ProductDescriptionWidth = 210 * scaleFactor
local ProductDescriptionHeight = 106 * scaleFactor
local PurchasingAnimationWidth = 96 * scaleFactor
local PurchasingAnimationHeight = 20 * scaleFactor
local HorizontalPadding = 25 * scaleFactor
local ItemPreviewBorder = 2 * scaleFactor
local ItemPreviewWidth = 64 * scaleFactor
local ItemPreviewHeight = 64 * scaleFactor
local ButtonIconPadding = 3 * scaleFactor
-- Button icons have drop shadow and need a slight offset in order to look centered
local ButtonIconYOffset = 2 * scaleFactor
local ItemPreviewBackgroundWidth = ItemPreviewWidth + 2 * ItemPreviewBorder
local ItemPreviewBackgroundHeight = ItemPreviewHeight + 2 * ItemPreviewBorder
local ItemPreviewContainerWidth = ItemPreviewBackgroundWidth + 2 * HorizontalPadding
local ItemPreviewContainerHeight = ItemPreviewBackgroundHeight + 2 * HorizontalPadding
--[[
Sizes for UI elements
]]
local Size = {
AdditonalDetailsLabel = UDim2.new(1, 0, 0, PostTextHeight),
ItemPreview = UDim2.new(0, ItemPreviewWidth, 0, ItemPreviewHeight),
ItemPreviewWhiteFrame = UDim2.new(0, ItemPreviewBackgroundWidth, 0, ItemPreviewBackgroundHeight),
ItemPreviewContainerFrame = UDim2.new(0, ItemPreviewContainerWidth, 0, ItemPreviewContainerHeight),
HorizontalPadding = HorizontalPadding,
ProductDescription = UDim2.new(0, ProductDescriptionWidth, 0, ProductDescriptionHeight),
ProductDescriptionPaddingTop = ProductDescriptionPaddingTop,
RobuxIconContainerFrame = UDim2.new(0, RobuxIconWidth + RobuxIconPadding, 0, RobuxIconHeight + 2 * RobuxIconPadding),
RobuxIcon = UDim2.new(0, RobuxIconWidth, 0, RobuxIconHeight),
PriceTextLabel = UDim2.new(1, 0, 0, RobuxIconHeight),
PurchasingAnimation = UDim2.new(0, PurchasingAnimationWidth, 0, PurchasingAnimationHeight),
ButtonIconPadding = ButtonIconPadding,
ButtonIconYOffset = ButtonIconYOffset,
ButtonHeight = ButtonHeight,
Dialog = UDim2.new(
0, ItemPreviewContainerWidth + ProductDescriptionWidth,
0, math.max(ItemPreviewContainerHeight, ProductDescriptionHeight) + PostTextHeight + ButtonHeight )
}
--[[
Font sizes for UI elements
]]
local TextSize = {
Default = 18 * scaleFactor,
ProductDescription = 18 * scaleFactor,
Button = 24 * scaleFactor,
AdditonalDetails = 14 * scaleFactor,
Purchasing = 36 * scaleFactor,
}
--[[
Background images, including slice center
]]
local Image = {}
Image.PromptBackground = isTenFoot
and makeImageData("ui/PurchasePrompt/PurchasePromptBG@2x.png", Rect.new(17, 17, 19, 19))
or makeImageData("ui/PurchasePrompt/PurchasePromptBG.png", Rect.new(8, 9, 10, 10))
Image.InProgressBackground = isTenFoot
and makeImageData("ui/PurchasePrompt/LoadingBG@2x.png", Rect.new(17, 17, 19, 19))
or makeImageData("ui/PurchasePrompt/LoadingBG.png", Rect.new(9, 9, 11, 11))
Image.ButtonUpLeft = isTenFoot
and makeImageData("ui/PurchasePrompt/LeftButton@2x.png", Rect.new(18, 5, 20, 7))
or makeImageData("ui/PurchasePrompt/LeftButton.png", Rect.new(8, 3, 10, 4))
Image.ButtonDownLeft = isTenFoot
and makeImageData("ui/PurchasePrompt/LeftButtonDown@2x.png", Rect.new(18, 5, 20, 7))
or makeImageData("ui/PurchasePrompt/LeftButtonDown.png", Rect.new(8, 3, 10, 4))
Image.ButtonUpRight = isTenFoot
and makeImageData("ui/PurchasePrompt/RightButton@2x.png", Rect.new(3, 5, 5, 7))
or makeImageData("ui/PurchasePrompt/RightButton.png", Rect.new(2, 3, 3, 4))
Image.ButtonDownRight = isTenFoot
and makeImageData("ui/PurchasePrompt/RightButtonDown@2x.png", Rect.new(3, 5, 5, 7))
or makeImageData("ui/PurchasePrompt/RightButtonDown.png", Rect.new(2, 3, 3, 4))
Image.ButtonUp = isTenFoot
and makeImageData("ui/PurchasePrompt/SingleButton@2x.png", Rect.new(18, 5, 20, 7))
or makeImageData("ui/PurchasePrompt/SingleButton.png", Rect.new(8, 3, 10, 4))
Image.ButtonDown = isTenFoot
and makeImageData("ui/PurchasePrompt/SingleButtonDown@2x.png", Rect.new(18, 5, 20, 7))
or makeImageData("ui/PurchasePrompt/SingleButtonDown.png", Rect.new(8, 3, 10, 4))
--[[
CLILUACORE-315: Make 2x versions for robux icon and error icon
]]
Image.RobuxIcon = isTenFoot
and makeImageData("ui/RobuxIcon.png")
or makeImageData("ui/RobuxIcon.png")
Image.ErrorIcon = isTenFoot
and makeImageData("ui/ErrorIcon.png")
or makeImageData("ui/ErrorIcon.png")
Image.ButtonA = isTenFoot
and makeImageData("ui/Settings/Help/AButtonDark@2x.png")
or makeImageData("ui/Settings/Help/AButtonDark.png")
Image.ButtonB = isTenFoot
and makeImageData("ui/Settings/Help/BButtonDark@2x.png")
or makeImageData("ui/Settings/Help/BButtonDark.png")
local LayoutValues = strict({
Size = strict(Size, "LayoutValues.Size"),
TextSize = strict(TextSize, "LayoutValues.TextSize"),
Image = strict(Image, "LayoutValues.Image"),
}, "LayoutValues")
return LayoutValues
end
return LayoutValues
@@ -0,0 +1,76 @@
local HttpRbxApiService = game:GetService("HttpRbxApiService")
local HttpService = game:GetService("HttpService")
local MarketplaceService = game:GetService("MarketplaceService")
local InsertService = game:GetService("InsertService")
local Promise = require(script.Parent.Parent.Promise)
local function getProductInfo(id, infoType)
return MarketplaceService:GetProductInfo(id, infoType)
end
local function getPlayerOwns(player, id, infoType)
if infoType == Enum.InfoType.Asset then
return MarketplaceService:PlayerOwnsAsset(player, id)
elseif infoType == Enum.InfoType.GamePass then
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, id)
end
return false
end
local function performPurchase(infoType, productId, expectedPrice, requestId)
local success, result = pcall(function()
return MarketplaceService:PerformPurchase(infoType, productId, expectedPrice, requestId)
end)
if success then
return result
end
error(tostring(result))
end
local function loadAssetForEquip(assetId)
return InsertService:LoadAsset(assetId)
end
local function getAccountInfo()
local success, result = pcall(function()
return HttpRbxApiService:GetAsync("users/account-info")
end)
if success and type(result) == "string" then
local decodeSuccess, decodeResult = pcall(function()
return HttpService:JSONDecode(result)
end)
if decodeSuccess then
return decodeResult
end
end
error(tostring(result))
end
local Network = {}
function Network.new()
local networkService = {
getProductInfo = Promise.promisify(getProductInfo),
getPlayerOwns = Promise.promisify(getPlayerOwns),
performPurchase = Promise.promisify(performPurchase),
loadAssetForEquip = Promise.promisify(loadAssetForEquip),
getAccountInfo = Promise.promisify(getAccountInfo),
}
setmetatable(networkService, {
__tostring = function()
return "Service(Network)"
end
})
return networkService
end
return Network
@@ -0,0 +1,45 @@
local ContentProvider = game:GetService("ContentProvider")
local GuiService = game:GetService("GuiService")
local MarketplaceService = game:GetService("MarketplaceService")
local PlatformService = nil
pcall(function()
PlatformService = game:GetService("PlatformService")
end)
local BASE_URL = string.gsub(ContentProvider.BaseUrl:lower(), "/m.", "/www.")
local PlatformInterface = {}
function PlatformInterface.new()
local service = {}
setmetatable(service, {
__tostring = function()
return "Service(PlatformInterface)"
end,
})
function service.startRobuxUpsellWeb()
local url = ("%sUpgrades/Robux.aspx"):format(BASE_URL)
GuiService:OpenBrowserWindow(url)
end
function service.startBuildersClubUpsellWeb()
local url = ("%sUpgrades/BuildersClubMemberships.aspx"):format(BASE_URL)
GuiService:OpenBrowserWindow(url)
end
function service.promptNativePurchase(player, mobileProductId)
return MarketplaceService:PromptNativePurchase(player, mobileProductId)
end
function service.beginPlatformStorePurchase(xboxProductId)
return PlatformService:BeginPlatformStorePurchase(xboxProductId)
end
return service
end
return PlatformInterface