WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Need Help Creating an "Install" Splash for my UI (https://www.wowinterface.com/forums/showthread.php?t=50253)

Cerberux19 10-23-14 12:48 AM

Need Help Creating an "Install" Splash for my UI
 
Hey all, I was looking to make my UI a bit more user friendly and create a separate addon that will simply load a splash screen the first time a character logs in and needs to set up my UI.

Currently I am using a string that incorporates the addon "Reflux" to load all addons in a single profile.

I have been trying, with no luck, in creating my own addon. And I am at a total loss atm.

The folder so far consists of the following files:

CerberuxUI > Core > Settings.lua
Media > Install > INSTALL.tga and Logo.tga
CerberuxUI.toc
Core.lua



These are the codes I currently have in each file:
Could someone please take a look and see where I might have gone wrong?

Settings.lua
Code:

local CerberuxUI = LibStub("AceAddon-3.0"):GetAddon("CerberuxUI")
local db, dbc, dbg

local CerberuxUICharacter_defaults = {
        initialized = false,
        needchatmoved = true,
}

local IWTextures = {
        Logo = [[Interface\AddOns\CerberuxUI\Media\Install\Logo.tga]],
}

local IWF = {}

---- Misc functions
CerberuxUI.deepCopyHash = function(t)
        local nt = {}
        for k, v in pairs(t) do
                if type(v) == "table" then
                        nt[k] = CerberuxUI.deepCopyHash(v)
                else
                        nt[k] = v
                end
        end
        return nt
end

-- Set default Chat frame position (called from Core.lua "PLAYER_ENTERING_WORLD")
function CerberuxUI:SetChatPosition()
        if CerberuxUICharacter.needchatmoved then
                ChatFrame1:ClearAllPoints()
                ChatFrame1:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 6, 32)
                ChatFrame1:SetFrameLevel(15)
                ChatFrame1:SetHeight(170)
                ChatFrame1:SetWidth(380)
                ChatFrame1:SetUserPlaced(true)
                FCF_SavePositionAndDimensions(ChatFrame1)
                CerberuxUICharacter.needchatmoved = false
        end
end

-- CVars
local function SetDefaultCVars()
        -- Sound
        SetCVar("Sound_EnableErrorSpeech", 0)
        -- Nameplates
        SetCVar("bloatTest", 0)
        SetCVar("bloatnameplates", 0)
        SetCVar("bloatthreat", 0)
        -- Screenshots
        SetCVar("screenshotFormat", "jpg")                                -- JPG format
        SetCVar("screenshotQuality", "10")                                -- Highest quality
        -- Help
        SetCVar("showGameTips", 0)                                                -- Turn off Loading Screen Tips
        SetCVar("showTutorials", 0)                                                -- Turn off Tutorials
        SetCVar("UberTooltips", 1)                                                -- Turn on Enhanced Tooltips
        SetCVar("scriptErrors", 1)                                                -- Turn on Display Lua Errors
        -- Controls
        SetCVar("deselectOnClick", 1)                                        -- Turn off Sticky Targeting (inverted)
        -- Combat
        SetCVar("displaySpellActivationOverlays", 1)        -- Turn on Spell Alerts
        -- Display
        SetCVar("emphasizeMySpellEffects", 0)                        -- Turn off Emphasize My Spell Effects
        SetCVar("SpellTooltip_DisplayAvgValues", 0)                -- Turn off Display Points As Average
        -- Social
        SetCVar("chatStyle", "classic")                                        -- Chat Style = "Classic"
        SetCVar("conversationMode", "inline")                        -- Conversation Mode = "In-line"
        -- Quality of Life
        SetCVar("guildShowOffline", 0)                                        -- Hide Offline Guild Members
        SetCVar("profanityFilter", 0)                                        -- Turn off Profanity Filter
end

-- Initial Settings
local function InitialSettings()
        ---- Chat
        -- Lock chat frames
        for i = 1,10 do
                local cf = _G["ChatFrame"..i]
                if cf then FCF_SetLocked(cf, 1) end
    end

        -- Set all chat channels to color player names by class
        for k, v in pairs(CHAT_CONFIG_CHAT_LEFT) do
                ToggleChatColorNamesByClassGroup(true, v.type)
        end
        for iCh = 1, 15 do
                ToggleChatColorNamesByClassGroup(true, "CHANNEL"..iCh)
        end

        -- Make Chat windows transparent
        SetChatWindowAlpha(1, 0)
        SetChatWindowAlpha(2, 0)
       
        -- Initial Settings done
        CerberuxUICharacter.initialized = true
end

---- Primary Installation
---- Stage 1
function CerberuxUI_RunStage1()
        dbc.installation.stage = -1
       
        if dbg.tags.firsttime then
                dbg.tags.firsttime = false
        end
       
        -- Make Chat windows transparent (again)
        SetChatWindowAlpha(1, 0)
        SetChatWindowAlpha(2, 0)
       
        end

        -- Reflux
        local RefluxArg = string.format("%s %s", "switch", "Cerberux")
    SlashCmdList.REFLUX(RefluxArg) -- This will cause a UI reload
end

local function CreateIWTextureFrame(texture, width, height, position, color)
        local frame = CreateFrame("Frame", nil, IWF)
        frame:SetParent(IWF)
        frame:SetPoint(unpack(position))
        frame:SetFrameStrata("DIALOG")
        frame:SetFrameLevel(IWF:GetFrameLevel() + 1)
        frame:SetWidth(width)
        frame:SetHeight(height)
       
        frame.bg = frame:CreateTexture()
        frame.bg:SetAllPoints(frame)
        frame.bg:SetTexture(texture)
        frame.bg:SetVertexColor(unpack(color))
       
        return frame
end

local function CreateInstallWindow()
        -- Background
        IWF = CreateFrame("Frame", nil, UIParent)
        IWF:SetParent(UIParent)
        IWF:SetAllPoints(UIParent)
        IWF:SetFrameStrata("DIALOG")
        IWF:SetFrameLevel(0)
        IWF:SetBackdrop({
                bgFile = "interface\\addons\\CerberuxUI\\Media\\Install\\INSTALL.tga",
        })
        IWF:SetBackdropColor(0, 0, 0, 0.9)
       
        -- Button
        IWF.install = CreateFrame("Button", "CerberuxUI_Install", IWF, "SecureActionButtonTemplate")
        IWF.install:SetPoint("CENTER", IWF, "CENTER", 40, 40)
        IWF.install:SetWidth(512)
        IWF.install:SetHeight(256)
        IWF.install:SetNormalFontObject(NumberFontNormal)
        IWF.install:SetText("")
        IWF.install:RegisterForClicks("LeftButtonUp")
        IWF.install:SetScript("OnClick", function()
                CerberuxUI_RunStage1()
        end)
       
               
        -- Logo
        IWF.logo = CreateIWTextureFrame(IWTextures.Logo, 256, 64, {"CENTER", IWF, "CENTER", 0, 60}, {1, 1, 1, 1})
end

local function InstallationStage1()
        ---- Create Installation Window
        CreateInstallWindow()
       
        ---- First Time
        if dbg.tags.firsttime then
                -- CVars
                SetDefaultCVars()
        end
       
        ---- Initial Character Settings
        if not CerberuxUICharacter.initialized then
                if StaticPopup1 then StaticPopup1:Hide() end
                InitialSettings()
        end
       
        DEFAULT_CHATFRAME_ALPHA = 0
end

---- Process
local function PrimaryInstallation()
        if dbc.installation.stage > -1 then
                InstallationStage1()
        end
end

---- Install Procedure
function CerberuxUI:InstallProcedure()
        db = self.db.profile
        dbc = self.db.char
        dbg = self.db.global
       
        -- Set Char defaults
        if not(CerberuxUICharacter) then
                CerberuxUICharacter = CerberuxUICharacter_defaults
        end
       
        -- Primary Stages
        if dbc.installation.stage > -1 then
                PrimaryInstallation()
        end
end

CerberuxUI.toc

Code:

## Interface: 60000
## Title: |cffF58CBAC|cff0070DEL|cff69CCF0A|cffC41F3BS|cff00FF96S|r |cffABD473C|cffFFFFFFO|cffFFF569L|cff9482C9O|cffC79C6ER|cffFF7D0AS|r |cff00FF00by|r |cff00FF00Cerberux|r
## Author: Cerberux
## Notes: CerberuxUI core functionality
## SavedVariables: CerberuxUIDB
## SavedVariablesPerCharacter: CerberuxUICharacter
## OptionalDeps: Ace3, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets
## RequiredDeps: Reflux

# Ace3
Libs\Embeds.xml

Core.lua
Core.xml

Core.lua

Code:

local CerberuxUI = LibStub("AceAddon-3.0"):NewAddon("CerberuxUI", "AceConsole-3.0", "AceEvent-3.0")
local db, dbg

-- Default Options
local defaults = {
        global = {
                tags = {
                        firsttime = false,
                },
        },
        char = {
                installation = {
                        stage = 0,
                },
        },
}

function CerberuxUI:UPDATE_PENDING_MAIL()
        self:UnregisterEvent("UPDATE_PENDING_MAIL")
        CancelEmote()        -- Cancel Map Holding animation
end

function CerberuxUI:PLAYER_LOGIN()
        -- Check if Installation/Patch is necessary
        self:InstallProcedure()
end

function CerberuxUI:ADDON_LOADED(event, addon)
        if addon ~= "CerberuxUI" then return end
       
        -- Open before login to stop taint
        ToggleFrame(SpellBookFrame)
        PetJournal_LoadUI()
       
        -- Remove Interface Options cancel button because it = taint
        InterfaceOptionsFrameCancel:Hide()
        InterfaceOptionsFrameOkay:SetAllPoints(InterfaceOptionsFrameCancel)

        -- Make clicking cancel the same as clicking okay
        InterfaceOptionsFrameCancel:SetScript("OnClick", function()
                InterfaceOptionsFrameOkay:Click()
        end)
end

function CerberuxUI:OnInitialize()
        -- Initialize settings, options, slash commands
        self.db = LibStub("AceDB-3.0"):New("CerberuxUIDB", defaults, "CerberuxUI")
        dbc = self.db.char
        dbg = self.db.global
       
        -- Vars
        self.realm = GetRealmName()
        self.class = select(2, UnitClass("player"))
        self.name = UnitName("player")
        self.key = string.format("%s - %s", self.name, self.realm)
       
        -- Register events
        self:RegisterEvent("ADDON_LOADED")
        self:RegisterEvent("PLAYER_LOGIN")
        self:RegisterEvent("UPDATE_PENDING_MAIL")
       
        -- Chat Commands
        self:RegisterChatCommand("rl", function() ReloadUI() end)

        -- Synch user's settings
        if dbg.tags.firsttime then
                SetCVar("synchronizeSettings", 1)
                SetCVar("synchronizeConfig", 1)
                SetCVar("synchronizeBindings", 1)
                SetCVar("synchronizeMacros", 1)
        end
       
        -- Done
        print("CerberuxUI loaded.")
end

p.s. I am very new to LUA and creating addons and recycled this code from a similar style splash so please pardon the ignorance. :p

Cerberux19 10-23-14 03:43 AM

Anyone able to help?

Tonyleila 10-23-14 06:55 AM

Quote:

Originally Posted by Cerberux19 (Post 298777)
Anyone able to help?

There is a working one klick profil loader for reflux here: nibProfileLoader

You can set up different profils for each class.

Cerberux19 10-23-14 02:51 PM

That will do in a pinch thanks :) however it looks too bland and I would like to load an entire splash screen with my own custom graphic and custom button. Would this be easily changed in that addon?

Phanx 10-23-14 07:21 PM

Mayron UI uses a custom GUI for this that you could look at for ideas.

Cerberux19 10-23-14 08:05 PM

Yeah thats actually where I got the code for the one i was trying, albeit it was for a fairly old version. I didnt think the code would have changed that much since i last used it in 5.2

suicidalkatt 10-28-14 04:06 PM

I made a rather simple splash art and a Reflux profile install call for my UI that I've yet to release:

https://www.dropbox.com/s/rpq8gmvqrbspprf/SyUI.zip?dl=0

(I'm on mobile so pasting code is a bit tedious)

I just have a simple frame animation play and at the end of it call a function that can display a simple StaticPopup which can then call the Reflux profile swap.


All times are GMT -6. The time now is 08:28 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI