public void InitializeComponents() { PauseGame = true; var r = new List <List <Recipe> >(); foreach (var e in GameState.LocalPlayer.Entity.Level.GetEntitiesOnArea(GameState.LocalPlayer.Entity.X, GameState.LocalPlayer.Entity.Y, Game.Unit * 3)) { var s = e.GetComponent <CraftingStation>(); if (s != null) { if (!r.Contains(s.Recipies)) { r.Add(s.Recipies); } } } var recipies = new List <Recipe>(); recipies.AddRange(RECIPIES.HandCrafted); foreach (var i in r) { recipies.AddRange(i); } _inventory = new WidgetItemContainer(GameState.LocalPlayer.Entity.GetComponent <Inventory>().Content); _crafting = new CraftingTab(GameState, recipies); _inventory.Dock = Dock.Fill; _inventory.MouseClick += (sender) => { _inventory.HighlightedItem = _inventory.SelectedItem; GameState.LocalPlayer.Entity.HoldingItem = _inventory.SelectedItem; }; var closeBtn = new SpriteButton() { Sprite = new Sprite(Ressources.TileGui, new Point(7, 7)), UnitBound = new Rectangle(0, 0, 48, 48), Anchor = Anchor.TopRight, Origine = Anchor.TopRight, UnitOffset = new Point(-16, 16) }; closeBtn.MouseClick += CloseBtnOnMouseClick; WidgetTabContainer _sideMenu = new WidgetTabContainer { Anchor = Anchor.Center, Origine = Anchor.Center, UnitBound = new Rectangle(0, 0, 600, 720), Dock = Rise.Platform.Family == PlatformFamily.Mobile ? Dock.Fill : Dock.None, TabAnchore = Rise.Platform.Family == PlatformFamily.Mobile ? TabAnchore.Bottom : TabAnchore.Left, Childrens = { closeBtn }, Tabs = { new EquipmentTab(), _crafting, new Tab() { Icon = new Sprite(Ressources.TileIcons, new Point(2, 3)), Content = new Container() { Childrens = { new Label { Text = "Inventory",Font = Ressources.FontAlagard, Dock = Dock.Top }, _inventory, } } }, new MinimapTab(GameState), new SaveTab(GameState), } }; Content = new Container() { Childrens = { _sideMenu }, }; }
public override void Load() { var background = RandomUtils.Choose(Ressources.ParalaxeForest, Ressources.ParalaxeMontain); Rise.Scene.SetBackground(background); var title = new Label { Text = Game.Name, Anchor = Anchor.Center, Origine = Anchor.Center, UnitOffset = new Point(0, -72), Font = Ressources.FontAlagard, TextSize = 3f, }; var subTitle = new Label { Text = "\"Tales of the unknow\"", Anchor = Anchor.Center, Origine = Anchor.Center, UnitOffset = new Point(0, -16), Font = Ressources.FontRomulus, TextSize = 1f, }; var copyright = new Label { Text = "© 2017-2018 MAKER", Anchor = Anchor.Bottom, Origine = Anchor.Bottom, Font = Ressources.FontRomulus, TextSize = 1f }; var continueButton = new Button { Text = "Continue", Anchor = Anchor.Center, Origine = Anchor.Center, UnitOffset = new Point(0, 72), UnitBound = new Rectangle(0, 0, 256, 64), } .RegisterMouseClickEvent((sender) => Game.Play(Game.GetLastGame())); var menu = new WidgetTabContainer { Anchor = Anchor.Center, Origine = Anchor.Center, UnitBound = new Rectangle(0, 0, 600, 720), TabAnchore = Rise.Platform.Family == PlatformFamily.Mobile ? TabAnchore.Bottom : TabAnchore.Left, Tabs = { new Tab { Icon = new Sprite(Ressources.TileIcons, new Point(0, 4)), Content = new Container(title, subTitle, copyright, Game.GetLastGame() != null ? continueButton : null) }, new TabNewWorld(), new TabLoadWorld(), new TabMultiplayerConnect(), new TabOption(), } }; Container = new Container(menu); }
public override void Load() { Rise.Sound.Play(Resources.Theme0); var title = new WidgetLabel { Text = Game.Title, Anchor = Anchor.Center, Origine = Anchor.Center, UnitOffset = new Point(0, -72), Font = Resources.FontAlagard, TextSize = 3f, }; var subTitle = new WidgetLabel { Text = Game.SubTitle, Anchor = Anchor.Center, Origine = Anchor.Center, UnitOffset = new Point(0, -16), Font = Resources.FontRomulus, TextColor = ColorPalette.Accent, TextSize = 1f, }; var copyright = new WidgetLabel { Text = "© 2017-2021 SMNX", Anchor = Anchor.Bottom, Origine = Anchor.Bottom, Font = Resources.FontRomulus, TextSize = 1f }; var continueButton = new WidgetButton { Enabled = Game.GetLastGame() != null, Text = "Continue", Anchor = Anchor.Center, Origine = Anchor.Center, UnitOffset = new Point(0, 72), UnitBound = new Rectangle(0, 0, 256, 64), } .RegisterMouseClickEvent((sender) => Game.Play(Game.GetLastGame())); var version = new WidgetLabel { Text = $"{Game.Title} {Game.Version}", Anchor = Anchor.BottomRight, Origine = Anchor.BottomRight, UnitOffset = new Point(-16, 0), Font = Resources.FontHack, TextAlignement = TextAlignement.Right, TextColor = Color.White * 0.5f, TextSize = 1f, }; var homeTab = new Tab { Icon = new Sprite(Resources.TileIcons, new Point(0, 4)), Content = new LayoutDock() { Children = { title, subTitle, copyright, continueButton } } }; var menu = new WidgetTabContainer { Anchor = Anchor.Center, Origine = Anchor.Center, UnitBound = new Rectangle(0, 0, 600, 720), TabAnchore = Rise.Platform.Family == PlatformFamily.Mobile ? TabAnchore.Bottom : TabAnchore.Left, Tabs = { homeTab, new TabNewWorld(), new TabLoadWorld(), new TabOption(), } }; Container = new LayoutDock().AddChildren(menu, version); }