public MainMenu() : base() { _optionsMenu = new OptionsMenu(this); _background = new FSprite("mainbackground"); _background.scale = 1.2f * screenHeight / 270f; container.AddChild(_background); _titleSprites = new FSprite[3]; _titleSprites[0] = new FSprite("titlei"); _titleSprites[1] = new FSprite("titles"); _titleSprites[2] = new FSprite("titleo"); for (int i = _titleSprites.Length - 1; !(i < 0); i--) { _titleSprites[i].x = screenWidth * 0.5f - ((3 - i) * 40f); _titleSprites[i].y = -screenHeight; _titleSprites[i].scale = 2f; container.AddChild(_titleSprites[i]); } _buttons = new GeneralButton[3]; _buttons[0] = new GeneralButton(this, "Start", OnWorldSelect); _buttons[1] = new GeneralButton(this, "Options", OpenOptions); _buttons[2] = new GeneralButton(this, "Quit", OnApplicationQuit); _buttons[0].position = new Vector2(0f, 88f - screenHeight * 0.5f); _buttons[0].size = new Vector2(48f, 48f); _buttons[1].position = new Vector2(0f, 48f - screenHeight * 0.5f); _buttons[1].size = new Vector2(48f, 16f); _buttons[2].position = new Vector2(0f, 24f - screenHeight * 0.5f); _buttons[2].size = new Vector2(48f, 16f); for (int index = 0; index < _buttons.Length; index++) { AddElement(_buttons[index]); } _worldSelect = new WorldSelect(this); _visitDevLog = new GeneralButton(this, "Wanna See Devlog?", OnVisitDevLog); _visitDevLog.position = new Vector2(0f, screenHeight * -0.5f + 24f); _visitDevLog.size = new Vector2(96f, 16f); AddElement(_visitDevLog); }
public InventoryMenu(PlayerInterface playerInterface) : base(null, true, 0.2f, 0.1f) { _playerInterface = playerInterface; AddElement(new FadePanel(this)); _itemSlots = new ItemSlot[player.inventorySize]; for (int index = 0; index < 8f; index++) { if (player.inventory[index] != null) { _itemSlots[index] = new ItemSlot(this, player.inventory[index]); _itemSlots[index].position = new Vector2(Mathf.Cos(index / 4f * Mathf.PI), Mathf.Sin(index / 4f * Mathf.PI)) * 40f; AddElement(_itemSlots[index]); } } for (int index = 8; index < _itemSlots.Length; index++) { if (player.inventory[index] != null) { _itemSlots[index] = new ItemSlot(this, player.inventory[index]); _itemSlots[index].position = leftUp + new Vector2(20f, -20f) + new Vector2((index / 8) - 1, -(index % 8)) * 32f; AddElement(_itemSlots[index]); } } _cursorItemContainer = new ItemContainer(); _inventoryCursor = new InventoryCursor(this); AddElement(_inventoryCursor); _exitButton = new GeneralButton(this, "X", RequestTerminate, false); _exitButton.position = rightUp + new Vector2(-24f, -24f); _exitButton.size = new Vector2(16f, 16f); AddElement(_exitButton); }
public PauseMenu(LoopFlow pauseTarget) : base(null, true, 0.5f, 0.5f) { _pauseTarget = pauseTarget; _optionsMenu = new OptionsMenu(this); AddElement(new FadePanel(this)); _cinematicEdge = new FSprite[2]; for (int index = 0; index < _cinematicEdge.Length; index++) { _cinematicEdge[index] = new FSprite("pixel"); _cinematicEdge[index].width = Futile.screen.width; _cinematicEdge[index].color = Color.black; _cinematicEdge[index].y = Futile.screen.halfHeight * (index > 0 ? 1f : -1f); } container.AddChild(_cinematicEdge[0]); container.AddChild(_cinematicEdge[1]); _buttons = new GeneralButton[3]; _buttons[0] = new GeneralButton(this, "Resume", RequestTerminate); _buttons[1] = new GeneralButton(this, "To Menu", BackToMenu); _buttons[2] = new GeneralButton(this, "Options", OpenOptions); for (int index = 0; index < _buttons.Length; index++) { _buttons[index].size = new Vector2(48f, 16f); AddElement(_buttons[index]); } _buttons[0].position = MenuFlow.rightDown + Vector2.right * -30f; _buttons[1].position = MenuFlow.leftDown + Vector2.right * 30f; _buttons[2].position = MenuFlow.leftDown + Vector2.right * 90f; if (_onPauseAudio == null) { _onPauseAudio = Resources.Load <AudioClip>("SoundEffects/UIMetalHit"); } }
public WorldSelect(MainMenu menu) : base(menu) { _worldNames = new string[WorldNumber]; _worldPaths = new string[WorldNumber]; _worldSelects = new GeneralButton[WorldNumber]; for (int index = 0; index < WorldNumber; index++) { string worldName = "World_" + index; string worldPath = "SaveData/" + worldName + ".dat"; _worldNames[index] = worldName; _worldPaths[index] = worldPath; _worldSelects[index] = new GeneralButton(menu, "World_#", delegate { menu.OnGameStart(worldPath); }); _worldSelects[index].position = new Vector2(-MenuFlow.screenWidth * 0.5f + 40f + index * 64f, 144f - MenuFlow.screenHeight * 0.5f); _worldSelects[index].size = new Vector2(48f, 48f); AddElement(_worldSelects[index]); } }