setting change
This commit is contained in:
@@ -8,7 +8,7 @@ namespace NBF
|
||||
public string ActionName;
|
||||
public string ShowName;
|
||||
|
||||
public virtual void SetData(string actionName, string showName)
|
||||
public virtual void SetData(string actionName, string showName, string map = InputManager.InputMapUI)
|
||||
{
|
||||
this.ActionName = actionName;
|
||||
this.ShowName = showName;
|
||||
@@ -21,7 +21,7 @@ namespace NBF
|
||||
title = Lan.Get(actionName);
|
||||
}
|
||||
|
||||
var iconName = InputManager.Instance.GetUIKeyCode(ActionName);
|
||||
var iconName = InputManager.Instance.GetInputIcon(map, ActionName);
|
||||
icon = UIPackage.GetItemURL(UIDef.Pack.Common, iconName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
|
||||
@@ -11,6 +12,7 @@ namespace NBF
|
||||
{
|
||||
ContentPane.sortingOrder = UIDef.UIOrder.CommonTopPanel;
|
||||
IsShowCursor = false;
|
||||
Lan.Inst.ChangeAction += ChangeLanguageConfirm;
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
@@ -26,21 +28,34 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUICanceled(string action)
|
||||
|
||||
private void ChangeLanguageConfirm()
|
||||
{
|
||||
if (action == InputDef.UI.Back)
|
||||
var uis = UI.Inst.GetAllUI();
|
||||
List<IUIPanel> panels = new List<IUIPanel>();
|
||||
foreach (var ui in uis)
|
||||
{
|
||||
var uis = UI.Inst.GetAllUI();
|
||||
foreach (var ui in uis)
|
||||
if (!ui.IsShowing && !ui.IsDotDel)
|
||||
{
|
||||
if (ui.ContentPane.sortingOrder > 0) continue;
|
||||
if (ui.IsTop && !ui.IsDontBack)
|
||||
{
|
||||
UI.Inst.HideUI(ui.GetType());
|
||||
break;
|
||||
}
|
||||
UI.Inst.DestroyUI(ui.GetType());
|
||||
}
|
||||
else
|
||||
{
|
||||
panels.Add(ui);
|
||||
}
|
||||
}
|
||||
|
||||
//打开的页面重刷多语言
|
||||
foreach (var panel in panels)
|
||||
{
|
||||
panel.SetLanguage();
|
||||
_ui.TrySetPanelLanguage(panel.ContentPane);
|
||||
}
|
||||
|
||||
// Net.Inst.Send(EnmCmdValue.EcvCsAcSetLanguageReq, new CS_AC_SetLanguageReq()
|
||||
// {
|
||||
// AppLanguage = Lan.Inst.GetCurrentCustomLanguageName()
|
||||
// });
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
@@ -49,7 +64,7 @@ namespace NBF
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
Lan.Inst.ChangeAction -= ChangeLanguageConfirm;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,17 +30,18 @@ namespace NBF
|
||||
{
|
||||
// InputWaitingPanel.Show(true);
|
||||
// UI.Inst.OpenUI<InputWaitingPanel>();
|
||||
// 取消当前绑定
|
||||
var settingPanel = UI.Inst.GetUI<SettingPanel>();
|
||||
settingPanel.InputWait.visible = true;
|
||||
Option.InputAction.Disable();
|
||||
|
||||
// 开始重绑定操作
|
||||
rebindingOperation = Option.InputAction.PerformInteractiveRebinding(Option.BindingIndex)
|
||||
.OnMatchWaitForAnother(0.1f)
|
||||
.OnComplete(operation => RebindComplete())
|
||||
.OnCancel(operation => RebindCanceled())
|
||||
.Start();
|
||||
SettingWaitInputPanel.Show();
|
||||
// // 取消当前绑定
|
||||
// var settingPanel = UI.Inst.GetUI<SettingPanel>();
|
||||
// settingPanel.InputWait.visible = true;
|
||||
// Option.InputAction.Disable();
|
||||
//
|
||||
// // 开始重绑定操作
|
||||
// rebindingOperation = Option.InputAction.PerformInteractiveRebinding(Option.BindingIndex)
|
||||
// .OnMatchWaitForAnother(0.1f)
|
||||
// .OnComplete(operation => RebindComplete())
|
||||
// .OnCancel(operation => RebindCanceled())
|
||||
// .Start();
|
||||
}
|
||||
|
||||
private void RebindComplete()
|
||||
@@ -48,12 +49,6 @@ namespace NBF
|
||||
rebindingOperation.Dispose();
|
||||
UpdateValueText();
|
||||
Option.InputAction.Enable();
|
||||
|
||||
var settingPanel = UI.Inst.GetUI<SettingPanel>();
|
||||
settingPanel.InputWait.visible = false;
|
||||
// UI.Inst.HideUI<InputWaitingPanel>();
|
||||
// startRebindObject.SetActive(true);
|
||||
// waitingForInputObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void RebindCanceled()
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace NBF
|
||||
{
|
||||
BtnPrev.onClick.Set(OnPrev);
|
||||
BtnNext.onClick.Set(OnNext);
|
||||
BtnControl.onClick.Set(OnControl);
|
||||
Slider.onChanged.Set(OnSliderChanged);
|
||||
ComboBox.onChanged.Set(OnComboBoxChanged);
|
||||
}
|
||||
@@ -163,7 +164,12 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateValueText()
|
||||
public void OnControl()
|
||||
{
|
||||
SettingWaitInputPanel.Show(this);
|
||||
}
|
||||
|
||||
public void UpdateValueText()
|
||||
{
|
||||
Pages.visible = false;
|
||||
if (Option is RangeOption range)
|
||||
@@ -183,6 +189,17 @@ namespace NBF
|
||||
|
||||
Pages.SetCurrent(multiOption.GetValue());
|
||||
}
|
||||
else if (Option is KeyBoardOption keyBoardOption)
|
||||
{
|
||||
UpdateControlInfo();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateControlInfo()
|
||||
{
|
||||
// BtnControl
|
||||
if (Option is not KeyBoardOption keyBoardOption) return;
|
||||
BtnControl.SetData(keyBoardOption.InputAction.name, keyBoardOption.Name, InputManager.InputMapPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,8 @@ namespace NBF
|
||||
public BottomMenu BottomMenu;
|
||||
[AutoFind(Name = "Mask")]
|
||||
public GLabel Mask;
|
||||
[AutoFind(Name = "InputWait")]
|
||||
public GComponent InputWait;
|
||||
[AutoFind(Name = "Title")]
|
||||
public GComponent Title;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<SettingPanel>(param); }
|
||||
|
||||
30
Assets/Scripts/UI/Settings/SettingWaitInputPanel.Designer.cs
generated
Normal file
30
Assets/Scripts/UI/Settings/SettingWaitInputPanel.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary> </summary>
|
||||
public partial class SettingWaitInputPanel
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "SettingWaitInputPanel";
|
||||
|
||||
[AutoFind(Name = "TextTime")]
|
||||
public GTextField TextTime;
|
||||
[AutoFind(Name = "BtnCancel")]
|
||||
public BtnTitleInputControl BtnCancel;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<SettingWaitInputPanel>(param); }
|
||||
|
||||
public static void Hide(){ UI.Inst.HideUI<SettingWaitInputPanel>(); }
|
||||
|
||||
public static void Del(){ UI.Inst.DestroyUI<SettingWaitInputPanel>(); }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 516cf8ed4abe3a14a8e101f8ec0d6924
|
||||
73
Assets/Scripts/UI/Settings/SettingWaitInputPanel.cs
Normal file
73
Assets/Scripts/UI/Settings/SettingWaitInputPanel.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using NBF.Setting;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class SettingWaitInputPanel : UIPanel
|
||||
{
|
||||
private SettingItem _settingItem;
|
||||
private InputOption _inputOption;
|
||||
private InputActionRebindingExtensions.RebindingOperation rebindingOperation;
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
_settingItem = GetData() as SettingItem;
|
||||
if (_settingItem == null)
|
||||
{
|
||||
Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_settingItem.Option is InputOption inputOption)
|
||||
{
|
||||
_inputOption = inputOption;
|
||||
OnRebinding();
|
||||
}
|
||||
}
|
||||
|
||||
#region 按键绑定
|
||||
|
||||
private void OnRebinding()
|
||||
{
|
||||
// 开始重绑定操作
|
||||
rebindingOperation = _inputOption.InputAction.PerformInteractiveRebinding(_inputOption.BindingIndex)
|
||||
.OnMatchWaitForAnother(0.1f)
|
||||
.OnComplete(operation => RebindComplete())
|
||||
.OnCancel(operation => RebindCanceled())
|
||||
.Start();
|
||||
}
|
||||
|
||||
private void RebindComplete()
|
||||
{
|
||||
rebindingOperation.Dispose();
|
||||
_inputOption.InputAction.Enable();
|
||||
UpdateValueText();
|
||||
}
|
||||
|
||||
private void RebindCanceled()
|
||||
{
|
||||
rebindingOperation.Dispose();
|
||||
_inputOption.InputAction.Enable();
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void UpdateValueText()
|
||||
{
|
||||
_settingItem.UpdateValueText();
|
||||
Hide();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
[InputInvoke(InputDef.UI.Back)]
|
||||
private void OnBack()
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Settings/SettingWaitInputPanel.cs.meta
Normal file
2
Assets/Scripts/UI/Settings/SettingWaitInputPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebd4baa307d417f48ade9e2c8255ace9
|
||||
Reference in New Issue
Block a user