Пример #1
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);
        }
Пример #2
0
        public static HUDButton CreateIconClickButton(HUDShape shape,
                                                      float fHUDRadius, float fAngleHorz, float fAngleVert,
                                                      string icon,
                                                      IGameObjectGenerator addGeometry = null)
        {
            Material  mat    = MaterialUtil.CreateTransparentImageMaterial(icon);
            HUDButton button = new HUDButton()
            {
                Shape = shape
            };

            button.Create(mat);
            if (addGeometry != null)
            {
                button.AddVisualElements(addGeometry.Generate(), true);
            }
            HUDUtil.PlaceInSphere(button, fHUDRadius, fAngleHorz, fAngleVert);
            return(button);
        }