Skip to content

Commit

Permalink
Updated functionality to rebind dependant action
Browse files Browse the repository at this point in the history
  • Loading branch information
dipokDipu committed Sep 6, 2024
1 parent 796e3ec commit 673132d
Show file tree
Hide file tree
Showing 17 changed files with 123 additions and 541 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/UPMBranchUpdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
steps:
- name: Set Git Config
run: |
git config --global user.email "nurusshafievan@gmail.com"
git config --global user.name "N-Evan"
git config --global user.email "tazimtazim2012@gmail.com"
git config --global user.name "Warhammer4000"
- name: Checkout Repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -86,4 +86,4 @@ jobs:

- uses: FrontEndDev-org/publish-node-package-action@v1
with:
target: github
target: github
23 changes: 0 additions & 23 deletions .github/workflows/code_quality.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/docgen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: docfx for GitHub Pages

on:
push:
branches:
- 'main'
release:
types: [published]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Remove csproj files
run: find . -name "*.csproj" -type f -delete

- name: Deploy with DocFX
uses: sator-imaging/docfx-pages@v1
id: deployment
with:
app_name: 'Rebinding Tool For Unity'
site_title: 'Rebinding Tool For Unity'
site_footer: '<big>&times; Is HTML accepted?</big>'
class_members: 'separatePages'
google_analytics: ''
define_symbols: ''
site_logo: '<logo>.svg'
site_favicon: '<favicon>.svg'
main_js: |
export default {
defaultTheme: 'light',
showLightbox: (img) => true,
iconLinks: [
{
icon: 'github',
href: 'https://github.com/sator-imaging',
title: 'GitHub'
},
],
}
main_css: |
5 changes: 5 additions & 0 deletions Assets/Packages/com.studio23.ss2.betterrebinder/CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [0.1.1](2024-09-06)

- Addded functionality to rebind to all action map when their action names matches


## [0.1.0](2024-09-05)

- Reworked the full package.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void CleanUp()
m_RebindStopEvent?.Invoke(this, operation);
CheckAndSwapDuplicates(action, bindingIndex, previousPath);
CheckAndApplyRebindInOtherActionMaps(action, bindingIndex, previousPath);
UpdateBindingDisplay();
CleanUp();
Expand All @@ -309,30 +309,9 @@ void CleanUp()
});

UpdateRebindingControlsExcluding();
//UpdateRebindingCancel();
UpdateRebindingPotentialMatch();


// If it's a part binding, show the name of the part in the UI.
//var partName = default(string);
//if (action.bindings[bindingIndex].isPartOfComposite)
// partName = $"Binding '{action.bindings[bindingIndex].name}'. ";

// Bring up rebind overlay, if we have one.
//m_RebindOverlay?.SetActive(true);
//if (m_RebindText != null)
//{
// var text = !string.IsNullOrEmpty(m_RebindOperation.expectedControlType)
// ? $"{partName}Waiting for {m_RebindOperation.expectedControlType} input..."
// : $"{partName}Waiting for input...";
// m_RebindText.text = text;
//}

// If we have no rebind overlay and no callback but we have a binding text label,
// temporarily set the binding text label to "<Waiting>".
//if (m_RebindOverlay == null && m_RebindText == null && m_RebindStartEvent == null && m_BindingText != null)
// m_BindingText.text = "<Waiting...>";

m_bindingIcon.gameObject.SetActive(false);
m_BindingText.gameObject.SetActive(true);
m_BindingText.text = $"[Waiting for Input]";
Expand Down Expand Up @@ -374,7 +353,62 @@ private void CheckAndSwapDuplicates(InputAction action, int bindingIndex, string
}
}
}
}


private void CheckAndApplyRebindInOtherActionMaps(InputAction action, int bindingIndex, string pathBeforeBinding)
{
string currentPath = action.bindings[bindingIndex].effectivePath;
var inputActionAsset = action.actionMap.asset;

foreach (var otherActionMap in inputActionAsset.actionMaps)
{
if(otherActionMap == action.actionMap) continue;

var matchFound = otherActionMap.actions.FirstOrDefault(x => x.name.Replace(otherActionMap.name,"").Equals(action.name.Replace(action.actionMap.name,"")));
if(matchFound == null) continue;

foreach (var otherAction in otherActionMap.actions)
{
if (otherAction == matchFound)
{
if (otherAction.bindings[0].isComposite)
{
for (int i = 0; i < otherAction.bindings.Count; i++)
{
if (i == bindingIndex)
{
otherAction.ApplyBindingOverride(i, currentPath);
}
else if (otherAction.bindings[i].isPartOfComposite && otherAction.bindings[i].effectivePath.Equals(currentPath))
{
otherAction.ApplyBindingOverride(i, pathBeforeBinding);
}
}
}
else
{
for (int i = 0; i < otherAction.bindings.Count; i++)
{
if (otherAction.bindings[i].effectivePath.Equals(pathBeforeBinding))
{
otherAction.ApplyBindingOverride(i, currentPath);
}
}
}
}
else
{
for (int i = 0; i < otherAction.bindings.Count; i++)
{
if (otherAction.bindings[i].effectivePath.Equals(currentPath))
{
otherAction.ApplyBindingOverride(i, pathBeforeBinding);
}
}
}
}
}
}


Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 673132d

Please sign in to comment.