diff --git a/src/ItemMenus/MagicMenu.as b/src/ItemMenus/MagicMenu.as index 5a8dc08c..73907cf2 100644 --- a/src/ItemMenus/MagicMenu.as +++ b/src/ItemMenus/MagicMenu.as @@ -10,64 +10,85 @@ import skyui.props.PropertyDataExtender; import skyui.defines.Input; import skyui.defines.Inventory; +import skyui.util.Debug; class MagicMenu extends ItemMenu { #include "../version.as" - + /* PRIVATE VARIABLES */ - + private var _hideButtonFlag: Number = 0; private var _bMenuClosing: Boolean = false; private var _bSwitchMenus: Boolean = false; private var _categoryListIconArt: Array; - - + + /* PROPERTIES */ - + public var hideButtonFlag: Number; - + /* INITIALIZATION */ public function MagicMenu() { super(); - + _categoryListIconArt = ["cat_favorites", "mag_all", "mag_alteration", "mag_illusion", "mag_destruction", "mag_conjuration", "mag_restoration", "mag_shouts", "mag_powers", "mag_activeeffects"]; } - - + + function OnShow() { + _bMenuClosing = false; + //iLastItemType = InventoryDefines.ICT_NONE; + //bottomBar.iLastItemType = Inventory.ICT_NONE; + /* ResetItemCard({type:Inventory.ICT_SPELL_DEFAULT}); */ + /* itemCard.bFadedIn = false; */ + /* itemCard._visible = false; */ + //inventoryLists.showPanel(false); + if(!bFadedIn) { + this.ToggleMenuFade(); + } + /* bottomBar.GoToDefaultFrame(); */ + /* bottomBar.HideButtons(); */ + } + /* PUBLIC FUNCTIONS */ public function InitExtensions(): Void { super.InitExtensions(); - + GameDelegate.addCallBack("DragonSoulSpent", this, "DragonSoulSpent"); GameDelegate.addCallBack("AttemptEquip", this , "AttemptEquip"); - + bottomBar.updatePerItemInfo({type:Inventory.ICT_SPELL_DEFAULT}); - + // Initialize menu-specific list components var categoryList: CategoryList = inventoryLists.categoryList; categoryList.iconArt = _categoryListIconArt; + + // SkyrimVR moves some variables from the "Interface" section to the "VRUI" section. + // Originally, SkyUI patched these positions in papyrus scripts to line up with the new UI. + // It does seem to make sense for this kind of patching to be done from the UI itself though. + var itemPosXSettingName = "fMagic3DItemPosX:VRUI"; + skse.SetINISetting(itemPosXSettingName, skse.GetINISetting(itemPosXSettingName) - 37); } // @override ItemMenu public function setConfig(a_config: Object): Void { super.setConfig(a_config); - + var itemList: TabularList = inventoryLists.itemList; itemList.addDataProcessor(new MagicDataSetter(a_config["Appearance"])); itemList.addDataProcessor(new MagicIconSetter(a_config["Appearance"])); itemList.addDataProcessor(new PropertyDataExtender(a_config["Appearance"], a_config["Properties"], "magicProperties", "magicIcons", "magicCompoundProperties")); - + var layout: ListLayout = ListLayoutManager.createLayout(a_config["ListLayout"], "MagicListLayout"); itemList.layout = layout; @@ -81,12 +102,12 @@ class MagicMenu extends ItemMenu { if (!bFadedIn) return true; - + var nextClip = pathToFocus.shift(); - + if (nextClip.handleInput(details, pathToFocus)) return true; - + if (GlobalFunc.IsKeyPressed(details)) { if (details.navEquivalent == NavigationCode.TAB || details.navEquivalent == NavigationCode.SHIFT_TAB ) { startMenuFade(); @@ -106,17 +127,17 @@ class MagicMenu extends ItemMenu itemCard.itemInfo.soulSpent = true; updateBottomBar(); } - + // @API public function AttemptEquip(a_slot: Number): Void { if (shouldProcessItemsListInput(true) && confirmSelectedEntry()) GameDelegate.call("ItemSelect",[a_slot]); } - - + + /* PRIVATE FUNCTIONS */ - + // @override ItemMenu private function onItemSelect(event: Object): Void { @@ -128,7 +149,7 @@ class MagicMenu extends ItemMenu GameDelegate.call("ShowShoutFail",[]); } } - + // @override ItemMenu private function onExitMenuRectClick(): Void { @@ -152,7 +173,7 @@ class MagicMenu extends ItemMenu private function onShowItemsList(event: Object): Void { super.onShowItemsList(event); - + if (event.index != -1) updateBottomBar(true); } @@ -161,7 +182,7 @@ class MagicMenu extends ItemMenu private function onItemHighlightChange(event: Object) { super.onItemHighlightChange(event); - + if (event.index != -1) updateBottomBar(true); } @@ -170,12 +191,12 @@ class MagicMenu extends ItemMenu private function onHideItemsList(event: Object): Void { super.onHideItemsList(event); - + bottomBar.updatePerItemInfo({type:Inventory.ICT_SPELL_DEFAULT}); - + updateBottomBar(false); } - + private function openInventoryMenu(a_bFade: Boolean): Void { if (a_bFade) { @@ -188,23 +209,32 @@ class MagicMenu extends ItemMenu skse.OpenMenu("InventoryMenu"); } } - + // @override ItemMenu private function updateBottomBar(a_bSelected: Boolean): Void { navPanel.clearButtons(); - + + var activateControls = skyui.util.Input.pickControls(_platform, + {PCArt:"E",XBoxArt:"360_A",PS3Art:"PS3_A",ViveArt:"trigger",MoveArt:"PS3_MOVE",OculusArt:"trigger",WindowsMRArt:"trigger"}); + var exitControls = skyui.util.Input.pickControls(_platform, + {PCArt:"Tab",XBoxArt:"360_B",PS3Art:"PS3_B",ViveArt:"grip",MoveArt:"PS3_B",OculusArt:"grab",WindowsMRArt:"grab"}); + var favoriteControls = skyui.util.Input.pickControls(_platform, + {PCArt:"F",XBoxArt:"360_Y",PS3Art:"PS3_Y",ViveArt:"radial_Either_Right",MoveArt:"PS3_Y",OculusArt:"OCC_B",WindowsMRArt:"radial_Either_Right"}); + var unlockControls = skyui.util.Input.pickControls(_platform, + {PCArt:"R",XBoxArt:"360_X",PS3Art:"PS3_X",ViveArt:"radial_Either_Left",MoveArt:"PS3_X",OculusArt:"OCC_Y",WindowsMRArt:"radial_Either_Left"}); + if (a_bSelected && (inventoryLists.itemList.selectedEntry.filterFlag & Inventory.FILTERFLAG_MAGIC_ACTIVEEFFECTS) == 0) { - navPanel.addButton({text: "$Equip", controls: Input.Equip}); - + navPanel.addButton({text: "$Equip", controls: activateControls}); + if (inventoryLists.itemList.selectedEntry.filterFlag & inventoryLists.categoryList.entryList[0].flag != 0) - navPanel.addButton({text: "$Unfavorite", controls: Input.YButton}); + navPanel.addButton({text: "$Unfavorite", controls: favoriteControls}); else - navPanel.addButton({text: "$Favorite", controls: Input.YButton}); - + navPanel.addButton({text: "$Favorite", controls: favoriteControls}); + if (itemCard.itemInfo.showUnlocked) - navPanel.addButton({text: "$Unlock", controls: Input.XButton}); - + navPanel.addButton({text: "$Unlock", controls: unlockControls}); + } else { navPanel.addButton({text: "$Exit", controls: _cancelControls}); navPanel.addButton({text: "$Search", controls: _searchControls}); @@ -214,15 +244,15 @@ class MagicMenu extends ItemMenu } navPanel.addButton({text: "$Inventory", controls: _switchControls}); } - + navPanel.updateButtons(true); } - + private function startMenuFade(): Void { - inventoryLists.hidePanel(); + //inventoryLists.hidePanel(); ToggleMenuFade(); saveIndices(); _bMenuClosing = true; } -} \ No newline at end of file +} diff --git a/src/ItemMenus/magicmenu.fla b/src/ItemMenus/magicmenu.fla index c998bb3f..253201cc 100644 Binary files a/src/ItemMenus/magicmenu.fla and b/src/ItemMenus/magicmenu.fla differ