Exemple #1
0
        public static void ShowCenteredPopupMessage(string sTitleText, string sText, Cockpit cockpit)
        {
            HUDPopupMessage message = new HUDPopupMessage()
            {
                Width           = 500 * cockpit.GetPixelScale(), Height = 250 * cockpit.GetPixelScale(),
                TitleTextHeight = 30 * cockpit.GetPixelScale(),
                TextHeight      = 20 * cockpit.GetPixelScale(),
                BackgroundColor = Colorf.Silver,
                TextColor       = Colorf.VideoBlack,
                TitleText       = sTitleText,
                Text            = sText
            };

            message.Create();
            if (FPlatform.IsUsingVR())
            {
                HUDUtil.PlaceInSphere(message, 0.5f, 0, 0);
            }
            else
            {
                HUDUtil.PlaceInSphere(message, 1.5f, 0, 0);
            }
            message.Name = "popup";
            cockpit.AddUIElement(message, true);
            message.OnDismissed += (s, e) => {
                AnimatedDimiss_Cockpit(message, cockpit, true);
            };
            AnimatedShow(message);
        }
Exemple #2
0
        public static void ShowToastStaticPopupMessage(string sImagePath, Cockpit cockpit)
        {
            Material mat     = MaterialUtil.CreateTransparentImageMaterial(sImagePath);
            float    fAspect = (float)mat.mainTexture.width / (float)mat.mainTexture.height;
            float    fScale  = 2.0f;    // should this be a parameter??

            HUDPopupMessage message = new HUDPopupMessage()
            {
                Shape = new HUDShape()
                {
                    Type           = HUDShapeType.Rectangle, Width = fScale * 1.0f, Height = fScale * 1.0f / fAspect,
                    UseUVSubRegion = false
                }
            };

            message.Create(mat);
            HUDUtil.PlaceInSphere(message, 3.0f, 30, -10);
            UnityUtil.TranslateInFrame(message.RootGameObject, 0.75f, -0.5f, 0.0f, CoordSpace.WorldCoords);
            message.Name = "popup";
            cockpit.AddUIElement(message, true);
            message.OnDismissed += (s, e) => {
                AnimatedDimiss_Cockpit(message, cockpit);
            };
            AnimatedShow(message, 0.5f);
        }
Exemple #3
0
        public static void ShowToastPopupMessage(string sText, Cockpit cockpit, float heightScale = 1.0f, float textScale = 1.0f)
        {
            // [TODO] should size based on VR or not-VR...for VR use visual radius?

            HUDPopupMessage message = new HUDPopupMessage()
            {
                Width           = 500 * cockpit.GetPixelScale(), Height = heightScale * 150 * cockpit.GetPixelScale(),
                TextHeight      = textScale * 50 * cockpit.GetPixelScale(),
                BackgroundColor = Colorf.DarkYellow,
                TextColor       = Colorf.VideoBlack,
                Text            = sText
            };

            message.Create();
            HUDUtil.PlaceInSphere(message, 1.0f, 30, -30);
            message.Name = "popup";
            cockpit.AddUIElement(message, true);
            message.OnDismissed += (s, e) => {
                AnimatedDimiss_Cockpit(message, cockpit, true);
            };
            AnimatedShow(message, 0.5f);
        }