public void LoadView() { mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground); mBackgroundTextureLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.CloudRecognition); string [] extendedTrackingStyle = {UIConstants.ExtendedTrackingStyleOff, UIConstants.ExtendedTrackingStyleOn}; mExtendedTracking = new UICheckButton(UIConstants.RectOptionOne, false, extendedTrackingStyle); string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle }; mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles); string[] cameraFlashStyles = {UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn}; mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionThree, false, cameraFlashStyles); string[] autofocusStyles = {UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn}; mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionTwo, false, autofocusStyles); mCameraLabel = new UILabel(UIConstants.RectLabelTwo, UIConstants.CameraLabelStyle); string[,] cameraFacingStyles = new string[2,2] {{UIConstants.CameraFacingFrontStyleOff, UIConstants.CameraFacingFrontStyleOn},{ UIConstants.CameraFacingRearStyleOff, UIConstants.CameraFacingRearStyleOn}}; UIRect[] cameraRect = { UIConstants.RectOptionFour, UIConstants.RectOptionFive }; mCameraFacing = new UIRadioButton(cameraRect, 1, cameraFacingStyles); string[] closeButtonStyles = {UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn }; mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles); }
//This code displays the box picker void ShowPicker() { //We create a new UIBox with ID: selector and custom type: demoBoxPicker UIBox selectorBox = new UIBox("selector", "demoBoxPicker"); //We change the title using the header variable selectorBox.header = "Select a box"; //We also change the message by using the body variable (Both of these actions aren't required); selectorBox.body = "Click a button to see how that type of box looks!"; //We also add four buttons, the first parameter is the text on the button and the second is the function to call selectorBox.buttons.Add(new UIButton("Message box", ShowMessage)); //The next 3 buttons have 3 parameters, that's because I want them to look like the type of the box they'll open. //The first one doesn't have this parameter because the default style is already Message, so there's no reason to edit it. selectorBox.buttons.Add(new UIButton("Warning box", ShowWarning, BUI.UIType.Warning)); selectorBox.buttons.Add(new UIButton("Succes box", ShowSuccess, BUI.UIType.Success)); selectorBox.buttons.Add(new UIButton("Error box", ShowError, BUI.UIType.Error)); //We also add a button for a custom box. This box will use a custom button type selectorBox.buttons.Add(new UIButton("Custom box", ShowCustomInput, "customInputButton")); //The last button we add will lead us back to the main menu selectorBox.buttons.Add(new UIButton("Main Menu", MainMenu, BUI.UIType.Error)); //In the end, we add our newly created box to the queue system. The BUI system will now ensure it'll be displayed at the right time BUI.Instance.AddToQueue(selectorBox); }
public void LoadView() { mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground); mVideoPlaybackLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.VideoPlaybackLabelStyle); string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle }; mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles); string[] extendedTrackingStyles = { UIConstants.ExtendedTrackingStyleOff, UIConstants.ExtendedTrackingStyleOn }; mExtendedTracking = new UICheckButton(UIConstants.RectOptionOne, false, extendedTrackingStyles); string[] cameraFlashStyles = { UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn }; mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionThree, false, cameraFlashStyles); string[] autofocusStyles = { UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn }; mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionTwo, false, autofocusStyles); mCameraLabel = new UILabel(UIConstants.RectLabelTwo, UIConstants.CameraLabelStyle); string[,] cameraFacingStyles = new string[2, 2] { { UIConstants.CameraFacingFrontStyleOff, UIConstants.CameraFacingFrontStyleOn }, { UIConstants.CameraFacingRearStyleOff, UIConstants.CameraFacingRearStyleOn } }; UIRect[] cameraRect = { UIConstants.RectOptionFour, UIConstants.RectOptionFive }; mCameraFacing = new UIRadioButton(cameraRect, 1, cameraFacingStyles); string[] closeButtonStyles = { UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn }; mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles); }
UIBox CreateDisplay() { newUIbox = Instantiate(UIBoxHolder, new Vector3(this.transform.position.x, this.transform.position.y, 0), Quaternion.identity); newUIbox.transform.SetParent(this.transform.parent); newUIbox.transform.SetAsLastSibling(); return(newUIbox); }
public void LoadView() { mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground); mImageTargetLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.ImageTargetLabelStyle); string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle }; mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles); string[] offTargetTrackingStyles = { UIConstants.ExtendedTrackingStyleOff, UIConstants.ExtendedTrackingStyleOn }; mExtendedTracking = new UICheckButton(UIConstants.RectOptionOne, false, offTargetTrackingStyles); string[] cameraFlashStyles = {UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn}; mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionThree, false, cameraFlashStyles); string[] autofocusStyles = {UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn}; mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionTwo, false, autofocusStyles); mCameraLabel = new UILabel(UIConstants.RectLabelTwo, UIConstants.CameraLabelStyle); string[,] cameraFacingStyles = new string[2,2] {{UIConstants.CameraFacingFrontStyleOff, UIConstants.CameraFacingFrontStyleOn},{ UIConstants.CameraFacingRearStyleOff, UIConstants.CameraFacingRearStyleOn}}; UIRect[] cameraRect = { UIConstants.RectOptionFour, UIConstants.RectOptionFive }; mCameraFacing = new UIRadioButton(cameraRect, 1, cameraFacingStyles); string[,] datasetStyles = new string[2,2] {{UIConstants.StonesAndChipsStyleOff, UIConstants.StonesAndChipsStyleOn}, {UIConstants.TarmacOff, UIConstants.TarmacOn}}; UIRect[] datasetRect = { UIConstants.RectOptionSix, UIConstants.RectOptionSeven}; mDataSet = new UIRadioButton(datasetRect, 0, datasetStyles); mDataSetLabel = new UILabel(UIConstants.RectLabelThree, UIConstants.DatasetLabelStyle); string[] closeButtonStyles = {UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn }; mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles); }
public void LoadView() { mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground); mHeaderLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.UDTTextureStyle); string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle }; mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles); string[] extendedTrackingStyles = { UIConstants.ExtendedTrackingStyleOff, UIConstants.ExtendedTrackingStyleOn }; mExtendedTracking = new UICheckButton(UIConstants.RectOptionOne, false, extendedTrackingStyles); string[] cameraFlashStyles = {UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn}; mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionThree, false, cameraFlashStyles); string[] autofocusStyles = {UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn}; mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionTwo, false, autofocusStyles); mCameraLabel = new UILabel(UIConstants.RectLabelTwo, UIConstants.CameraLabelStyle); string[,] cameraFacingStyles = new string[2,2] {{UIConstants.CameraFacingFrontStyleOff, UIConstants.CameraFacingFrontStyleOn},{ UIConstants.CameraFacingRearStyleOff, UIConstants.CameraFacingRearStyleOn}}; UIRect[] cameraRect = { UIConstants.RectOptionFour, UIConstants.RectOptionFive }; mCameraFacing = new UIRadioButton(cameraRect, 1, cameraFacingStyles); string[] closeButtonStyles = {UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn }; mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles); // Rect rect = new Rect(0.4f * Screen.width, Screen.height - (100 * Screen.width)/800.0f, 0.3f * Screen.width, (70.0f * Screen.width)/800.0f); // string[] newUDTButtonStyles = {"UserInterface/capture_button_normal_XHigh", "UserInterface/capture_button_normal_XHigh"}; // string imageForButton = "UserInterface/icon_camera"; // mNewUserDefinedTargetButton = new UIButton(rect, newUDTButtonStyles, imageForButton); }
//*************************************************************************// void nextscene() { if (Global.email.Equals("*****@*****.**") && Global.signedin == true) { DebugLog(" ADMINscene"); SceneManager.LoadSceneAsync(4); } if (Global.signedin == true && !Global.email.Equals("*****@*****.**")) { DebugLog("NonADMIN scene"); SceneManager.LoadScene(2); } else { DisableUI(); DebugLog(" wrong email or password "); UIBox pasted_message_box = new UIBox("pastedID", "MessageBox"); pasted_message_box.body = " wrong email or password"; pasted_message_box.buttons.Add(new UIButton("OK", close_message_box, "MessageButton")); BUI.Instance.AddToQueue(pasted_message_box); } }
public UIMenu( string title, float xpos, float ypos, float wide = -1f, float high = -1f, string conString = "", InputProfile conProfile = null, bool tiny = false) : base(xpos, ypos, wide, high) { this._controlProfile = conProfile; this._splitter = new UIDivider(false, 0.0f, 4f); this._section = this._splitter.rightSection; UIText uiText = new UIText(title, Color.White); if (tiny) { BitmapFont f = new BitmapFont("smallBiosFontUI", 7, 5); uiText.SetFont(f); } uiText.align |= UIAlign.Top; this._splitter.topSection.Add((UIComponent)uiText, true); this._controlString = conString; if (this._controlString != "" && this._controlString != null) { UIDivider uiDivider = new UIDivider(false, 0.0f, 4f); this._controlText = new UIText(this._controlString, Color.White, heightAdd: 4f, controlProfile: this._controlProfile); uiDivider.bottomSection.Add((UIComponent)this._controlText, true); this.Add((UIComponent)uiDivider, true); this._section = uiDivider.topSection; } base.Add((UIComponent)this._splitter, true); }
private void Awake() { fairy = GameObject.FindGameObjectWithTag("Fairy").GetComponent <Fairy>(); playerMovement = GetComponent <PlayerMovement>(); available = true; mainDialogueUIBox = mainDialogueBox.GetComponent <UIBox>(); }
void close_message_box(UIBox boxInfo, UIButton buttonInfo) { CloseBox(boxInfo.id); EnableUI(); //update_cloud(); //Global.upload_bool = true; //SceneManager.LoadScene(3); }
public void LoadView() { m_AboutText = Resources.Load("Vuforia_About") as TextAsset; mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground); mAboutTitleBgStyle = new GUIStyle(); mOKButtonBgStyle = new GUIStyle(); mAboutTitleBgStyle.normal.background = Resources.Load("UserInterface/grayTexture") as Texture2D; mOKButtonBgStyle.normal.background = Resources.Load("UserInterface/capture_button_normal_XHigh") as Texture2D; mAboutTitleBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; mOKButtonBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; if (Screen.dpi > 300) { // load and set gui style mUISkin = Resources.Load("UserInterface/ButtonSkinsXHDPI") as GUISkin; mUISkin.label.font = Resources.Load("SourceSansPro-Regular") as Font; mAboutTitleBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; mOKButtonBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; } else if (Screen.dpi > 260) { // load and set gui style mUISkin = Resources.Load("UserInterface/ButtonSkins") as GUISkin; mUISkin.label.font = Resources.Load("SourceSansPro-Regular") as Font; mAboutTitleBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; mOKButtonBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; } else { // load and set gui style mUISkin = Resources.Load("UserInterface/ButtonSkinsSmall") as GUISkin; mUISkin.label.font = Resources.Load("SourceSansPro-Regular_Small") as Font; mAboutTitleBgStyle.font = Resources.Load("SourceSansPro-Regular") as Font; mOKButtonBgStyle.font = Resources.Load("SourceSansPro-Regular") as Font; } #if UNITY_IPHONE if (Screen.height > 1500) { // Loads the XHDPI sources for the iPAd 3 mUISkin = Resources.Load("UserInterface/ButtonSkinsiPad3") as GUISkin; mUISkin.label.font = Resources.Load("SourceSansPro-Regular_big_iPad3") as Font; mAboutTitleBgStyle.font = Resources.Load("SourceSansPro-Regular_big_iPad3") as Font; mOKButtonBgStyle.font = Resources.Load("SourceSansPro-Regular_big_iPad3") as Font; } #endif mOKButtonBgStyle.normal.textColor = Color.white; mAboutTitleBgStyle.alignment = TextAnchor.MiddleLeft; mOKButtonBgStyle.alignment = TextAnchor.MiddleCenter; }
public FreeSpacesController(UIBox owner) : base(owner, SpaceConcept.NineSpaceFree) { spaces[L] = InitSpace(SpaceName.Left); spaces[R] = InitSpace(SpaceName.Right); spaces[T] = InitSpace(SpaceName.Top); spaces[B] = InitSpace(SpaceName.Bottom); spaces[C] = InitSpace(SpaceName.Center); spaces[LT] = InitSpace(SpaceName.LeftTop); spaces[RT] = InitSpace(SpaceName.RightTop); spaces[RB] = InitSpace(SpaceName.RightBottom); spaces[LB] = InitSpace(SpaceName.LeftBottom); }
void CreateUIBox(int _x, int _y, int _idx) { GameObject clone = Instantiate(uiBoxPrefab); BOX_COLOR color = (BOX_COLOR)Random.Range(0, 5); clone.transform.SetParent(GameObject.Find("Canvas").transform); UIBox box = clone.GetComponent <UIBox>(); box.Init(color, _x, _y); UIBoxArr[_idx] = box; }
// Use this for initialization void Start() { UIBox choice = new UIBox("choice", BUI.UIType.Message); choice.header = "Menu"; choice.body = "What demo would you like to open?"; choice.buttons.Add(new UIButton("Demo", LoadScene)); choice.buttons.Add(new UIButton("Video Demo", LoadScene)); choice.buttons.Add(new UIButton("Quit", Quit)); BUI.Instance.AddToQueue(choice); }
public UIHolderBox WrapWithHolderBox(int x, int y, UIBox uibox) { //create holder ui var box1 = new UIHolderBox(uibox.Width + 10, uibox.Height + 10); uibox.SetLocation(5, 5); box1.AddChild(uibox); box1.SetLocation(x, y); box1.TargetBox = uibox; SetupActiveBoxProperties(box1); userBoxes.Add(box1); return(box1); }
public static void WriteElement(DzBoxSerializer writer, UIBox uiElement, string elemName) { uiElement.Walk(writer); //writer.BeginElement(elemName); ////collect bounds and attrs //writer.AddAttribute("left", uiElement.Left.ToString()); //writer.AddAttribute("top", uiElement.Top.ToString()); //writer.AddAttribute("width", uiElement.Width.ToString()); //writer.AddAttribute("height", uiElement.Height.ToString()); ////------------------------------------------------------- ////content //writer.EndElement(); }
public UIHolderBox AddExternalControl(int x, int y, UIBox uibox) { //create holder ui var box1 = new UIHolderBox(uibox.Width + 10, uibox.Height + 10); uibox.SetLocation(5, 5); box1.AddChild(uibox); box1.SetLocation(x, y); box1.TargetBox = uibox; SetupActiveBoxProperties(box1); viewport.AddContent(box1); userBoxes.Add(box1); return(box1); }
public void LoadView() { m_AboutText = Resources.Load("Vuforia_About") as TextAsset; mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground); mAboutTitleBgStyle = new GUIStyle(); mOKButtonBgStyle = new GUIStyle(); mAboutTitleBgStyle.normal.background = Resources.Load ("UserInterface/grayTexture") as Texture2D; mOKButtonBgStyle.normal.background = Resources.Load ("UserInterface/capture_button_normal_XHigh") as Texture2D; mAboutTitleBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; mOKButtonBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; if(Screen.dpi > 300 ){ // load and set gui style mUISkin = Resources.Load("UserInterface/ButtonSkinsXHDPI") as GUISkin; mUISkin.label.font = Resources.Load("SourceSansPro-Regular") as Font; mAboutTitleBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; mOKButtonBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; } else if(Screen.dpi > 260 ){ // load and set gui style mUISkin = Resources.Load("UserInterface/ButtonSkins") as GUISkin; mUISkin.label.font = Resources.Load("SourceSansPro-Regular") as Font; mAboutTitleBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; mOKButtonBgStyle.font = Resources.Load("SourceSansPro-Regular_big_xhdpi") as Font; }else{ // load and set gui style mUISkin = Resources.Load("UserInterface/ButtonSkinsSmall") as GUISkin; mUISkin.label.font = Resources.Load("SourceSansPro-Regular_Small") as Font; mAboutTitleBgStyle.font = Resources.Load("SourceSansPro-Regular") as Font; mOKButtonBgStyle.font = Resources.Load("SourceSansPro-Regular") as Font; } #if UNITY_IPHONE if(Screen.height > 1500 ){ // Loads the XHDPI sources for the iPAd 3 mUISkin = Resources.Load("UserInterface/ButtonSkinsiPad3") as GUISkin; mUISkin.label.font = Resources.Load("SourceSansPro-Regular_big_iPad3") as Font; mAboutTitleBgStyle.font = Resources.Load("SourceSansPro-Regular_big_iPad3") as Font; mOKButtonBgStyle.font = Resources.Load("SourceSansPro-Regular_big_iPad3") as Font; } #endif mOKButtonBgStyle.normal.textColor = Color.white; mAboutTitleBgStyle.alignment = TextAnchor.MiddleLeft; mOKButtonBgStyle.alignment = TextAnchor.MiddleCenter; }
public static void WriteCommon(DzBoxSerializer writer, UIBox uiElement) { //find element type //var elemType = uiElement.GetType(); //writer.BeginElement(elemName); ////collect bounds and attrs //writer.AddAttribute("left", uiElement.Left.ToString()); //writer.AddAttribute("top", uiElement.Top.ToString()); //writer.AddAttribute("width", uiElement.Width.ToString()); //writer.AddAttribute("height", uiElement.Height.ToString()); ////------------------------------------------------------- ////content //writer.EndElement(); }
public TutorialState(Game1 game, GraphicsDevice graphicsDevice, ContentManager content) : base(game, graphicsDevice, content) { tutorialTexture1 = _content.Load <Texture2D>(ControlConstants.TUTORIAL_TEXTURE1); tutorialTexture2 = _content.Load <Texture2D>(ControlConstants.TUTORIAL_TEXTURE3); tutorialTexture3 = _content.Load <Texture2D>(ControlConstants.TUTORIAL_TEXTURE2); textures = new Texture2D[3]; textures[0] = tutorialTexture1; textures[1] = tutorialTexture2; textures[2] = tutorialTexture3; Texture2D buttonTexture = _content.Load <Texture2D>(ControlConstants.BUTTON_TEXTURE); SpriteFont buttonFont = _content.Load <SpriteFont>(ControlConstants.BUTTON_FONT); _primaryBox = new UIBox(tutorialTexture1) { UIBoxInfo = ControlConstants.TUTORIAL_TEXTURE_BOX }; Button ExitButton = new Button(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.EXIT_TUTORIAL }; ExitButton.Click += ExitButton_Click; Button NextButton = new Button(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.NEXT_TUTORIAL }; NextButton.Click += NextButton_Click; Button PreviousButton = new Button(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.PREVIOUS_TUTORIAL }; PreviousButton.Click += PreviousButton_Click; _uicomponents = new List <UI_Component>() { _primaryBox, ExitButton, NextButton, PreviousButton }; }
public void LoadView() { mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground); mBackgroundTextureLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.BackgroundTextureStyle); string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle }; mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles); string[] cameraFlashStyles = { UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn }; mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionTwo, false, cameraFlashStyles); string[] autofocusStyles = { UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn }; mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionOne, false, autofocusStyles); string[] closeButtonStyles = { UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn }; mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles); }
public void LoadView() { mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground); mBackgroundTextureLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.BackgroundTextureStyle); string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle }; mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles); string[] cameraFlashStyles = {UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn}; mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionTwo, false, cameraFlashStyles); string[] autofocusStyles = {UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn}; mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionOne, false, autofocusStyles); string[] closeButtonStyles = {UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn }; mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles); }
//This function shows the error box void ShowError(UIBox boxInfo, UIButton buttonInfo) { //We first close the box picker BUI.Instance.CloseBox("selector"); //We then start off by creating a new UIBox with the unique ID 'message' with a UIType of Message UIBox error = new UIBox("error", BUI.UIType.Error); //We change the title to "Message" using the header variable error.header = "Error"; //By changing the body variable we change the message of the box error.body = "This is a error box. This is often used to display errors to the user."; //We also add one button. We do this by creating a new UI button. The first paramater is the text we want the button to have. The second one is the function we want to run error.buttons.Add(new UIButton("Close", CloseButtonPressed)); //When we're done creating the box, we add it to the queue system so that the BUI system can ensure it get's displayed at the right moment. BUI.Instance.AddToQueue(error); }
//Move all boxes so handIndex box is at the front private void moveUI(int handIndex) { float curPlace = InventoryBoxes[handIndex].GetDegrees(); float degrees = 0; //Calculate direction and distance to that position if (Mathf.Abs(curPlace - 45) <= Mathf.Abs(CYCLE_SIZE + 45 - curPlace)) { degrees = -(curPlace - 45); } else { degrees = (float)CYCLE_SIZE + 45 - curPlace; } //Move UI Boxes foreach (UIItemBox UIBox in InventoryBoxes) { UIBox.addDegrees(degrees); } }
static void MoveWithSnapToGrid(UIControllerBox controllerBox, int dx, int dy) { //sample move with snap to grid Point pos = controllerBox.Position; int newX = pos.X + dx; int newY = pos.Y + dy; int gridSize = 5; float halfGrid = (float)gridSize / 2f; int nearestX = (int)((newX + halfGrid) / gridSize) * gridSize; int nearestY = (int)((newY + halfGrid) / gridSize) * gridSize; controllerBox.SetLocation(nearestX, nearestY); UIBox targetBox = controllerBox.TargetBox; if (targetBox != null) { int xdiff = nearestX - pos.X; int ydiff = nearestY - pos.Y; targetBox.SetLocation(targetBox.Left + xdiff, targetBox.Top + ydiff); } }
//This function shows the custom input box void ShowCustomInput(UIBox boxInfo, UIButton buttonInfo) { //We first close the box picker BUI.Instance.CloseBox("selector"); //We then start off by creating a new UIBox with the unique ID 'message' with custom UI type. BUI will load this custom type for you. UIBox custom = new UIBox("customInput", "videoDemoUserInput"); //We change the title to "Message" using the header variable custom.header = "A custom box"; //By changing the body variable we change the message of the box custom.body = "This custom box proves you can make anything you want with BUI. You can even use information from this box in your scripts. Check the " + "video demo for more info."; //We also add one button. We do this by creating a new UI button. The first paramater is the text we want the button to have. The second one is the function we want to run custom.buttons.Add(new UIButton("Close", CloseButtonPressed)); custom.onOpenedCallback = Test; //When we're done creating the box, we add it to the queue system so that the BUI system can ensure it get's displayed at the right moment. BUI.Instance.AddToQueue(custom); }
public BuildStateShipUI(ContentManager _content) { Texture2D buttonTexture = _content.Load <Texture2D>(ControlConstants.BUTTON_TEXTURE); SpriteFont buttonFont = _content.Load <SpriteFont>(ControlConstants.BUTTON_FONT); Texture2D pixelTexture = _content.Load <Texture2D>(Config.PIXEL_TEXTURE); _roomInfo = new TextBox(buttonFont) { TextBoxInfo = ControlConstants.ROOM_INFO_TEXTBOX }; _roomOutline = new UIBox(pixelTexture) { UIBoxInfo = ControlConstants.ROOM_INFO_BOX }; UI_Components = new List <UI_Component>() { _roomInfo, _roomOutline }; }
public void LoadView() { mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground); mImageTargetLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.ImageTargetLabelStyle); string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle }; mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles); string[] offTargetTrackingStyles = { UIConstants.ExtendedTrackingStyleOff, UIConstants.ExtendedTrackingStyleOn }; mExtendedTracking = new UICheckButton(UIConstants.RectOptionOne, false, offTargetTrackingStyles); string[] cameraFlashStyles = { UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn }; mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionThree, false, cameraFlashStyles); string[] autofocusStyles = { UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn }; mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionTwo, false, autofocusStyles); mCameraLabel = new UILabel(UIConstants.RectLabelTwo, UIConstants.CameraLabelStyle); string[,] cameraFacingStyles = new string[2, 2] { { UIConstants.CameraFacingFrontStyleOff, UIConstants.CameraFacingFrontStyleOn }, { UIConstants.CameraFacingRearStyleOff, UIConstants.CameraFacingRearStyleOn } }; UIRect[] cameraRect = { UIConstants.RectOptionFour, UIConstants.RectOptionFive }; mCameraFacing = new UIRadioButton(cameraRect, 1, cameraFacingStyles); string[,] datasetStyles = new string[2, 2] { { UIConstants.StonesAndChipsStyleOff, UIConstants.StonesAndChipsStyleOn }, { UIConstants.TarmacOff, UIConstants.TarmacOn } }; UIRect[] datasetRect = { UIConstants.RectOptionSix, UIConstants.RectOptionSeven }; mDataSet = new UIRadioButton(datasetRect, 0, datasetStyles); mDataSetLabel = new UILabel(UIConstants.RectLabelThree, UIConstants.DatasetLabelStyle); string[] closeButtonStyles = { UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn }; mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles); }
void close_message_box(UIBox boxInfo, UIButton buttonInfo) { CloseBox(boxInfo.id); }
void loadNewTutorialText() { alreadyHit = false; StringArrayIndex++; if (StringArrayIndex == 5 || StringArrayIndex == 8 || StringArrayIndex == 9) { canHitContinue = false; if (StringArrayIndex == 9) { Services.EventManager.Register <PlacedOnCache>(OnCachePlacement); } } else { canHitContinue = true; } if (StringArrayIndex == 4) { controlRoomPicture.DOFade(0f, 1f).OnComplete(() => martianSurface.DOFade(1f, 1f)); game.SetActive(true); grid.DOFade(.4f, 1f).SetDelay(1f); rover.DOFade(1f, 1f); roverArrow.DOFade(1f, 1f).SetDelay(1f); roverArrow.transform.DOMove(new Vector2(roverArrowVector.x, roverArrowVector.y - arrowMoveAmount), 1).SetEase(Ease.InOutQuad).SetLoops(4).SetDelay(1f) .OnComplete(() => roverArrow.DOFade(0f, 1f). OnComplete(() => roverArrow.gameObject.SetActive(false))); } if (StringArrayIndex == 5) { foreach (var butt in fadeableDirectionalIconArray) { butt.gameObject.SetActive(true); butt.image.DOFade(1f, 1f); } foreach (var UIBox in fadeableImageArray) { UIBox.gameObject.SetActive(true); UIBox.DOFade(.8f, 1f); } directionalArrow.DOFade(1f, 1f); directionalArrow.transform.DOMove(new Vector2(directionalArrowVector.x, directionalArrowVector.y - arrowMoveAmount), 1).SetEase(Ease.InOutQuad).SetLoops(4) .OnComplete(() => directionalArrow.DOFade(0f, 1f) .OnComplete(() => directionalArrow.gameObject.SetActive(false))); sendArrow.DOFade(1f, 1f).SetDelay(4f); sendArrow.transform.DOMove(new Vector2(sendArrowVector.x - arrowMoveAmount, sendArrowVector.y), 1).SetEase(Ease.InOutQuad).SetLoops(4).SetDelay(4f) .OnComplete(() => sendArrow.DOFade(0f, 1f). OnComplete(() => sendArrow.gameObject.SetActive(false))); } if (StringArrayIndex == 6) { //reset the rover myLevelLoader.LoadLevel(Services.GameController.currentLevel); } if (StringArrayIndex == 7) { obstacleArrow1.DOFade(1f, 1f); obstacleArrow2.DOFade(1f, 1f); obstacleArrow1.transform .DOMove(new Vector2(obstacleArrow1Vector.x, obstacleArrow1Vector.y - arrowMoveAmount), 1) .SetEase(Ease.InOutQuad).SetLoops(4) .OnComplete(() => obstacleArrow1.DOFade(0f, 1f)); obstacleArrow2.transform .DOMove(new Vector2(obstacleArrow2Vector.x, obstacleArrow2Vector.y - arrowMoveAmount), 1) .SetEase(Ease.InOutQuad).SetLoops(4) .OnComplete(() => obstacleArrow2.DOFade(0f, 1f)); } if (StringArrayIndex == 8) { pickupButton.image.DOFade(1f, 1f); sampleArrow.DOFade(1f, 1f); sampleArrow.transform.DOMove(new Vector2(sampleArrowVector.x - arrowMoveAmount, sampleArrowVector.y), 1).SetEase(Ease.InOutQuad).SetLoops(4) .OnComplete(() => sampleArrow.DOFade(0f, 1f). OnComplete(() => sampleArrow.gameObject.SetActive(false))); pickupArrow.DOFade(1f, 1f).SetDelay(3f); pickupArrow.transform.DOMove(new Vector2(pickupArrowVector.x, pickupArrowVector.y - arrowMoveAmount), 1).SetEase(Ease.InOutQuad).SetLoops(4) .SetDelay(3f) .OnComplete(() => pickupArrow.DOFade(0f, 1f). OnComplete(() => pickupArrow.gameObject.SetActive(false))); } if (StringArrayIndex == 9) { dropoffButton.image.DOFade(1f, 1f); cacheArrow.DOFade(1f, 1f); cacheArrow.transform.DOMove(new Vector2(cacheArrowVector.x - arrowMoveAmount, cacheArrowVector.y), 1).SetEase(Ease.InOutQuad).SetLoops(4) .OnComplete(() => cacheArrow.DOFade(0f, 1f). OnComplete(() => cacheArrow.gameObject.SetActive(false))); dropoffArrow.DOFade(1f, 1f).SetDelay(3f); dropoffArrow.transform.DOMove(new Vector2(dropoffArrowVector.x - arrowMoveAmount, dropoffArrowVector.y), 1).SetEase(Ease.InOutQuad).SetLoops(4) .SetDelay(3f) .OnComplete(() => dropoffArrow.DOFade(0f, 1f). OnComplete(() => dropoffArrow.gameObject.SetActive(false))); } if (StringArrayIndex == tutorialStringArray.Length) { //SceneManager.LoadScene(1); Services.GameController.intro = null; Destroy(gameObject); Services.GameController.currentLevel++; Services.GameController.levelLoader.LoadLevel(Services.GameController.currentLevel); } else { tutorialText.text = tutorialStringArray[StringArrayIndex]; } }
public override void Initialize() { Layer.Add((Layer) new GridBackground("GRID", 99999)); this._font = new BitmapFont("duckFont", 8); this._font.scale = new Vec2(2f, 2f); Gun gun = (Gun) new Saxaphone(0.0f, 0.0f); gun.scale = new Vec2(2f, 2f); UIMenu uiMenu = new UIMenu(gun.editorName, Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 220f); UIBox uiBox1 = new UIBox(false, false); UIImage uiImage = new UIImage(gun.GetEditorImage(64, 64, true)); uiImage.collisionSize = new Vec2(64f, 32f); uiBox1.Add((UIComponent)uiImage, true); UIBox uiBox2 = new UIBox(isVisible: false); uiBox2.Add((UIComponent) new UIText("AMMO: " + (gun.ammo > 900 ? "INFINITE" : gun.ammo.ToString()), Color.White, UIAlign.Left), true); string str1 = "SHORT"; if ((double)gun.ammoType.range > 150.0) { str1 = "MEDIUM"; } if ((double)gun.ammoType.range > 300.0) { str1 = "LONG"; } if ((double)gun.ammoType.range > 600.0) { str1 = "EXTREME"; } uiBox2.Add((UIComponent) new UIText("RANGE: " + str1, Color.White, UIAlign.Left), true); if ((double)gun.ammoType.penetration > 0.0) { uiBox2.Add((UIComponent) new UIText("PENETRATION: " + (object)gun.ammoType.penetration, Color.White, UIAlign.Left), true); } else { uiBox2.Add((UIComponent) new UIText("SPECIAL AMMO", Color.White, UIAlign.Left), true); } uiBox1.Add((UIComponent)uiBox2, true); uiMenu.Add((UIComponent)uiBox1, true); UIBox uiBox3 = new UIBox(isVisible: false); uiBox3.Add((UIComponent) new UIText("---------------------", Color.White), true); float num = 190f; string str2 = gun.bio; string textVal = ""; string str3 = ""; while (true) { if (str2.Length > 0 && str2[0] != ' ') { str3 += (string)(object)str2[0]; } else { if ((double)((textVal.Length + str3.Length) * 8) > (double)num) { uiBox3.Add((UIComponent) new UIText(textVal, Color.White), true); textVal = ""; } if (textVal.Length > 0) { textVal += " "; } textVal += str3; str3 = ""; } if (str2.Length != 0) { str2 = str2.Remove(0, 1); } else { break; } } if (str3.Length > 0) { if (textVal.Length > 0) { textVal += " "; } textVal += str3; } if (textVal.Length > 0) { uiBox3.Add((UIComponent) new UIText(textVal, Color.White), true); } uiMenu.Add((UIComponent)uiBox3, true); Level.Add((Thing)uiMenu); }
public DzSetBoundsAction(UIBox box, Rectangle oldBounds, Rectangle newBounds) { this.dzBox = box; this.oldBounds = oldBounds; this.newBounds = newBounds; }
public DzSetLocationAction(UIBox box, Point oldPoint, Point newPoint) { this.dzBox = box; this.oldPoint = oldPoint; this.newPoint = newPoint; }
void Quit(UIBox boxInfo, UIButton buttonInfo) { Application.Quit(); }
void LoadScene(UIBox boxInfo, UIButton buttonInfo) { SceneManager.LoadScene(buttonInfo.buttonText); }