//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ 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(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>(); vBackgroundMeshBuilder = new MeshBuilder(); BuildMesh(vBackgroundMeshBuilder); vBackgroundMeshBuilder.Commit(); vBackgroundMeshBuilder.CommitColors(Color.clear); bgFilt.sharedMesh = vBackgroundMeshBuilder.Mesh; //// 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 DemoTextPixels(UiLabel pLabel) { vUiLabel = pLabel; vUiLabel.SetSize(1, 1, 1, 1); vUiLabel.FontName = "TahomaPixel16"; vUiLabel.Alpha = 1; vUiLabel.Color = Color.red; vUiLabel.FontSize = 40; vUiLabel.Label = "Test"; }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ 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 virtual void Build(IHovercastMenuState pMenuState, IBaseItemState pItemState, float pArcAngle, IItemVisualSettings pSettings) { vMenuState = pMenuState; vItemState = pItemState; vSettings = (ItemVisualSettingsStandard)pSettings; //// vHoverSlice = new UiHoverMeshSlice(gameObject); vHoverSlice.UpdateSize(InnerRadius, 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; }