public LobbyCharacterPreviewPanel(IEntityManager entityManager,
                                          IClientPreferencesManager preferencesManager,
                                          IPrototypeManager prototypeManager)
        {
            _entMan             = entityManager;
            _preferencesManager = preferencesManager;
            _prototypeManager   = prototypeManager;

            var header = new NanoHeading
            {
                Text = Loc.GetString("lobby-character-preview-panel-header")
            };

            CharacterSetupButton = new Button
            {
                Text = Loc.GetString("lobby-character-preview-panel-character-setup-button"),
                HorizontalAlignment = HAlignment.Left
            };

            _summaryLabel = new Label();

            var vBox = new BoxContainer
            {
                Orientation = LayoutOrientation.Vertical
            };

            vBox.AddChild(header);

            _unloaded = new Label {
                Text = Loc.GetString("lobby-character-preview-panel-unloaded-preferences-label")
            };

            _loaded = new BoxContainer
            {
                Orientation = LayoutOrientation.Vertical,
                Visible     = false
            };

            _loaded.AddChild(CharacterSetupButton);
            _loaded.AddChild(_summaryLabel);

            _viewBox = new BoxContainer
            {
                Orientation = LayoutOrientation.Horizontal
            };

            _loaded.AddChild(_viewBox);

            vBox.AddChild(_loaded);
            vBox.AddChild(_unloaded);
            AddChild(vBox);

            UpdateUI();

            _preferencesManager.OnServerDataLoaded += UpdateUI;
        }
Exemple #2
0
        public LobbyCharacterPreviewPanel(IEntityManager entityManager,
                                          IClientPreferencesManager preferencesManager)
        {
            _preferencesManager = preferencesManager;
            _previewDummy       = entityManager.SpawnEntity("HumanMob_Dummy", MapCoordinates.Nullspace);

            var header = new NanoHeading
            {
                Text = Loc.GetString("lobby-character-preview-panel-header")
            };

            CharacterSetupButton = new Button
            {
                Text = Loc.GetString("lobby-character-preview-panel-character-setup-button"),
                HorizontalAlignment = HAlignment.Left
            };

            _summaryLabel = new Label();

            var viewSouth = MakeSpriteView(_previewDummy, Direction.South);
            var viewNorth = MakeSpriteView(_previewDummy, Direction.North);
            var viewWest  = MakeSpriteView(_previewDummy, Direction.West);
            var viewEast  = MakeSpriteView(_previewDummy, Direction.East);

            var vBox = new VBoxContainer();

            vBox.AddChild(header);

            _unloaded = new Label {
                Text = Loc.GetString("lobby-character-preview-panel-unloaded-preferences-label")
            };

            _loaded = new VBoxContainer {
                Visible = false
            };

            _loaded.AddChild(CharacterSetupButton);
            _loaded.AddChild(_summaryLabel);

            var hBox = new HBoxContainer();

            hBox.AddChild(viewSouth);
            hBox.AddChild(viewNorth);
            hBox.AddChild(viewWest);
            hBox.AddChild(viewEast);

            _loaded.AddChild(hBox);

            vBox.AddChild(_loaded);
            vBox.AddChild(_unloaded);
            AddChild(vBox);

            UpdateUI();

            _preferencesManager.OnServerDataLoaded += UpdateUI;
        }
        public LobbyCharacterPreviewPanel()
        {
            IoCManager.InjectDependencies(this);
            var header = new NanoHeading
            {
                Text = Loc.GetString("lobby-character-preview-panel-header")
            };

            CharacterSetupButton = new Button
            {
                Text = Loc.GetString("lobby-character-preview-panel-character-setup-button"),
                HorizontalAlignment = HAlignment.Left
            };

            _summaryLabel = new Label();

            var vBox = new BoxContainer
            {
                Orientation = LayoutOrientation.Vertical
            };
            _unloaded = new Label { Text = Loc.GetString("lobby-character-preview-panel-unloaded-preferences-label") };

            _loaded = new BoxContainer
            {
                Orientation = LayoutOrientation.Vertical,
                Visible = false
            };
            _viewBox = new BoxContainer
            {
                Orientation = LayoutOrientation.Horizontal
            };
            var _vSpacer = new VSpacer();

            _loaded.AddChild(_summaryLabel);
            _loaded.AddChild(_viewBox);
            _loaded.AddChild(_vSpacer);
            _loaded.AddChild(CharacterSetupButton);

            vBox.AddChild(header);
            vBox.AddChild(_loaded);
            vBox.AddChild(_unloaded);
            AddChild(vBox);

            UpdateUI();

            _preferencesManager.OnServerDataLoaded += UpdateUI;
        }