打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

RIA Wiki 已更新到 1.41!部分 CSS 在新版本下可能有不同的表现,请编辑者注意检查和修改。 目前wiki关闭了自行注册账号的功能,如需注册账号,请查阅Help:注册账号

模块:Rail line:修订间差异

来自RIA | Wiki
秋月白留言 | 贡献
无编辑摘要
秋月白留言 | 贡献
无编辑摘要
第27行: 第27行:
             ["6<small>01</small>"] = { bgc1 = "#0000ff" },
             ["6<small>01</small>"] = { bgc1 = "#0000ff" },
             ["7"] = { bgc1 = "#7f00ff" },
             ["7"] = { bgc1 = "#7f00ff" },
             ["10"] = { bgc1 = "#bfbf00" },
             ["10"] = { bgc1 = "#4b5931" },
         },
         },
         default = { bgc1 = "#cccccc" }
         default = { bgc1 = "#cccccc" }

2026年2月8日 (日) 15:26的版本

模块文档

颜色配置维护指南

若需要添加新的路局与线路,请在本模块中编辑代码并保存。

格式:

新路局代号 = {
    lines = {
        ["线路代号"] = { bgc1 = "颜色代码", color2 = "颜色代码" },  -- 需要color2时
        ["线路代号"] = { bgc1 = "颜色代码" },                       -- 不需要color2时
    },
    default = { bgc1 = "默认颜色", color2 = "默认颜色" }  -- color2可选
},

添加新线路

  1. 找到对应铁路局的配置
  2. lines 表中添加新线路
  3. 保存页面

修改颜色

  1. 找到对应的线路配置
  2. 修改 bgc1color2 的值
  3. 保存页面
local p = {}

-- 颜色配置表 - 只需编辑这个表
local colorConfig = {
    -- ZTH轨道交通结社配置
    R = {
        lines = {
			["D"] = { bgc1 = "#2bff9c", color2 = "#2bff9c" },
			["F"] = { bgc1 = "#ffa500", color2 = "#ffa500" },
			["Z"] = { bgc1 = "#191970", color2 = "#191970" },
        },
        default = { bgc1 = "#cccccc", color2 = "#cccccc" }
    },
    
    -- 海华铁路局配置
    H = {
        lines = {
            ["1"] = { bgc1 = "#ff0000" },
            ["1<small>01</small>"] = { bgc1 = "#ff0000" },
            ["2"] = { bgc1 = "#ff7f00" },
            ["2<small>01</small>"] = { bgc1 = "#ff7f00" },
            ["3"] = { bgc1 = "#ffdf00" },
            ["3<small>01</small>"] = { bgc1 = "#ffdf00" },
            ["4"] = { bgc1 = "#00ff00" },
            ["5"] = { bgc1 = "#00bfbf" },
            ["6"] = { bgc1 = "#0000ff" },
            ["6<small>01</small>"] = { bgc1 = "#0000ff" },
            ["7"] = { bgc1 = "#7f00ff" },
            ["10"] = { bgc1 = "#4b5931" },
        },
        default = { bgc1 = "#cccccc" }
    },
    
    -- 溯铁集团配置
    T = {
        lines = {
            ["8"] = { bgc1 = "#e6722c" },
            ["14"] = { bgc1 = "#a5459b" },
        },
        default = { bgc1 = "#cccccc" }
    },
    
    -- 白马川铁路局配置
    B = {
    	lines = {
    		["6"] = { bgc1 = "#b5d204" },
    		["7"] = { bgc1 = "#e0231b" },
    	},
    	default = { bgc1 = "#cccccc" }
    },
    
    -- 大站快线配置
    G = {
        lines = {
            ["1"] = { bgc1 = "#ffdc1e" },
        },
        default = { bgc1 = "#cccccc" }
    },
    
    -- 全局默认配置(当路局未配置时使用)
    default = {
        bgc1 = "#cccccc",
        color2 = "#cccccc"
    }
}

-- 以下为主函数,仅添加线路时无需更改

function p.railBox(frame)
    local args = frame.args
    
    local system = args.system or args[1] or ""
    local line = args.line or args[2] or ""
    local station = args.station or args[3]
    local inline = args.inline or args[4]
    
    local bureau = system:upper()
    
    local bureauConfig = colorConfig[bureau]
    local colors = {}
    
    if bureauConfig then
        local lineConfig = bureauConfig.lines and bureauConfig.lines[line]
        
        if lineConfig then
            colors.bgc1 = lineConfig.bgc1 or bureauConfig.default.bgc1
            colors.color2 = lineConfig.color2 or bureauConfig.default.color2
        else
            colors.bgc1 = bureauConfig.default.bgc1
            colors.color2 = bureauConfig.default.color2
        end
    else
        colors.bgc1 = colorConfig.default.bgc1
        colors.color2 = colorConfig.default.color2
    end
    
    local templateArgs = {
        system = system,
        line = line,
    }
    
    if station and station ~= "" then
        templateArgs.station = station
    end
    
    templateArgs["color-system"] = "white"
    templateArgs["bgc-system"] = colors.bgc1
    
    if colors.color2 then
        templateArgs["color-line"] = colors.color2
    end
    
    if inline and inline ~= "" then
        templateArgs.inline = inline
    end
    
    if args.debug == "yes" then
        local debugInfo = "传递给 Rail_line_box 的参数: "
        for k, v in pairs(templateArgs) do
            debugInfo = debugInfo .. string.format("[%s]=%s ", k, v)
        end
        return debugInfo
    end
    
    return frame:expandTemplate{
        title = 'Rail_line_box',
        args = templateArgs
    }
end

function p.debug(frame)
    local args = frame.args
    local result = "参数: "
    for k, v in pairs(args) do
        result = result .. string.format("[%s]=%s ", k, v)
    end
    return result
end

return p