private void Awake() { orig_Awake(); TabModTheGungeonSelector = Instantiate(TabGameplaySelector); TabModTheGungeonSelector.Text = "MODS"; m_panel.AddControl(TabModTheGungeonSelector); TabModTheGungeonSelector.Position = new Vector3(TabModTheGungeonSelector.Position.x, TabGameplaySelector.Position.y - 42.75f, 0); TabControlsSelector.Position = new Vector3(TabControlsSelector.Position.x, TabModTheGungeonSelector.Position.y - 42.75f, 0); TabVideoSelector.Position = new Vector3(TabVideoSelector.Position.x, TabControlsSelector.Position.y - 42.75f, 0); TabAudioSelector.Position = new Vector3(TabAudioSelector.Position.x, TabVideoSelector.Position.y - 42.75f, 0); TabModTheGungeonSelector.Click += delegate(dfControl control, dfMouseEventArgs mouseEvent) { ToggleToPanel(((FullOptionsMenuController)FullOptionsMenu).TabModTheGungeon, false, false); }; }
private void Awake() { Instance = this; orig_Awake(); TabModsSelector = m_panel.AddControl <dfButton>(); var crosshair_selection_doer_control = TabGameplaySelector.GetComponent <MenuCrosshairSelectionDoer>().controlToPlace; var mods_ui_key_controls = TabModsSelector.gameObject.AddComponent <UIKeyControls>(); var mods_crosshair_doer = TabModsSelector.gameObject.AddComponent <MenuCrosshairSelectionDoer>(); mods_ui_key_controls.up = TabGameplaySelector; mods_ui_key_controls.down = TabControlsSelector; var gameplay_ui_key_controls = TabGameplaySelector.GetComponent <UIKeyControls>(); gameplay_ui_key_controls.down = TabModsSelector; var controls_ui_key_controls = TabControlsSelector.GetComponent <UIKeyControls>(); controls_ui_key_controls.up = TabModsSelector; mods_crosshair_doer.controlToPlace = crosshair_selection_doer_control; //var props = typeof(dfButton).GetProperties(BindingFlags.Public | BindingFlags.Instance); //for (int j = 0; j < props.Length; j++) { // var prop = props[j]; // if (prop.GetSetMethod() != null) prop.SetValue(TabModsSelector, prop.GetValue(TabGameplaySelector, null), null); //} TabModsSelector.Font = TabGameplaySelector.Font; TabModsSelector.TextScale = TabGameplaySelector.TextScale; TabModsSelector.RelativePosition = TabGameplaySelector.RelativePosition; TabModsSelector.AutoSize = true; TabModsSelector.TextColor = TabGameplaySelector.TextColor; TabModsSelector.FocusTextColor = TabGameplaySelector.FocusTextColor; TabModsSelector.HoverTextColor = TabGameplaySelector.HoverTextColor; TabModsSelector.Atlas = TabGameplaySelector.Atlas; TabModsSelector.Height = TabGameplaySelector.Height; TabModsSelector.IsEnabled = TabGameplaySelector.IsEnabled; TabModsSelector.IsVisible = TabGameplaySelector.IsVisible; TabModsSelector.IsLocalized = true; TabModsSelector.forceUpperCase = true; TabModsSelector.Text = "#semi:TAB_MODS"; TabModsSelector.Localize(); TabModsSelector.RelativePosition = new Vector2(m_panel.Width / 2 - TabModsSelector.Width / 2, TabModsSelector.RelativePosition.y); TabModsSelector.name = "TabModsSelector"; Console.WriteLine($"TEXTSCALE {TabModsSelector.TextScale}"); Console.WriteLine($"TEXTCOL {TabModsSelector.TextColor}"); Console.WriteLine($"FTEXTCOL {TabModsSelector.FocusTextColor}"); Console.WriteLine($"HTEXTCOL {TabModsSelector.HoverTextColor}"); TabGameplaySelector.RelativePosition = new Vector2(TabGameplaySelector.RelativePosition.x, TabGameplaySelector.RelativePosition.y + 2); TabModsSelector.RelativePosition = new Vector2(TabModsSelector.RelativePosition.x, TabGameplaySelector.RelativePosition.y + 40); TabControlsSelector.RelativePosition = new Vector2(TabControlsSelector.RelativePosition.x, TabModsSelector.RelativePosition.y + 40); TabVideoSelector.RelativePosition = new Vector2(TabVideoSelector.RelativePosition.x, TabControlsSelector.RelativePosition.y + 40); TabAudioSelector.RelativePosition = new Vector2(TabAudioSelector.RelativePosition.x, TabVideoSelector.RelativePosition.y + 40); var comps = TabModsSelector.GetComponents <MonoBehaviour>(); for (int i = 0; i < comps.Length; i++) { Console.WriteLine($"COMP {comps[i].GetType().FullName}"); } comps = TabGameplaySelector.GetComponents <MonoBehaviour>(); for (int i = 0; i < comps.Length; i++) { Console.WriteLine($"COMPX {comps[i].GetType().FullName}"); } TabModsSelector.Click += delegate(dfControl control, dfMouseEventArgs mouseEvent) { ToggleToPanel(((FullOptionsMenuController)FullOptionsMenu).TabMods, false, false); }; TabModsSelector.IsVisible = true; Console.WriteLine($"GAMEPLAY: {TabGameplaySelector} {TabGameplaySelector.Position.x} {TabGameplaySelector.Position.y} {TabGameplaySelector.IsVisible}"); Console.WriteLine($"MODS: {TabModsSelector} {TabModsSelector.Position.x} {TabModsSelector.Position.y} {TabModsSelector.IsVisible}"); Console.WriteLine($"CONTROLS: {TabControlsSelector} {TabControlsSelector.Position.x} {TabControlsSelector.Position.y} {TabControlsSelector.IsVisible}"); Console.WriteLine($"VIDEO: {TabVideoSelector} {TabVideoSelector.Position.x} {TabVideoSelector.Position.y} {TabVideoSelector.IsVisible}"); Console.WriteLine($"AUDIO: {TabAudioSelector} {TabAudioSelector.Position.x} {TabAudioSelector.Position.y} {TabAudioSelector.IsVisible}"); }
private float AddBox(Brain b, int level, float prev_center, Color32 color) { var top_padding = 10; var spacing = 150; // var button = _panel.AddControl<BrainButton>(); BrainButton button = _panel.AddPrefab(ListItem) as BrainButton; // as UserListItem; dfLabel NameLabel = button.Find("Brain Name Label").GetComponent <dfLabel>(); dfLabel GenerationLabel = button.Find("Generation Label").GetComponent <dfLabel>(); dfLabel FitnessLabel = button.Find("Fitness Label").GetComponent <dfLabel>(); BrainButton branchButton = button.Find("Branch Button").GetComponent <BrainButton>(); NameLabel.Text = b.Name; GenerationLabel.Text = "Generation: " + b.Generation; FitnessLabel.Text = "Fitness: " + b.BestFitness; button.Brain = b; button.Click += button_Click; button.IsNewBrain = b.IsNewBrain; button.DragStart += button_DragStart; //button.BackgroundSprite = "BLANK_TEXTURE"; button.NormalBackgroundColor = color; //button.HoverSprite = "listitem-hover"; //button.PressedSprite = "listitem-selected"; //button.Width = 150; //button.Height = 80; var center_spacing = _panel.Width / (LevelCount[level]); var center = center_spacing * CurrentCount[level] - center_spacing / 2; CurrentCount[level] += 1; button.RelativePosition = new Vector3(center - button.Width / 2, top_padding + level * spacing); var plus = branchButton; plus.Brain = b; plus.Click += new_button_Click; if (level > 0) { var line = _panel.AddControl <dfSprite>(); line.SpriteName = "vslider-track-normal"; line.Width = 12; //line.Height = spacing - button.Height; float B = spacing - button.Height; line.Height = HypotenuseLength(prev_center, center, B) + 20; Vector3 rot = Vector3.forward; float angle = Angle(B, center - prev_center); print("Angle: " + angle); line.transform.Rotate(rot, angle); float padding = 0; if (angle < 0) { padding = -5; } if (angle > 0) { padding = 5; } line.RelativePosition = new Vector3(prev_center, top_padding + level * spacing - B + padding - 2); line.ZOrder = 0; } return(center); }