Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:添加wx.navigateBackMiniProgram #972

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Demo/API_V2/Assets/API/GUI/Interact/InteractSO.asset
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ MonoBehaviour:
- buttonText: "\u9690\u85CF\u6D88\u606F\u63D0\u793A\u6846"
- buttonText: "\u9690\u85CF loading \u63D0\u793A\u6846"
initialResultList: []
entryOrder: 0
25 changes: 25 additions & 0 deletions Demo/API_V2/Assets/API/Navigate/Navigate/Navigate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ private void Start()
// 绑定额外的按钮操作
GameManager.Instance.detailsController.BindExtraButtonAction(0, navigateToMiniProgram);
GameManager.Instance.detailsController.BindExtraButtonAction(1, exitMiniProgram);
GameManager.Instance.detailsController.BindExtraButtonAction(2, backMiniProgram);
}

// 测试 API
Expand Down Expand Up @@ -56,4 +57,28 @@ public void exitMiniProgram()
{
WX.ExitMiniProgram(new ExitMiniProgramOption { });
}

public void backMiniProgram()
{
Debug.Log("触发返回到上一个小程序");
WX.NavigateBackMiniProgram(new NavigateBackMiniProgramOption {
success = (res) =>
{
Debug.Log("success: " + JsonUtility.ToJson(res));
},
fail = (res) =>
{
WX.ShowModal(
new ShowModalOption()
{
content = "NavigateBackMiniProgram Fail Result:" + JsonUtility.ToJson(res)
}
);
},
complete = (res) =>
{
Debug.Log("complete");
}
});
}
}
7 changes: 6 additions & 1 deletion Demo/API_V2/Assets/API/Navigate/Navigate/NavigateSO.asset
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ MonoBehaviour:
m_EditorClassIdentifier:
entryScriptTypeName: Navigate
entryName: "\u8DF3\u8F6C"
entryAPI: "\u8DF3\u8F6C\u76F8\u5173API"
entryAPI: 'RestartMiniProgram | NavigateToMiniProgram

NavigateBackMiniProgram
| ExitMiniProgram'
entryDescription:
optionList: []
initialButtonText: "\u91CD\u542F\u5F53\u524D\u5C0F\u7A0B\u5E8F"
extraButtonList:
- buttonText: "\u6253\u5F00\u53E6\u4E00\u4E2A\u5C0F\u7A0B\u5E8F"
- buttonText: "\u9000\u51FA\u5F53\u524D\u5C0F\u7A0B\u5E8F"
- buttonText: "\u8FD4\u56DE\u5230\u4E0A\u4E00\u4E2A\u5C0F\u7A0B\u5E8F"
initialResultList: []
entryOrder: 0
1 change: 1 addition & 0 deletions Demo/API_V2/Assets/API/Navigate/NavigateSO.asset
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ MonoBehaviour:
categorySprite: {fileID: 21300000, guid: 28238bea78eb34481998d9679ff9acc3, type: 3}
entryList:
- {fileID: 11400000, guid: ee0f2dd14aceb4a83a4c7c75f5c3b688, type: 2}
- {fileID: 11400000, guid: 61851e0243a1f344885a04bdaa28ee40, type: 2}
categoryOrder: 1