Proper SkyUI 5.2 scripts source code, forwarded from SkyUI VR

This commit is contained in:
Eddoursul 2021-11-30 00:43:45 +01:00
parent 9d417d5915
commit 6c2a191ff7
10 changed files with 167 additions and 45 deletions

Binary file not shown.

Binary file not shown.

BIN
scripts/ski_configmenu.pex Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -10,6 +10,7 @@ int property STATE_RESET = 1 autoReadonly
int property STATE_SLIDER = 2 autoReadonly int property STATE_SLIDER = 2 autoReadonly
int property STATE_MENU = 3 autoReadonly int property STATE_MENU = 3 autoReadonly
int property STATE_COLOR = 4 autoReadonly int property STATE_COLOR = 4 autoReadonly
int property STATE_INPUT = 5 autoReadonly
int property OPTION_TYPE_EMPTY = 0x00 autoReadonly int property OPTION_TYPE_EMPTY = 0x00 autoReadonly
int property OPTION_TYPE_HEADER = 0x01 autoReadonly int property OPTION_TYPE_HEADER = 0x01 autoReadonly
@ -19,6 +20,7 @@ int property OPTION_TYPE_SLIDER = 0x04 autoReadonly
int property OPTION_TYPE_MENU = 0x05 autoReadonly int property OPTION_TYPE_MENU = 0x05 autoReadonly
int property OPTION_TYPE_COLOR = 0x06 autoReadonly int property OPTION_TYPE_COLOR = 0x06 autoReadonly
int property OPTION_TYPE_KEYMAP = 0x07 autoReadonly int property OPTION_TYPE_KEYMAP = 0x07 autoReadonly
int property OPTION_TYPE_INPUT = 0x08 autoReadonly
int property OPTION_FLAG_NONE = 0x00 autoReadonly int property OPTION_FLAG_NONE = 0x00 autoReadonly
int property OPTION_FLAG_DISABLED = 0x01 autoReadonly int property OPTION_FLAG_DISABLED = 0x01 autoReadonly
@ -56,6 +58,7 @@ int[] _colorParams
int _activeOption = -1 int _activeOption = -1
string _infoText string _infoText
string _inputStartText
bool _messageResult = false bool _messageResult = false
bool _waitForMessage = false bool _waitForMessage = false
@ -1114,3 +1117,89 @@ function RemapKey(int a_index, int a_keyCode, string a_conflictControl, string a
OnOptionKeyMapChange(option, a_keyCode, a_conflictControl, a_conflictName) OnOptionKeyMapChange(option, a_keyCode, a_conflictControl, a_conflictName)
endIf endIf
endFunction endFunction
function OnOptionInputOpen(Int a_option)
{Called when a text input option has been selected}
endFunction
function OnInputOpenST()
{Called when a text input state option has been selected}
endFunction
function OnOptionInputAccept(Int a_option, String a_input)
{Called when a new text input has been accepted}
endFunction
function OnInputAcceptST(String a_input)
{Called when a new text input has been accepted for this state option}
endFunction
function SetInputOptionValue(Int a_option, String a_value, Bool a_noUpdate)
Int index = a_option % 256
Int type = _optionFlagsBuf[index] % 256
if type != self.OPTION_TYPE_INPUT
Int pageIdx = a_option / 256 - 1
if pageIdx != -1
self.Error("Option type mismatch. Expected input option, page \"" + Pages[pageIdx] + "\", index " + index as String)
else
self.Error("Option type mismatch. Expected input option, page \"\", index " + index as String)
endIf
return
endIf
self.SetOptionStrValue(index, a_value, a_noUpdate)
endFunction
function SetInputOptionValueST(String a_value, Bool a_noUpdate, String a_stateName)
Int index = self.GetStateOptionIndex(a_stateName)
if index < 0
self.Error("Cannot use SetInputOptionValueST outside a valid option state")
return
endIf
self.SetInputOptionValue(index, a_value, a_noUpdate)
endFunction
function RequestInputDialogData(Int a_index)
_activeOption = a_index + _currentPageNum * 256
_inputStartText = ""
_state = self.STATE_INPUT
String optionState = _stateOptionMap[a_index]
if optionState != ""
String oldState = self.GetState()
self.GotoState(optionState)
self.OnInputOpenST()
self.GotoState(oldState)
else
self.OnOptionInputOpen(_activeOption)
endIf
_state = self.STATE_DEFAULT
ui.InvokeString(self.JOURNAL_MENU, self.MENU_ROOT + ".setInputDialogParams", _inputStartText)
endFunction
Int function AddInputOption(String a_text, String a_value, Int a_flags)
return self.AddOption(self.OPTION_TYPE_INPUT, a_text, a_value, 0 as Float, a_flags)
endFunction
function AddInputOptionST(String a_stateName, String a_text, String a_value, Int a_flags)
self.AddOptionST(a_stateName, self.OPTION_TYPE_INPUT, a_text, a_value, 0 as Float, a_flags)
endFunction
function SetInputDialogStartText(String a_text)
if _state != self.STATE_INPUT
self.Error("Cannot set input dialog params while outside OnOptionInputOpen()")
return
endIf
_inputStartText = a_text
endFunction
function SetInputText(String a_text)
String optionState = _stateOptionMap[_activeOption % 256]
if optionState != ""
String oldState = self.GetState()
self.GotoState(optionState)
self.OnInputAcceptST(a_text)
self.GotoState(oldState)
else
self.OnOptionInputAccept(_activeOption, a_text)
endIf
_activeOption = -1
endFunction

View File

@ -70,6 +70,8 @@ event OnGameReload()
RegisterForModEvent("SKICP_menuAccepted", "OnMenuAccept") RegisterForModEvent("SKICP_menuAccepted", "OnMenuAccept")
RegisterForModEvent("SKICP_colorSelected", "OnColorSelect") RegisterForModEvent("SKICP_colorSelected", "OnColorSelect")
RegisterForModEvent("SKICP_colorAccepted", "OnColorAccept") RegisterForModEvent("SKICP_colorAccepted", "OnColorAccept")
self.RegisterForModEvent("SKICP_inputSelected", "OnInputSelect")
self.RegisterForModEvent("SKICP_inputAccepted", "OnInputAccept")
RegisterForModEvent("SKICP_dialogCanceled", "OnDialogCancel") RegisterForModEvent("SKICP_dialogCanceled", "OnDialogCancel")
RegisterForMenu(JOURNAL_MENU) RegisterForMenu(JOURNAL_MENU)
@ -357,6 +359,15 @@ function Log(string a_msg)
Debug.Trace(self + ": " + a_msg) Debug.Trace(self + ": " + a_msg)
endFunction endFunction
function OnInputSelect(String a_eventName, String a_strArg, Float a_numArg, Form a_sender)
Int optionIndex = a_numArg as Int
_activeConfig.RequestInputDialogData(optionIndex)
endFunction
function OnInputAccept(String a_eventName, String a_strArg, Float a_numArg, Form a_sender)
_activeConfig.SetInputText(a_strArg)
ui.InvokeBool(self.JOURNAL_MENU, self.MENU_ROOT + ".unlock", true)
endFunction
; STATES --------------------------------------------------------------------------------------- ; STATES ---------------------------------------------------------------------------------------

View File

@ -25,7 +25,7 @@ scriptname SKI_ConfigMenu extends SKI_ConfigBase
; 8: - Removed unsupported icon themes ; 8: - Removed unsupported icon themes
int function GetVersion() int function GetVersion()
return 8 return 9
endFunction endFunction
@ -329,7 +329,24 @@ event OnVersionUpdate(int a_version)
SKI_SettingsManagerInstance.SetOverride("Appearance$icons$category$source", _categoryIconThemeValues[_categoryIconThemeIdx]) SKI_SettingsManagerInstance.SetOverride("Appearance$icons$category$source", _categoryIconThemeValues[_categoryIconThemeIdx])
endIf endIf
if a_version >= 9 && CurrentVersion < 9
debug.Trace(self as String + ": Updating to script version 9")
_categoryIconThemeShortNames = new String[4]
_categoryIconThemeShortNames[0] = "SKYUI V5"
_categoryIconThemeShortNames[1] = "CELTIC"
_categoryIconThemeShortNames[2] = "CURVED"
_categoryIconThemeShortNames[3] = "STRAIGHT"
_categoryIconThemeLongNames = new String[4]
_categoryIconThemeLongNames[0] = "SkyUI V5, by PsychoSteve"
_categoryIconThemeLongNames[1] = "Celtic, by GreatClone"
_categoryIconThemeLongNames[2] = "Curved, by T3T"
_categoryIconThemeLongNames[3] = "Straight, by T3T"
_categoryIconThemeValues = new String[4]
_categoryIconThemeValues[0] = "skyui\\icons_category_psychosteve.swf"
_categoryIconThemeValues[1] = "skyui\\icons_category_celtic.swf"
_categoryIconThemeValues[2] = "skyui\\icons_category_curved.swf"
_categoryIconThemeValues[3] = "skyui\\icons_category_straight.swf"
endIf
endEvent endEvent
@ -353,7 +370,7 @@ event OnPageReset(string a_page)
AddHeaderOption("$Item List") AddHeaderOption("$Item List")
AddTextOptionST("ITEMLIST_FONT_SIZE", "$Font Size", _sizes[_itemlistFontSizeIdx]) AddTextOptionST("ITEMLIST_FONT_SIZE", "$Font Size", _sizes[_itemlistFontSizeIdx])
AddSliderOptionST("ITEMLIST_QUANTITY_MIN_COUNT", "$Quantity Menu Min. Count", _itemlistQuantityMinCount) AddSliderOptionST("ITEMLIST_QUANTITY_MIN_COUNT", "$Quantity Menu Min. Count", _itemlistQuantityMinCount)
;AddMenuOptionST("ITEMLIST_CATEGORY_ICON_THEME", "$Category Icon Theme", _categoryIconThemeShortNames[_categoryIconThemeIdx]) AddMenuOptionST("ITEMLIST_CATEGORY_ICON_THEME", "$Category Icon Theme", _categoryIconThemeShortNames[_categoryIconThemeIdx])
AddToggleOptionST("ITEMLIST_NO_ICON_COLORS", "$Disable Icon Colors", _itemlistNoIconColors) AddToggleOptionST("ITEMLIST_NO_ICON_COLORS", "$Disable Icon Colors", _itemlistNoIconColors)
AddEmptyOption() AddEmptyOption()

View File

@ -964,6 +964,11 @@ bool function ProcessItem(Form a_item, int a_itemType, bool a_allowDeferring = t
endIf endIf
return true return true
; MISC ------------
elseIf a_itemType == 32
PlayerREF.EquipItem(a_item, abSilent = True)
return true
endIf endIf
return true return true

View File

@ -36,11 +36,11 @@ bool _craftingMenuCheckEnabled = true
; PROPERTIES -------------------------------------------------------------------------------------- ; PROPERTIES --------------------------------------------------------------------------------------
int property MinSKSERelease = 44 autoReadonly int property MinSKSERelease = 53 autoReadonly
string property MinSKSEVersion = "1.6.16" autoReadonly string property MinSKSEVersion = "2.0.10" autoReadonly
int property ReqSWFRelease = 17 autoReadonly int property ReqSWFRelease = 2018 autoReadonly
string property ReqSWFVersion = "5.0" autoReadonly string property ReqSWFVersion = "5.2 SE" autoReadonly
bool property ErrorDetected = false auto bool property ErrorDetected = false auto