Skip to content

Commit

Permalink
Merge branch 'fixes/spit-n-polish'
Browse files Browse the repository at this point in the history
  • Loading branch information
Odie committed Sep 29, 2018
2 parents d11bdf1 + d9532f8 commit 52613a8
Show file tree
Hide file tree
Showing 28 changed files with 367 additions and 271 deletions.
12 changes: 6 additions & 6 deletions build/skyui/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ itemcard.yOffset = 0


; =====================================================================================================================
[ItemList]
[ItemList]
; =====================================================================================================================
quantityMenu.minCount = 6 ; Number of items required to trigger quantity dialog. 0 is disabled


; =====================================================================================================================
[Appearance]
[Appearance]
; =====================================================================================================================
icons.category.source = 'skyui/icons_category_psychosteve.swf'

Expand All @@ -50,7 +50,7 @@ colors.negative.disabled = 0x800000


; =====================================================================================================================
[ListLayout]
[ListLayout]
; =====================================================================================================================
vars.a_textBorder.value = <0, 0, 1.1, 0> ; left right top bottom
vars.n_iconSize.value = 18
Expand All @@ -63,7 +63,7 @@ defaults.entry.textFormat.align = right
defaults.entry.textFormat.bold = false
defaults.entry.textFormat.italic = false
defaults.entry.textFormat.underline = false
defaults.entry.textFormat.size = 14
defaults.entry.textFormat.size = 18
defaults.entry.textFormat.letterSpacing = 0.8
defaults.entry.textFormat.kerning = false
defaults.entry.textFormat.leftMargin = 0
Expand All @@ -76,7 +76,7 @@ defaults.label.textFormat.align = right
defaults.label.textFormat.bold = false
defaults.label.textFormat.italic = false
defaults.label.textFormat.underline = false
defaults.label.textFormat.size = 12
defaults.label.textFormat.size = 16
defaults.label.textFormat.letterSpacing = 0.8
defaults.label.textFormat.kerning = false
defaults.label.textFormat.leftMargin = 0
Expand Down Expand Up @@ -757,4 +757,4 @@ layouts.smithingListLayout.name = 'SmithingListLayout'
layouts.smithingListLayout.views = <defaultCraftingView>

layouts.alchemyListLayout.name = 'AlchemyListLayout'
layouts.alchemyListLayout.views = <alchemyView>
layouts.alchemyListLayout.views = <alchemyView>
47 changes: 14 additions & 33 deletions misc/Flash Util/build-all.jsfl
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
var srcDir = "file:///E:/skyui/src/"
var flaFiles = [
"CraftingMenu/craftingmenu.fla",
//"Enderal/SkillMenu.fla",
"FavoritesMenu/favoritesmenu.fla",
"HUDWidgets/activeeffects.fla",
//"HUDWidgets/arrowcount.fla",
//"HUDWidgets/meter.fla",
//"HUDWidgets/minimap.fla",
//"HUDWidgets/status.fla",
//"HUDWidgets/statusicons.fla",
"HUDWidgets/widgetloader.fla",
//"FavoritesMenu/favoritesmenu.fla",
//"HUDWidgets/activeeffects.fla",
//"HUDWidgets/widgetloader.fla",
"ItemMenus/bartermenu.fla",
"ItemMenus/bottombar.fla",
"ItemMenus/containermenu.fla",
Expand All @@ -18,32 +12,19 @@ var flaFiles = [
"ItemMenus/inventorymenu.fla",
"ItemMenus/itemcard.fla",
"ItemMenus/magicmenu.fla",
"MapMenu/map.fla",
//"MessageBox/messagebox.fla",
//"MapMenu/map.fla",
"ModConfigPanel/configpanel.fla",
"ModConfigPanel/mcm_splash.fla",
"ModConfigPanel/skyui_splash.fla",
//"ModConfigPanel/TextLoader.fla",
//"ModConfigPanel/mcm_splash.fla",
//"ModConfigPanel/skyui_splash.fla",
"PauseMenu/quest_journal.fla",
//"Resources/Assets/maskedtextarea.fla",
//"Resources/Assets/meter.fla",
//"Resources/Assets/scrollbar.fla",
"Resources/buttonArt.fla",
//"Resources/buttonArtSymbols.fla",
//"Resources/fonts_en_snk.fla",
//"Resources/gfxfontlib.fla",
"Resources/icons_category_celtic.fla",
"Resources/icons_category_curved.fla",
"Resources/icons_category_psychosteve.fla",
"Resources/icons_category_straight.fla",
"Resources/icons_effect_psychosteve.fla",
//"Resources/icons_item_celtic.fla",
//"Resources/icons_item_curved.fla",
"Resources/icons_item_psychosteve.fla",
"Resources/mapMarkerArt.fla",
//"Resources/skyui_icons.fla",
//"Resources/skyui_icons_psychosteve.fla",
//"Resources/skyui_icons_straight.fla",
//"Resources/icons_category_celtic.fla",
//"Resources/icons_category_curved.fla",
//"Resources/icons_category_psychosteve.fla",
//"Resources/icons_category_straight.fla",
//"Resources/icons_effect_psychosteve.fla",
//"Resources/icons_item_psychosteve.fla",
//"Resources/mapMarkerArt.fla",
];

for(var i = 0; i < flaFiles.length; i++) {
Expand All @@ -68,4 +49,4 @@ for(idx in flaFiles) {
build(flaFiles[idx]);
}

FLfile.remove(logfile);
FLfile.remove(logfile);
10 changes: 8 additions & 2 deletions misc/cp-built-files
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Pathname.glob("#{destDir}/**/*").each do |destPath|

# For all files (not a directory)...
next if destPath.directory?
next if destPath.to_s.include? "/exported/"

srcPath = srcDirPath + destPath.relative_path_from(destDirPath)

Expand Down Expand Up @@ -109,11 +110,15 @@ if options[:watch] then
modifiedPath = Pathname.new(modifiedFile)
waitFileStopsGrowing(modifiedPath)

# Copy the file
# Figure out where to copy the file from & to
srcPath = modifiedPath
destPath = getDestPath(srcDirPath.realpath, srcPath, destDirPath)
time = Time.new

# Don't copy the file if it doesn't already exist in the destination
next if !destPath.exist?

# Actually copy the file when ready
time = Time.new
while true do
begin
puts("[#{time.strftime("%H:%M")}] #{srcPath} => #{destPath}")
Expand All @@ -138,6 +143,7 @@ if options[:watch] then
if modified then
semaphore.synchronize do
modified.each do |f|
next if f.include? "/exported/"
filesBeingWritten.add(f)
end
end
Expand Down
1 change: 0 additions & 1 deletion src/Common/Shared/GlobalFunc.as
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Shared.GlobalFunc
var letterSpacing: Number = textFormat.letterSpacing;
var kerning: Boolean = textFormat.kerning;
this.htmlText = aText;
textFormat = this.getTextFormat();
textFormat.letterSpacing = letterSpacing;
textFormat.kerning = kerning;
this.setTextFormat(textFormat);
Expand Down
48 changes: 48 additions & 0 deletions src/Common/skyui/components/BottomBarMappedButton.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import skyui.components.MappedButton;
import skyui.util.GlobalFunctions;
import skyui.defines.Screen;

// Specialized version of a MappedButton for the BottomBar
// We vertically center the button after the button is updated.
// Note that we're assuming information regarding the bottombar
// layout and where mapped buttons would be.
//
// This is not suitable for general use in other layouts.
class skyui.components.BottomBarMappedButton extends MappedButton
{
public function update(): Void
{
super.update();

// Position this button so it's centered in the bottombar
// We're assuming the following display tree:
// bottom bar
// |- bg
// |- button panel
// |- Mapped Button
//
// Note that the bg provides a stable/static dimension for the bottombar.
// Since we're tweaking the layout of the bottombar programmatically, it's not a good
// idea to perform the calculation with respect to the dynamic size of the bottombar since
// might change if the button or text size were to ever exceed the static height of the
// bottombar, then the layout calculation would be thrown off from that point on.
//
// To center the ourselves to the bottom bar, we need to:
// ( center self with respect to the bottombar ) - (_y offset introduced by button panel)
//
// Also note that, sometimes, the bottombar may fall outside of the rendering area. Having
// an oversized element like this makes design time tweaking a bit more straigtforward.
// If we want to tweak the position at runtime, it means we can't just use the `bg` object
// as a sizing reference directly. We need to figure out how much of the element is actually
// visible and use that as the height of the bottombar.
var targetHeight = textField._height;
var bottombar = _parent._parent;
var reference = bottombar.centerReference != undefined ? bottombar.centerReference : bottombar.bg;

var referenceOrigin:Object = {x: 0, y:0};
reference.localToGlobal(referenceOrigin);

var visibleHeight = GlobalFunctions.clamp(referenceOrigin.y + reference._height, 0, Screen.height) - referenceOrigin.y;
_y = ((visibleHeight - targetHeight) / 2) - _parent._y + reference._y;
}
}
13 changes: 11 additions & 2 deletions src/Common/skyui/components/MappedButton.as
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,22 @@ class skyui.components.MappedButton extends Button
public function update(): Void
{
var xOffset = 0;
var targetHeight = textField._height;

for (var i=0; i<buttonArt.length; i++) {
var icon: MovieClip = buttonArt[i];

if (_controlInfos[i].keyCode > 0) {
icon._visible = true;
icon.gotoAndStop(_controlInfos[i].keyCode);

// Scale up the icon up to the target height
icon._scaleX = 1.0;
icon._scaleY = 1.0;
var scaleMult = targetHeight / icon._height;
icon._scaleY = scaleMult;
icon._scaleX = scaleMult;

icon._x = xOffset
icon._y = (_height - icon._height) / 2;
xOffset += icon._width - 2;
Expand All @@ -171,8 +180,8 @@ class skyui.components.MappedButton extends Button
}
}

textField._x = xOffset + 1;
xOffset += textField._width + 6;
textField._x = xOffset + 3;
xOffset += textField._width + 8;

background._width = xOffset;
}
Expand Down
3 changes: 0 additions & 3 deletions src/Common/skyui/components/list/ScrollingList.as
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ class skyui.components.list.ScrollingList extends BasicList

listEnumeration.invalidate();

if (_selectedIndex >= listEnumeration.size())
_selectedIndex = listEnumeration.size() - 1;

if (listEnumeration.lookupEnumIndex(_selectedIndex) == null)
_selectedIndex = -1;

Expand Down
20 changes: 20 additions & 0 deletions src/Common/skyui/components/list/TabularListEntry.as
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ class skyui.components.list.TabularListEntry extends BasicListEntry
setSpecificEntryLayout(a_entryObject, a_state);
}

// The entire entry should be using the same font & size
// We want to fetch the lineMetrics just once (not sure how expensive this call is)
var textMetrics = undefined;

// Format the actual entry contents. Do this with every upate.
for (var i = 0; i < layout.columnCount; i++) {
var columnLayoutData: ColumnLayoutData = layout.columnLayoutData[i];
var e = this[columnLayoutData.stageName];
if (textMetrics == undefined)
textMetrics = e.getLineMetrics(0);

// Substitute @variables by entryObject properties
var entryValue: String = columnLayoutData.entryValue;
Expand Down Expand Up @@ -80,6 +86,20 @@ class skyui.components.list.TabularListEntry extends BasicListEntry
if (color != undefined)
e.textColor = color;
}

// Center the text vertically, using the selectIndicator as a reference
//
// For some reason, text alignment is more difficult than it should be.
// The idea here is to align the top of the select indicator and the TextField.
// Then, we vertically center the TextField using the `ascent` height only.
//
// There is a small wrinkle here. For some reason, even if selectIndicator._y
// and TextField._y is set to 0, they are not perfectly vertically aligned.
// There is a small vertical gap which throws off this centering calculation.
// By experiementation, it looks like subtracting the `descent` hight gets the
// text to mostly align with the top of the indicator selector. It's still off
// by a few pixels, but at least it's much better than not accounting for it.
e._y = selectIndicator._y - textMetrics.descent + ((selectIndicator._height - textMetrics.ascent)/2);
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/Common/skyui/defines/ButtonArtNames.as
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,12 @@ class skyui.defines.ButtonArtNames
"PS3_LTRT", "PS3_LS", "PS3_LBRB", "PS3_LB", "PS3_L3",
"PS3_CON_RIGHT", "PS3_CON_LEFT", "PS3_B_RIGHT", "PS3_B_LEFT", "PS3_B",

// 450 - 455
// 450 - 459
"PS3_AB_RIGHT", "PS3_AB_LEFT", "PS3_AB", "PS3_A_RIGHT", "PS3_A_LEFT",
"PS3_A", "radial_Either_Right", "radial_Either_Left"
"PS3_A", "radial_Either_Right", "radial_Either_Left", "Action_Up", "Action_Double_Up",

// 460 - 469
"Action_Left"
]);
return aNameMap;
}
Expand Down
5 changes: 5 additions & 0 deletions src/Common/skyui/defines/Screen.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class skyui.defines.Screen
{
static public var width = 1280;
static public var height = 720;
}
19 changes: 16 additions & 3 deletions src/Common/skyui/util/Debug.as
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class skyui.util.Debug
/* PRIVATE VARIABLES */
private static var _buffer: Array = [];

private static var indent = 0;

/* PUBLIC STATIC FUNCTIONS */
public static function log(/* a_text: String , a_text2: String ... */): Void
{
Expand All @@ -23,12 +25,21 @@ class skyui.util.Debug
// Flush buffer
if (_global.skse && _buffer.length > 0) {
for(var i = 0; i < _buffer.length; i++)
skse.Log(_buffer[i]);
skse.Log(_buffer[i]);
_buffer.splice(0);
}

if(arguments[0].slice(0, 3) == "<< ")
indent -= 1;

for(var i = 0; i < arguments.length; i++) {
var str = dateTime + " " + arguments[i];
var str = dateTime + " ";

for(var j = 0; j < indent; j++) {
str += " ";
}

str += arguments[i];

if (_global.skse)
skse.Log(str);
Expand All @@ -37,14 +48,16 @@ class skyui.util.Debug
else
_buffer.push(str);
}
if(arguments[0].slice(0, 3) == ">> ")
indent += 1;
}

public static function logNT(/* a_text: String , a_text2: String ... */): Void
{
// Flush buffer
if (_global.skse && _buffer.length > 0) {
for(var i = 0; i < _buffer.length; i++)
skse.Log(_buffer[i]);
skse.Log(_buffer[i]);
_buffer.splice(0);
}

Expand Down
Loading

0 comments on commit 52613a8

Please sign in to comment.