Exemplo n.º 1
0
        public async Task <IPanel> LoadAsync(IGame game)
        {
            _game = game;
            _game.Events.OnSavedGameLoad.Subscribe(onSaveGameLoaded);
            IGameFactory factory = game.Factory;

            _player = game.State.Player;
            _panel  = await factory.UI.GetPanelAsync("Toolbar", "../../Assets/Gui/DialogBox/toolbar.bmp", 0f, 180f);

            _panel.Visible = false;

            await loadButton("Walk Button", factory, "walk/", 0f, RotatingCursorScheme.WALK_MODE);
            await loadButton("Interact Button", factory, "hand/", 20f, RotatingCursorScheme.INTERACT_MODE);
            await loadButton("Look Button", factory, "eye/", 40f, RotatingCursorScheme.LOOK_MODE);
            await loadButton("Talk Button", factory, "talk/", 60f, MouseCursors.TALK_MODE);

            InventoryButton = await loadButton("Inventory Button", factory, "inventory/", 80f);

            IButton activeInvButton = await loadButton("Active Inventory Button", factory, "activeInventory/", 100f, RotatingCursorScheme.INVENTORY_MODE);

            activeInvButton.Z = 1f;
            IButton helpButton = await loadButton("Help Button", factory, "help/", 280f);

            IButton optionsButton = await loadButton("Settings Button", factory, "settings/", 300f);

            InventoryButton.OnMouseClick(() => _invPanel.Show(), _game);
            optionsButton.OnMouseClick(() => _optionsPanel.Show(), _game);
            helpButton.OnMouseClick(() => _featuresPanel.Show(), _game);

            game.Events.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
            _inventoryItemIcon       = factory.Object.GetObject("Inventory Item Icon");
            _inventoryItemIcon.X     = 10f;
            _inventoryItemIcon.Y     = 10f;
            _inventoryItemIcon.Pivot = new AGS.API.PointF(0f, 0f);
            _inventoryItemIcon.TreeNode.SetParent(activeInvButton.TreeNode);
            _inventoryItemIcon.RenderLayer       = _panel.RenderLayer;
            _inventoryItemIcon.Enabled           = false;
            _inventoryItemIcon.IgnoreScalingArea = true;
            _inventoryItemIcon.IgnoreViewport    = true;
            game.State.UI.Add(_inventoryItemIcon);

            ILabel label = game.Factory.UI.GetLabel("Hotspot Label", "", 150f, 20f, 200f, 0f, _panel, new AGSTextConfig(brush: AGSGame.Device.BrushLoader.LoadSolidBrush(Colors.LightGreen),
                                                                                                                        alignment: Alignment.MiddleCenter, autoFit: AutoFit.TextShouldFitLabel, paddingBottom: 5f,
                                                                                                                        font: game.Factory.Fonts.LoadFont(AGSGameSettings.DefaultTextFont.FontFamily, 10f)));

            label.Pivot = new AGS.API.PointF(0.5f, 0f);
            VerbOnHotspotLabel hotspotLabel = new VerbOnHotspotLabel(() => _scheme.CurrentMode, game, label);

            hotspotLabel.Start();

            return(_panel);
        }