Okay, this is the barest minimum I needed to get it to work. The fading code used is simply due to its simplicity. I am personally using animation fading in my big project so I'll leave any changes you require up to you.
<YourAddonName>.TOC
Code:
## Interface: 80000
## Title: <YourAddOnName>
## Notes: Shows a Splash Window
## Version: 1.0.7
## Author: Whoever wants to use it honest
## eMail: contactme@myemailaddress
## DefaultState: Enabled
## RequiredDeps:
## LoadOnDemand: 0
## SavedVariables:
## SavedVariablesPerCharacter: PawDB
<YourAddOnName>.lua
<YourAddOnName>.lua
Lua Code:
local addonName, addonData = ...
-- Create a new table if it is empty
addonData = addonData or {}
-- Get this version of the addon
addonData.version = GetAddOnMetadata(addonName, "Version")
-- Force initialisation in case there are no saved variables yet
-- These should get overriden when the saved variables are loaded
PawDB = {}
PawDB.version = nil
-- Create the frame and set up its visual details, I've just created a white background
-- By Default it will show so FadeOut immediately via the method you choose
local InstallerLogo = CreateFrame("Frame", addonName.."ILogo", UIParent);
InstallerLogo.Background = InstallerLogo:CreateTexture( "$parentBackground", "BACKGROUND" );
-- Create UI Elements
InstallerLogo.Background:SetAllPoints()
-- Customize the Elements
InstallerLogo.Background:SetColorTexture(1,1,1,1)
-- Fade Out the screen as we don't want to see it by default
UIFrameFadeOut(InstallerLogo,1,1,0)
-- Event function
local function OnEvent(self,event,...)
-- if this is the first time entering the world
if event == "PLAYER_ENTERING_WORLD" then
local login,reload = ...
-- Displays the two values in the chat frame so you can see what is being tested
--print(addonData.version, PawDB.version)
-- Only process this block if this is the first time logging in and the version numbers are different
-- Addons will only know about a TOC change if the change was made before you logged into the game ( character screen is not enough, log right out to the beginning)
if login == true and addonData.version ~= PawDB.version then
-- Set up the Splash Screens UI with its required data and any other changes not already made
InstallerLogo:SetSize(850, 480); -- the size of the splash
InstallerLogo:SetPoint("CENTER"); -- its position on the screen
-- Then fade it into view using your preferred method
UIFrameFadeIn(InstallerLogo,1,0,1);
-- Then Update the saved variable table for the character with the new version
PawDB.version = addonData.version
end
end
end
-- Create the frame that will monitor events and tell the other frames what to do
local EventWatcher = CreateFrame("Frame")
EventWatcher:RegisterEvent("PLAYER_ENTERING_WORLD");
EventWatcher:SetScript("OnEvent", OnEvent)