修改设置界面
This commit is contained in:
@@ -15,6 +15,7 @@ namespace NBF
|
||||
UIObjectFactory.SetPackageItemExtension(ClassifyList.URL, typeof(ClassifyList));
|
||||
UIObjectFactory.SetPackageItemExtension(CommonMenu.URL, typeof(CommonMenu));
|
||||
UIObjectFactory.SetPackageItemExtension(MarqueeTag.URL, typeof(MarqueeTag));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnSubMenuLeft.URL, typeof(BtnSubMenuLeft));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnTextInputControl.URL, typeof(BtnTextInputControl));
|
||||
UIObjectFactory.SetPackageItemExtension(CommonItemList.URL, typeof(CommonItemList));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnTitleInputControl.URL, typeof(BtnTitleInputControl));
|
||||
@@ -22,6 +23,7 @@ namespace NBF
|
||||
UIObjectFactory.SetPackageItemExtension(CommonSubMenu.URL, typeof(CommonSubMenu));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnInputControl.URL, typeof(BtnInputControl));
|
||||
UIObjectFactory.SetPackageItemExtension(ListTitleItem.URL, typeof(ListTitleItem));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnSubMenu.URL, typeof(BtnSubMenu));
|
||||
UIObjectFactory.SetPackageItemExtension(ModelViewer.URL, typeof(ModelViewer));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace NBF
|
||||
if (_panel == null) return;
|
||||
if (!_panel.IsShowing) return;
|
||||
if (!_panel.IsTop) return;
|
||||
|
||||
|
||||
if (action == InputDef.UI.SubPrev)
|
||||
{
|
||||
OnClickBtnPrev();
|
||||
@@ -57,7 +57,7 @@ namespace NBF
|
||||
for (int i = 0; i < subItems.Count; i++)
|
||||
{
|
||||
var tabData = subItems[i];
|
||||
var tabItem = List.AddItemFromPool().asButton;
|
||||
var tabItem = List.AddItemFromPool(i == 0 ? BtnSubMenuLeft.URL : BtnSubMenu.URL).asButton;
|
||||
tabItem.SetLanguage(tabData.Key);
|
||||
|
||||
width += tabItem.width;
|
||||
|
||||
3
Assets/Scripts/UI/Common/Menu/item.meta
Normal file
3
Assets/Scripts/UI/Common/Menu/item.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21fd308a87b848d7b4a9138f06c4c5f7
|
||||
timeCreated: 1769923363
|
||||
25
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.Designer.cs
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnSubMenu
|
||||
{
|
||||
public const string URL = "ui://6hgkvlauvbojxi";
|
||||
|
||||
public GImage back;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
back = (GImage)GetChild("back");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 670c4d5385c0ad741a5381d10fc7dd15
|
||||
15
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.cs
Normal file
15
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnSubMenu : GButton
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b6a27e3fa4572443afc883702c768f3
|
||||
25
Assets/Scripts/UI/Common/Menu/item/BtnSubMenuLeft.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/Common/Menu/item/BtnSubMenuLeft.Designer.cs
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnSubMenuLeft
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaumbu9y9";
|
||||
|
||||
public GImage back;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
back = (GImage)GetChild("back");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bfb4ffee7088da54d95a349215186ba6
|
||||
15
Assets/Scripts/UI/Common/Menu/item/BtnSubMenuLeft.cs
Normal file
15
Assets/Scripts/UI/Common/Menu/item/BtnSubMenuLeft.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnSubMenuLeft : GButton
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ce6cf183d4b20f4997dd9ca99797135
|
||||
@@ -30,13 +30,14 @@ namespace NBF
|
||||
{
|
||||
await LoginHelper.Login(InputAccount.text);
|
||||
|
||||
await Fishing.Instance.Go(RoleModel.Instance.Info.MapId);
|
||||
// await Fishing.Instance.Go(RoleModel.Instance.Info.MapId);
|
||||
// await MapHelper.EnterMap(mapId, role.RoomCode);
|
||||
|
||||
// BagPanel.Show();
|
||||
// BagSlotPanel.Show();
|
||||
|
||||
// FishingShopPanel.Show();
|
||||
SettingPanel.Show();
|
||||
|
||||
Del();
|
||||
}
|
||||
|
||||
@@ -11,14 +11,12 @@ namespace NBF
|
||||
{
|
||||
public const string URL = "ui://hxr7rc7pe9z89";
|
||||
|
||||
public GTextField TextName;
|
||||
public GTextField TextIntroduce;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
TextName = (GTextField)GetChild("TextName");
|
||||
TextIntroduce = (GTextField)GetChild("TextIntroduce");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
|
||||
12
Assets/Scripts/UI/Settings/SettingItem.Designer.cs
generated
12
Assets/Scripts/UI/Settings/SettingItem.Designer.cs
generated
@@ -16,10 +16,12 @@ namespace NBF
|
||||
public GTextField TextName;
|
||||
public GTextField TextInfo;
|
||||
public GSlider Slider;
|
||||
public BtnInputControl BtnPrev;
|
||||
public BtnInputControl BtnNext;
|
||||
public GTextField TextSliderValue;
|
||||
public SelectPages Pages;
|
||||
public GButton BtnPrev;
|
||||
public GButton BtnNext;
|
||||
public BtnInputControl BtnControl;
|
||||
public GComboBox ComboBox;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
@@ -30,10 +32,12 @@ namespace NBF
|
||||
TextName = (GTextField)GetChild("TextName");
|
||||
TextInfo = (GTextField)GetChild("TextInfo");
|
||||
Slider = (GSlider)GetChild("Slider");
|
||||
BtnPrev = (BtnInputControl)GetChild("BtnPrev");
|
||||
BtnNext = (BtnInputControl)GetChild("BtnNext");
|
||||
TextSliderValue = (GTextField)GetChild("TextSliderValue");
|
||||
Pages = (SelectPages)GetChild("Pages");
|
||||
BtnPrev = (GButton)GetChild("BtnPrev");
|
||||
BtnNext = (GButton)GetChild("BtnNext");
|
||||
BtnControl = (BtnInputControl)GetChild("BtnControl");
|
||||
ComboBox = (GComboBox)GetChild("ComboBox");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace NBF
|
||||
BtnPrev.onClick.Set(OnPrev);
|
||||
BtnNext.onClick.Set(OnNext);
|
||||
Slider.onChanged.Set(OnSliderChanged);
|
||||
ComboBox.onChanged.Set(OnComboBoxChanged);
|
||||
}
|
||||
|
||||
public void SetData(OptionBase option)
|
||||
@@ -24,18 +25,34 @@ namespace NBF
|
||||
|
||||
if (option is IMultiOption multiOption)
|
||||
{
|
||||
style.selectedIndex = 0;
|
||||
if (multiOption.IsDropdown)
|
||||
{
|
||||
style.selectedIndex = 2;
|
||||
if (multiOption.IsDropdown)
|
||||
{
|
||||
ComboBox.items = multiOption.GetOptionNames().ToArray();
|
||||
ComboBox.selectedIndex = multiOption.GetValue();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
style.selectedIndex = 1;
|
||||
}
|
||||
}
|
||||
else if (option is RangeOption range)
|
||||
{
|
||||
style.selectedIndex = 1;
|
||||
style.selectedIndex = 3; //进度类型
|
||||
Slider.min = range.MinValue;
|
||||
Slider.max = range.MaxValue;
|
||||
Slider.wholeNumbers = true;
|
||||
}
|
||||
else if (option is KeyBoardOption keyBoardOption)
|
||||
{
|
||||
style.selectedIndex = 2;
|
||||
style.selectedIndex = 4; //按键类型
|
||||
}
|
||||
else
|
||||
{
|
||||
style.selectedIndex = 0;
|
||||
}
|
||||
|
||||
TextName.SetLanguage(Option.Name);
|
||||
@@ -65,7 +82,8 @@ namespace NBF
|
||||
if (Option is ResolutionSetting resolutionSetting)
|
||||
{
|
||||
var res = Screen.resolutions;
|
||||
Debug.LogError($"next index={index} count = {multiOption.GetOptionNames().Count} res={res.Length}");
|
||||
Debug.LogError(
|
||||
$"next index={index} count = {multiOption.GetOptionNames().Count} res={res.Length}");
|
||||
}
|
||||
|
||||
multiOption.SetValue(index);
|
||||
@@ -137,6 +155,15 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
private void OnComboBoxChanged()
|
||||
{
|
||||
Debug.Log(ComboBox.selectedIndex);
|
||||
if (Option is IMultiOption multiOption)
|
||||
{
|
||||
multiOption.SetValue(ComboBox.selectedIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateValueText()
|
||||
{
|
||||
Pages.visible = false;
|
||||
|
||||
@@ -14,16 +14,14 @@ namespace NBF
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "SettingPanel";
|
||||
|
||||
[AutoFind(Name = "Menu")]
|
||||
public CommonMenu Menu;
|
||||
[AutoFind(Name = "MenuList")]
|
||||
public CommonSubMenu MenuList;
|
||||
[AutoFind(Name = "Introduce")]
|
||||
public IntroduceTag Introduce;
|
||||
[AutoFind(Name = "List")]
|
||||
public GList List;
|
||||
[AutoFind(Name = "BottomMenu")]
|
||||
public BottomMenu BottomMenu;
|
||||
[AutoFind(Name = "BottomLine")]
|
||||
public GImage BottomLine;
|
||||
[AutoFind(Name = "Mask")]
|
||||
public GLabel Mask;
|
||||
[AutoFind(Name = "InputWait")]
|
||||
|
||||
@@ -23,27 +23,28 @@ namespace NBF
|
||||
base.OnInit();
|
||||
IsShowCursor = true;
|
||||
IsDontBack = true;
|
||||
|
||||
//TEXT_SETTINGS_
|
||||
var groupNames = Settings.Instance.GetAllTabs();
|
||||
foreach (var group in groupNames)
|
||||
{
|
||||
var tab = new TabItemData
|
||||
{
|
||||
Key = $"TEXT_SETTINGS_{group}"
|
||||
Key = $"TEXT_SETTINGS_{group}",
|
||||
Name = group
|
||||
};
|
||||
tabList.Add(tab);
|
||||
}
|
||||
|
||||
|
||||
Menu.OnTabChange += ChangeTab;
|
||||
MenuList.OnTabChange += ChangeTab;
|
||||
List.onClickItem.Set(OnClickListItem);
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
InputManager.Instance.Off(this);
|
||||
Settings.Instance.LoadAllSettings();
|
||||
InputManager.OnUICanceled += OnUICanceled;
|
||||
Menu.SetTabs(tabList);
|
||||
MenuList.SetTabs(tabList);
|
||||
UseBottomMenu();
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ namespace NBF
|
||||
if (index < 0) return;
|
||||
Log.Info($"Change tab index={index}");
|
||||
var tabListData = tabList[index];
|
||||
_currentTab = tabListData.Key;
|
||||
_currentTab = tabListData.Name;
|
||||
ResetSettingList();
|
||||
}
|
||||
|
||||
@@ -82,35 +83,29 @@ namespace NBF
|
||||
|
||||
|
||||
var url = UIPackage.GetItemURL(UIPackName, "SettingSubTitleItem");
|
||||
var groupIndex = 0;
|
||||
foreach (var key in groupOptions.Keys)
|
||||
{
|
||||
var value = groupOptions[key];
|
||||
if (List.AddItemFromPool(url) is GLabel label)
|
||||
if (groupIndex > 0)
|
||||
{
|
||||
label.SetLanguage(key);
|
||||
if (List.AddItemFromPool(url) is GLabel label)
|
||||
{
|
||||
label.SetLanguage(key);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var option in value)
|
||||
{
|
||||
if (option is InputOption)
|
||||
if (List.AddItemFromPool() is SettingItem item)
|
||||
{
|
||||
if (List.AddItemFromPool(SettingInputItem.URL) is SettingInputItem item)
|
||||
{
|
||||
item.SetData(option as InputOption);
|
||||
var index = List.GetChildIndex(item);
|
||||
_canSelectIndex.Add(index);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (List.AddItemFromPool() is SettingItem item)
|
||||
{
|
||||
item.SetData(option);
|
||||
var index = List.GetChildIndex(item);
|
||||
_canSelectIndex.Add(index);
|
||||
}
|
||||
item.SetData(option);
|
||||
var index = List.GetChildIndex(item);
|
||||
_canSelectIndex.Add(index);
|
||||
}
|
||||
}
|
||||
|
||||
groupIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,16 +114,6 @@ namespace NBF
|
||||
BottomMenu.Use(this);
|
||||
}
|
||||
|
||||
private void OnApplySettings()
|
||||
{
|
||||
var options = Settings.Instance.GetOptionsByTab(_currentTab);
|
||||
Log.Info("OnApplySettings");
|
||||
foreach (var option in options)
|
||||
{
|
||||
option.Apply();
|
||||
}
|
||||
Notices.Success("TEXT_OP_SUCCESS");
|
||||
}
|
||||
|
||||
private void OnResetSettings()
|
||||
{
|
||||
@@ -138,51 +123,10 @@ namespace NBF
|
||||
{
|
||||
option.Reset();
|
||||
}
|
||||
|
||||
ResetSettingList();
|
||||
|
||||
Notices.Success("TEXT_OP_SUCCESS");
|
||||
}
|
||||
|
||||
private void OnUICanceled(string action)
|
||||
{
|
||||
if (action == InputDef.UI.SubPrev)
|
||||
{
|
||||
if (List.GetChildAt(List.selectedIndex) is SettingItem item)
|
||||
{
|
||||
item.OnPrev();
|
||||
}
|
||||
}
|
||||
else if (action == InputDef.UI.SubNext)
|
||||
{
|
||||
if (List.GetChildAt(List.selectedIndex) is SettingItem item)
|
||||
{
|
||||
item.OnNext();
|
||||
}
|
||||
}
|
||||
else if (action == InputDef.UI.Up)
|
||||
{
|
||||
ChangeListSelected();
|
||||
}
|
||||
else if (action == InputDef.UI.Down)
|
||||
{
|
||||
ChangeListSelected(false);
|
||||
}
|
||||
else if (action == InputDef.UI.Back)
|
||||
{
|
||||
OnBack();
|
||||
}
|
||||
else if (action == InputDef.UI.Enter)
|
||||
{
|
||||
OnApplySettings();
|
||||
}
|
||||
else if (action == InputDef.UI.Reset)
|
||||
{
|
||||
MessageBox.Show("是否重置为默认?", (ret) =>
|
||||
{
|
||||
if (ret) OnResetSettings();
|
||||
});
|
||||
}
|
||||
ResetSettingList();
|
||||
|
||||
Notices.Success("TEXT_OP_SUCCESS");
|
||||
}
|
||||
|
||||
|
||||
@@ -225,12 +169,62 @@ namespace NBF
|
||||
var settingItem = List.GetChildAt(index);
|
||||
if (settingItem is SettingItem item)
|
||||
{
|
||||
Introduce.TextName.SetLanguage(item.Option.Name);
|
||||
// Introduce.TextName.SetLanguage(item.Option.Name);
|
||||
Introduce.TextIntroduce.SetLanguage(item.Option.Name);
|
||||
// Introduce.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void CancelAndBack()
|
||||
{
|
||||
var groupNames = Settings.Instance.GetAllTabs();
|
||||
foreach (var group in groupNames)
|
||||
{
|
||||
var options = Settings.Instance.GetOptionsByTab(group);
|
||||
foreach (var option in options)
|
||||
{
|
||||
if (option.HaveNotApple())
|
||||
{
|
||||
option.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Input Evnet
|
||||
|
||||
[InputInvoke(InputDef.UI.SubPrev)]
|
||||
private void OnSubPrev()
|
||||
{
|
||||
if (List.GetChildAt(List.selectedIndex) is SettingItem item)
|
||||
{
|
||||
item.OnPrev();
|
||||
}
|
||||
}
|
||||
|
||||
[InputInvoke(InputDef.UI.SubNext)]
|
||||
private void OnSubNext()
|
||||
{
|
||||
if (List.GetChildAt(List.selectedIndex) is SettingItem item)
|
||||
{
|
||||
item.OnNext();
|
||||
}
|
||||
}
|
||||
|
||||
[InputInvoke(InputDef.UI.Up)]
|
||||
private void OnUp()
|
||||
{
|
||||
ChangeListSelected();
|
||||
}
|
||||
|
||||
[InputInvoke(InputDef.UI.Down)]
|
||||
private void OnDown()
|
||||
{
|
||||
ChangeListSelected(false);
|
||||
}
|
||||
|
||||
[InputInvoke(InputDef.UI.Back)]
|
||||
private void OnBack()
|
||||
{
|
||||
if (Settings.Instance.HaveNotAppleSettings())
|
||||
@@ -250,33 +244,40 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelAndBack()
|
||||
[InputInvoke(InputDef.UI.Enter)]
|
||||
private void OnApplySettings()
|
||||
{
|
||||
|
||||
var groupNames = Settings.Instance.GetAllTabs();
|
||||
foreach (var group in groupNames)
|
||||
var options = Settings.Instance.GetOptionsByTab(_currentTab);
|
||||
Log.Info("OnApplySettings");
|
||||
foreach (var option in options)
|
||||
{
|
||||
var options = Settings.Instance.GetOptionsByTab(group);
|
||||
foreach (var option in options)
|
||||
{
|
||||
if (option.HaveNotApple())
|
||||
{
|
||||
option.Cancel();
|
||||
}
|
||||
}
|
||||
option.Apply();
|
||||
}
|
||||
|
||||
Notices.Success("TEXT_OP_SUCCESS");
|
||||
}
|
||||
|
||||
[InputInvoke(InputDef.UI.Reset)]
|
||||
private void OnReset()
|
||||
{
|
||||
MessageBox.Show("是否重置为默认?", (ret) =>
|
||||
{
|
||||
if (ret) OnResetSettings();
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
base.OnHide();
|
||||
InputManager.OnUICanceled -= OnUICanceled;
|
||||
InputManager.Instance.Off(this);
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
Menu.OnTabChange -= ChangeTab;
|
||||
MenuList.OnTabChange -= ChangeTab;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user