public void RefreshFunctions(Config config) { int prevIndex = -1; if (comboBox_Function.Items.Count != 0) { prevIndex = comboBox_Function.SelectedIndex; } comboBox_Function.Items.Clear(); comboBox_Function.Items.Add("-"); for (int i = 0; i < MenuFuncs.FUNCS.Length; i++) { comboBox_Function.Items.Add(MenuFuncs.WithSpaces(MenuFuncs.FUNCS[i])); } if (config != null) { for (int i = 0; i < config.CustomActions.Count; i++) { comboBox_Function.Items.Add((config.CustomActions[i] as dynamic).name); } } comboBox_Function.SelectedIndex = 0; if (prevIndex != -1 && prevIndex < comboBox_Function.Items.Count) { comboBox_Function.SelectedIndex = prevIndex; } }
public ContextMenuItem(string name, string func, Config config) { InitializeComponent(); // func drop down list RefreshFunctions(config); // name textBox_Name.Text = name; // func func = MenuFuncs.WithSpaces(func); int fundIndex = comboBox_Function.Items.IndexOf(func); if (fundIndex != -1) { comboBox_Function.SelectedIndex = fundIndex; } }
public ContextMenuItem(string name, string func) { InitializeComponent(); // func drop down list comboBox_Function.Items.Add("-"); for (int i = 0; i < MenuFuncs.FUNCS.Length; i++) { comboBox_Function.Items.Add(MenuFuncs.WithSpaces(MenuFuncs.FUNCS[i])); } comboBox_Function.SelectedIndex = 0; // name textBox_Name.Text = name; // func func = MenuFuncs.WithSpaces(func); int fundIndex = comboBox_Function.Items.IndexOf(func); if (fundIndex != -1) { comboBox_Function.SelectedIndex = fundIndex; } }
// Start is called before the first frame update void Start() { displayedGameTime = InGameStartTime; SceneLoader = this.GetComponent <MenuFuncs>(); }
// Start is called before the first frame update void Start() { menuScript = GetComponent <MenuFuncs>(); }