protected void OnSubmitName() { if (editNameInput == null) { Debug.LogWarning("Edit Name Input is not set!"); return; } var avatarButton = ProfileController.GetEditPlayerAvatarButton(); if (avatarButton != null) { Debug.Log("Player Name: " + editNameInput.text); avatarButton.transform.Find("Label").GetComponent <UILabel>().text = editNameInput.text; UIButtonSelection sel = ProfileController.GetCurrentSelectionButton(); UILabel selLabel = sel.transform.Find("Label").GetComponent <UILabel>(); selLabel.text = editNameInput.text; int selectedIndex = ProfileController.GetSelectedButtonIndex(); PlayerProfile.current.profiles[selectedIndex].Name = editNameInput.text; PlayerProfile.Save(); } else { Debug.Log("Avatar Button is null"); } }
static public void SetProfileButton(UIButtonSelection button, string name, string avatar, string piece) { UISlicedSprite selBg = button.transform.FindChild("Background").GetComponent <UISlicedSprite>(); UILabel selLabel = button.transform.Find("Label").GetComponent <UILabel>(); selBg.spriteName = avatar; selLabel.text = name; }
internal void SelectedButton(UIButtonSelection buttonSelection) { selectedButton = buttonSelection; if (priorityHit != null && !inGame) { SetCursor(buttonSelection); } }
public static UILabel GetButtonLabel(UIButtonSelection button) { if (button == null) { return(null); } return(button.transform.FindChild("Label").GetComponent <UILabel>()); }
public static UILabel GetButtonLabel(UIButtonSelection button) { if (button == null) { return null; } return button.transform.FindChild("Label").GetComponent<UILabel>(); }
public void OnOptionClick(UIButtonSelection buttonSelection) { mouseAndRaycast.SelectedButton(buttonSelection); if (!hasPressedButton) { hasPressedButton = true; toolTipText.text = "Now click the terrain to spawn"; } currentSelection = buttonSelection; }
protected void OnEditPlayer() { UIButtonSelection sel = GetCurrentSelectionButton(); UISlicedSprite selBg = sel.transform.FindChild("Background").GetComponent <UISlicedSprite>(); UILabel selLabel = sel.transform.Find("Label").GetComponent <UILabel>(); UISlicedSprite avatarBg = editPlayerAvatar.transform.FindChild("Background").GetComponent <UISlicedSprite>(); UILabel avatarLabel = editPlayerAvatar.transform.Find("Label").GetComponent <UILabel>(); avatarBg.spriteName = selBg.spriteName; avatarLabel.text = selLabel.text; }
public static UIButtonSelection GetSelectedButton(GameObject parent) { var button = GetSelectedButtonSelection(parent); UIButtonSelection selected = null; if (button != null) { selected = button.gameObject.GetComponent <UIButtonSelection>(); } return(selected); }
public static UIButtonSelection GetSelectedButtonSelection(GameObject parent) { UIButtonSelection[] buttons = parent.GetComponentsInChildren <UIButtonSelection>(true); UIButtonSelection selection = null; foreach (UIButtonSelection btn in buttons) { if (btn.selected) { selection = btn; break; } } return(selection); }
protected void OnDeletePlayer() { UIButtonSelection sel = GetCurrentSelectionButton(); int selectionIndex = GetSelectionButtonIndex(sel); var spriteName = convertProfileIndexToSpriteName(selectionIndex + 1); string playerName = "Player " + (selectionIndex + 1).ToString(); sel.transform.FindChild("Label").GetComponent <UILabel>().text = playerName; sel.transform.FindChild("Background").GetComponent <UISlicedSprite>().spriteName = spriteName; int selectedIndex = GetSelectedButtonIndex(); PlayerProfile.current.profiles[selectedIndex] = new PlayerProfile.Profile(playerName, spriteName, ""); PlayerProfile.Save(); Debug.Log("Delete and use SpriteName: " + spriteName); }
static public int GetSelectionButtonIndex(UIButtonSelection sel) { if (profileController == null) { return(0); } int selectionIndex = 0; for (int i = 0; i < profileController.selectionButtons.Length; i++) { if (sel == profileController.selectionButtons[i]) { selectionIndex = i; break; } } return(selectionIndex); }
static public UIButtonSelection GetCurrentSelectionButton() { if (profileController == null) { return(null); } UIButtonSelection selection = null; foreach (UIButtonSelection sel in profileController.selectionButtons) { if (sel.selected) { selection = sel; break; } } return(selection); }
static public int GetSelectedButtonIndex() { if (profileController == null) { return(0); } UIButtonSelection sel = GetCurrentSelectionButton(); int selection = 0; for (; selection < profileController.selectionButtons.Length; selection++) { if (profileController.selectionButtons[selection] == sel) { break; } } return(selection); }
/// <summary> /// Event where a player is selected and Proceed selected to continut to game - Default/Customized /// </summary> protected void OnSelectPlayer() { // Get selected profile UIButtonSelection sel = GetCurrentSelectionButton(); // Get the index of the player profile int selectionIndex = GetSelectionButtonIndex(sel); PlayerProfile.current.selectedProfileIndex = selectionIndex; // Get the current game data slot var dataSlot = GameData.current.GetCurrentDataSlot(); dataSlot.ClearPlayer(); // Add the selected player to it var player = dataSlot.AddPlayer(selectionIndex); // Set the Color Path for the selected player player.colorPath = PlayerProfile.current.GetColorPathFromProfile(selectionIndex); Debug.Log("Player Selection: " + selectionIndex); GameData.Save(); PlayerProfile.Save(); if (dismissOnSelect) { UINavigationController.DismissController(); } else { UINavigationController.PushController(controllerRedirectOnSelect); } }
public static UISlicedSprite GetButtonSprite(UIButtonSelection button) { var btn = button.gameObject.GetComponent<UIButton>(); return GetButtonSprite(btn); }
public static int GetSelectionButtonIndex(UIButtonSelection sel) { if (profileController == null) { return 0; } int selectionIndex = 0; for (int i = 0; i < profileController.selectionButtons.Length; i++) { if (sel == profileController.selectionButtons[i]) { selectionIndex = i; break; } } return selectionIndex; }
public static void SetProfileButton(UIButtonSelection button, string name, string avatar, string piece) { UISlicedSprite selBg = button.transform.FindChild("Background").GetComponent<UISlicedSprite>(); UILabel selLabel = button.transform.Find("Label").GetComponent<UILabel>(); selBg.spriteName = avatar; selLabel.text = name; }
public static UISlicedSprite GetButtonSprite(UIButtonSelection button) { var btn = button.gameObject.GetComponent <UIButton>(); return(GetButtonSprite(btn)); }
private void SetCursor(UIButtonSelection buttonSelection) { if (!inGame) { switch (buttonSelection) { case UIButtonSelection.Spawn: if (spawnCursor) { Cursor.SetCursor(spawnCursor, cursorNewSpot, CursorMode.Auto); } else { Cursor.SetCursor(defaultCursor, cursorDefaultSpot, CursorMode.Auto); } break; case UIButtonSelection.SpawnMace: if (spawnCursor) { Cursor.SetCursor(maceCursor, cursorNewSpot, CursorMode.Auto); } else { Cursor.SetCursor(defaultCursor, cursorDefaultSpot, CursorMode.Auto); } break; case UIButtonSelection.SpawnShield: if (spawnCursor) { Cursor.SetCursor(shieldCursor, cursorNewSpot, CursorMode.Auto); } else { Cursor.SetCursor(defaultCursor, cursorDefaultSpot, CursorMode.Auto); } break; case UIButtonSelection.SpawnHealing: if (spawnCursor) { Cursor.SetCursor(healCursor, cursorNewSpot, CursorMode.Auto); } else { Cursor.SetCursor(defaultCursor, cursorDefaultSpot, CursorMode.Auto); } break; case UIButtonSelection.SpawnMe: if (spawnCursor) { Cursor.SetCursor(circleCursor, cursorNewSpot, CursorMode.Auto); } else { Cursor.SetCursor(defaultCursor, cursorDefaultSpot, CursorMode.Auto); } break; case UIButtonSelection.Destroy: if (spawnCursor) { Cursor.SetCursor(deleteCursor, cursorNewSpot, CursorMode.Auto); } else { Cursor.SetCursor(defaultCursor, cursorDefaultSpot, CursorMode.Auto); } break; case UIButtonSelection.None: Cursor.SetCursor(defaultCursor, cursorDefaultSpot, CursorMode.Auto); break; } } else { Cursor.SetCursor(defaultCursor, cursorDefaultSpot, CursorMode.Auto); } }