public CharacterSetupGui( IEntityManager entityManager, IResourceCache resourceCache, IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager, IConfigurationManager configurationManager) { RobustXamlLoader.Load(this); _entityManager = entityManager; _prototypeManager = prototypeManager; _preferencesManager = preferencesManager; _configurationManager = configurationManager; var panelTex = resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png"); var back = new StyleBoxTexture { Texture = panelTex, Modulate = new Color(37, 37, 42) }; back.SetPatchMargin(StyleBox.Margin.All, 10); BackgroundPanel.PanelOverride = back; _createNewCharacterButton = new Button { Text = Loc.GetString("character-setup-gui-create-new-character-button"), }; _createNewCharacterButton.OnPressed += args => { preferencesManager.CreateCharacter(HumanoidCharacterProfile.Random()); UpdateUI(); args.Event.Handle(); }; _humanoidProfileEditor = new HumanoidProfileEditor(preferencesManager, prototypeManager, entityManager, configurationManager); _humanoidProfileEditor.OnProfileChanged += ProfileChanged; CharEditor.AddChild(_humanoidProfileEditor); UpdateUI(); RulesButton.OnPressed += _ => new RulesAndInfoWindow().Open(); preferencesManager.OnServerDataLoaded += UpdateUI; }
private void GenerateEditors() { chars = new CharEditor[CharWidth * CharHeight]; if (CharSetSort == CharSetSort.UpDown) { for (int x = 0; x < CharWidth; x++) { for (int y = 0; y < CharHeight; y++) { CharEditor newChar = new CharEditor(); newChar.PixelDown += NewChar_PixelDown; newChar.Updated += NewChar_Updated; newChar.Top = y * CharEditor.EditorSizeBase; newChar.Left = x * CharEditor.EditorSizeBase; this.Controls.Add(newChar); newChar.Visible = true; chars[y + x * CharHeight] = newChar; } } } else { for (int y = 0; y < CharHeight; y++) { for (int x = 0; x < CharWidth; x++) { CharEditor newChar = new CharEditor(); newChar.PixelDown += NewChar_PixelDown; newChar.Updated += NewChar_Updated; newChar.Top = y * CharEditor.EditorSizeBase; newChar.Left = x * CharEditor.EditorSizeBase; this.Controls.Add(newChar); newChar.Visible = true; chars[x + y * CharWidth] = newChar; } } } this.ClientSize = new Size(CharWidth * CharEditor.EditorSizeBase, CharHeight * CharEditor.EditorSizeBase); }