This repository has been archived by the owner on Nov 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
RubyButtonAPI.cs
573 lines (485 loc) · 24.2 KB
/
RubyButtonAPI.cs
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
using System;
using Il2CppSystem.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnhollowerRuntimeLib;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using VRC.UI;
namespace RubyButtonAPI
{
//Credits:
//Emilia - Porting it to MelonLoader and helping to keep the git updated
//Tritn - Helping to keep the git updated
//This adds a couple of new functions compared to the old one, however,
//like the last one, I will not be providing any support as I will
//personally not be using melonloader/unhollower in the near future.
//Look here for a useful example guide:
//https://github.com/DubyaDude/RubyButtonAPI/blob/master/RubyButtonAPI_Old.cs
public static class QMButtonAPI
{
//REPLACE THIS STRING SO YOUR MENU DOESNT COLLIDE WITH OTHER MENUS
public static string identifier = "REPLACEME";
public static Color mBackground = Color.red;
public static Color mForeground = Color.white;
public static Color bBackground = Color.red;
public static Color bForeground = Color.yellow;
public static List<QMSingleButton> allSingleButtons = new List<QMSingleButton>();
public static List<QMToggleButton> allToggleButtons = new List<QMToggleButton>();
public static List<QMNestedButton> allNestedButtons = new List<QMNestedButton>();
}
public class QMButtonBase
{
protected GameObject button;
protected string btnQMLoc;
protected string btnType;
protected string btnTag;
protected int[] initShift = { 0, 0 };
protected Color OrigBackground;
protected Color OrigText;
public GameObject getGameObject()
{
return button;
}
public void setActive(bool isActive)
{
button.gameObject.SetActive(isActive);
}
public void setIntractable(bool isIntractable)
{
if (isIntractable)
{
setBackgroundColor(OrigBackground, false);
setTextColor(OrigText, false);
}
else
{
setBackgroundColor(new Color(0.5f, 0.5f, 0.5f, 1), false);
setTextColor(new Color(0.7f, 0.7f, 0.7f, 1), false); ;
}
button.gameObject.GetComponent<Button>().interactable = isIntractable;
}
public void setLocation(int buttonXLoc, int buttonYLoc)
{
button.GetComponent<RectTransform>().anchoredPosition += Vector2.right * (420 * (buttonXLoc + initShift[0]));
button.GetComponent<RectTransform>().anchoredPosition += Vector2.down * (420 * (buttonYLoc + initShift[1]));
btnTag = "(" + buttonXLoc + "," + buttonYLoc + ")";
button.name = btnQMLoc + "/" + btnType + btnTag;
button.GetComponent<Button>().name = btnType + btnTag;
}
public void setToolTip(string buttonToolTip)
{
button.GetComponent<UiTooltip>().field_Public_String_0 = buttonToolTip;
button.GetComponent<UiTooltip>().field_Public_String_1 = buttonToolTip;
}
public void DestroyMe()
{
try
{
UnityEngine.Object.Destroy(button);
}
catch { }
}
public virtual void setBackgroundColor(Color buttonBackgroundColor, bool save = true) { }
public virtual void setTextColor(Color buttonTextColor, bool save = true) { }
}
public class QMSingleButton : QMButtonBase
{
public QMSingleButton(QMNestedButton btnMenu, int btnXLocation, int btnYLocation, String btnText, System.Action btnAction, String btnToolTip, Color? btnBackgroundColor = null, Color? btnTextColor = null)
{
btnQMLoc = btnMenu.getMenuName();
initButton(btnXLocation, btnYLocation, btnText, btnAction, btnToolTip, btnBackgroundColor, btnTextColor);
}
public QMSingleButton(string btnMenu, int btnXLocation, int btnYLocation, String btnText, System.Action btnAction, String btnToolTip, Color? btnBackgroundColor = null, Color? btnTextColor = null)
{
btnQMLoc = btnMenu;
initButton(btnXLocation, btnYLocation, btnText, btnAction, btnToolTip, btnBackgroundColor, btnTextColor);
}
private void initButton(int btnXLocation, int btnYLocation, String btnText, System.Action btnAction, String btnToolTip, Color? btnBackgroundColor = null, Color? btnTextColor = null)
{
btnType = "SingleButton";
button = UnityEngine.Object.Instantiate(QMStuff.SingleButtonTemplate(), QMStuff.GetQuickMenuInstance().transform.Find(btnQMLoc), true);
initShift[0] = -1;
initShift[1] = 0;
setLocation(btnXLocation, btnYLocation);
setButtonText(btnText);
setToolTip(btnToolTip);
setAction(btnAction);
if (btnBackgroundColor != null)
setBackgroundColor((Color)btnBackgroundColor);
else
OrigBackground = button.GetComponentInChildren<UnityEngine.UI.Image>().color;
if (btnTextColor != null)
setTextColor((Color)btnTextColor);
else
OrigText = button.GetComponentInChildren<Text>().color;
setActive(true);
QMButtonAPI.allSingleButtons.Add(this);
}
public void setButtonText(string buttonText)
{
button.GetComponentInChildren<Text>().text = buttonText;
}
public void setAction(System.Action buttonAction)
{
button.GetComponent<Button>().onClick = new Button.ButtonClickedEvent();
if (buttonAction != null)
button.GetComponent<Button>().onClick.AddListener(UnhollowerRuntimeLib.DelegateSupport.ConvertDelegate<UnityAction>(buttonAction));
}
public override void setBackgroundColor(Color buttonBackgroundColor, bool save = true)
{
//button.GetComponentInChildren<UnityEngine.UI.Image>().color = buttonBackgroundColor;
if (save)
OrigBackground = (Color)buttonBackgroundColor;
//UnityEngine.UI.Image[] btnBgColorList = ((btnOn.GetComponentsInChildren<UnityEngine.UI.Image>()).Concat(btnOff.GetComponentsInChildren<UnityEngine.UI.Image>()).ToArray()).Concat(button.GetComponentsInChildren<UnityEngine.UI.Image>()).ToArray();
//foreach (UnityEngine.UI.Image btnBackground in btnBgColorList) btnBackground.color = buttonBackgroundColor;
button.GetComponentInChildren<UnityEngine.UI.Button>().colors = new ColorBlock()
{
colorMultiplier = 1f,
disabledColor = Color.grey,
highlightedColor = buttonBackgroundColor * 1.5f,
normalColor = buttonBackgroundColor / 1.5f,
pressedColor = Color.grey * 1.5f
};
}
public override void setTextColor(Color buttonTextColor, bool save = true)
{
button.GetComponentInChildren<Text>().color = buttonTextColor;
if (save)
OrigText = (Color)buttonTextColor;
}
}
public class QMToggleButton : QMButtonBase
{
public GameObject btnOn;
public GameObject btnOff;
public List<QMButtonBase> showWhenOn = new List<QMButtonBase>();
public List<QMButtonBase> hideWhenOn = new List<QMButtonBase>();
public bool shouldSaveInConfig = false;
System.Action btnOnAction = null;
System.Action btnOffAction = null;
public QMToggleButton(QMNestedButton btnMenu, int btnXLocation, int btnYLocation, String btnTextOn, System.Action btnActionOn, String btnTextOff, System.Action btnActionOff, String btnToolTip, Color? btnBackgroundColor = null, Color? btnTextColor = null, bool shouldSaveInConfig = false, bool defaultPosition = false)
{
btnQMLoc = btnMenu.getMenuName();
initButton(btnXLocation, btnYLocation, btnTextOn, btnActionOn, btnTextOff, btnActionOff, btnToolTip, btnBackgroundColor, btnTextColor, shouldSaveInConfig, defaultPosition);
}
public QMToggleButton(string btnMenu, int btnXLocation, int btnYLocation, String btnTextOn, System.Action btnActionOn, String btnTextOff, System.Action btnActionOff, String btnToolTip, Color? btnBackgroundColor = null, Color? btnTextColor = null, bool shouldSaveInConfig = false, bool defaultPosition = false)
{
btnQMLoc = btnMenu;
initButton(btnXLocation, btnYLocation, btnTextOn, btnActionOn, btnTextOff, btnActionOff, btnToolTip, btnBackgroundColor, btnTextColor, shouldSaveInConfig, defaultPosition);
}
private void initButton(int btnXLocation, int btnYLocation, String btnTextOn, System.Action btnActionOn, String btnTextOff, System.Action btnActionOff, String btnToolTip, Color? btnBackgroundColor = null, Color? btnTextColor = null, bool shouldSaveInConf = false, bool defaultPosition = false)
{
btnType = "ToggleButton";
button = UnityEngine.Object.Instantiate<GameObject>(QMStuff.ToggleButtonTemplate(), QMStuff.GetQuickMenuInstance().transform.Find(btnQMLoc), true);
btnOn = button.transform.Find("Toggle_States_Visible/ON").gameObject;
btnOff = button.transform.Find("Toggle_States_Visible/OFF").gameObject;
initShift[0] = -3;
initShift[1] = -1;
setLocation(btnXLocation, btnYLocation);
setOnText(btnTextOn);
setOffText(btnTextOff);
Text[] btnTextsOn = btnOn.GetComponentsInChildren<Text>();
btnTextsOn[0].name = "Text_ON";
btnTextsOn[0].resizeTextForBestFit = true;
btnTextsOn[1].name = "Text_OFF";
btnTextsOn[1].resizeTextForBestFit = true;
Text[] btnTextsOff = btnOff.GetComponentsInChildren<Text>();
btnTextsOff[0].name = "Text_ON";
btnTextsOff[0].resizeTextForBestFit = true;
btnTextsOff[1].name = "Text_OFF";
btnTextsOff[1].resizeTextForBestFit = true;
setToolTip(btnToolTip);
//button.transform.GetComponentInChildren<UiTooltip>().SetToolTipBasedOnToggle();
setAction(btnActionOn, btnActionOff);
btnOn.SetActive(false);
btnOff.SetActive(true);
if (btnBackgroundColor != null)
setBackgroundColor((Color)btnBackgroundColor);
else
OrigBackground = btnOn.GetComponentsInChildren<Text>().First().color;
if (btnTextColor != null)
setTextColor((Color)btnTextColor);
else
OrigText = btnOn.GetComponentsInChildren<UnityEngine.UI.Image>().First().color;
setActive(true);
shouldSaveInConfig = shouldSaveInConf;
if (defaultPosition == true)// && !ButtonSettings.Contains(this))
{
setToggleState(true, false);
}
QMButtonAPI.allToggleButtons.Add(this);
//ButtonSettings.InitToggle(this);
}
public override void setBackgroundColor(Color buttonBackgroundColor, bool save = true)
{
UnityEngine.UI.Image[] btnBgColorList = ((btnOn.GetComponentsInChildren<UnityEngine.UI.Image>()).Concat(btnOff.GetComponentsInChildren<UnityEngine.UI.Image>()).ToArray()).Concat(button.GetComponentsInChildren<UnityEngine.UI.Image>()).ToArray();
foreach (UnityEngine.UI.Image btnBackground in btnBgColorList) btnBackground.color = buttonBackgroundColor;
if (save)
OrigBackground = (Color)buttonBackgroundColor;
}
public override void setTextColor(Color buttonTextColor, bool save = true)
{
Text[] btnTxtColorList = (btnOn.GetComponentsInChildren<Text>()).Concat(btnOff.GetComponentsInChildren<Text>()).ToArray();
foreach (Text btnText in btnTxtColorList) btnText.color = buttonTextColor;
if (save)
OrigText = (Color)buttonTextColor;
}
public void setAction(System.Action buttonOnAction, System.Action buttonOffAction)
{
btnOnAction = buttonOnAction;
btnOffAction = buttonOffAction;
button.GetComponent<Button>().onClick = new Button.ButtonClickedEvent();
button.GetComponent<Button>().onClick.AddListener(UnhollowerRuntimeLib.DelegateSupport.ConvertDelegate<UnityAction>((System.Action)(() =>
{
if (btnOn.activeSelf)
{
setToggleState(false, true);
}
else
{
setToggleState(true, true);
}
})));
}
public void setToggleState(bool toggleOn, bool shouldInvoke = false)
{
btnOn.SetActive(toggleOn);
btnOff.SetActive(!toggleOn);
try
{
if (toggleOn && shouldInvoke)
{
btnOnAction.Invoke();
showWhenOn.ForEach(x => x.setActive(true));
hideWhenOn.ForEach(x => x.setActive(false));
}
else if (!toggleOn && shouldInvoke)
{
btnOffAction.Invoke();
showWhenOn.ForEach(x => x.setActive(false));
hideWhenOn.ForEach(x => x.setActive(true));
}
}
catch { }
if (shouldSaveInConfig)
{
//ButtonSettings.UpdateToggle(this);
}
}
public string getOnText()
{
return btnOn.GetComponentsInChildren<Text>()[0].text;
}
public void setOnText(string buttonOnText)
{
Text[] btnTextsOn = btnOn.GetComponentsInChildren<Text>();
btnTextsOn[0].text = buttonOnText;
Text[] btnTextsOff = btnOff.GetComponentsInChildren<Text>();
btnTextsOff[0].text = buttonOnText;
}
public void setOffText(string buttonOffText)
{
Text[] btnTextsOn = btnOn.GetComponentsInChildren<Text>();
btnTextsOn[1].text = buttonOffText;
Text[] btnTextsOff = btnOff.GetComponentsInChildren<Text>();
btnTextsOff[1].text = buttonOffText;
}
}
public class QMNestedButton
{
protected QMSingleButton mainButton;
protected QMSingleButton backButton;
protected string menuName;
protected string btnQMLoc;
protected string btnType;
public QMNestedButton(QMNestedButton btnMenu, int btnXLocation, int btnYLocation, String btnText, String btnToolTip, Color? btnBackgroundColor = null, Color? btnTextColor = null, Color? backbtnBackgroundColor = null, Color? backbtnTextColor = null)
{
btnQMLoc = btnMenu.getMenuName();
initButton(btnXLocation, btnYLocation, btnText, btnToolTip, btnBackgroundColor, btnTextColor, backbtnBackgroundColor, backbtnTextColor);
}
public QMNestedButton(string btnMenu, int btnXLocation, int btnYLocation, String btnText, String btnToolTip, Color? btnBackgroundColor = null, Color? btnTextColor = null, Color? backbtnBackgroundColor = null, Color? backbtnTextColor = null)
{
btnQMLoc = btnMenu;
initButton(btnXLocation, btnYLocation, btnText, btnToolTip, btnBackgroundColor, btnTextColor, backbtnBackgroundColor, backbtnTextColor);
}
public void initButton(int btnXLocation, int btnYLocation, String btnText, String btnToolTip, Color? btnBackgroundColor = null, Color? btnTextColor = null, Color? backbtnBackgroundColor = null, Color? backbtnTextColor = null)
{
btnType = "NestedButton";
Transform menu = UnityEngine.Object.Instantiate<Transform>(QMStuff.NestedMenuTemplate(), QMStuff.GetQuickMenuInstance().transform);
menuName = QMButtonAPI.identifier + btnQMLoc + "_" + btnXLocation + "_" + btnYLocation;
menu.name = menuName;
mainButton = new QMSingleButton(btnQMLoc, btnXLocation, btnYLocation, btnText, () => { QMStuff.ShowQuickmenuPage(menuName); }, btnToolTip, btnBackgroundColor, btnTextColor);
Il2CppSystem.Collections.IEnumerator enumerator = menu.transform.GetEnumerator();
while (enumerator.MoveNext())
{
Il2CppSystem.Object obj = enumerator.Current;
Transform btnEnum = obj.Cast<Transform>();
if (btnEnum != null)
{
UnityEngine.Object.Destroy(btnEnum.gameObject);
}
}
if (backbtnTextColor == null)
{
backbtnTextColor = Color.yellow;
}
QMButtonAPI.allNestedButtons.Add(this);
backButton = new QMSingleButton(this, 5, 2, "Back", () => { QMStuff.ShowQuickmenuPage(btnQMLoc); }, "Go Back", backbtnBackgroundColor, backbtnTextColor);
}
public string getMenuName()
{
return menuName;
}
public QMSingleButton getMainButton()
{
return mainButton;
}
public QMSingleButton getBackButton()
{
return backButton;
}
public void DestroyMe()
{
mainButton.DestroyMe();
backButton.DestroyMe();
}
}
public class QMStuff
{
// Internal cache of the BoxCollider Background for the Quick Menu
private static BoxCollider QuickMenuBackgroundReference;
// Internal cache of the Single Button Template for the Quick Menu
private static GameObject SingleButtonReference;
// Internal cache of the Toggle Button Template for the Quick Menu
private static GameObject ToggleButtonReference;
// Internal cache of the Nested Menu Template for the Quick Menu
private static Transform NestedButtonReference;
// Internal cache of the QuickMenu
private static QuickMenu quickmenuInstance;
// Internal cache of the VRCUiManager
private static VRCUiManager vrcuimInstance;
// Fetch the background from the Quick Menu
public static BoxCollider QuickMenuBackground()
{
if (QuickMenuBackgroundReference == null)
QuickMenuBackgroundReference = GetQuickMenuInstance().GetComponent<BoxCollider>();
return QuickMenuBackgroundReference;
}
// Fetch the Single Button Template from the Quick Menu
public static GameObject SingleButtonTemplate()
{
if (SingleButtonReference == null)
SingleButtonReference = GetQuickMenuInstance().transform.Find("ShortcutMenu/WorldsButton").gameObject;
return SingleButtonReference;
}
// Fetch the Toggle Button Template from the Quick Menu
public static GameObject ToggleButtonTemplate()
{
if (ToggleButtonReference == null)
{
ToggleButtonReference = GetQuickMenuInstance().transform.Find("UserInteractMenu/BlockButton").gameObject;
}
return ToggleButtonReference;
}
// Fetch the Nested Menu Template from the Quick Menu
public static Transform NestedMenuTemplate()
{
if (NestedButtonReference == null)
{
NestedButtonReference = GetQuickMenuInstance().transform.Find("CameraMenu");
}
return NestedButtonReference;
}
// Fetch the Quick Menu instance
public static QuickMenu GetQuickMenuInstance()
{
if (quickmenuInstance == null)
{
quickmenuInstance = QuickMenu.prop_QuickMenu_0;
}
return quickmenuInstance;
}
// Fetch the VRCUiManager instance
public static VRCUiManager GetVRCUiMInstance()
{
if (vrcuimInstance == null)
{
vrcuimInstance = VRCUiManager.prop_VRCUiManager_0;
}
return vrcuimInstance;
}
// Cache the FieldInfo for getting the current page. Hope to god this works!
private static FieldInfo currentPageGetter;
private static GameObject shortcutMenu;
private static GameObject userInteractMenu;
// Show a Quick Menu page via the Page Name. Hope to god this works!
public static void ShowQuickmenuPage(string pagename)
{
QuickMenu quickmenu = GetQuickMenuInstance();
Transform pageTransform = quickmenu?.transform.Find(pagename);
if (pageTransform == null)
{
Console.WriteLine("[QMStuff] pageTransform is null !");
}
if (currentPageGetter == null)
{
GameObject shortcutMenu = quickmenu.transform.Find("ShortcutMenu").gameObject;
if (!shortcutMenu.activeInHierarchy)
shortcutMenu = quickmenu.transform.Find("UserInteractMenu").gameObject;
FieldInfo[] fis = Il2CppType.Of<QuickMenu>().GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where((fi) => fi.FieldType == Il2CppType.Of<GameObject>()).ToArray();
//MelonLoader.MelonModLogger.Log("[QMStuff] GameObject Fields in QuickMenu:");
int count = 0;
foreach (FieldInfo fi in fis)
{
GameObject value = fi.GetValue(quickmenu)?.TryCast<GameObject>();
if (value == shortcutMenu && ++count == 2)
{
//MelonLoader.MelonModLogger.Log("[QMStuff] currentPage field: " + fi.Name);
currentPageGetter = fi;
break;
}
}
if (currentPageGetter == null)
{
Console.WriteLine("[QMStuff] Unable to find field currentPage in QuickMenu");
return;
}
}
currentPageGetter.GetValue(quickmenu)?.Cast<GameObject>().SetActive(false);
GameObject infoBar = GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar").gameObject;
infoBar.SetActive(pagename == "ShortcutMenu");
QuickMenuContextualDisplay quickmenuContextualDisplay = GetQuickMenuInstance().field_Private_QuickMenuContextualDisplay_0;
quickmenuContextualDisplay.Method_Public_Void_EnumNPublicSealedvaUnNoToUs7vUsNoUnique_0(QuickMenuContextualDisplay.EnumNPublicSealedvaUnNoToUs7vUsNoUnique.NoSelection);
//quickmenuContextualDisplay.Method_Public_Nested0_0(QuickMenuContextualDisplay.Nested0.NoSelection);
pageTransform.gameObject.SetActive(true);
currentPageGetter.SetValue(quickmenu, pageTransform.gameObject);
if (shortcutMenu == null)
shortcutMenu = QuickMenu.prop_QuickMenu_0.transform.Find("ShortcutMenu")?.gameObject;
if (userInteractMenu == null)
userInteractMenu = QuickMenu.prop_QuickMenu_0.transform.Find("UserInteractMenu")?.gameObject;
if (pagename == "ShortcutMenu")
{
SetIndex(0);
}
else if (pagename == "UserInteractMenu")
{
SetIndex(3);
}
else
{
SetIndex(-1);
shortcutMenu?.SetActive(false);
userInteractMenu?.SetActive(false);
}
}
// Set the current Quick Menu index
// VRChat Build 1101 - github.com/MintLily
public static void SetIndex(int index)
{
GetQuickMenuInstance().field_Private_EnumNPublicSealedvaUnShEmUsEmNoCaMo_nUnique_0 = (QuickMenu.EnumNPublicSealedvaUnShEmUsEmNoCaMo_nUnique)index;
}
}
}