view ObjectiveTracker/Schema.lua @ 35:69d03f8e293e

- separated layout and data logic between Frame.lua and Update.lua - solved disappearing tracker mystery
author Nenue
date Sun, 17 Apr 2016 11:07:48 -0400
parents 9856ebc63fa4
children e84d645c8ab8
line wrap: on
line source
--- ${PACKAGE_NAME}
-- @file-author@
-- @project-revision@ @project-hash@
-- @file-revision@ @file-hash@
-- Created: 4/15/2016 11:36 PM

local B = select(2,...).frame
local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
local setmetatable, type, rawset = setmetatable, type, rawset
local print = B.print('Schema')
T.defaults.Schema = setmetatable({}, {
  __newindex = function(schemas,layerName, layerTable)
    -- tracker/block/line
    if type(layerTable) == 'table' then
      rawset(schemas, layerName, setmetatable(layerTable, {
        __index = function(layerTable, schemaName)

        end,
        __newindex = function(layerTable, schemaName, schemaTable)
          -- schema table
          if type(schemaTable) == 'table' then
            rawset(layerTable, schemaName, setmetatable(schemaTable, {
              __index = function(schemaTable, key)
                print('substituting a default value for |cFF00FFFF', layerName..'|r.|cFF0088FF'..schemaName..'|r.'..key)
                return layerTable.default[key]
              end
            }))
          end
        end,
      }))
    end
  end
})

T.defaults.Schema = {
  tracker = {
    default = {
      headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0},
      headerFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE'},
      blockSpacing = 1,
    }
  },
  block = {
    default = {
      titlebg = {'HORIZONTAL', 1, 0, .7, 0,    1, 0, .7, .125},
      textbg = {'HORIZONTAL', 0, 0, 0, 0.4,      0, 0, 0, 0 },
      selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225},
      titleFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE'},
      textFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE'},
      titleIndent = 4,
      titleSpacing = 3,
      textIndent = 3,
      textSpacing = 3,
      rewardSize = 24,
    },
    daily = {
      titlebg = {'HORIZONTAL', 0, .7, 1, .25,  0, 1, .7, .125},
      textbg = {'HORIZONTAL', 0, .7, 1, .1,    0, 1, .7, .075 },
    },
    weekly = {
      titlebg = {'HORIZONTAL', 0, .35, .7, .25,   0, .35, .7, .125},
      textbg = {'HORIZONTAL', 0, .35, .7, .1,     0, .35, .7, .075 },
    },
    account = {
      titlebg = {'HORIZONTAL', .1, .1, .1, .25, .1, .1, .1, .125},
      textbg = {'HORIZONTAL', .1, .1, .1, 0.4, .1, .1, .1, .085 },
    },
    -- alliance
    faction_1 = {
      titlebg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 },
      textbg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 },
    },
    -- horde
    faction_2 = {
      titlebg = {'HORIZONTAL', .6, 0, 0.4, 0.4,  .6, 0, 0.4, .085 },
      textbg = {'HORIZONTAL', .6, 0, 0.4, 0.4,   .6, 0, 0.4, .085 },
    }
  },
  line = {
    default  = {
      textColor = {.5,.75,1},
      textSpacing = 3,
      textIndent = 3,
    },
    completed = {
      textColor = {0, 1, 0}
    },
    failed = {
      textColor = {1,0,0 }
    },
    autocomplete = {
      textColor = {0,1,0 }
    },
    objectColor = {
      textColor = {0,1,1}
    },
    monster = {
      textColor = {1,1,0}
    },
    item = {
      textColor = {1,.25,.5}
    }
  },
  widget = {
    progressbar = {

    },
    timer = {

    }
  },
}