-- Season UI
local Text = GLOBAL.require("widgets/text")
local UIClock = GLOBAL.require("widgets/uiclock")
local myclockupdate = UIClock.UpdateDayString

function GetSeasonText()
    local sm = GLOBAL.GetSeasonManager()
    local s = sm:GetSeasonString()
	  if s == "summer" then
		    s = GLOBAL.STRINGS.UI.SANDBOXMENU.SUMMER
	  elseif s == "autumn" then
		    s = GLOBAL.STRINGS.UI.SANDBOXMENU.AUTUMN
	  elseif s == "winter" then
		    s = GLOBAL.STRINGS.UI.SANDBOXMENU.WINTER
	  elseif s == "spring" then
		    s = GLOBAL.STRINGS.UI.SANDBOXMENU.SPRING
	  end
    s = s .. string.format(" %d/%d", math.floor(sm:GetDaysIntoSeason() + 1 + 0.5), sm:GetSeasonLength())
    return s
end
function UIClock:UpdateDayString()
	  local daystr = myclockupdate(self)
		if not self.text2 then
		    self.text2 = self:AddChild(Text(GLOBAL.BODYTEXTFONT, 22/self.base_scale))
    	  self.text2:SetPosition(5, -25/self.base_scale, 0)
			  self.text2:SetColour(1,1,1,1)
        self.inst:DoPeriodicTask(1, function(inst)
          self.text2:SetString(GetSeasonText())
        end)
		end

    return daystr
end