////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Build(IHovercastMenuState pMenuState, IBaseItemState pItemState,
                                  float pArcAngle, IItemVisualSettings pSettings)
        {
            vMenuState = pMenuState;
            vItemState = pItemState;
            vSettings  = (ItemVisualSettingsStandard)pSettings;

            ////

            vHoverSlice = new UiHoverMeshSlice(gameObject, true);
            vHoverSlice.UpdateSize(UiItemSelectRenderer.InnerRadius,
                                   UiItemSelectRenderer.OuterRadius, pArcAngle);

            ////

            var labelObj = new GameObject("Label");

            labelObj.transform.SetParent(gameObject.transform, false);
            labelObj.transform.localPosition = new Vector3(0, 0, 1);
            labelObj.transform.localRotation = Quaternion.FromToRotation(Vector3.back, Vector3.right);
            labelObj.transform.localScale    = new Vector3((vMenuState.IsOnLeftSide ? 1 : -1), 1, 1);

            vLabel           = labelObj.AddComponent <UiLabel>();
            vLabel.AlignLeft = vMenuState.IsOnLeftSide;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Build(MenuState pMenuState, IItemVisualSettings pSettings,
                                  float pAngle0, float pAngle1)
        {
            vMenuState = pMenuState;
            vSettings  = (ItemVisualSettingsStandard)pSettings;
            vAngle0    = pAngle0;
            vAngle1    = pAngle1;
            vMeshSteps = (int)Math.Round(Math.Max(2, (vAngle1 - vAngle0) / Math.PI * 60));

            ////

            vBackground = new GameObject("Background");
            vBackground.transform.SetParent(gameObject.transform, false);
            vBackground.AddComponent <MeshRenderer>();

            MeshFilter bgFilt = vBackground.AddComponent <MeshFilter>();

            vBackgroundMesh = bgFilt.mesh;
            BuildMesh(vBackgroundMesh);
            Materials.SetMeshColor(vBackgroundMesh, Color.clear);

            ////

            var labelObj = new GameObject("Label");

            labelObj.transform.SetParent(gameObject.transform, false);
            labelObj.transform.localPosition = new Vector3(0, 0, InnerRadius);
            labelObj.transform.localRotation = Quaternion.FromToRotation(Vector3.back, Vector3.right);
            labelObj.transform.localScale    = new Vector3((vMenuState.IsOnLeftSide ? 1 : -1), 1, 1);

            vLabel           = labelObj.AddComponent <UiLabel>();
            vLabel.AlignLeft = vMenuState.IsOnLeftSide;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void Awake()
        {
            const int width = 8;

            var lblObj = new GameObject("TextEntry");

            lblObj.transform.SetParent(gameObject.transform, false);
            lblObj.transform.localRotation = Quaternion.FromToRotation(Vector3.down, Vector3.back);
            lblObj.transform.localScale    = Vector3.one * 0.05f;

            var lblBgObj = GameObject.CreatePrimitive(PrimitiveType.Quad);

            lblBgObj.transform.SetParent(lblObj.transform, false);
            lblBgObj.transform.localPosition                         = new Vector3(0, 0, 0.01f);
            lblBgObj.transform.localRotation                         = Quaternion.FromToRotation(Vector3.up, Vector3.back);
            lblBgObj.transform.localScale                            = new Vector3(width, 1, 1);
            lblBgObj.GetComponent <Renderer>().material              = new Material(Shader.Find("Unlit/AlphaSelfIllum"));
            lblBgObj.GetComponent <Renderer>().material.color        = new Color(0.1f, 0.1f, 0.1f, 0.666f);
            lblBgObj.GetComponent <Renderer>().material.renderQueue -= 300;

            Color green = HoverboardItemVisualSettingsStandard.Green;

            green.a *= 0.5f;

            vTextEntry = lblObj.AddComponent <UiLabel>();
            vTextEntry.SetSize(width, 1, UiItem.Size * 0.012f);
            vTextEntry.FontName = "Tahoma";
            vTextEntry.FontSize = 60;
            vTextEntry.Color    = green;
            vTextEntry.Alpha    = 1;
            vTextEntry.Label    = "";

            ClearLetters();
        }
Esempio n. 4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Build(MenuState pMenuState, IItemVisualSettings pSettings,
                                  float pAngle0, float pAngle1)
        {
            vMenuState   = pMenuState;
            vSettings    = (ItemVisualSettingsStandard)pSettings;
            vAngle0      = pAngle0;
            vAngle1      = pAngle1;
            vMeshSteps   = (int)Math.Round(Math.Max(2, (vAngle1 - vAngle0) / Math.PI * 60));
            vInnerRadius = 0.17f;

            ////

            vBackground = new GameObject("Background");
            vBackground.transform.SetParent(gameObject.transform, false);
            vBackground.AddComponent <MeshFilter>();
            vBackground.AddComponent <MeshRenderer>();
            vBackground.renderer.sharedMaterial              = new Material(Shader.Find("Unlit/AlphaSelfIllum"));
            vBackground.renderer.sharedMaterial.renderQueue -= 100;
            vBackground.renderer.sharedMaterial.color        = Color.clear;

            BuildMesh(vBackground.GetComponent <MeshFilter>().mesh);

            ////

            var labelObj = new GameObject("Label");

            labelObj.transform.SetParent(gameObject.transform, false);
            labelObj.transform.localPosition = new Vector3(0, 0, vInnerRadius);
            labelObj.transform.localRotation = Quaternion.FromToRotation(Vector3.back, Vector3.right);
            labelObj.transform.localScale    = new Vector3((vMenuState.IsOnLeftSide ? 1 : -1), 1, 1);

            vLabel           = labelObj.AddComponent <UiLabel>();
            vLabel.AlignLeft = vMenuState.IsOnLeftSide;
        }
Esempio n. 5
0
 public BuildingObjectInfo(CBuildingWrapped cbuilding)
 {
     _building     = cbuilding;
     UiLabel.Color = System.Drawing.Color.FromArgb(190, UserConfig.BuildingColour);
     UiLabel.SetText(0, "NAME: " + (_building.ModelName ?? "Unknown"));
     UiLabel.SetText(1, "POSITION:  " + $"{_building.Position.X}, {_building.Position.Y}, {_building.Position.Z}");
     UiLabel.SetText(2, "YMAP:  " + MemoryAccess.GetEntityMapDataName(_building.Address) + ".ymap");
     UiLabel.SetText(3, "Memory Address: 0x" + MemoryAddress.ToString("X"));
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public DemoTextPixels(UiLabel pLabel)
 {
     vUiLabel = pLabel;
     vUiLabel.SetSize(1, 1, 1);
     vUiLabel.FontName = "TahomaPixel16";
     vUiLabel.Alpha    = 1;
     vUiLabel.Color    = Color.red;
     vUiLabel.FontSize = 40;
     vUiLabel.Label    = "Test";
 }
Esempio n. 7
0
 public PropObjectInfo(Prop obj)
 {
     _prop         = obj;
     _modelName    = MemoryAccess.GetEntityName(MemoryAddress);
     UiLabel.Color = System.Drawing.Color.FromArgb(190, UserConfig.ObjectColour);
     UiLabel.SetText(0, "NAME: " + ModelName);
     UiLabel.SetText(1, "POSITION:  " + $"{_prop.Position.X}, {_prop.Position.Y}, {_prop.Position.Z}");
     UiLabel.SetText(2, "YMAP:  " + MemoryAccess.GetEntityMapDataName(MemoryAddress) + ".ymap");
     UiLabel.SetText(3, "Memory Address: 0x" + MemoryAddress.ToString("X"));
 }
 void ReleaseDesignerOutlets()
 {
     if (UiLabel != null)
     {
         UiLabel.Dispose();
         UiLabel = null;
     }
     if (UiTextField != null)
     {
         UiTextField.Dispose();
         UiTextField = null;
     }
 }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void Build(IBaseItemState pItemState, IItemVisualSettings pSettings)
        {
            vItemState      = pItemState;
            vVisualSettings = (ItemVisualSettingsStandard)pSettings;

            float       width  = UiItem.Size * vItemState.Item.Width;
            const float height = UiItem.Size;

            gameObject.transform.SetParent(gameObject.transform, false);
            gameObject.transform.localPosition = new Vector3(width / 2, 0, height / 2f);

            vHoverRect = new UiHoverMeshRect(gameObject);
            vHoverRect.UpdateSize(width, height);

            var labelObj = new GameObject("Label");

            labelObj.transform.SetParent(gameObject.transform, false);
            vLabel = labelObj.AddComponent <UiLabel>();
            vLabel.SetSize(width, height, ArcCanvasScale);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void Awake()
        {
            const int width = 8;

            var lblObj = new GameObject("TextEntry");

            lblObj.transform.SetParent(gameObject.transform, false);
            lblObj.transform.localRotation = Quaternion.FromToRotation(Vector3.down, Vector3.back);
            lblObj.transform.localScale    = Vector3.one * 0.05f;

            var lblBgObj = GameObject.CreatePrimitive(PrimitiveType.Quad);

            lblBgObj.transform.SetParent(lblObj.transform, false);
            lblBgObj.transform.localPosition = new Vector3(0, 0, 0.01f);
            lblBgObj.transform.localRotation = Quaternion.FromToRotation(Vector3.up, Vector3.back);
            lblBgObj.transform.localScale    = new Vector3(width, 1, 1);

            Renderer lblRend = lblBgObj.GetComponent <Renderer>();

            lblRend.material = Materials.GetLayer(Materials.Layer.Background, -2);

            var lblMeshBuild = new MeshBuilder(lblBgObj.GetComponent <MeshFilter>().mesh);

            lblMeshBuild.CommitColors(new Color(0.1f, 0.1f, 0.1f, 0.666f));

            Color green = HoverboardItemVisualSettingsStandard.Green;

            green.a *= 0.5f;

            vTextEntry = lblObj.AddComponent <UiLabel>();
            vTextEntry.SetSize(width, 1, 60 * 0.6f, UiItem.Size * 0.012f);
            vTextEntry.FontName = "Tahoma";
            vTextEntry.FontSize = 60;
            vTextEntry.Color    = green;
            vTextEntry.Alpha    = 1;
            vTextEntry.Label    = "";
            vTextEntry.SetDepthHint(-1);

            ClearLetters();
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Build(IHoverboardPanelState pPanelState,
                                  IHoverboardLayoutState pLayoutState, IBaseItemState pItemState,
                                  IItemVisualSettings pSettings)
        {
            vPanelState  = pPanelState;
            vLayoutState = pLayoutState;
            vItemState   = pItemState;
            vSettings    = (ItemVisualSettingsStandard)pSettings;
            vWidth       = UiItem.Size * vItemState.Item.Width;
            vHeight      = UiItem.Size * vItemState.Item.Height;

            gameObject.transform.SetParent(gameObject.transform, false);
            gameObject.transform.localPosition = new Vector3(vWidth / 2, 0, vHeight / 2f);

            vHoverRect = new UiHoverMeshRectBg(gameObject);
            vHoverRect.UpdateSize(vWidth, vHeight);

            var labelObj = new GameObject("Label");

            labelObj.transform.SetParent(gameObject.transform, false);
            vLabel = labelObj.AddComponent <UiLabel>();
            vLabel.SetSize(vWidth, vHeight, vSettings.TextSize * 0.25f, LabelCanvasScale);
        }
Esempio n. 12
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Build(IHoverboardPanelState pPanelState,
                                  IHoverboardLayoutState pLayoutState, IBaseItemState pItemState,
                                  IItemVisualSettings pSettings)
        {
            vPanelState  = pPanelState;
            vLayoutState = pLayoutState;
            vItemState   = pItemState;
            vSettings    = (ItemVisualSettingsStandard)pSettings;

            gameObject.transform.SetParent(gameObject.transform, false);

            vHoverRect = new UiHoverMeshRect(gameObject);

            var labelObj = new GameObject("Label");

            labelObj.transform.SetParent(gameObject.transform, false);
            vLabel = labelObj.AddComponent <UiLabel>();

            float width  = UiItem.Size * vItemState.Item.Width;
            float height = UiItem.Size * vItemState.Item.Height;

            SetCustomSize(width, height);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void Awake()
        {
            RandomUtil.Init(RandomSeed);

            ////

            var lightObj = new GameObject("Light");

            lightObj.transform.SetParent(gameObject.transform, false);
            lightObj.transform.localPosition = new Vector3(0, 1.5f, 0);

            vLight           = lightObj.AddComponent <Light>();
            vLight.type      = LightType.Point;
            vLight.range     = LightRange;
            vLight.intensity = 1;

            ////

            var pixObj = new GameObject("PixelLabel");

            pixObj.transform.SetParent(gameObject.transform, false);

            UiLabel pix = pixObj.AddComponent <UiLabel>();

            pixObj.SetActive(false);

            vPixels = new DemoTextPixels(pix);

            ////

            /*var boxesObj = new GameObject("Boxes");
             * boxesObj.transform.SetParent(gameObject.transform, false);
             * boxesObj.transform.localPosition = new Vector3(0, 0, 3.5f);
             * boxesObj.transform.localRotation =
             *      Quaternion.FromToRotation(Vector3.up, new Vector3(0, 1, -1.5f).normalized);
             * boxesObj.transform.localScale = Vector3.one*0.2f;
             *
             * vBoxes = boxesObj.AddComponent<DemoBoxes>();*/

            for (int i = 0; i < 6; ++i)
            {
                var lettHoldObj = new GameObject("LetterHold" + i);
                lettHoldObj.transform.SetParent(gameObject.transform, false);

                var lettObj = new GameObject("Letter");
                lettObj.transform.SetParent(lettHoldObj.transform, false);
                lettObj.transform.localScale = Vector3.one * 0.3f;

                var lett = lettObj.AddComponent <DemoLetter>();
                lett.RandomAxis = Random.onUnitSphere;
                vLetterCache.Add(lett);

                lettObj.SetActive(false);
            }

            ////

            for (int i = 0; i < 40; ++i)
            {
                var ringObj = new GameObject("Ring" + i);
                ringObj.transform.SetParent(gameObject.transform, false);
                ringObj.transform.localPosition = Random.onUnitSphere * 2;
                ringObj.transform.localRotation = Random.rotation;

                DemoRing ring = ringObj.AddComponent <DemoRing>();
                ring.Radius = RandomUtil.Float(LightRange * 0.4f) + 3;
            }

            ////

            GameObject ovrObj = GameObject.Find("LeapOVRPlayerController");

            if (ovrObj != null)
            {
                OVRPlayerController ovrPlayer = ovrObj.GetComponent <OVRPlayerController>();
                ovrPlayer.SetSkipMouseRotation(true);
            }
        }
Esempio n. 14
0
 /// <summary>
 /// Draw the entity information.
 /// </summary>
 /// <param name="distance"></param>
 /// <param name="stackedIdx"></param>
 public virtual void Draw(float distance, int stackedIdx)
 {
     UiLabel.DrawAtPosition(MidPoint + DrawOffset, distance, stackedIdx);
 }