public void LoadView() { mBox = new SampleAppUIBox(SampleAppUIConstants.BoxRect, SampleAppUIConstants.MainBackground); mVideoPlaybackLabel = new SampleAppUILabel(SampleAppUIConstants.RectLabelOne, SampleAppUIConstants.VideoPlaybackLabelStyle); string[] aboutStyles = { SampleAppUIConstants.AboutLableStyle, SampleAppUIConstants.AboutLableStyle }; mAboutLabel = new SampleAppUICheckButton(SampleAppUIConstants.RectLabelAbout, false, aboutStyles); string[] extendedTrackingStyles = { SampleAppUIConstants.ExtendedTrackingStyleOff, SampleAppUIConstants.ExtendedTrackingStyleOn }; mExtendedTracking = new SampleAppUICheckButton(SampleAppUIConstants.RectOptionOne, false, extendedTrackingStyles); string[] cameraFlashStyles = { SampleAppUIConstants.CameraFlashStyleOff, SampleAppUIConstants.CameraFlashStyleOn }; mCameraFlashSettings = new SampleAppUICheckButton(SampleAppUIConstants.RectOptionThree, false, cameraFlashStyles); string[] autofocusStyles = { SampleAppUIConstants.AutoFocusStyleOff, SampleAppUIConstants.AutoFocusStyleOn }; mAutoFocusSetting = new SampleAppUICheckButton(SampleAppUIConstants.RectOptionTwo, false, autofocusStyles); string[] playFullScreenStyles = { SampleAppUIConstants.PlayFullscreenModeOff, SampleAppUIConstants.PlayFullscreenModeOn }; mPlayFullscreeSettings = new SampleAppUICheckButton(SampleAppUIConstants.RectOptionSixteen, false, playFullScreenStyles); mCameraLabel = new SampleAppUILabel(SampleAppUIConstants.RectLabelSix, SampleAppUIConstants.CameraLabelStyle); string[,] cameraFacingStyles = new string[2, 2] { { SampleAppUIConstants.CameraFacingFrontStyleOff, SampleAppUIConstants.CameraFacingFrontStyleOn }, { SampleAppUIConstants.CameraFacingRearStyleOff, SampleAppUIConstants.CameraFacingRearStyleOn } }; SampleAppUIRect[] cameraRect = { SampleAppUIConstants.RectOptionsSvnteen, SampleAppUIConstants.RectOptionsEighteen }; mCameraFacing = new SampleAppUIRadioButton(cameraRect, 1, cameraFacingStyles); string[] closeButtonStyles = { SampleAppUIConstants.closeButtonStyleOff, SampleAppUIConstants.closeButtonStyleOn }; mCloseButton = new SampleAppUIButton(SampleAppUIConstants.CloseButtonRect, closeButtonStyles); }
public void LoadView() { m_AboutText = Resources.Load("Vuforia_About") as TextAsset; mBox = new SampleAppUIBox(); 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 if (Screen.height == 1848 && Screen.width == 1200) { 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 { // 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 || UNITY_IOS) 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; //canvas = (Canvas)GameObject.FindGameObjectWithTag ("Canvas"); }
public SampleAppsUILayout() { GUIElements = new List<ISampleAppUIElement>(); SampleAppUIBox box = new SampleAppUIBox(); GUIElements.Add (box); //Header Label mStyleHeader = new GUIStyle(); mStyleHeader.normal.background = Resources.Load("UIStyles/header") as Texture2D; mStyleHeader.font = StyleFont; mStyleHeader.alignment = TextAnchor.MiddleLeft; mStyleHeader.contentOffset = new Vector2(Screen.width * 0.04f, 0); //About Button mStyleAboutButton = new GUIStyle(); mStyleAboutButton.normal.background = Resources.Load("UIStyles/checkedoff") as Texture2D; mStyleAboutButton.active.background = Resources.Load("UIStyles/checkedoff") as Texture2D; mStyleAboutButton.onNormal.background = Resources.Load("UIStyles/checkedoff") as Texture2D; mStyleAboutButton.font = StyleFont; mStyleAboutButton.alignment = TextAnchor.MiddleLeft; mStyleAboutButton.contentOffset = new Vector2(Screen.width * 0.08f, 0); //Sliding options mStyleSlider = new GUIStyle(); mStyleSlider.normal.background = Resources.Load("UIStyles/slideroff") as Texture2D; mStyleSlider.active.background = Resources.Load("UIStyles/slideron") as Texture2D; mStyleSlider.onNormal.background = Resources.Load("UIStyles/slideron") as Texture2D; mStyleSlider.font = StyleFont; mStyleSlider.alignment = TextAnchor.MiddleLeft; mStyleSlider.contentOffset = new Vector2(Screen.width * 0.08f, 0); //Check Toggle options mStyleToggle = new GUIStyle(); mStyleToggle.normal.background = Resources.Load("UIStyles/checkedoff") as Texture2D; mStyleToggle.active.background = Resources.Load("UIStyles/checkedon") as Texture2D; mStyleToggle.onNormal.background = Resources.Load("UIStyles/checkedon") as Texture2D; mStyleToggle.font = StyleFont; mStyleToggle.alignment = TextAnchor.MiddleLeft; mStyleToggle.contentOffset = new Vector2(Screen.width * 0.08f, 0); //Group Labels mStyleGroupLabel = new GUIStyle(); mStyleGroupLabel.normal.background = Resources.Load("UIStyles/label") as Texture2D; mStyleGroupLabel.font = StyleFont; mStyleGroupLabel.alignment = TextAnchor.MiddleLeft; mStyleGroupLabel.contentOffset = new Vector2(Screen.width * 0.08f, 0); //Close Button mStyleCloseButton = new GUIStyle(); mStyleCloseButton.normal.background = Resources.Load("UIStyles/buttonoff") as Texture2D; mStyleCloseButton.active.background = Resources.Load("UIStyles/buttonon") as Texture2D; mStyleCloseButton.onNormal.background = Resources.Load("UIStyles/buttonon") as Texture2D; mStyleCloseButton.font = StyleFont; mStyleCloseButton.alignment = TextAnchor.MiddleCenter; }