Merge pull request #435 from Unity-UI-Extensions/fix/resolveflowoverflow
Resolve FlowLayoutGroup overflow issuepull/436/head^2
commit
a45509ee55
|
@ -1,10 +1,10 @@
|
|||
name: Build and test UPM packages for platforms on all available Unity Versions
|
||||
name: Build and test UPM packages for platforms, all branches except main
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches-ignore:
|
||||
- 'release'
|
||||
# Ignore PRs targetting main
|
||||
# Ignore PRs targeting main
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
@ -14,6 +14,7 @@ concurrency:
|
|||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# Check Unity version required by the package
|
||||
# Run Unity build unit tests defined in the package for a single version for feature branches
|
||||
Run-Partial-Unit-Tests:
|
||||
name: Run Unity Unit Tests
|
||||
|
@ -27,11 +28,3 @@ jobs:
|
|||
name: Run Unity Unit Tests
|
||||
if: github.ref == 'refs/heads/development'
|
||||
uses: ./.github/workflows/rununitybuildmultiversion.yml
|
||||
|
||||
# Update the package release version
|
||||
Update-Version:
|
||||
name: Update Package Version
|
||||
uses: ./.github/workflows/tagrelease.yml
|
||||
with:
|
||||
build-target: windows
|
||||
secrets: inherit
|
|
@ -0,0 +1,26 @@
|
|||
name: Publish development branch on Merge
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
branches:
|
||||
- development
|
||||
# On close of PR targeting development
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
release_on_merge:
|
||||
if: github.event.pull_request.merged == true
|
||||
name: Tag and Publish UPM package
|
||||
uses: ./.github/workflows/upversionandtagrelease.yml
|
||||
with:
|
||||
build-host: ubuntu-latest
|
||||
build-type: pre-release
|
||||
secrets: inherit
|
|
@ -0,0 +1,91 @@
|
|||
name: Publish main branch and increment version
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
# Get Version to tag and release the branch, no up-version - [no-ver] included in PR title
|
||||
validate-environment:
|
||||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, 'no-ver')
|
||||
name: Get Version from UPM package
|
||||
uses: ./.github/workflows/getpackageversionfrompackage.yml
|
||||
with:
|
||||
build-host: ubuntu-latest
|
||||
|
||||
# Perform tagging
|
||||
release-Package-only:
|
||||
needs: validate-environment
|
||||
name: Release package only, no upversion
|
||||
uses: ./.github/workflows/tagrelease.yml
|
||||
with:
|
||||
build-host: ubuntu-latest
|
||||
version: ${{ needs.validate-environment.outputs.packageversion }}
|
||||
secrets: inherit
|
||||
|
||||
# Up version the release and publish major release
|
||||
upversion-major-Package:
|
||||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, 'no-ver') == false && contains(github.event.pull_request.title, 'major-release')
|
||||
name: Major Version package and release
|
||||
uses: ./.github/workflows/upversionandtagrelease.yml
|
||||
with:
|
||||
build-host: ubuntu-latest
|
||||
build-type: major
|
||||
secrets: inherit
|
||||
|
||||
# Up version the release and publish minor release
|
||||
upversion-minor-Package:
|
||||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, 'no-ver') == false && contains(github.event.pull_request.title, 'minor-release')
|
||||
name: Minor Version package and release
|
||||
uses: ./.github/workflows/upversionandtagrelease.yml
|
||||
with:
|
||||
build-host: ubuntu-latest
|
||||
build-type: minor
|
||||
secrets: inherit
|
||||
|
||||
# Up version the release and publish patch release (default)
|
||||
upversion-patch-Package:
|
||||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, 'no-ver') == false && contains(github.event.pull_request.title, 'minor-release') == false && contains(github.event.pull_request.title, 'major-release') == false
|
||||
name: Patch Version package and release
|
||||
uses: ./.github/workflows/upversionandtagrelease.yml
|
||||
with:
|
||||
build-host: ubuntu-latest
|
||||
build-type: patch-release
|
||||
secrets: inherit
|
||||
|
||||
release-Complete:
|
||||
if: ${{ always() }}
|
||||
needs: [upversion-major-Package, upversion-minor-Package, upversion-patch-Package, release-Package-only]
|
||||
name: Release complete
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Script Version
|
||||
run: echo "Release done, updating Development"
|
||||
|
||||
# Refresh the development branch with the main publish
|
||||
refresh-development:
|
||||
if: ${{ always() }}
|
||||
needs: [release-Complete]
|
||||
name: Refresh development branch
|
||||
uses: ./.github/workflows/refreshbranch.yml
|
||||
with:
|
||||
build-host: ubuntu-latest
|
||||
target-branch: development
|
||||
source-branch: main
|
||||
secrets: inherit
|
||||
|
||||
# Up version the development branch ready for future development
|
||||
upversion-development:
|
||||
if: ${{ always() }}
|
||||
needs: [refresh-development]
|
||||
name: UpVersion the development branch for the next release
|
||||
uses: ./.github/workflows/upversionandtagrelease.yml
|
||||
with:
|
||||
build-host: ubuntu-latest
|
||||
build-type: patch
|
||||
target-branch: development
|
||||
createTag: false
|
||||
secrets: inherit
|
|
@ -0,0 +1,43 @@
|
|||
name: Refresh branch
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
build-host:
|
||||
required: true
|
||||
type: string
|
||||
target-branch:
|
||||
required: true
|
||||
type: string
|
||||
source-branch:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
packageRelease:
|
||||
name: Refresh ${{ inputs.target-branch }} branch from ${{ inputs.source-branch }} branch
|
||||
runs-on: ${{ inputs.build-host }}
|
||||
steps:
|
||||
- name: Script Version
|
||||
run: |
|
||||
echo "::group::Script Versioning"
|
||||
$scriptVersion = "1.0.1"
|
||||
echo "Build Script Version: $scriptVersion"
|
||||
echo "::endgroup::"
|
||||
shell: pwsh
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ inputs.target-branch }}
|
||||
clean: true
|
||||
token: ${{ secrets.GIT_PAT }}
|
||||
- name: Refresh from Source Branch
|
||||
run: |
|
||||
git pull origin ${{ inputs.source-branch }}
|
||||
git commit -m "Branch ${{ inputs.target-branch }} updated with changes from ${{ inputs.source-branch }} [skip ci]"
|
||||
git push origin ${{ inputs.target-branch }}
|
||||
echo "Branch ${{ inputs.target-branch }} updated with changes from ${{ inputs.source-branch }}"
|
||||
shell: pwsh
|
|
@ -80,7 +80,7 @@ jobs:
|
|||
name: 'Run Unity Builds'
|
||||
run: |
|
||||
echo "::group::Set Hub and editor locations"
|
||||
$unityVersion = ${{ matrix.unityVersion }}
|
||||
$unityVersion = '${{ matrix.unityVersion }}'
|
||||
|
||||
echo "::group::Set Hub and editor locations"
|
||||
|
||||
|
@ -90,6 +90,7 @@ jobs:
|
|||
$hubPath = "C:\Program Files\Unity Hub\Unity Hub.exe"
|
||||
$editorRootPath = "C:\Program Files\Unity\Hub\Editor\"
|
||||
$editorFileEx = "\Editor\Unity.exe"
|
||||
$directorySeparatorChar = "\"
|
||||
|
||||
#"Unity Hub.exe" -- --headless help
|
||||
#. 'C:\Program Files\Unity Hub\Unity Hub.exe' -- --headless help
|
||||
|
@ -103,6 +104,7 @@ jobs:
|
|||
$hubPath = "/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"
|
||||
$editorRootPath = "/Applications/Unity/Hub/Editor/"
|
||||
$editorFileEx = "/Unity.app/Contents/MacOS/Unity"
|
||||
$directorySeparatorChar = "/"
|
||||
|
||||
# /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless help
|
||||
function unity-hub
|
||||
|
@ -115,6 +117,7 @@ jobs:
|
|||
$hubPath = "$HOME/Unity Hub/UnityHub.AppImage"
|
||||
$editorRootPath = "$HOME/Unity/Hub/Editor/"
|
||||
$editorFileEx = "/Editor/Unity"
|
||||
$directorySeparatorChar = "/"
|
||||
|
||||
# /UnityHub.AppImage --headless help
|
||||
# xvfb-run --auto-servernum "$HOME/Unity Hub/UnityHub.AppImage" --headless help
|
||||
|
@ -126,8 +129,6 @@ jobs:
|
|||
|
||||
echo "::endgroup::"
|
||||
|
||||
|
||||
|
||||
echo "::group::Get String function to query a string for a value"
|
||||
|
||||
function GetString($InputString, $InputPattern, $MatchIndex)
|
||||
|
@ -151,7 +152,6 @@ jobs:
|
|||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Get Installed Unity version based on Matrix"
|
||||
echo 'Script Start'
|
||||
echo "Unity hub path is {$hubPath}"
|
||||
echo "Requested unity version is {$unityVersion}"
|
||||
|
||||
|
@ -171,7 +171,7 @@ jobs:
|
|||
$queryUnityVersion = GetString $InstalledUnityVersions "$unityVersion" -MatchIndex 0
|
||||
}
|
||||
|
||||
echo "Found unity version is {$queryUnityVersion}"
|
||||
echo "Found unity version is {$queryUnityVersion} for input {$unityVersion}"
|
||||
|
||||
if ($queryUnityVersion -ne 0)
|
||||
{
|
||||
|
|
|
@ -40,12 +40,11 @@ jobs:
|
|||
with:
|
||||
submodules: recursive
|
||||
clean: true
|
||||
|
||||
- id: build
|
||||
name: 'Run Unity Builds'
|
||||
run: |
|
||||
echo "::group::Set Hub and editor locations"
|
||||
$unityVersion = ${{ inputs.unityVersion }}
|
||||
$unityVersion = '${{ inputs.unityVersion }}'
|
||||
|
||||
echo "::group::Set Hub and editor locations"
|
||||
|
||||
|
@ -55,6 +54,7 @@ jobs:
|
|||
$hubPath = "C:\Program Files\Unity Hub\Unity Hub.exe"
|
||||
$editorRootPath = "C:\Program Files\Unity\Hub\Editor\"
|
||||
$editorFileEx = "\Editor\Unity.exe"
|
||||
$directorySeparatorChar = "\"
|
||||
|
||||
#"Unity Hub.exe" -- --headless help
|
||||
#. 'C:\Program Files\Unity Hub\Unity Hub.exe' -- --headless help
|
||||
|
@ -68,6 +68,7 @@ jobs:
|
|||
$hubPath = "/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"
|
||||
$editorRootPath = "/Applications/Unity/Hub/Editor/"
|
||||
$editorFileEx = "/Unity.app/Contents/MacOS/Unity"
|
||||
$directorySeparatorChar = "/"
|
||||
|
||||
# /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless help
|
||||
function unity-hub
|
||||
|
@ -80,6 +81,7 @@ jobs:
|
|||
$hubPath = "$HOME/Unity Hub/UnityHub.AppImage"
|
||||
$editorRootPath = "$HOME/Unity/Hub/Editor/"
|
||||
$editorFileEx = "/Editor/Unity"
|
||||
$directorySeparatorChar = "/"
|
||||
|
||||
# /UnityHub.AppImage --headless help
|
||||
# xvfb-run --auto-servernum "$HOME/Unity Hub/UnityHub.AppImage" --headless help
|
||||
|
@ -91,8 +93,6 @@ jobs:
|
|||
|
||||
echo "::endgroup::"
|
||||
|
||||
|
||||
|
||||
echo "::group::Get String function to query a string for a value"
|
||||
|
||||
function GetString($InputString, $InputPattern, $MatchIndex)
|
||||
|
@ -115,8 +115,7 @@ jobs:
|
|||
}
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Get Installed Unity version based on Matrix"
|
||||
echo 'Script Start'
|
||||
echo "::group::Find Installed Unity version based on input"
|
||||
echo "Unity hub path is {$hubPath}"
|
||||
echo "Requested unity version is {$unityVersion}"
|
||||
|
||||
|
@ -136,7 +135,7 @@ jobs:
|
|||
$queryUnityVersion = GetString $InstalledUnityVersions "$unityVersion" -MatchIndex 0
|
||||
}
|
||||
|
||||
echo "Found unity version is {$queryUnityVersion}"
|
||||
echo "Found unity version is {$queryUnityVersion} for input {$unityVersion}"
|
||||
|
||||
if ($queryUnityVersion -ne 0)
|
||||
{
|
||||
|
|
|
@ -1,33 +1,26 @@
|
|||
name: Package UPM project and deploy
|
||||
name: Tag Release
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
build-target:
|
||||
build-host:
|
||||
required: true
|
||||
type: string
|
||||
build-type:
|
||||
required: false
|
||||
default: 'pre-release'
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
# options:
|
||||
# - major
|
||||
# - minor
|
||||
# - patch
|
||||
# - pre-release
|
||||
# - build
|
||||
outputs:
|
||||
packageversion:
|
||||
description: "Returns the version of Unity the UPM package requires"
|
||||
value: ${{ jobs.packageRelease.outputs.packageversion }}
|
||||
secrets:
|
||||
GIT_USER_NAME:
|
||||
required: false
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
packageRelease:
|
||||
name: Package UPM Project and tag
|
||||
runs-on: ${{ inputs.build-target }}
|
||||
runs-on: ${{ inputs.build-host }}
|
||||
outputs:
|
||||
packageversion: ${{ steps.getpackageversion.outputs.packageversion }}
|
||||
steps:
|
||||
|
@ -40,6 +33,7 @@ jobs:
|
|||
shell: pwsh
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
clean: true
|
||||
token: ${{ secrets.GIT_PAT }}
|
||||
|
@ -60,87 +54,26 @@ jobs:
|
|||
$gitUser = "${{ secrets.GIT_USER_NAME }}"
|
||||
$gitEmail = "$gitUser@users.noreply.github.com"
|
||||
}
|
||||
echo "email $gitUser@users.noreply.github.com"
|
||||
git config --global user.email "$gitUser@users.noreply.github.com"
|
||||
git config --global user.name "$gitUser"
|
||||
shell: pwsh
|
||||
- id: getpackageversion
|
||||
name: Bump UPM Package version
|
||||
- name: Check if Tag Exists
|
||||
run: |
|
||||
function UpdateProjectVersionJSON {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
$type,
|
||||
$packageFile = 'package.json'
|
||||
)
|
||||
<#
|
||||
Type of build can be one of the following
|
||||
- 'build' # Build release - 1.0.0-pre-release.0+1
|
||||
- 'pre-release' # Pre-Release release - 1.0.0-pre-release.1
|
||||
- 'patch' # Patch release - 1.0.1
|
||||
- 'minor' # Minor release - 1.1.0
|
||||
- 'major' # Major release - 2.0.0
|
||||
#>
|
||||
|
||||
if ( -not (Test-Path -Path $packageFile) ) {
|
||||
Write-Error "Failed to find a valid project manifest at `"$packageFile`""
|
||||
return $null
|
||||
}
|
||||
|
||||
$packageInfo = (Get-Content $packageFile -Raw) | ConvertFrom-Json
|
||||
Write-Host "Detected Project Version:" $packageInfo.version
|
||||
function IfNull($a, $b, $c) { if ($null -eq $a) { return $b } else { return $c } }
|
||||
|
||||
$packageSemVer = [System.Management.Automation.SemanticVersion]$packageInfo.version
|
||||
$majorVersion = if($null -eq $packageSemVer.Major) {0} else {$packageSemVer.Major}
|
||||
$minorVersion = if($null -eq $packageSemVer.Minor) {0} else {$packageSemVer.Minor}
|
||||
$patchVersion = if($null -eq $packageSemVer.Patch) {0} else {$packageSemVer.Patch}
|
||||
$prereleaseVersion = if($null -eq $packageSemVer.PreReleaseLabel) {0} else {$packageSemVer.PreReleaseLabel.Replace('pre-release.','')}
|
||||
$buildVersion = if($null -eq $packageSemVer.BuildLabel) {0} else {$packageSemVer.BuildLabel}
|
||||
|
||||
# work out new version
|
||||
switch ($type) {
|
||||
'build' {
|
||||
[int]$buildVersion += 1
|
||||
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion, "pre-release." + $prereleaseVersion, $buildVersion)
|
||||
}
|
||||
'pre-release' {
|
||||
[int]$prereleaseVersion += 1
|
||||
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion, "pre-release." + $prereleaseVersion)
|
||||
}
|
||||
'patch' {
|
||||
[int]$patchVersion += 1
|
||||
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion)
|
||||
}
|
||||
'minor' {
|
||||
[int]$minorVersion += 1
|
||||
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, 0)
|
||||
}
|
||||
'major' {
|
||||
[int]$majorVersion += 1
|
||||
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Upgrading project version [$packageSemVer] to [$newPackageSemVer]"
|
||||
|
||||
# Write out updated package info
|
||||
|
||||
$packageInfo.version = $newPackageSemVer.ToString()
|
||||
$packageInfo | ConvertTo-Json | Set-Content $packageFile
|
||||
|
||||
return $packageInfo.version
|
||||
}
|
||||
|
||||
$packageFile = 'package.json'
|
||||
$result = UpdateProjectVersionJSON("${{ inputs.build-type }}","$packageFile")
|
||||
if([string]::IsNullOrEmpty($result)) {
|
||||
echo "Version patch failed"
|
||||
$tagVersion = "${{ inputs.version }}"
|
||||
$tags = git tag
|
||||
echo "Tags found are [$tags], searching for [$tagVersion]"
|
||||
foreach ($tag in $tags)
|
||||
{
|
||||
if($tag.Trim() -eq "$tagVersion")
|
||||
{
|
||||
Write-Error "$tagVersion tag already exists"
|
||||
exit 1
|
||||
}
|
||||
echo "packageversion=$result" >> $env:GITHUB_OUTPUT
|
||||
git add "$packageFile"
|
||||
git commit -m "Auto increment pre-release version to $result [skip ci]"
|
||||
git tag -fa "$result" "${GITHUB_SHA}" -m "$result Release"
|
||||
git push origin --force
|
||||
}
|
||||
shell: pwsh
|
||||
- name: Create tag and push
|
||||
run: |
|
||||
$tagVersion = "${{ inputs.version }}"
|
||||
git tag -fa "v$tagVersion" "${GITHUB_SHA}" -m "v$tagVersion Release [skip ci]"
|
||||
git push origin "v$tagVersion" --force
|
||||
shell: pwsh
|
|
@ -0,0 +1,181 @@
|
|||
name: UpVersion Package UPM project and create new tag
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
build-host:
|
||||
required: true
|
||||
type: string
|
||||
build-type:
|
||||
required: false
|
||||
default: 'pre-release'
|
||||
type: string
|
||||
# options:
|
||||
# - major
|
||||
# - minor
|
||||
# - patch
|
||||
# - patch-release
|
||||
# - pre-release
|
||||
# - build
|
||||
target-branch:
|
||||
required: false
|
||||
type: string
|
||||
default: ${{ github.ref }}
|
||||
createTag:
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
outputs:
|
||||
packageversion:
|
||||
description: "Returns the version of Unity the UPM package requires"
|
||||
value: ${{ jobs.packageRelease.outputs.packageversion }}
|
||||
secrets:
|
||||
GIT_USER_NAME:
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
packageRelease:
|
||||
name: Package UPM Project and tag
|
||||
runs-on: ${{ inputs.build-host }}
|
||||
outputs:
|
||||
packageversion: ${{ steps.getpackageversion.outputs.packageversion }}
|
||||
steps:
|
||||
- name: Script Version
|
||||
run: |
|
||||
echo "::group::Script Versioning"
|
||||
$scriptVersion = "1.0.2"
|
||||
echo "Build Script Version: $scriptVersion"
|
||||
echo "::endgroup::"
|
||||
shell: pwsh
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ inputs.target-branch }}
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
clean: true
|
||||
token: ${{ secrets.GIT_PAT }}
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Set Github vars
|
||||
run: |
|
||||
if([string]::IsNullOrEmpty('${{ secrets.GIT_USER_NAME }}')){
|
||||
if([string]::IsNullOrEmpty('${{ secrets.GIT_USER_NAME }}')){
|
||||
$gitUser = "action"
|
||||
$gitEmail = "action@github.com"
|
||||
}
|
||||
else {
|
||||
$gitUser = "${GITHUB_ACTOR}"
|
||||
$gitEmail = "$gitUser@users.noreply.github.com"
|
||||
}
|
||||
}
|
||||
else {
|
||||
$gitUser = "${{ secrets.GIT_USER_NAME }}"
|
||||
$gitEmail = "$gitUser@users.noreply.github.com"
|
||||
}
|
||||
git config --global user.email "$gitUser@users.noreply.github.com"
|
||||
git config --global user.name "$gitUser"
|
||||
shell: pwsh
|
||||
- id: getpackageversion
|
||||
name: Bump UPM Package version
|
||||
run: |
|
||||
function UpdateProjectVersionJSON {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
$type,
|
||||
$packageFile = 'package.json'
|
||||
)
|
||||
<#
|
||||
Type of build can be one of the following
|
||||
- 'build' # Build release - 1.0.0-pre.0+1
|
||||
- 'pre-release' # Pre-Release - 1.0.0-pre.1
|
||||
- 'patch-release' # Patch release - 1.0.1 (reset preview version to current patch, no increase)
|
||||
- 'patch' # Patch release - 1.0.1
|
||||
- 'minor' # Minor release - 1.1.0
|
||||
- 'major' # Major release - 2.0.0
|
||||
#>
|
||||
|
||||
if ( -not (Test-Path -Path $packageFile) ) {
|
||||
Write-Error "Failed to find a valid project manifest at `"$packageFile`""
|
||||
return $null
|
||||
}
|
||||
|
||||
$packageInfo = (Get-Content $packageFile -Raw) | ConvertFrom-Json
|
||||
Write-Host "Detected Project Version:" $packageInfo.version
|
||||
function IfNull($a, $b, $c) { if ($null -eq $a) { return $b } else { return $c } }
|
||||
|
||||
$packageSemVer = [System.Management.Automation.SemanticVersion]$packageInfo.version
|
||||
$majorVersion = if($null -eq $packageSemVer.Major) {0} else {$packageSemVer.Major}
|
||||
$minorVersion = if($null -eq $packageSemVer.Minor) {0} else {$packageSemVer.Minor}
|
||||
$patchVersion = if($null -eq $packageSemVer.Patch) {0} else {$packageSemVer.Patch}
|
||||
$prereleaseVersion = if($null -eq $packageSemVer.PreReleaseLabel) {0} else {$packageSemVer.PreReleaseLabel.Replace('pre.','')}
|
||||
$buildVersion = if($null -eq $packageSemVer.BuildLabel) {0} else {$packageSemVer.BuildLabel}
|
||||
|
||||
# work out new version
|
||||
switch ($type) {
|
||||
'build' {
|
||||
[int]$buildVersion += 1
|
||||
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion, "pre." + $prereleaseVersion, $buildVersion)
|
||||
}
|
||||
'pre-release' {
|
||||
[int]$prereleaseVersion += 1
|
||||
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion, "pre." + $prereleaseVersion)
|
||||
}
|
||||
'patch-release' {
|
||||
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion)
|
||||
}
|
||||
'patch' {
|
||||
[int]$patchVersion += 1
|
||||
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion)
|
||||
}
|
||||
'minor' {
|
||||
[int]$minorVersion += 1
|
||||
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, 0)
|
||||
}
|
||||
'major' {
|
||||
[int]$majorVersion += 1
|
||||
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Upgrading project version [$packageSemVer] to [$newPackageSemVer]"
|
||||
|
||||
# Write out updated package info
|
||||
|
||||
$packageInfo.version = $newPackageSemVer.ToString()
|
||||
$packageInfo | ConvertTo-Json | Set-Content $packageFile
|
||||
|
||||
return $packageInfo.version
|
||||
}
|
||||
|
||||
$packageFile = 'package.json'
|
||||
$result = UpdateProjectVersionJSON("${{ inputs.build-type }}","$packageFile")
|
||||
if([string]::IsNullOrEmpty($result)) {
|
||||
echo "Version patch failed"
|
||||
exit 1
|
||||
}
|
||||
git add "$packageFile"
|
||||
git commit -m "Auto increment pre-release version to $result [skip ci]"
|
||||
git push origin
|
||||
echo "packageversion=$result" >> $env:GITHUB_OUTPUT
|
||||
shell: pwsh
|
||||
- name: Check if Tag Exists
|
||||
run: |
|
||||
$tagVersion = '${{steps.getpackageversion.outputs.packageversion }}'
|
||||
$tags = git tag
|
||||
echo "Tags found are [$tags], searching for [$tagVersion]"
|
||||
foreach ($tag in $tags)
|
||||
{
|
||||
if($tag.Trim() -eq "$tagVersion")
|
||||
{
|
||||
Write-Error "$tagVersion tag already exists"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
shell: pwsh
|
||||
- name: Publish package tag
|
||||
if: ${{inputs.createTag == true}}
|
||||
run: |
|
||||
$outputVersion = '${{steps.getpackageversion.outputs.packageversion }}'
|
||||
git tag -fa "v$outputVersion" "${GITHUB_SHA}" -m "v$outputVersion Release"
|
||||
git push origin "v$outputVersion" --force --tags
|
||||
shell: pwsh
|
|
@ -6,6 +6,7 @@
|
|||
/// Vertical Flow by Ramon Molossi
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
|
@ -17,26 +18,31 @@ namespace UnityEngine.UI.Extensions
|
|||
{
|
||||
public enum Axis { Horizontal = 0, Vertical = 1 }
|
||||
|
||||
public float SpacingX = 0f;
|
||||
public float SpacingY = 0f;
|
||||
public bool ExpandHorizontalSpacing = false;
|
||||
|
||||
public bool ChildForceExpandWidth = false;
|
||||
public bool ChildForceExpandHeight = false;
|
||||
public bool invertOrder = false;
|
||||
private float _layoutHeight;
|
||||
private float _layoutWidth;
|
||||
|
||||
[SerializeField] protected Axis m_StartAxis = Axis.Horizontal;
|
||||
public Axis startAxis { get { return m_StartAxis; } set { SetProperty(ref m_StartAxis, value); } }
|
||||
public float SpacingX = 0f;
|
||||
public float SpacingY = 0f;
|
||||
public bool ExpandHorizontalSpacing = false;
|
||||
public bool ChildForceExpandWidth = false;
|
||||
public bool ChildForceExpandHeight = false;
|
||||
public bool invertOrder = false;
|
||||
|
||||
[SerializeField]
|
||||
protected Axis m_StartAxis = Axis.Horizontal;
|
||||
|
||||
public Axis StartAxis { get { return m_StartAxis; } set { SetProperty(ref m_StartAxis, value); } }
|
||||
|
||||
public override void CalculateLayoutInputHorizontal()
|
||||
{
|
||||
if (startAxis == Axis.Horizontal) {
|
||||
if (StartAxis == Axis.Horizontal)
|
||||
{
|
||||
base.CalculateLayoutInputHorizontal();
|
||||
var minWidth = GetGreatestMinimumChildWidth() + padding.left + padding.right;
|
||||
SetLayoutInputForAxis(minWidth, -1, -1, 0);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
_layoutWidth = SetLayout(0, true);
|
||||
}
|
||||
|
||||
|
@ -54,9 +60,12 @@ namespace UnityEngine.UI.Extensions
|
|||
|
||||
public override void CalculateLayoutInputVertical()
|
||||
{
|
||||
if (startAxis == Axis.Horizontal) {
|
||||
if (StartAxis == Axis.Horizontal)
|
||||
{
|
||||
_layoutHeight = SetLayout(1, true);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
base.CalculateLayoutInputHorizontal();
|
||||
var minHeight = GetGreatestMinimumChildHeigth() + padding.bottom + padding.top;
|
||||
SetLayoutInputForAxis(minHeight, -1, -1, 1);
|
||||
|
@ -65,38 +74,22 @@ namespace UnityEngine.UI.Extensions
|
|||
|
||||
protected bool IsCenterAlign
|
||||
{
|
||||
get
|
||||
{
|
||||
return childAlignment == TextAnchor.LowerCenter || childAlignment == TextAnchor.MiddleCenter ||
|
||||
childAlignment == TextAnchor.UpperCenter;
|
||||
}
|
||||
get => childAlignment == TextAnchor.LowerCenter || childAlignment == TextAnchor.MiddleCenter || childAlignment == TextAnchor.UpperCenter;
|
||||
}
|
||||
|
||||
protected bool IsRightAlign
|
||||
{
|
||||
get
|
||||
{
|
||||
return childAlignment == TextAnchor.LowerRight || childAlignment == TextAnchor.MiddleRight ||
|
||||
childAlignment == TextAnchor.UpperRight;
|
||||
}
|
||||
get => childAlignment == TextAnchor.LowerRight || childAlignment == TextAnchor.MiddleRight || childAlignment == TextAnchor.UpperRight;
|
||||
}
|
||||
|
||||
protected bool IsMiddleAlign
|
||||
{
|
||||
get
|
||||
{
|
||||
return childAlignment == TextAnchor.MiddleLeft || childAlignment == TextAnchor.MiddleRight ||
|
||||
childAlignment == TextAnchor.MiddleCenter;
|
||||
}
|
||||
get => childAlignment == TextAnchor.MiddleLeft || childAlignment == TextAnchor.MiddleRight || childAlignment == TextAnchor.MiddleCenter;
|
||||
}
|
||||
|
||||
protected bool IsLowerAlign
|
||||
{
|
||||
get
|
||||
{
|
||||
return childAlignment == TextAnchor.LowerLeft || childAlignment == TextAnchor.LowerRight ||
|
||||
childAlignment == TextAnchor.LowerCenter;
|
||||
}
|
||||
get => childAlignment == TextAnchor.LowerLeft || childAlignment == TextAnchor.LowerRight || childAlignment == TextAnchor.LowerCenter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -122,25 +115,34 @@ namespace UnityEngine.UI.Extensions
|
|||
float counterOffset = 0;
|
||||
float groupSize = 0;
|
||||
float workingSize = 0;
|
||||
if (startAxis == Axis.Horizontal) {
|
||||
if (StartAxis == Axis.Horizontal)
|
||||
{
|
||||
groupSize = groupHeight;
|
||||
workingSize = groupWidth - padding.left - padding.right;
|
||||
if (IsLowerAlign) {
|
||||
if (IsLowerAlign)
|
||||
{
|
||||
offset = (float)padding.bottom;
|
||||
counterOffset = (float)padding.top;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = (float)padding.top;
|
||||
counterOffset = (float)padding.bottom;
|
||||
}
|
||||
spacingBetweenBars = SpacingY;
|
||||
spacingBetweenElements = SpacingX;
|
||||
} else if (startAxis == Axis.Vertical) {
|
||||
}
|
||||
else if (StartAxis == Axis.Vertical)
|
||||
{
|
||||
groupSize = groupWidth;
|
||||
workingSize = groupHeight - padding.top - padding.bottom;
|
||||
if (IsRightAlign) {
|
||||
if (IsRightAlign)
|
||||
{
|
||||
offset = (float)padding.right;
|
||||
counterOffset = (float)padding.left;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = (float)padding.left;
|
||||
counterOffset = (float)padding.right;
|
||||
}
|
||||
|
@ -151,23 +153,28 @@ namespace UnityEngine.UI.Extensions
|
|||
var currentBarSize = 0f;
|
||||
var currentBarSpace = 0f;
|
||||
|
||||
for (var i = 0; i < rectChildren.Count; i++) {
|
||||
|
||||
for (var i = 0; i < rectChildren.Count; i++)
|
||||
{
|
||||
int index = i;
|
||||
var child = rectChildren[index];
|
||||
float childSize = 0;
|
||||
float childOtherSize = 0;
|
||||
//get height and width of elements.
|
||||
if (startAxis == Axis.Horizontal) {
|
||||
if (invertOrder) {
|
||||
if (StartAxis == Axis.Horizontal)
|
||||
{
|
||||
if (invertOrder)
|
||||
{
|
||||
index = IsLowerAlign ? rectChildren.Count - 1 - i : i;
|
||||
}
|
||||
child = rectChildren[index];
|
||||
childSize = LayoutUtility.GetPreferredSize(child, 0);
|
||||
childSize = Mathf.Min(childSize, workingSize);
|
||||
childOtherSize = LayoutUtility.GetPreferredSize(child, 1);
|
||||
} else if (startAxis == Axis.Vertical) {
|
||||
if (invertOrder) {
|
||||
}
|
||||
else if (StartAxis == Axis.Vertical)
|
||||
{
|
||||
if (invertOrder)
|
||||
{
|
||||
index = IsRightAlign ? rectChildren.Count - 1 - i : i;
|
||||
}
|
||||
child = rectChildren[index];
|
||||
|
@ -178,16 +185,20 @@ namespace UnityEngine.UI.Extensions
|
|||
|
||||
// If adding this element would exceed the bounds of the container,
|
||||
// go to a new bar after processing the current bar
|
||||
if (currentBarSize + childSize > workingSize) {
|
||||
|
||||
if (currentBarSize + childSize > workingSize)
|
||||
{
|
||||
currentBarSize -= spacingBetweenElements;
|
||||
|
||||
// Process current bar elements positioning
|
||||
if (!layoutInput) {
|
||||
if (startAxis == Axis.Horizontal) {
|
||||
if (!layoutInput)
|
||||
{
|
||||
if (StartAxis == Axis.Horizontal)
|
||||
{
|
||||
float newOffset = CalculateRowVerticalOffset(groupSize, offset, currentBarSpace);
|
||||
LayoutRow(_itemList, currentBarSize, currentBarSpace, workingSize, padding.left, newOffset, axis);
|
||||
} else if (startAxis == Axis.Vertical) {
|
||||
}
|
||||
else if (StartAxis == Axis.Vertical)
|
||||
{
|
||||
float newOffset = CalculateColHorizontalOffset(groupSize, offset, currentBarSpace);
|
||||
LayoutCol(_itemList, currentBarSpace, currentBarSize, workingSize, newOffset, padding.top, axis);
|
||||
}
|
||||
|
@ -202,31 +213,28 @@ namespace UnityEngine.UI.Extensions
|
|||
|
||||
currentBarSpace = 0;
|
||||
currentBarSize = 0;
|
||||
|
||||
}
|
||||
|
||||
currentBarSize += childSize;
|
||||
_itemList.Add(child);
|
||||
|
||||
// We need the largest element height to determine the starting position of the next line
|
||||
if (childOtherSize > currentBarSpace) {
|
||||
currentBarSpace = childOtherSize;
|
||||
}
|
||||
currentBarSpace = childOtherSize > currentBarSpace ? childOtherSize : currentBarSpace;
|
||||
|
||||
// Don't do this for the last one
|
||||
if (i < rectChildren.Count - 1){
|
||||
currentBarSize += spacingBetweenElements;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Layout the final bar
|
||||
if (!layoutInput) {
|
||||
if (startAxis == Axis.Horizontal) {
|
||||
if (!layoutInput)
|
||||
{
|
||||
if (StartAxis == Axis.Horizontal)
|
||||
{
|
||||
float newOffset = CalculateRowVerticalOffset(groupHeight, offset, currentBarSpace);
|
||||
currentBarSize -= spacingBetweenElements;
|
||||
LayoutRow(_itemList, currentBarSize, currentBarSpace, workingSize, padding.left, newOffset, axis);
|
||||
}else if (startAxis == Axis.Vertical) {
|
||||
}
|
||||
else if (StartAxis == Axis.Vertical)
|
||||
{
|
||||
float newOffset = CalculateColHorizontalOffset(groupWidth, offset, currentBarSpace);
|
||||
currentBarSize -= spacingBetweenElements;
|
||||
LayoutCol(_itemList, currentBarSpace, currentBarSize, workingSize, newOffset, padding.top, axis);
|
||||
|
@ -239,7 +247,8 @@ namespace UnityEngine.UI.Extensions
|
|||
offset += currentBarSpace;
|
||||
offset += counterOffset;
|
||||
|
||||
if (layoutInput) {
|
||||
if (layoutInput)
|
||||
{
|
||||
SetLayoutInputForAxis(offset, offset, -1, axis);
|
||||
}
|
||||
return offset;
|
||||
|
@ -247,87 +256,109 @@ namespace UnityEngine.UI.Extensions
|
|||
|
||||
private float CalculateRowVerticalOffset(float groupHeight, float yOffset, float currentRowHeight)
|
||||
{
|
||||
if (IsLowerAlign) {
|
||||
if (IsLowerAlign)
|
||||
{
|
||||
return groupHeight - yOffset - currentRowHeight;
|
||||
} else if (IsMiddleAlign) {
|
||||
return groupHeight * 0.5f - _layoutHeight * 0.5f + yOffset;
|
||||
} else {
|
||||
return yOffset;
|
||||
}
|
||||
else if (IsMiddleAlign)
|
||||
{
|
||||
return groupHeight * 0.5f - _layoutHeight * 0.5f + yOffset;
|
||||
}
|
||||
return yOffset;
|
||||
}
|
||||
|
||||
private float CalculateColHorizontalOffset(float groupWidth, float xOffset, float currentColWidth)
|
||||
{
|
||||
if (IsRightAlign) {
|
||||
if (IsRightAlign)
|
||||
{
|
||||
return groupWidth - xOffset - currentColWidth;
|
||||
} else if (IsCenterAlign) {
|
||||
return groupWidth * 0.5f - _layoutWidth * 0.5f + xOffset;
|
||||
} else {
|
||||
return xOffset;
|
||||
}
|
||||
else if (IsCenterAlign)
|
||||
{
|
||||
return groupWidth * 0.5f - _layoutWidth * 0.5f + xOffset;
|
||||
}
|
||||
return xOffset;
|
||||
}
|
||||
|
||||
protected void LayoutRow(IList<RectTransform> contents, float rowWidth, float rowHeight, float maxWidth, float xOffset, float yOffset, int axis)
|
||||
{
|
||||
var xPos = xOffset;
|
||||
|
||||
if (!ChildForceExpandWidth && IsCenterAlign) {
|
||||
if (!ChildForceExpandWidth && IsCenterAlign)
|
||||
{
|
||||
xPos += (maxWidth - rowWidth) * 0.5f;
|
||||
} else if (!ChildForceExpandWidth && IsRightAlign) {
|
||||
}
|
||||
else if (!ChildForceExpandWidth && IsRightAlign)
|
||||
{
|
||||
xPos += (maxWidth - rowWidth);
|
||||
}
|
||||
|
||||
var extraWidth = 0f;
|
||||
var extraSpacing = 0f;
|
||||
|
||||
if (ChildForceExpandWidth) {
|
||||
extraWidth = (maxWidth - rowWidth)/_itemList.Count;
|
||||
if (ChildForceExpandWidth)
|
||||
{
|
||||
extraWidth = (maxWidth - rowWidth) / contents.Count;
|
||||
}
|
||||
else if (ExpandHorizontalSpacing) {
|
||||
extraSpacing = (maxWidth - rowWidth)/(_itemList.Count - 1);
|
||||
if (_itemList.Count > 1) {
|
||||
if (IsCenterAlign) {
|
||||
xPos -= extraSpacing * 0.5f * (_itemList.Count - 1);
|
||||
} else if (IsRightAlign) {
|
||||
xPos -= extraSpacing * (_itemList.Count - 1);
|
||||
else if (ExpandHorizontalSpacing)
|
||||
{
|
||||
extraSpacing = (maxWidth - rowWidth) / (contents.Count - 1);
|
||||
if (contents.Count > 1)
|
||||
{
|
||||
if (IsCenterAlign)
|
||||
{
|
||||
xPos -= extraSpacing * 0.5f * (contents.Count - 1);
|
||||
}
|
||||
else if (IsRightAlign)
|
||||
{
|
||||
xPos -= extraSpacing * (contents.Count - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var j = 0; j < _itemList.Count; j++) {
|
||||
for (var j = 0; j < contents.Count; j++)
|
||||
{
|
||||
var index = IsLowerAlign ? contents.Count - 1 - j : j;
|
||||
|
||||
var index = IsLowerAlign ? _itemList.Count - 1 - j : j;
|
||||
|
||||
var rowChild = _itemList[index];
|
||||
var rowChild = contents[index];
|
||||
|
||||
var rowChildWidth = LayoutUtility.GetPreferredSize(rowChild, 0) + extraWidth;
|
||||
var rowChildHeight = LayoutUtility.GetPreferredSize(rowChild, 1);
|
||||
|
||||
if (ChildForceExpandHeight)
|
||||
{
|
||||
rowChildHeight = rowHeight;
|
||||
}
|
||||
|
||||
rowChildWidth = Mathf.Min(rowChildWidth, maxWidth);
|
||||
|
||||
var yPos = yOffset;
|
||||
|
||||
if (IsMiddleAlign) {
|
||||
if (IsMiddleAlign)
|
||||
{
|
||||
yPos += (rowHeight - rowChildHeight) * 0.5f;
|
||||
} else if (IsLowerAlign) {
|
||||
}
|
||||
else if (IsLowerAlign)
|
||||
{
|
||||
yPos += (rowHeight - rowChildHeight);
|
||||
}
|
||||
|
||||
if (ExpandHorizontalSpacing && j > 0) {
|
||||
if (ExpandHorizontalSpacing && j > 0)
|
||||
{
|
||||
xPos += extraSpacing;
|
||||
}
|
||||
|
||||
if (axis == 0) {
|
||||
if (axis == 0)
|
||||
{
|
||||
SetChildAlongAxis(rowChild, 0, xPos, rowChildWidth);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
SetChildAlongAxis(rowChild, 1, yPos, rowChildHeight);
|
||||
}
|
||||
|
||||
// Don't do horizontal spacing for the last one
|
||||
if (j < _itemList.Count - 1) {
|
||||
if (j < contents.Count - 1)
|
||||
{
|
||||
xPos += rowChildWidth + SpacingX;
|
||||
}
|
||||
}
|
||||
|
@ -337,39 +368,49 @@ namespace UnityEngine.UI.Extensions
|
|||
{
|
||||
var yPos = yOffset;
|
||||
|
||||
if (!ChildForceExpandHeight && IsMiddleAlign) {
|
||||
if (!ChildForceExpandHeight && IsMiddleAlign)
|
||||
{
|
||||
yPos += (maxHeight - colHeight) * 0.5f;
|
||||
} else if (!ChildForceExpandHeight && IsLowerAlign) {
|
||||
}
|
||||
else if (!ChildForceExpandHeight && IsLowerAlign)
|
||||
{
|
||||
yPos += (maxHeight - colHeight);
|
||||
}
|
||||
|
||||
var extraHeight = 0f;
|
||||
var extraSpacing = 0f;
|
||||
|
||||
if (ChildForceExpandHeight) {
|
||||
extraHeight = (maxHeight - colHeight)/_itemList.Count;
|
||||
if (ChildForceExpandHeight)
|
||||
{
|
||||
extraHeight = (maxHeight - colHeight) / contents.Count;
|
||||
}
|
||||
else if (ExpandHorizontalSpacing) {
|
||||
extraSpacing = (maxHeight - colHeight)/(_itemList.Count - 1);
|
||||
if (_itemList.Count > 1) {
|
||||
if (IsMiddleAlign) {
|
||||
yPos -= extraSpacing * 0.5f * (_itemList.Count - 1);
|
||||
} else if (IsLowerAlign) {
|
||||
yPos -= extraSpacing * (_itemList.Count - 1);
|
||||
else if (ExpandHorizontalSpacing)
|
||||
{
|
||||
extraSpacing = (maxHeight - colHeight) / (contents.Count - 1);
|
||||
if (contents.Count > 1)
|
||||
{
|
||||
if (IsMiddleAlign)
|
||||
{
|
||||
yPos -= extraSpacing * 0.5f * (contents.Count - 1);
|
||||
}
|
||||
else if (IsLowerAlign)
|
||||
{
|
||||
yPos -= extraSpacing * (contents.Count - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var j = 0; j < _itemList.Count; j++) {
|
||||
for (var j = 0; j < contents.Count; j++)
|
||||
{
|
||||
var index = IsRightAlign ? contents.Count - 1 - j : j;
|
||||
|
||||
var index = IsRightAlign ? _itemList.Count - 1 - j : j;
|
||||
|
||||
var rowChild = _itemList[index];
|
||||
var rowChild = contents[index];
|
||||
|
||||
var rowChildWidth = LayoutUtility.GetPreferredSize(rowChild, 0);
|
||||
var rowChildHeight = LayoutUtility.GetPreferredSize(rowChild, 1) + extraHeight;
|
||||
|
||||
if (ChildForceExpandWidth) {
|
||||
if (ChildForceExpandWidth)
|
||||
{
|
||||
rowChildWidth = colWidth;
|
||||
}
|
||||
|
||||
|
@ -377,25 +418,32 @@ namespace UnityEngine.UI.Extensions
|
|||
|
||||
var xPos = xOffset;
|
||||
|
||||
if (IsCenterAlign) {
|
||||
if (IsCenterAlign)
|
||||
{
|
||||
xPos += (colWidth - rowChildWidth) * 0.5f;
|
||||
} else if (IsRightAlign) {
|
||||
}
|
||||
else if (IsRightAlign)
|
||||
{
|
||||
xPos += (colWidth - rowChildWidth);
|
||||
}
|
||||
|
||||
//
|
||||
if (ExpandHorizontalSpacing && j > 0) {
|
||||
if (ExpandHorizontalSpacing && j > 0)
|
||||
{
|
||||
yPos += extraSpacing;
|
||||
}
|
||||
|
||||
if (axis == 0) {
|
||||
if (axis == 0)
|
||||
{
|
||||
SetChildAlongAxis(rowChild, 0, xPos, rowChildWidth);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
SetChildAlongAxis(rowChild, 1, yPos, rowChildHeight);
|
||||
}
|
||||
|
||||
// Don't do vertical spacing for the last one
|
||||
if (j < _itemList.Count - 1) {
|
||||
if (j < contents.Count - 1)
|
||||
{
|
||||
yPos += rowChildHeight + SpacingY;
|
||||
}
|
||||
}
|
||||
|
@ -404,9 +452,9 @@ namespace UnityEngine.UI.Extensions
|
|||
public float GetGreatestMinimumChildWidth()
|
||||
{
|
||||
var max = 0f;
|
||||
for (var i = 0; i < rectChildren.Count; i++) {
|
||||
for (var i = 0; i < rectChildren.Count; i++)
|
||||
{
|
||||
var w = LayoutUtility.GetMinWidth(rectChildren[i]);
|
||||
|
||||
max = Mathf.Max(w, max);
|
||||
}
|
||||
return max;
|
||||
|
@ -415,9 +463,9 @@ namespace UnityEngine.UI.Extensions
|
|||
public float GetGreatestMinimumChildHeigth()
|
||||
{
|
||||
var max = 0f;
|
||||
for (var i = 0; i < rectChildren.Count; i++) {
|
||||
for (var i = 0; i < rectChildren.Count; i++)
|
||||
{
|
||||
var w = LayoutUtility.GetMinHeight(rectChildren[i]);
|
||||
|
||||
max = Mathf.Max(w, max);
|
||||
}
|
||||
return max;
|
||||
|
@ -428,7 +476,5 @@ namespace UnityEngine.UI.Extensions
|
|||
m_Tracker.Clear();
|
||||
LayoutRebuilder.MarkLayoutForRebuild(rectTransform);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "com.unity.uiextensions",
|
||||
"displayName": "Unity UI Extensions",
|
||||
"version": "2.3.1.pre.1",
|
||||
"version": "2.3.2-pre.1",
|
||||
"description": "An extension project for the Unity3D UI system, all crafted and contributed by the awesome Unity community",
|
||||
"author": "Simon darkside Jackson <@SimonDarksideJ>",
|
||||
"contributors": [
|
||||
|
|
Loading…
Reference in New Issue