A nicer inventory
This commit is contained in:
parent
3c2d087a66
commit
8da9e4ce87
@ -14,8 +14,10 @@ do
|
||||
local BackGround = formSpec.Background
|
||||
local BGColor = formSpec.BGColor
|
||||
local List = formSpec.List
|
||||
local ListColors = formSpec.ListColors
|
||||
local color = utility.color
|
||||
local colorScalar = utility.colorScalar
|
||||
local colorRGB = utility.colorRGB
|
||||
local playerInventory = generate(__TS__New(
|
||||
FormSpec,
|
||||
{
|
||||
@ -26,7 +28,17 @@ do
|
||||
{
|
||||
bgColor = colorScalar(85),
|
||||
fullScreen = "both",
|
||||
fullScreenbgColor = colorScalar(0, 30)
|
||||
fullScreenbgColor = colorScalar(0, 40)
|
||||
}
|
||||
),
|
||||
__TS__New(
|
||||
ListColors,
|
||||
{
|
||||
slotBGHover = colorScalar(70),
|
||||
slotBGNormal = colorScalar(55),
|
||||
slotBorder = colorScalar(0),
|
||||
toolTipBGColor = colorRGB(123, 104, 238),
|
||||
toolTipFontColor = colorScalar(100)
|
||||
}
|
||||
),
|
||||
__TS__New(
|
||||
@ -44,7 +56,7 @@ do
|
||||
{
|
||||
location = "current_player",
|
||||
listName = "craftpreview",
|
||||
position = create(9, 2.25),
|
||||
position = create(9, 2.375),
|
||||
size = create(1, 1),
|
||||
startingIndex = 0
|
||||
}
|
||||
|
@ -3,21 +3,34 @@ namespace player {
|
||||
export const INVENTORY_SIZE = vector.create2d(9,4)
|
||||
|
||||
const create = vector.create2d
|
||||
|
||||
const generate = formSpec.generate
|
||||
const FormSpec = formSpec.FormSpec
|
||||
const BackGround = formSpec.Background
|
||||
const BGColor = formSpec.BGColor
|
||||
const List = formSpec.List
|
||||
const ListColors = formSpec.ListColors
|
||||
|
||||
const color = utility.color
|
||||
const colorScalar = utility.colorScalar
|
||||
const colorRGB = utility.colorRGB
|
||||
|
||||
const playerInventory: string = generate(new FormSpec({
|
||||
size: create(12,12),
|
||||
elements: [
|
||||
//! Nice background colors.
|
||||
new BGColor({
|
||||
bgColor: colorScalar(85),
|
||||
fullScreen: "both",
|
||||
fullScreenbgColor: colorScalar(0,30)
|
||||
fullScreenbgColor: colorScalar(0,40)
|
||||
}),
|
||||
//! Make these lists look nice as well.
|
||||
new ListColors({
|
||||
slotBGHover: colorScalar(70),
|
||||
slotBGNormal: colorScalar(55),
|
||||
slotBorder: colorScalar(0),
|
||||
toolTipBGColor: colorRGB(123,104,238),
|
||||
toolTipFontColor: colorScalar(100)
|
||||
}),
|
||||
//! Craft area.
|
||||
new List({
|
||||
@ -39,7 +52,7 @@ namespace player {
|
||||
listName: "craftpreview",
|
||||
position: create(
|
||||
9,
|
||||
2.25
|
||||
2.375
|
||||
),
|
||||
size: create(
|
||||
1,
|
||||
|
@ -123,6 +123,17 @@ do
|
||||
end
|
||||
return newColor
|
||||
end
|
||||
--- Like the color() function, but can take in raw (0-255) rgba elements.
|
||||
--
|
||||
-- @param r Red channel. (0-255)
|
||||
-- @param g Green channel. (0-255)
|
||||
-- @param b Blue channel. (0-255)
|
||||
-- @param a Alpha channel. (0-255)
|
||||
-- @returns Color string in hex.
|
||||
function utility.colorRGB(r, g, b, a)
|
||||
a = a and a / 2.55 or a
|
||||
return utility.color(r / 2.55, g / 2.55, b / 2.55, a)
|
||||
end
|
||||
function utility.colorScalar(s, a)
|
||||
local newColor = "#"
|
||||
local hex = hexValues[lockChannel(s)]
|
||||
|
@ -130,6 +130,20 @@ namespace utility {
|
||||
return newColor
|
||||
}
|
||||
|
||||
/**
|
||||
* Like the color() function, but can take in raw (0-255) rgba elements.
|
||||
* @param r Red channel. (0-255)
|
||||
* @param g Green channel. (0-255)
|
||||
* @param b Blue channel. (0-255)
|
||||
* @param a Alpha channel. (0-255)
|
||||
* @returns Color string in hex.
|
||||
*/
|
||||
export function colorRGB(r: number, g: number, b: number, a?: number): string {
|
||||
// Get everything to 0-100 range
|
||||
a = (a) ? a / 2.55 : a
|
||||
return color(r / 2.55, g / 2.55, b / 2.55, a)
|
||||
}
|
||||
|
||||
export function colorScalar(s: number, a?: number): string {
|
||||
let newColor = "#"
|
||||
const hex = hexValues[lockChannel(s)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user