private void CreateTutorialButton() { string str; if (tutorialNum == 0) { str = generalTutorialStrings[pageNum]; } else if (tutorialNum == 1) { str = battleTutorialStrings[pageNum]; } else if (tutorialNum == 2) { str = staminaTutorialStrings[pageNum]; } else { str = "nUll eRRoR ubuh"; } //Create New Tutorial Button Object GameObject iii = Instantiate(TutorialButtonPrefab, transform.position, transform.rotation); iii.transform.SetParent(gameObject.transform); TutorialButton scr = iii.GetComponent <TutorialButton>(); if (scr) { scr.setButton(str); } }
private void LoadContent_Ui(ContentManager Content) { augmentIcon = Content.Load <Texture2D>("PreparationTurn/StatAugmentIcon"); moneyBox = new RectBox(graphicsDevice, characterDrawPos + new Vector2(uiScale * turnPlayer.CharacterSprite.Width / 2, winBarDimensions.Y + unitBarDimensions.Y), (int)moneyBoxDimensions.X, (int)moneyBoxDimensions.Y); emptyRect = UiTools.GeneratePixelTexture(graphicsDevice); characterBoundary = Content.Load <Texture2D>("CharacterSelect/Buttons/ButtonBoundaryLR"); vsAiIcon = Content.Load <Texture2D>("PreparationTurn/vsPlayerIcon"); vsPlayerIcon = Content.Load <Texture2D>("PreparationTurn/vsPlayerIcon"); moneyIcon = Content.Load <Texture2D>("PreparationTurn/MoneyIcon"); //information used by the stage box: stageInfo = new StageViewBox(graphicsDevice, currentStage, bebasSmall, stageNumber + 1, stageIndex + 1, WindowTools.PaddingToPixelCoordinate(0f, 0.25f, 10, 10) ); //Buttons Texture2D buttonTexture = Content.Load <Texture2D>("PreparationTurn/EndTurnButton"); Texture2D hoverTexture = Content.Load <Texture2D>("PreparationTurn/EndTurnButtonHovered"); bool[,] mask = UiTools.CreateBoolMask(buttonTexture); endTurnButton = new SinglePressSpriteButton(WindowTools.PaddingToPixelCoordinate(0f, 0.17f, 10, 10), buttonTexture, hoverTexture, mask, uiScale); //assign the end turn function to the button's event handler. endTurnButton.buttonPressed += HandleEndTurnButtonPress; levelUnitCapButton = new LevelUnitCapButton(graphicsDevice, moneyBox.GetPos() + new Vector2(moneyBoxDimensions.X, 0f), (int)WindowTools.GetUpscaledValue(225f), (int)moneyBoxDimensions.Y); //and so on with all used buttons levelUnitCapButton.buttonPressed += HandleLevelUpCapPress; useAbilityButton = new UseAbilityButton(graphicsDevice, WindowTools.PaddingToPixelCoordinate(0.1f, 0.17f, 10, 10), (int)WindowTools.GetUpscaledValue(225f), (int)(buttonTexture.Height * uiScale) ); useAbilityButton.buttonPressed += HandleAbilityButtonPress; //divisor line to distinguish between money box/level up button. divisorLine = new Line(graphicsDevice, levelUnitCapButton.GetPos(), levelUnitCapButton.GetPos() + new Vector2(0, levelUnitCapButton.GetHeight()), 5, Color.White); //help button helpButton = new TutorialButton(graphicsDevice, this, WindowTools.PaddingToPixelCoordinate(0.90f, 0f, 0, 10), (int)(20 * uiScale), (int)(10 * uiScale)); }
private void _joinGame(MsgTickerJoinGame message) { if (_tickerState == TickerState.InGame) { return; } _tickerState = TickerState.InGame; if (_lobby != null) { _lobby.Dispose(); _lobby = null; } _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat, InputCmdHandler.FromDelegate(session => { _gameChat.Input.IgnoreNext = true; _gameChat.Input.GrabKeyboardFocus(); })); _gameChat = new ChatBox(); _userInterfaceManager.StateRoot.AddChild(_gameChat); _chatManager.SetChatBox(_gameChat); _tutorialButton = new TutorialButton(); _userInterfaceManager.StateRoot.AddChild(_tutorialButton); _tutorialButton.SetAnchorAndMarginPreset(Control.LayoutPreset.BottomLeft, Control.LayoutPresetMode.MinSize, 50); _gameChat.DefaultChatFormat = "say \"{0}\""; }
private void LoadContent_Ui(ContentManager Content) { //Load icons augmentIcon = Content.Load <Texture2D>("PreparationTurn/StatAugmentIcon"); characterBoundary = Content.Load <Texture2D>("CharacterSelect/Buttons/ButtonBoundaryLR"); emptyRect = UiTools.GeneratePixelTexture(graphicsDevice); //used to draw % bars moneyIcon = Content.Load <Texture2D>("PreparationTurn/MoneyIcon"); //load money ui if vs ai if (useAiOpponent) { moneyUiBox = new RectBox(graphicsDevice, characterPos[0] + new Vector2(uiScale * playerToCheckWinCondition.CharacterSprite.Width / 2, 0), (int)moneyBoxDimensions.X, (int)moneyBoxDimensions.Y ); } actionLogTextures = new ActionLogBox.DrawParams( unitSprites, Content.Load <Texture2D>("BattleTurn/AttackIcon"), Content.Load <Texture2D>("BattleTurn/DefenseIcon"), Content.Load <Texture2D>("BattleTurn/NoMoveIcon"), Content.Load <Texture2D>("BattleTurn/Footprints"), Content.Load <Texture2D>("BattleTurn/SkullIcon"), Content.Load <Texture2D>("BattleTurn/TargetIcon") ); logDisplay = new ActionLogBox(graphicsDevice, logCapacity, bebasSmall, WindowTools.PaddingToPixelCoordinate(1f, 0.5f, -10, 0)); logDisplay.SetAnchorPoint(1f, 0.5f); helpButton = new TutorialButton(graphicsDevice, this, WindowTools.PaddingToPixelCoordinate(0.9f, 0f, 0, 10), (int)(20 * uiScale), (int)(10 * uiScale)); }
void Start() { Button btnPlay = PlayButton.GetComponent <Button>(); Button btnSelectLevel = SelectLevelButton.GetComponent <Button>(); Button btnTutorial = TutorialButton.GetComponent <Button>(); Button btnLearn = LearnButton.GetComponent <Button>(); btnPlay.onClick.AddListener(Play); btnSelectLevel.onClick.AddListener(SelectLevel); btnTutorial.onClick.AddListener(Tutorial); btnLearn.onClick.AddListener(Learn); }
private void LoadContent_Buttons(ContentManager Content) { //generating button for each available character. Vector2 prevDrawCoordinate = buttonGridOrigin; Vector2 translation; for (int i = 0; i < uiButtons.Length; i++) { //get the directory of respective button textures for characters from the ID; Type characterReference = CharacterLinker.GetCharacterReference(i); string directory = (string)characterReference.GetField("SpriteReference").GetRawConstantValue(); //load the button texture(s) Texture2D tex = Content.Load <Texture2D>(directory); Texture2D outline = Content.Load <Texture2D>("CharacterSelect/Buttons/Outline"); //create mask bool[,] mask = UiTools.CreateBoolMask(tex); //generate draw position if ((i & 1) == 1) //if odd number { translation = buttonTesselateVector; } else { translation = new Vector2(buttonTesselateVector.X, -buttonTesselateVector.Y); } //instantiate button uiButtons[i] = new CharSelectButton(i, prevDrawCoordinate + (buttonScale * translation), tex, outline, mask, buttonScale); //update the draw coordinate for tesselation. prevDrawCoordinate = prevDrawCoordinate + (buttonScale * translation); //attach event handler to button uiButtons[i].buttonPressed += HandleButtonPress; } //generate help button helpButton = new TutorialButton(graphicsDevice, this, WindowTools.PaddingToPixelCoordinate(0, 0, 10, 10), (int)(20 * buttonScale), (int)(10 * buttonScale)); //generating confirm button Texture2D confirmButtonTexture = Content.Load <Texture2D>("PreparationTurn/EndTurnButton"); Texture2D confirmButtonOutline = Content.Load <Texture2D>("PreparationTurn/EndTurnButtonHovered"); confirmButton = new CharSelectConfirmButton(WindowTools.PaddingToPixelCoordinate(0.45f, 0.6f, 0, 0) - buttonScale / 2 * new Vector2(confirmButtonTexture.Width, 0), confirmButtonTexture, confirmButtonOutline, UiTools.CreateBoolMask(confirmButtonTexture), buttonScale * 2); confirmButton.buttonPressed += HandleButtonPress; }
/// <summary> /// Optimization of focus for the menu buttons, used for Xbox and desktop keyboard /// </summary> private async void FocusOptimization() { await Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () => { if (!VM.ShowTutorialButton) { SinglePlayerButton.Focus(FocusState.Programmatic); } else { TutorialButton.Focus(FocusState.Programmatic); } }); }
public void TutorialStart() { Time.timeScale = 1; if (PlayButton != null) { PlayButton.SetActive(false); } TutorialButton.SetActive(false); if (ShopButton != null) { ShopButton.SetActive(false); } if (Title != null) { Title.SetActive(false); } tut_1(); }
public void tut_over() { tutorial_5.SetActive(false); PowerUpsContinue.SetActive(false); if (PlayButton != null) { PlayButton.SetActive(true); } TutorialButton.SetActive(true); if (ShopButton != null) { ShopButton.SetActive(true); } if (Title != null) { Title.SetActive(true); } Time.timeScale = 0; }
void HandleInput(Vector2 pos) { if (SingleButton.HitTest(pos)) { if (OnSingle != null) { OnSingle(); } } else if (EndlessButton.HitTest(pos)) { if (OnEndless != null) { OnEndless(); } } else if (KingsButton.HitTest(pos)) { if (OnKings != null) { OnKings(); } } else if (TutorialButton.HitTest(pos)) { if (OnTutorial != null) { OnTutorial(); } } else if (ThemesButton.HitTest(pos)) { if (OnThemes != null) { OnThemes(); } } }
private void Start() { // Get all the levels LevelID[] ids = LevelSettings.GetAllLevelIDs(); foreach (LevelID id in ids) { LevelData data = LevelSettings.GetLevelData(id); if (data.Tutorials.Length > 0) { foreach (TutorialData tutorial in data.Tutorials) { TutorialButton button = Instantiate(buttonPrefab, buttonParent); button.TutorialManager = tutorialManager; button.Tutorial = tutorial; button.Button.interactable = PlayerData.GetCompletionData(id).Encountered; if (button.Button.interactable) { dropdown.AddDropdownDisableButton(button.Button); } } } } }
private void _joinLobby(MsgTickerJoinLobby message) { if (_tickerState == TickerState.InLobby) { return; } if (_gameChat != null) { _gameChat.Dispose(); _gameChat = null; } if (_tutorialButton != null) { _tutorialButton.Dispose(); _tutorialButton = null; } _tickerState = TickerState.InLobby; _lobby = new LobbyGui(_localization, _resourceCache); _userInterfaceManager.StateRoot.AddChild(_lobby); _lobby.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide, margin: 20); _chatManager.SetChatBox(_lobby.Chat); _lobby.Chat.DefaultChatFormat = "ooc \"{0}\""; _lobby.ServerName.Text = _baseClient.GameInfo.ServerName; _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat, InputCmdHandler.FromDelegate(session => { _lobby.Chat.Input.IgnoreNext = true; _lobby.Chat.Input.GrabKeyboardFocus(); })); _updateLobbyUi(); _lobby.ObserveButton.OnPressed += args => _console.ProcessCommand("observe"); _lobby.ReadyButton.OnPressed += args => { if (!_gameStarted) { return; } _console.ProcessCommand("joingame"); }; _lobby.ReadyButton.OnToggled += args => { if (_gameStarted) { return; } _console.ProcessCommand($"toggleready {args.Pressed}"); }; _lobby.LeaveButton.OnPressed += args => _console.ProcessCommand("disconnect"); _updatePlayerList(); }