EKzyis Posted July 10, 2016 Share Posted July 10, 2016 (edited) Hello there I can't find any tutorial about how to make it possible that the UI has an image around it? The .png I am using in spriter is attached. Thats my code: local assets = { Asset("ANIM", "anim/toolrack.zip"), Asset("ANIM", "anim/ui_toolrack.zip"), } prefabs = {} local function onopen(inst) if not inst:HasTag("burnt") then inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_open") end end local function onclose(inst) if not inst:HasTag("burnt") then inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_close") end end local slotpos = { Vector3(0,49+32+8+4,0), Vector3(0,17+4,0), Vector3(0,-(47+4),0), Vector3(0,-(79+32+8+4),0), Vector3(0,-(111+64+16+4),0) } local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() MakeObstaclePhysics(inst, .3) inst.AnimState:SetBank("toolrack") inst.AnimState:SetBuild("toolrack") inst.AnimState:PlayAnimation("idle") inst:AddComponent("inspectable") inst:AddComponent("container") inst.components.container:SetNumSlots(#slotpos) inst.components.container.onopenfn = onopen inst.components.container.onclosefn = onclose inst.components.container.widgetslotpos = slotpos inst.components.container.widgetanimbank = "ui_toolrack" inst.components.container.widgetanimbuild = "ui_toolrack" inst.components.container.widgetpos = Vector3(0,200,0) inst.components.container.side_align_tip = 160 STRINGS.NAMES.TOOLRACK = "Toolrack" STRINGS.RECIPE_DESC.TOOLRACK = "Storage for your tools & weapons." return inst end return Prefab("common/inventory/toolrack", fn, assets, prefabs) I think I have to do something special in spriter like typing "BUILD" if I want to create an animation for an equipped item but I can't find anywhere what The game is extracting and atlasing the .scml-file just fine, it just doesn't show up ingame. Just a blank UI with the slots. edit: If of any interest, the number for the vectors and the image I do have from another mod because I wanted to try out implementing ui images. edit2: oh, and btw, this should go into DS forums not DST Edited July 10, 2016 by EKzyis Link to comment https://forums.kleientertainment.com/forums/topic/68764-how-to-use-ui-image/ Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now