-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuRight2.as
More file actions
118 lines (106 loc) · 3.09 KB
/
MenuRight2.as
File metadata and controls
118 lines (106 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
class MenuRight2 extends MovieClip
{
/* STAGE ELEMENTS */
public var furnitureType: MovieClip;
public var stepSize: MovieClip;
public var stageOnly: MovieClip;
public var resetOffsets: MovieClip;
public var xOffset: MovieClip;
public var yOffset: MovieClip;
public var zOffset: MovieClip;
public var rOffset: MovieClip;
/* PRIVATE VARIABLES */
private var selectables: Array;
private var activeSelectionIndex: Number = 0;
/* INITIALIZATION */
public function MenuRight2()
{
super();
selectables = [
stepSize,
stageOnly,
resetOffsets,
xOffset,
zOffset,
yOffset,
rOffset
];
}
public function setDefault()
{
stepSize.setSelected(true);
activeSelectionIndex = 0;
}
public function resetSelection()
{
selectables[activeSelectionIndex].setSelected(false);
activeSelectionIndex = -1;
}
public function updateFields()
{
furnitureType.init({ name: "$SSL_ActiveFurniture{" + SexLabAPI.GetActiveFurnitureName() + "}" });
stepSize.init({ name: "$SSL_StepSize" });
stepSize.updateFloatValue(SexLabAPI.GetOffsetStepSize());
stageOnly.init({ name: "$SSL_StageOnly", extra: SexLabAPI.GetAdjustStageOnly().toString() });
resetOffsets.init({ name: "$SSL_ResetOffsets" });
xOffset.init({ name: "X" });
yOffset.init({ name: "Y" });
zOffset.init({ name: "Z" });
rOffset.init({ name: "R" });
}
public function handleInputEx(keyStr: String, modes: Boolean, reset: Boolean): Boolean
{
var selection = selectables[activeSelectionIndex];
if (selection.hasFocus != undefined && selection.hasFocus()) {
if (keyStr == KeyType.END)
selection.endInput();
return selection.handleInput(keyStr, modes, reset);
}
switch (keyStr) {
case KeyType.PAGE_UP:
selection.setSelected(false);
activeSelectionIndex = 0;
selectables[activeSelectionIndex].setSelected(true);
return true;
case KeyType.PAGE_DOWN:
selection.setSelected(false);
activeSelectionIndex = selectables.length - 1;
selectables[activeSelectionIndex].setSelected(true);
return true;
case KeyType.UP:
if (selection.endInput != undefined && modes) {
selection.adjustOffset(true);
return true;
}
selection.setSelected(false);
activeSelectionIndex = (activeSelectionIndex - 1 + selectables.length) % selectables.length;
selectables[activeSelectionIndex].setSelected(true);
return true;
case KeyType.DOWN:
if (selection.endInput != undefined && modes) {
selection.adjustOffset(false);
return true;
}
selection.setSelected(false);
activeSelectionIndex = (activeSelectionIndex + 1) % selectables.length;
selectables[activeSelectionIndex].setSelected(true);
return true;
case KeyType.SELECT:
if (selection == stepSize) {
stepSize.updateFloatValue(SexLabAPI.AdjustOffsetStepSize(!reset));
} else if (selection == stageOnly) {
SexLabAPI.SetAdjustStageOnly(!SexLabAPI.GetAdjustStageOnly());
updateFields();
} else if (selection == resetOffsets) {
SexLabAPI.ResetOffsets();
updateFields();
} else if (selection.setFocus != undefined) {
selection.setFocus();
}
return true;
default:
return false;
}
}
}