-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The beginnings of the creature viewer
- Loading branch information
1 parent
c93ab77
commit 5307e61
Showing
6 changed files
with
192 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
Datamine/Modules/Unified/Templates/CreatureView/CreatureView.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
local L = Datamine.Strings; | ||
local Registry = Datamine.EventRegistry; | ||
local Events = Datamine.Events; | ||
local Popup = Datamine.Popup; | ||
local Search = Datamine.Search; | ||
local Database = Datamine.Database; | ||
|
||
------------ | ||
|
||
DatamineCreaturePickerMixin = {}; | ||
|
||
function DatamineCreaturePickerMixin:OnLoad() | ||
local titleBar = self.TitleBar; | ||
local creatureList = self.CreatureList; | ||
|
||
titleBar.TitleText:SetText(L.CREATUREVIEW_LIST_TITLE); | ||
creatureList.Background_Base:Hide(); | ||
|
||
creatureList.HelpText:SetText(L.CREATUREVIEW_TEXT_HELP_HEADER); | ||
creatureList.HelpTextDetails:SetText(L.CREATUREVIEW_TEXT_HELP); | ||
|
||
creatureList:SetFailText(nil, L.CREATUREVIEW_LIST_SEARCH_FAIL_TEXT); | ||
|
||
self:SetupSearchBox(); | ||
end | ||
|
||
function DatamineCreaturePickerMixin:OnShow() | ||
if self.SearchTask then | ||
self.SearchTask:ClearSearchQuery(); | ||
end | ||
|
||
if not self.Populated then | ||
self:PopulateCreatures(); | ||
end | ||
|
||
self.TitleBar.SearchBox:SetText(""); | ||
self.CreatureList.ScrollBox:ScrollToBegin(); | ||
end | ||
|
||
function DatamineCreaturePickerMixin:SetupSearchBox() | ||
local searchBox = self.TitleBar.SearchBox; | ||
local creatureList = self.CreatureList; | ||
|
||
creatureList:SetEditBox(searchBox); | ||
end | ||
|
||
function DatamineCreaturePickerMixin:PopulateCreatures() | ||
local creatureList = self.CreatureList; | ||
|
||
creatureList.HelpText:Hide(); | ||
creatureList.HelpTextDetails:Hide(); | ||
|
||
creatureList.ScrollView:SetPadding(2, 2, 2, 2, 2); | ||
|
||
local allCreatures = {}; | ||
local creatures = Datamine.Database:GetAllCreatureEntries(); | ||
for creatureID, creatureInfo in pairs(creatures) do | ||
local locale = GetLocale(); | ||
local data = { | ||
ID = creatureID, | ||
Text = creatureInfo.Name[locale], | ||
TextScale = 0.9, | ||
Callback = function() end, | ||
BackgroundAlpha = 0.5, | ||
}; | ||
|
||
tinsert(allCreatures, data); | ||
end | ||
|
||
local function AlphabeticalSort(a, b) | ||
return a.Text < b.Text; | ||
end | ||
|
||
table.sort(allCreatures, AlphabeticalSort); | ||
creatureList:SetSearchDataSource(allCreatures, "Text"); | ||
|
||
self.Populated = true; | ||
end |
94 changes: 94 additions & 0 deletions
94
Datamine/Modules/Unified/Templates/CreatureView/CreatureView.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.blizzard.com/wow/ui/ https://raw.githubusercontent.com/Meorawr/wow-ui-schema/main/UI.xsd"> | ||
|
||
<Frame name="DatamineCreaturePickerTemplate" mixin="DatamineCreaturePickerMixin" virtual="true"> | ||
<Layers> | ||
<Layer level="BACKGROUND"> | ||
<Texture parentKey="Background" inherits="DatamineMediumGrayBackgroundTemplate" | ||
setAllPoints="true" /> | ||
</Layer> | ||
</Layers> | ||
<Frames> | ||
<Frame parentKey="TitleBar"> | ||
<Size y="50" /> | ||
<Anchors> | ||
<Anchor point="TOPLEFT" /> | ||
<Anchor point="TOPRIGHT" /> | ||
</Anchors> | ||
<Layers> | ||
<Layer level="ARTWORK"> | ||
<FontString parentKey="TitleText" font="DatamineCleanFontBig"> | ||
<Size x="125" /> | ||
<Anchors> | ||
<Anchor point="TOP" /> | ||
<Anchor point="BOTTOM" relativePoint="CENTER" /> | ||
</Anchors> | ||
</FontString> | ||
</Layer> | ||
</Layers> | ||
<Frames> | ||
<EditBox parentKey="SearchBox" inherits="DatamineEditBoxTemplate"> | ||
<Anchors> | ||
<Anchor point="TOPLEFT" relativePoint="LEFT" x="10" /> | ||
<Anchor point="BOTTOMRIGHT" x="-4" /> | ||
</Anchors> | ||
</EditBox> | ||
</Frames> | ||
</Frame> | ||
<Frame parentKey="CreatureList" inherits="DatamineSearchableListTemplate"> | ||
<Anchors> | ||
<Anchor point="TOPLEFT" relativeKey="$parent.TitleBar" | ||
relativePoint="BOTTOMLEFT" x="6" y="-2" /> | ||
<Anchor point="BOTTOMRIGHT" x="-6" y="4" /> | ||
</Anchors> | ||
<Layers> | ||
<Layer level="ARTWORK"> | ||
<FontString parentKey="HelpText" font="DatamineCleanFont" | ||
wordwrap="false" | ||
justifyH="CENTER" justifyV="MIDDLE" text="TEXT HERE" | ||
outline="THICK"> | ||
<Anchors> | ||
<Anchor point="CENTER" y="20" /> | ||
</Anchors> | ||
<Color r="0.45" g="0.45" b="0.45" a="1" /> | ||
</FontString> | ||
<FontString parentKey="HelpTextDetails" | ||
font="DatamineCleanFontSmall" | ||
wordwrap="true" | ||
maxLines="3" | ||
justifyH="CENTER" justifyV="MIDDLE" text="DETAILS" | ||
outline="THICK"> | ||
<Anchors> | ||
<Anchor point="TOP" relativeKey="$parent.HelpText" | ||
relativePoint="BOTTOM" y="-3" /> | ||
</Anchors> | ||
<Color r="0.45" g="0.45" b="0.45" a="1" /> | ||
</FontString> | ||
</Layer> | ||
<Layer level="BACKGROUND"> | ||
<Texture parentKey="Background" | ||
inherits="DatamineDarkGrayBackgroundTemplate" | ||
setAllPoints="true" /> | ||
</Layer> | ||
</Layers> | ||
</Frame> | ||
</Frames> | ||
<Scripts> | ||
<OnLoad method="OnLoad" /> | ||
<OnShow method="OnShow" /> | ||
</Scripts> | ||
</Frame> | ||
|
||
<Frame name="DatamineCreatureViewTabTemplate" virtual="true"> | ||
<Frames> | ||
<Frame parentKey="CreaturePicker" inherits="DatamineCreaturePickerTemplate" | ||
frameLevel="5"> | ||
<Size x="300" /> | ||
<Anchors> | ||
<Anchor point="TOPLEFT" x="4" y="-4" /> | ||
<Anchor point="BOTTOMLEFT" x="4" y="4" /> | ||
</Anchors> | ||
</Frame> | ||
</Frames> | ||
</Frame> | ||
</Ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters