Exemplo n.º 1
0
        public PlayingState(Alex alex, GraphicsDevice graphics, WorldProvider worldProvider, INetworkProvider networkProvider) : base(alex)
        {
            NetworkProvider = networkProvider;

            World       = new World(alex, graphics, Options, new FirstPersonCamera(Options.VideoOptions.RenderDistance, Vector3.Zero, Vector3.Zero), networkProvider);
            SkyRenderer = new SkyBox(alex, graphics, World);

            WorldProvider = worldProvider;
            if (worldProvider is SPWorldProvider)
            {
                World.FreezeWorldTime = true;
            }

            var chat  = new ChatComponent(World);
            var title = new TitleComponent();

            WorldProvider = worldProvider;
            WorldProvider.Init(World, chat, out var info, out var chatProvider);
            World.WorldInfo              = info;
            chat.ChatProvider            = chatProvider;
            WorldProvider.TitleComponent = title;

            _playingHud = new PlayingHud(Alex, World.Player, chat, title);
            _debugInfo  = new GuiDebugInfo();
            InitDebugInfo();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Handles property change for errors to update the Errors panel
 /// </summary>
 /// <param name="sender">Model that sent the event</param>
 /// <param name="e">Event arguments</param>
 protected virtual async void OnModelPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == ViewModel.ViewTitleProperty && TitleComponent != null && sender is ViewModel vm)
     {
         TitleComponent.SetTitle(vm.ViewTitle);
         await TitleComponent.Update();
     }
 }
Exemplo n.º 3
0
        public virtual PartialViewResult Title(TitleComponent component)
        {
            if (component == null)
            {
                throw new ArgumentNullException("component");
            }

            return(PartialView(component));
        }
Exemplo n.º 4
0
        private void setTitle()
        {
            TitleComponent title = new TitleComponent("Fonts/MaturaTitle", "Controls", new Vector2(136, 50), Color.Red);

            title.setAlignment(TextAlignment.center);

            title.setTransitions(new MoveComponent(null, new Vector2(-200, 0), true, 15), new MoveComponent(null, new Vector2(200, 0), false, 15));

            addComponent(title);
        }
Exemplo n.º 5
0
        public PlayingHud(Alex game, Player player, TitleComponent titleComponent) : base()
        {
            Title = titleComponent;

            Alex   = game;
            Player = player;

            Player.OnInventoryChanged += OnInventoryChanged;

            Anchor  = Alignment.Fill;
            Padding = Thickness.One;

            _playerController = player.Controller;
            InputManager.AddListener(new MouseInputListener(InputManager.PlayerIndex));

            _healthAndHotbar = new GuiStackContainer()
            {
                Orientation = Orientation.Vertical,
                ChildAnchor = Alignment.Fill
            };

            _bottomContainer              = new GuiMultiStackContainer();
            _bottomContainer.ChildAnchor  = Alignment.BottomFill;
            _bottomContainer.Anchor       = Alignment.BottomCenter;
            _bottomContainer.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            _bottomContainer.Orientation  = Orientation.Vertical;

            //BottomContainer.

            _hotbar         = new GuiItemHotbar(player.Inventory);
            _hotbar.Anchor  = Alignment.BottomCenter;
            _hotbar.Padding = Thickness.Zero;

            Chat         = new ChatComponent();
            Chat.Enabled = false;
            Chat.Anchor  = Alignment.BottomLeft;

            _healthContainer        = new GuiContainer();
            _healthContainer.Anchor = Alignment.Fill;

            _healthContainer.Margin = new Thickness(0, 0, 0, 1);

            _healthComponent        = new HealthComponent(player);
            _healthComponent.Anchor = Alignment.TopLeft;

            _hungerComponent        = new HungerComponent(player);
            _hungerComponent.Anchor = Alignment.TopRight;

            _tipPopupComponent              = new TipPopupComponent();
            _tipPopupComponent.Anchor       = Alignment.BottomCenter;
            _tipPopupComponent.AutoSizeMode = AutoSizeMode.GrowAndShrink;

            Scoreboard        = new ScoreboardView();
            Scoreboard.Anchor = Alignment.MiddleRight;
        }
Exemplo n.º 6
0
        private void setTitle()
        {
            TitleComponent title = new TitleComponent("Fonts/MaturaInGame", "Paused", new Vector2(136, 110), Color.Red);

            title.setAlignment(TextAlignment.center);

            title.setTransitions(new MoveComponent(null, new Vector2(0, 340), true, 20), new MoveComponent(null, new Vector2(200, 0), true, 15),
                                 new MoveComponent(null, new Vector2(-200, 0), false, 15), new MoveComponent(null, new Vector2(0, -340), false, 20));

            addComponent(title);
        }
Exemplo n.º 7
0
        public PlayingState(Alex alex, GraphicsDevice graphics, WorldProvider worldProvider, NetworkProvider networkProvider) : base(alex)
        {
            NetworkProvider = networkProvider;

            World = new World(alex.Services, graphics, Options, networkProvider);
            World.Player.IsFirstPersonMode = true;

            WorldProvider = worldProvider;
            if (worldProvider is SPWorldProvider)
            {
                World.DoDaylightcycle = false;
                //World.Player.SetInventory(new BedrockInventory(46));
                if (ItemFactory.TryGetItem("minecraft:diamond_sword", out var sword))
                {
                    World.Player.Inventory.MainHand = sword;
                    World.Player.Inventory[World.Player.Inventory.SelectedSlot] = sword;
                }
            }

            var title = new TitleComponent();

            WorldProvider = worldProvider;
            WorldProvider.Init(World);

            WorldProvider.TitleComponent = title;

            _playingHud = new PlayingHud(Alex, World.Player, title);
            _playingHud.Chat.Network = networkProvider;

            WorldProvider.ScoreboardView = _playingHud.Scoreboard;
            WorldProvider.ChatRecipient  = _playingHud;
            //WorldProvider.ScoreboardView

            _debugInfo = new GuiDebugInfo();
            InitDebugInfo();

            MiniMap = new GuiMiniMap(World.ChunkManager)
            {
                Anchor = Alignment.TopRight
            };

            var settings = GetService <IOptionsProvider>();

            settings.AlexOptions.VideoOptions.Minimap.Bind(OnMinimapSettingChange);
            RenderMinimap = settings.AlexOptions.VideoOptions.Minimap.Value;

            if (RenderMinimap)
            {
                _playingHud.AddChild(MiniMap);
            }

            _networkDebugHud = new NetworkDebugHud(NetworkProvider);
        }
Exemplo n.º 8
0
        public PlayingHud(Alex game, Player player, ChatComponent chat, TitleComponent titleComponent) : base()
        {
            Title = titleComponent;

            Alex   = game;
            Player = player;

            _playerController = player.Controller;
            InputManager.AddListener(new MouseInputListener(InputManager.PlayerIndex));

            _hotbar         = new GuiItemHotbar(player.Inventory);
            _hotbar.Anchor  = Alignment.BottomCenter;
            _hotbar.Padding = Thickness.Zero;

            Chat         = chat;
            Chat.Enabled = false;
            Chat.Anchor  = Alignment.BottomLeft;
        }
Exemplo n.º 9
0
        public void setSongs(string collectionName, SongCollection songCollection)
        {
            songs = songCollection;

            if (components.ContainsKey("Title"))
            {
                TitleComponent title = components["Title"] as TitleComponent;

                title.Text = collectionName;
            }

            if (components.ContainsKey("Scroll Options"))
            {
                ScrollOptionsComponent optionList = components["Scroll Options"] as ScrollOptionsComponent;

                int i;

                for (i = 1; i <= songs.Count; i++)
                {
                    try
                    {
                        optionList.getOption(i).Text = songs[i - 1].Name;
                    }
                    catch
                    {
                        OptionType option = new OptionType(optionList.getOption(0));

                        option.Text = songs[i - 1].Name;

                        option.Position = new Vector2(option.Position.X, option.Position.Y + i * factor);

                        option.Selected -= AddAll;
                        option.Selected += AddSong;

                        optionList.addOption(option);
                    }
                }

                if (i < optionList.Count - 1)
                {
                    optionList.clearOptions(i);
                }
            }
        }
Exemplo n.º 10
0
        private void setTitle()
        {
            TitleComponent title = new TitleComponent("High Scores", "LindseyLarge", Color.Yellow, new Vector2(25, 0));

            TransitionWrapper transition;

            transition = new BaseTransition(15, TransitionState.intro);
            transition = new FloatTitle(transition, new Vector2(0, -20));
            transition = new FadeTitle(transition);
            transition.setTransition(title);
            title.Intro = transition;

            transition   = new BaseTransition(15, TransitionState.selected);
            transition   = new FloatTitle(transition, new Vector2(0, 20));
            transition   = new FadeTitle(transition);
            title.Select = transition;

            transition.State = TransitionState.exit;
            title.Exit       = transition;

            addComponent(title);
        }
Exemplo n.º 11
0
        private void setTitle()
        {
            TitleComponent title = new TitleComponent("Touch Pad", "Lindsey", Color.Yellow, new Vector2(120, 210), TextAlignment.center);

            TransitionWrapper transition;

            transition = new BaseTransition(15, TransitionState.intro);
            transition = new FloatTitle(transition, new Vector2(0, 15));
            transition = new FadeTitle(transition);
            transition.setTransition(title);
            title.Intro = transition;

            transition   = new BaseTransition(15, TransitionState.selected);
            transition   = new FloatTitle(transition, new Vector2(0, -15));
            transition   = new FadeTitle(transition);
            title.Select = transition;

            transition.State = TransitionState.exit;
            title.Exit       = transition;

            addComponent(title);
        }
Exemplo n.º 12
0
        public void setTitle(TitleComponent title, ITransition intro, ITransition revert, ITransition select, ITransition exit)
        {
            title.setTransitions(intro, revert, select, exit);

            addComponent(title);
        }
Exemplo n.º 13
0
 public bool HasLicenseKey()
 {
     return(TitleComponent.HasLicenseKey());
 }
Exemplo n.º 14
0
 public string GetLicensePopupText()
 {
     return(TitleComponent.GetLicenseKeyPopupText());
 }