-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElfin.cs
More file actions
41 lines (33 loc) · 1.14 KB
/
Elfin.cs
File metadata and controls
41 lines (33 loc) · 1.14 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
using System;
using Il2CppAssets.Scripts.PeroTools.Commons;
using Il2CppAssets.Scripts.PeroTools.Managers;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
namespace QuickSwitchCombination;
[RegisterTypeInIl2Cpp]
internal class Elfin : MonoBehaviour
{
private int _count;
public Elfin(IntPtr intPtr) : base(intPtr)
{
}
private void Start()
{
_count = transform.parent.gameObject.GetComponent<Count>().count;
var dropdown = GetComponent<Dropdown>();
dropdown.ClearOptions();
List<string> elfins = new();
elfins.Add("None");
for (var i = 0; i < Singleton<ConfigManager>.instance["elfin"].Count; i++)
{
elfins.Add(Singleton<ConfigManager>.instance.GetJson("elfin", true)[i]["name"].ToObject<string>());
}
dropdown.AddOptions(elfins);
dropdown.value = Save.Settings.Data[_count].Elfin + 1;
dropdown.onValueChanged.AddListener((UnityAction<int>)OnValueChanged);
}
private void OnValueChanged(int index) => Save.Settings.Data[_count].Elfin = index - 1;
}