private BaseLayout createContentLayout() { contentHolder = new LinearLayout(); contentHolder.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT)); contentHolder.invertDirection = true; contentHolder.addItem(createSwitchViewLayout()); SizeParams fityPercentWidthSizeParams = new SizeParams(); fityPercentWidthSizeParams.WidthPercent = 50.0f; fityPercentWidthSizeParams.Height = MATCH_PARENT; jsonInput = new LinearLayout(); jsonInput.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT)); jsonInput.setDirection(Direction.HORIZONTAL); LinearLayout json1Column = new LinearLayout(); json1Column.setSizeParams(fityPercentWidthSizeParams); json1Column.addItem(createJsonHeaderLayout("Left JSON")); EditTextLayout json1Text = new EditTextLayout(); json1Text.edgeColor = new Color(0, 122, 204); json1Text.setSizeParams(new SizeParams(MATCH_PARENT, FILL)); json1Column.addItem(json1Text); json1Text.susbcribeToTextChanges(() => { model.setjson1(json1Text.getText()); }); json1Text.setText(Properties.Resources.TextFile1); LinearLayout json2Column = new LinearLayout(); json2Column.setSizeParams(fityPercentWidthSizeParams); json2Column.addItem(createJsonHeaderLayout("Right JSON")); EditTextLayout json2Text = new EditTextLayout(); json2Text.edgeColor = new Color(0, 122, 204); json2Text.setSizeParams(new SizeParams(MATCH_PARENT, FILL)); json2Column.addItem(json2Text); json2Text.susbcribeToTextChanges(() => { model.setjson2(json2Text.getText()); }); json2Text.setText(Properties.Resources.TextFile1); jsonInput.addItem(json1Column); jsonInput.addItem(json2Column); jsonResultLayout = new JsonLayout(); contentHolder.addItem(jsonInput); return(contentHolder); }
private BaseLayout createBody() { LinearLayout horizontal = new LinearLayout(); horizontal.setDirection(LinearLayout.Direction.HORIZONTAL); horizontal.setSizeParams(new SizeParams(MATCH_PARENT, FILL)); CustomPlacementLayout keysHeader = new CustomPlacementLayout(); keysHeader.setSizeParams(new SizeParams(MATCH_PARENT, 30)); TextBoxLayout headerText = new TextBoxLayout(); headerText.text = "Comparison Keys"; headerText.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS)); headerText.setPositionParams(new PositionParams(5, 4)); headerText.textColor = uiWhite; keysHeader.addChild(headerText); ColoredLayout greyBody = new ColoredLayout(); greyBody.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT)); greyBody.color = new Color(90, 90, 90); ColoredLayout dargerGreyBody = new ColoredLayout(); dargerGreyBody.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT)); dargerGreyBody.color = new Color(70, 70, 70); SizeParams thirdWidthSizeParams = new SizeParams(); thirdWidthSizeParams.Width = 250; thirdWidthSizeParams.Height = MATCH_PARENT; LinearLayout keysColumn = new LinearLayout(); keysColumn.setSizeParams(thirdWidthSizeParams); keysColumn.addItem(keysHeader); keysColumn.addItem(createKeysLayout()); horizontal.addItem(keysColumn); BaseLayout switchableSection = createContentLayout(); switchableSection.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT)); horizontal.addItem(switchableSection); return(horizontal); }
public static float3 MakePosition( int index, float time, SizeParams sizes, NoiseFuncKinds noiseFunc ) { int row = index / sizes.NumberPerRow; int col = (index - (row * sizes.NumberPerRow)) % sizes.NumberPerRow; float2 xyPos = new float2(col * sizes.ColumnWidth, row * sizes.RowHeight); float height = NOISE_FUNCTION(xyPos, time, noiseFunc); return(new float3(xyPos.x, height, xyPos.y)); }
public static JobHandle Begin( NativeArray <float3> positions, SizeParams sizes, NoiseFuncKinds noiseFunc ) { var job = new NoisePositionJob() { Time = UnityEngine.Time.realtimeSinceStartup, Positions = positions, Sizes = sizes, NoiseFunction = noiseFunc }; if (sizes.NumberOfRows == 0 || sizes.NumberPerRow == 0) { Debug.LogWarning($"Sizes - {sizes}"); } return(IJobParallelForExtensions.Schedule(job, positions.Length, BATCH_SIZE)); }
bool isHeightDependantOnParent(SizeParams parameters) { return(parameters.Height == MATCH_PARENT || parameters.Height == FILL || parameters.HeightPercent > 0); }
bool isWidthDependantOnParent(SizeParams parameters) { return(parameters.Width == MATCH_PARENT || parameters.Width == FILL || parameters.WidthPercent > 0); }
public static string ToString(SizeParams sizes) { return($"SizeParams: Num / row: {sizes.NumberPerRow} Num of Rows: {sizes.NumberOfRows}"); }
public void setSizeParams(SizeParams sizeParams) { this.sizeParams = sizeParams; }
private static Bounds calcualteChildRect(Rect parentRect, SizeParams sizeParams, PositionParams positionParams, Rect contentRect) { Bounds bounds = new Bounds(); int childWidth = 0; if (sizeParams.Width == WRAP_CONTENTS) { childWidth = (int)contentRect.Width; } else if (sizeParams.WidthPercent != FILL && sizeParams.WidthPercent != MATCH_PARENT) { childWidth = (int)(parentRect.Width * sizeParams.WidthPercent / 100.0f); } else if (sizeParams.Width == MATCH_PARENT) { childWidth = (int)parentRect.Width; } else if (sizeParams.Width >= 0) { childWidth = (int)sizeParams.Width; } else { childWidth = (int)parentRect.Width; } int childHeight = 0; if (sizeParams.Height == WRAP_CONTENTS) { childHeight = (int)contentRect.Height; } else if (sizeParams.HeightPercent != FILL && sizeParams.HeightPercent != MATCH_PARENT) { childHeight = (int)(parentRect.Height * sizeParams.HeightPercent / 100.0f); } else if (sizeParams.Height == MATCH_PARENT) { childHeight = (int)parentRect.Height; } else if (sizeParams.Height >= 0) { childHeight = (int)sizeParams.Height; } else { childHeight = (int)parentRect.Height; } int childXPos; if (positionParams.xPos == CENTER) { childXPos = (int)parentRect.Left + (int)((parentRect.Width / 2.0f) - childWidth / 2); } else { childXPos = (int)parentRect.Left + (int)positionParams.xPos; } int childYPos; if (positionParams.yPos == CENTER) { childYPos = (int)parentRect.Top + (int)((parentRect.Height / 2.0f) - childHeight / 2); } else { childYPos = (int)parentRect.Top + (int)positionParams.yPos; } bounds.rect = new Rect(childXPos, childYPos, childWidth, childHeight); return(bounds); }