队伍和技能选择界面初版
parent
ebb4bbd2b6
commit
dab9440310
|
|
@ -175,6 +175,7 @@ public static class UINameConst
|
|||
public static readonly string UI_BuyDiamond = "Interface/Shop/UI_BuyDiamond";
|
||||
public static readonly string UI_LevelDetail = "LevelSelect/UI_LevelDetail";
|
||||
public static readonly string UI_CommandSkill = "CommandSkill/CommandSkill_Cultivate";
|
||||
public static readonly string UI_TeamAndSkillSelect = "CommandSkill/CommandAndTeamSelect/TeamAndSkillSelect";
|
||||
|
||||
public static readonly string UI_DailyBonus = "Interface/UI_DailyBonus";
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ using UnityEngine.TextCore.Text;
|
|||
/// </summary>
|
||||
public class TeamEditManager : Singlenton<TeamEditManager>, IInitable
|
||||
{
|
||||
private const int MAX_TEAM_COUNT = 10;
|
||||
public const int MAX_TEAM_COUNT = 10;
|
||||
private List<Team> _teamList;
|
||||
private Team _selectTeam;
|
||||
private int _selectTeamIdx;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8e193b4b995207b42bc1647df7c28de1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 19b8651bffbb67845ada99031a782716
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,750 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
using Image = UnityEngine.UI.Image;
|
||||
using Toggle = UnityEngine.UI.Toggle;
|
||||
using ScrollView = PhxhSDK.PhxhScrollView;
|
||||
using Framework;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System;
|
||||
using cfg.SkillCfg;
|
||||
using cfg.PlayerSkillCfg;
|
||||
using PhxhSDK;
|
||||
using cfg.ActorCfg;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem;
|
||||
using Gameplay.PlayerSkill;
|
||||
using Gameplay.Skill;
|
||||
using Constants = Framework.Constants;
|
||||
using DG.Tweening;
|
||||
|
||||
/// <summary>
|
||||
/// 队伍和技能选择界面
|
||||
/// </summary>
|
||||
public class UI_TeamAndSkillSelectController : UIWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// 打开UI(方便调试哪里调用打开该UI和限制参数类型)
|
||||
/// </summary>
|
||||
public static async UniTask<UIWindow> Open(int levelId)
|
||||
{
|
||||
return await UIManager.Instance.OpenWindow(UINameConst.UI_TeamAndSkillSelect, levelId);
|
||||
}
|
||||
|
||||
#region 类
|
||||
/// <summary>
|
||||
/// 队伍
|
||||
/// </summary>
|
||||
private class TeamItem : UIBaseItem
|
||||
{
|
||||
#region UI
|
||||
/// <summary>
|
||||
/// 弹出按钮
|
||||
/// </summary>
|
||||
private Button buttonRoot;
|
||||
/// <summary>
|
||||
/// 收回按钮
|
||||
/// </summary>
|
||||
private Button buttonReturn;
|
||||
/// <summary>
|
||||
/// 编辑队伍按钮
|
||||
/// </summary>
|
||||
private Button buttonEdit;
|
||||
/// <summary>
|
||||
/// 队伍编号
|
||||
/// </summary>
|
||||
private TMP_Text textTeamNum;
|
||||
/// <summary>
|
||||
/// 队伍名
|
||||
/// </summary>
|
||||
private TMP_Text textName;
|
||||
/// <summary>
|
||||
/// 队伍图标
|
||||
/// </summary>
|
||||
private Image imageTeamLogo;
|
||||
/// <summary>
|
||||
/// 队伍
|
||||
/// </summary>
|
||||
private GameObject goTeam;
|
||||
private RectTransform rectTransformTeam;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 队伍索引
|
||||
/// </summary>
|
||||
private readonly int index;
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
private bool isSelect;
|
||||
|
||||
public bool IsSelect
|
||||
{
|
||||
get { return isSelect; }
|
||||
set
|
||||
{
|
||||
//rectTransformTeam.DOPivotX(1f, 0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
public TeamItem(GameObject root, int index) : base(root)
|
||||
{
|
||||
this.index = index;
|
||||
|
||||
goTeam = FindObj("ImageTeamName");
|
||||
textTeamNum = GetComponent<TMP_Text>("TextTeamNum");
|
||||
textName = GetComponent<TMP_Text>("ImageTeamName/TextName");
|
||||
imageTeamLogo = GetComponent<Image>("ImageTeamName/ImageTeamLogo");
|
||||
buttonReturn = GetComponent<Button>("ImageTeamName/ButtonReturn");
|
||||
buttonEdit = GetComponent<Button>("ImageTeamName/ButtonEdit");
|
||||
buttonRoot = GoRoot.GetComponent<Button>();
|
||||
rectTransformTeam = goTeam.transform as RectTransform;
|
||||
|
||||
BindButton(buttonRoot, OnPop);
|
||||
BindButton(buttonReturn, OnPush);
|
||||
BindButton(buttonEdit, OnEdit);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入口
|
||||
/// </summary>
|
||||
public void SetInfo()
|
||||
{
|
||||
textTeamNum.text = $"{index + 1}";
|
||||
|
||||
Team team = TeamEditManager.Instance.TeamList[index];
|
||||
textName.text = team.Name;
|
||||
//imageTeamLogo.sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(team.); TODO 加载队伍图标
|
||||
|
||||
IsScaleShow = true;
|
||||
}
|
||||
|
||||
#region 按钮回调方法
|
||||
/// <summary>
|
||||
/// UI收回
|
||||
/// </summary>
|
||||
private void OnPush()
|
||||
{
|
||||
rectTransformTeam.DOPivotX(1f, 0.3f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UI弹出
|
||||
/// </summary>
|
||||
private void OnPop()
|
||||
{
|
||||
rectTransformTeam.DOPivotX(0f, 0.3f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 队伍编辑
|
||||
/// </summary>
|
||||
private async void OnEdit()
|
||||
{
|
||||
TeamEditManager.Instance.RefreshTeams();
|
||||
await TeamEditManager.Instance.PreLoadAssets();
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UITeamChoose, index);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 技能
|
||||
/// </summary>
|
||||
private class SkillItem : UIBaseItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 打开技能选择按钮
|
||||
/// </summary>
|
||||
private Button buttonSkill;
|
||||
/// <summary>
|
||||
/// 技能图标
|
||||
/// </summary>
|
||||
private Image imageLogo;
|
||||
|
||||
private readonly string UI_Plus_Icon_Path = "Assets/Art/UI/Texture/UI_Pic_Team/UI_TeamAndSkillSelect/UI_Plus";
|
||||
/// <summary>
|
||||
/// 打开技能选择界面回调
|
||||
/// </summary>
|
||||
private Action openSelectSkillAction;
|
||||
/// <summary>
|
||||
/// 索引
|
||||
/// </summary>
|
||||
private int index;
|
||||
|
||||
public SkillItem(GameObject root, int index, Action openSelectSkillAction) : base(root)
|
||||
{
|
||||
this.index = index;
|
||||
this.openSelectSkillAction = openSelectSkillAction;
|
||||
|
||||
imageLogo = GetComponent<Image>("ImageLogo");
|
||||
buttonSkill = GoRoot.GetComponent<Button>();
|
||||
|
||||
BindButton(buttonSkill, OnOpenSelectSkill);
|
||||
}
|
||||
|
||||
public async void SetInfo(int skillId)
|
||||
{
|
||||
if (skillId == Constants.INVALID_ID)
|
||||
imageLogo.sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(UI_Plus_Icon_Path);
|
||||
else
|
||||
{
|
||||
DataPlayerSkill dataPlayerSkill = TableManager.Instance.Tables.PlayerSkillConfig.Get(skillId);
|
||||
imageLogo.sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(dataPlayerSkill.IconPath);
|
||||
}
|
||||
|
||||
IsScaleShow = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开技能选择UI
|
||||
/// </summary>
|
||||
private void OnOpenSelectSkill()
|
||||
{
|
||||
openSelectSkillAction?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 技能选择面板
|
||||
/// </summary>
|
||||
private class SelectSkillPanel : UIBaseItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 页签
|
||||
/// </summary>
|
||||
private class TabItem : UIBaseItem
|
||||
{
|
||||
#region UI
|
||||
/// <summary>
|
||||
/// 选中状态
|
||||
/// </summary>
|
||||
private GameObject goSelect;
|
||||
/// <summary>
|
||||
/// 页签文本
|
||||
/// </summary>
|
||||
private TMP_Text text;
|
||||
/// <summary>
|
||||
/// 页签按钮
|
||||
/// </summary>
|
||||
private Button buttonSelect;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 选中的字体颜色
|
||||
/// </summary>
|
||||
private readonly Color SELECT_FONT_COLOR = Color.black;
|
||||
/// <summary>
|
||||
/// 未选中的字体颜色
|
||||
/// </summary>
|
||||
private readonly Color NORMAL_FONT_COLOR = Color.white;
|
||||
/// <summary>
|
||||
/// 玩家技能类型
|
||||
/// </summary>
|
||||
private readonly PlayerSkillType playerSkillType;
|
||||
/// <summary>
|
||||
/// 选中回调
|
||||
/// </summary>
|
||||
private readonly Action<PlayerSkillType> selectAction;
|
||||
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
public bool IsSelect
|
||||
{
|
||||
set
|
||||
{
|
||||
goSelect.IsScaleShow(value);
|
||||
if (value)
|
||||
text.color = SELECT_FONT_COLOR;
|
||||
else
|
||||
text.color = NORMAL_FONT_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 技能类型
|
||||
/// </summary>
|
||||
public PlayerSkillType SkillType
|
||||
{
|
||||
get { return playerSkillType; }
|
||||
}
|
||||
|
||||
public TabItem(GameObject root, PlayerSkillType playerSkillType, Action<PlayerSkillType> selectAction) : base(root, true)
|
||||
{
|
||||
this.playerSkillType = playerSkillType;
|
||||
this.selectAction = selectAction;
|
||||
|
||||
goSelect = FindObj("ImageSelect");
|
||||
text = GetComponent<TMP_Text>("Text");
|
||||
buttonSelect = GoRoot.GetComponent<Button>();
|
||||
|
||||
BindButton(buttonSelect, OnClick);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中页签
|
||||
/// </summary>
|
||||
private void OnClick()
|
||||
{
|
||||
selectAction?.Invoke(playerSkillType);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 技能
|
||||
/// </summary>
|
||||
private class SkillItem : UIBaseItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 选中状态
|
||||
/// </summary>
|
||||
private GameObject goSelect;
|
||||
private Button buttonSkill;
|
||||
|
||||
/// <summary>
|
||||
/// 技能数据
|
||||
/// </summary>
|
||||
private DataPlayerSkill skillData;
|
||||
/// <summary>
|
||||
/// 点击回调
|
||||
/// </summary>
|
||||
private readonly Action<int> clickAction;
|
||||
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
public bool IsSelect
|
||||
{
|
||||
set { goSelect.IsScaleShow(value); }
|
||||
}
|
||||
|
||||
public DataPlayerSkill SkillData
|
||||
{
|
||||
get { return skillData; }
|
||||
}
|
||||
|
||||
public SkillItem(GameObject root, Action<int> clickAction) : base(root)
|
||||
{
|
||||
this.clickAction = clickAction;
|
||||
|
||||
goSelect = FindObj("ImageChooseRect");
|
||||
buttonSkill = GetComponent<Button>("ButtonSkillLogoS");
|
||||
|
||||
BindButton(buttonSkill, OnClick);
|
||||
}
|
||||
|
||||
public void SetInfo(DataPlayerSkill dataPlayerSkill)
|
||||
{
|
||||
skillData = dataPlayerSkill;
|
||||
|
||||
IsScaleShow = true;
|
||||
}
|
||||
|
||||
private void OnClick()
|
||||
{
|
||||
clickAction?.Invoke(skillData.ID);
|
||||
}
|
||||
}
|
||||
|
||||
#region UI
|
||||
/// <summary>
|
||||
/// 关闭按钮
|
||||
/// </summary>
|
||||
private Button buttonClose;
|
||||
/// <summary>
|
||||
/// 取消按钮
|
||||
/// </summary>
|
||||
private Button buttonCancel;
|
||||
/// <summary>
|
||||
/// 确定按钮
|
||||
/// </summary>
|
||||
private Button buttonConfirm;
|
||||
/// <summary>
|
||||
/// 技能名
|
||||
/// </summary>
|
||||
private TMP_Text textSkillTitle;
|
||||
/// <summary>
|
||||
/// 技能冷却时间
|
||||
/// </summary>
|
||||
private TMP_Text textSkillCollingTime;
|
||||
/// <summary>
|
||||
/// 技能描述
|
||||
/// </summary>
|
||||
private TMP_Text textDescribe;
|
||||
/// <summary>
|
||||
/// 动态列表
|
||||
/// </summary>
|
||||
private RecycleView phxhRecycleView;
|
||||
/// <summary>
|
||||
/// 滑动列表
|
||||
/// </summary>
|
||||
private ScrollRect scrollRect;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 页签列表
|
||||
/// </summary>
|
||||
private readonly List<TabItem> listTab = new(4);
|
||||
/// <summary>
|
||||
/// 实例id对应玩家技能UI列表字典
|
||||
/// </summary>
|
||||
private readonly Dictionary<int, SkillItem> dicSkillItem = new();
|
||||
/// <summary>
|
||||
/// 玩家技能类型对应玩家技能列表字典
|
||||
/// </summary>
|
||||
private readonly Dictionary<PlayerSkillType, List<DataPlayerSkill>> dicSkillData = new();
|
||||
/// <summary>
|
||||
/// 当前选中页签类型
|
||||
/// </summary>
|
||||
private PlayerSkillType curSelectTab;
|
||||
|
||||
/// <summary>
|
||||
/// 以缩放判定是否显示
|
||||
/// </summary>
|
||||
public new bool IsScaleShow
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GoRoot.transform.localScale.x == 0f)
|
||||
return false;
|
||||
|
||||
if (GoRoot.transform.localScale.y == 0f)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
set
|
||||
{
|
||||
GoRoot.IsScaleShow(value);
|
||||
|
||||
// 缩放为0时,无限列表会计算错误,一直滑动
|
||||
if (value)
|
||||
scrollRect.enabled = true;
|
||||
else
|
||||
scrollRect.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public SelectSkillPanel(GameObject root) : base(root)
|
||||
{
|
||||
buttonCancel = GetComponent<Button>("Button_Cancel");
|
||||
buttonConfirm = GetComponent<Button>("Button_Confirm");
|
||||
buttonClose = GetComponent<Button>("Image_BG/Button_Close");
|
||||
textSkillTitle = GetComponent<TMP_Text>("Image_BG/Image_RightBG/Text_SkillTitle");
|
||||
textSkillCollingTime = GetComponent<TMP_Text>("Image_BG/Image_RightBG/Text_SkillCollingTime");
|
||||
textDescribe = GetComponent<TMP_Text>("Image_BG/Image_RightBG/Text_Describe");
|
||||
phxhRecycleView = GetComponent<RecycleView>("Image_BG/PhxhScrollView");
|
||||
scrollRect = phxhRecycleView.transform.GetComponent<ScrollRect>();
|
||||
|
||||
listTab.Add(new TabItem(FindObj("Image_BG/Button_ConductTitle"), PlayerSkillType.Conduct, OnSelectTab));
|
||||
listTab.Add(new TabItem(FindObj("Image_BG/Button_AttackTitle"), PlayerSkillType.Attack, OnSelectTab));
|
||||
listTab.Add(new TabItem(FindObj("Image_BG/Button_SupportTitle"), PlayerSkillType.Support, OnSelectTab));
|
||||
|
||||
#region 获取技能数据
|
||||
foreach (DataPlayerSkill data in TableManager.Instance.Tables.PlayerSkillConfig.DataList)
|
||||
{
|
||||
//PlayerSkillType playerSkillType = TableManager.Instance.Tables.PlayerSkillUpgrade.Get(data.ID, 0).SkillType;
|
||||
PlayerSkillType playerSkillType = (PlayerSkillType)(data.SkillGroup - 1);
|
||||
|
||||
if (dicSkillData.TryGetValue(playerSkillType, out List<DataPlayerSkill> listSkillData))
|
||||
listSkillData.Add(data);
|
||||
else
|
||||
dicSkillData[playerSkillType] = new List<DataPlayerSkill>() { data };
|
||||
}
|
||||
#endregion
|
||||
|
||||
phxhRecycleView.Init(RefreshItem);
|
||||
|
||||
BindButton(buttonCancel, OnCancel);
|
||||
BindButton(buttonClose, OnClose);
|
||||
BindButton(buttonConfirm, OnConfirm);
|
||||
}
|
||||
|
||||
public void SetInfo()
|
||||
{
|
||||
OnSelectTab(PlayerSkillType.Conduct); // 默认选中指挥系
|
||||
|
||||
IsScaleShow = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新技能列表
|
||||
/// </summary>
|
||||
private void RefreshSkillList()
|
||||
{
|
||||
phxhRecycleView.ShowList(GetRecycleListShowCount());
|
||||
|
||||
// 默认选中第一个
|
||||
List<DataPlayerSkill> listCurSkillData = GetCurTapSkillDatas();
|
||||
if (listCurSkillData == null || listCurSkillData.Count < 1)
|
||||
return;
|
||||
|
||||
int skillId = listCurSkillData[0].ID;
|
||||
|
||||
foreach (SkillItem skillItem in dicSkillItem.Values)
|
||||
{
|
||||
skillItem.IsSelect = skillItem.SkillData.ID == skillId;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 无限列表刷新单个项
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="itemTransform"></param>
|
||||
private void RefreshItem(GameObject cell, int index)
|
||||
{
|
||||
if (!dicSkillItem.TryGetValue(cell.GetInstanceID(), out SkillItem skillItem))
|
||||
{
|
||||
skillItem = new SkillItem(cell, OnSelectSkill);
|
||||
dicSkillItem[cell.GetInstanceID()] = skillItem;
|
||||
}
|
||||
|
||||
List<DataPlayerSkill> listPlayerSkillData = GetCurTapSkillDatas();
|
||||
if (listPlayerSkillData == null)
|
||||
return;
|
||||
|
||||
if (listPlayerSkillData.Count < 0 || index >= listPlayerSkillData.Count)
|
||||
{
|
||||
DebugUtil.LogWarning("索引错误");
|
||||
return;
|
||||
}
|
||||
|
||||
skillItem.SetInfo(listPlayerSkillData[index]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前页签对应所有技能数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private List<DataPlayerSkill> GetCurTapSkillDatas()
|
||||
{
|
||||
if (dicSkillData.TryGetValue(curSelectTab, out List<DataPlayerSkill> listData))
|
||||
return listData;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取动态列表需要显示的数量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private int GetRecycleListShowCount()
|
||||
{
|
||||
List<DataPlayerSkill> listSkillData = GetCurTapSkillDatas();
|
||||
|
||||
if (listSkillData == null)
|
||||
return 0;
|
||||
else
|
||||
return listSkillData.Count;
|
||||
}
|
||||
|
||||
#region 按钮回调方法
|
||||
/// <summary>
|
||||
/// 选中页签
|
||||
/// </summary>
|
||||
private void OnSelectTab(PlayerSkillType playerSkillType)
|
||||
{
|
||||
curSelectTab = playerSkillType;
|
||||
|
||||
foreach (TabItem tabItem in listTab)
|
||||
{
|
||||
tabItem.IsSelect = tabItem.SkillType == curSelectTab;
|
||||
}
|
||||
|
||||
RefreshSkillList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中技能
|
||||
/// </summary>
|
||||
private void OnSelectSkill(int skillId)
|
||||
{
|
||||
foreach(SkillItem skillItem in dicSkillItem.Values)
|
||||
{
|
||||
if (skillItem.SkillData.ID == skillId)
|
||||
{
|
||||
skillItem.IsSelect = true;
|
||||
|
||||
textSkillTitle.text = skillItem.SkillData.NameLocal;
|
||||
textDescribe.text = skillItem.SkillData.DescLocal;
|
||||
textSkillCollingTime.text = $"冷却时间:{skillItem.SkillData.CDTime}s";
|
||||
}
|
||||
else
|
||||
skillItem.IsSelect = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭
|
||||
/// </summary>
|
||||
private void OnClose()
|
||||
{
|
||||
IsScaleShow = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消
|
||||
/// </summary>
|
||||
private void OnCancel()
|
||||
{
|
||||
// TODO
|
||||
Debug.Log("点击取消");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 确定
|
||||
/// </summary>
|
||||
private void OnConfirm()
|
||||
{
|
||||
// TODO
|
||||
Debug.Log("点击确定");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UI
|
||||
/// <summary>
|
||||
/// 返回按钮
|
||||
/// </summary>
|
||||
public Button Button_Back;
|
||||
/// <summary>
|
||||
/// 主页按钮
|
||||
/// </summary>
|
||||
public Button Button_Home;
|
||||
/// <summary>
|
||||
/// 开始按钮
|
||||
/// </summary>
|
||||
public Button Button_Start;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 选中的技能列表
|
||||
/// </summary>
|
||||
private readonly List<SkillItem> listSkill = new(CommandSkillManager.COMMAND_SKILL_COUNT);
|
||||
/// <summary>
|
||||
/// 编队列表
|
||||
/// </summary>
|
||||
private readonly List<TeamItem> listTeam = new(TeamEditManager.MAX_TEAM_COUNT);
|
||||
/// <summary>
|
||||
/// 选择技能面板
|
||||
/// </summary>
|
||||
private SelectSkillPanel selectSkillPanel;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
/// </summary>
|
||||
public override void OnInit()
|
||||
{
|
||||
TeamAndSkillSelectBinder.GetComponents(this);
|
||||
|
||||
selectSkillPanel = new SelectSkillPanel(FindObj("ImageBG/ChangeSkillPanel"));
|
||||
|
||||
Transform tsTeamRoot = FindObj("ImageBG/Teams").transform;
|
||||
for (int i = 0; i < tsTeamRoot.childCount; ++i)
|
||||
{
|
||||
listTeam.Add(new TeamItem(tsTeamRoot.GetChild(i).gameObject, i));
|
||||
}
|
||||
|
||||
Transform tsSkillRoot = FindObj("ImageBG/CommandSkill").transform;
|
||||
for (int i = 0; i < tsSkillRoot.childCount; ++i)
|
||||
{
|
||||
listSkill.Add(new SkillItem(tsSkillRoot.GetChild(i).gameObject, i, OnOpenSkillSelect));
|
||||
}
|
||||
|
||||
BindButton(Button_Back, OnBack);
|
||||
BindButton(Button_Home, OnHome);
|
||||
BindButton(Button_Start, OnSweep);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开窗口时调用
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
protected override void OnShowWindow(object data = null)
|
||||
{
|
||||
selectSkillPanel.IsScaleShow = false;
|
||||
|
||||
foreach (TeamItem teamItem in listTeam)
|
||||
{
|
||||
teamItem.SetInfo();
|
||||
}
|
||||
|
||||
TeamManager.Instance.Init();
|
||||
for (int i = 0; i < CommandSkillManager.COMMAND_SKILL_COUNT; ++i)
|
||||
{
|
||||
if(TeamManager.Instance.CommonSkillMgr.CommandSkillIDs.Count > i)
|
||||
listSkill[i].SetInfo(TeamManager.Instance.CommonSkillMgr.CommandSkillIDs[i]);
|
||||
else
|
||||
listSkill[i].SetInfo(Constants.INVALID_ID);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重新加载窗口时调用
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
protected override void OnReloadWindow(object data = null)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭窗口时调用
|
||||
/// </summary>
|
||||
protected override void OnHideWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁时调用
|
||||
/// </summary>
|
||||
public override void OnRelease()
|
||||
{
|
||||
|
||||
|
||||
base.OnRelease();
|
||||
}
|
||||
|
||||
#region 按钮回调方法
|
||||
/// <summary>
|
||||
/// 返回
|
||||
/// </summary>
|
||||
private void OnBack()
|
||||
{
|
||||
CloseWindow(UIWindowCloseType.HideAndDestroy);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主页
|
||||
/// </summary>
|
||||
private void OnHome()
|
||||
{
|
||||
CloseWindow(UIWindowCloseType.HideAndDestroy);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫荡
|
||||
/// </summary>
|
||||
private void OnSweep()
|
||||
{
|
||||
// TODO
|
||||
Debug.Log("点击扫荡");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开技能选择界面
|
||||
/// </summary>
|
||||
private void OnOpenSkillSelect()
|
||||
{
|
||||
selectSkillPanel.SetInfo();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b2bca5f788e7d054badba6531de3eb53
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -96,7 +96,7 @@ public class UI_ShopController : UIWindow
|
|||
sdkHelper.OnRecvReceipt(SendRecipt);
|
||||
sdkHelper.SetClientVerify();
|
||||
sdkHelper.AddGoods(new List<string>() { "Try_Consumable_1" }, new List<string>());
|
||||
sdkHelper.BuyGoods("Try_Consumable_1", "", PurchaseSuccess, PurchaseFail);
|
||||
sdkHelper.BuyGoods("Try_Consumable_1", "");
|
||||
}
|
||||
|
||||
private void PurchaseSuccess(string goodsID)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,262 @@
|
|||
using NPOI.HWPF.Model;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// UI内部类基类
|
||||
/// </summary>
|
||||
public abstract class UIBaseItem
|
||||
{
|
||||
public GameObject GoRoot;
|
||||
|
||||
/// <summary>
|
||||
/// 以缩放判定是否显示
|
||||
/// </summary>
|
||||
public bool IsScaleShow
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GoRoot.transform.localScale.x == 0f)
|
||||
return false;
|
||||
|
||||
if (GoRoot.transform.localScale.y == 0f)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
set
|
||||
{
|
||||
GoRoot.IsScaleShow(value);
|
||||
}
|
||||
}
|
||||
|
||||
public UIBaseItem(GameObject root, bool isScaleShow = false)
|
||||
{
|
||||
GoRoot = root;
|
||||
|
||||
IsScaleShow = isScaleShow;
|
||||
}
|
||||
|
||||
#region 绑定方法
|
||||
public GameObject BindButton(string target, Action action, bool playAudio = true)
|
||||
{
|
||||
GameObject obj = GoRoot.transform.Find(target)?.gameObject;
|
||||
|
||||
if (obj != null)
|
||||
{
|
||||
if (obj.TryGetComponent(out Button button))
|
||||
{
|
||||
button.onClick.AddListener(
|
||||
delegate ()
|
||||
{
|
||||
if (playAudio)
|
||||
{
|
||||
//AudioManager.Instance.PlaySound(SfxNameConst.button_s);
|
||||
}
|
||||
action?.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
DebugUtil.LogError("未找到 {0}/{1}", GoRoot.name, target);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加一个可绑定对应变量的点击事件
|
||||
/// 传入GameObject
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="playAudio"></param>
|
||||
/// <returns></returns>
|
||||
public GameObject BindButton(GameObject obj, Action action, bool playAudio = true)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
if (obj.TryGetComponent(out Button button))
|
||||
{
|
||||
button.onClick.AddListener(
|
||||
delegate ()
|
||||
{
|
||||
if (playAudio)
|
||||
{
|
||||
//AudioManager.Instance.PlaySound(SfxNameConst.button_s);
|
||||
}
|
||||
action?.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
DebugUtil.LogError("未找到 {0}/{1}", GoRoot.name, obj.name);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 传入参数
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="parameter"></param>
|
||||
/// <param name="playAudio"></param>
|
||||
/// <returns></returns>
|
||||
public GameObject BindButton<T>(GameObject obj, Action<T> action, T parameter, bool playAudio = true)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
if (obj.TryGetComponent(out Button button))
|
||||
{
|
||||
button.onClick.AddListener(
|
||||
delegate ()
|
||||
{
|
||||
if (playAudio)
|
||||
{
|
||||
//AudioManager.Instance.PlaySound(SfxNameConst.button_s);
|
||||
}
|
||||
action?.Invoke(parameter);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
DebugUtil.LogError("未找到 {0}/{1}", GoRoot.name, obj.name);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 直接绑按钮
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="playAudio"></param>
|
||||
/// <returns></returns>
|
||||
public GameObject BindButton(Button button, Action action, bool playAudio = true)
|
||||
{
|
||||
if (button != null)
|
||||
{
|
||||
//Button button = button.GetComponent<Button>();
|
||||
if (button != null)
|
||||
{
|
||||
button.onClick.AddListener
|
||||
(
|
||||
delegate ()
|
||||
{
|
||||
if (playAudio)
|
||||
{
|
||||
//AudioManager.Instance.PlaySound(SfxNameConst.button_s);
|
||||
}
|
||||
action?.Invoke();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugUtil.LogError("传入按钮为空,请检查按钮绑定参数!!!");
|
||||
//DebugUtil.LogError($"未找到 {gameObject.name}/{button.name}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return button.gameObject;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 可传入参数
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="button"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="parameter"></param>
|
||||
/// <param name="playAudio"></param>
|
||||
/// <returns></returns>
|
||||
public GameObject BindButton<T>(Button button, Action<T> action, T parameter, bool playAudio = true)
|
||||
{
|
||||
if (button != null)
|
||||
{
|
||||
//Button button = obj.GetComponent<Button>();
|
||||
if (button != null)
|
||||
{
|
||||
button.onClick.AddListener
|
||||
(
|
||||
delegate ()
|
||||
{
|
||||
if (playAudio)
|
||||
{
|
||||
//AudioManager.Instance.PlaySound(SfxNameConst.button_s);
|
||||
}
|
||||
|
||||
if (parameter == null)
|
||||
{
|
||||
DebugUtil.LogError("=== 传入参数为空! ===");
|
||||
}
|
||||
action?.Invoke(parameter);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugUtil.LogError("传入按钮为空,请检查按钮绑定参数!!!");
|
||||
return null;
|
||||
}
|
||||
|
||||
return button.gameObject;
|
||||
}
|
||||
|
||||
public void ClearBind(Button button)
|
||||
{
|
||||
if (button != null)
|
||||
{
|
||||
button.onClick.RemoveAllListeners();
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearBind(GameObject go)
|
||||
{
|
||||
if (go.TryGetComponent(out Button button))
|
||||
button.onClick.RemoveAllListeners();
|
||||
}
|
||||
|
||||
public GameObject FindObj(string path)
|
||||
{
|
||||
GameObject obj = GoRoot.transform.Find(path)?.gameObject;
|
||||
if (obj == null)
|
||||
{
|
||||
DebugUtil.LogError("未找到 {0}/{1}", GoRoot.name, path);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
public T GetComponent<T>(string path = "") where T : Behaviour
|
||||
{
|
||||
T component = GoRoot.transform.Find(path)?.GetComponent<T>();
|
||||
if (component == null)
|
||||
{
|
||||
DebugUtil.LogError("未找到组件{0}: {1}", typeof(T).Name, path);
|
||||
}
|
||||
return component;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class GameObjectExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 修改缩放的方式显示隐藏
|
||||
/// </summary>
|
||||
/// <param name="go"></param>
|
||||
/// <param name="isShow"></param>
|
||||
public static void IsScaleShow(this GameObject go, bool isShow)
|
||||
{
|
||||
if (isShow)
|
||||
go.transform.localScale = Vector3.one;
|
||||
else
|
||||
go.transform.localScale = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f360947ab08f1904da7a5708e8d811a1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using Framework;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
using Image = UnityEngine.UI.Image;
|
||||
using Toggle = UnityEngine.UI.Toggle;
|
||||
using ScrollView = PhxhSDK.PhxhScrollView;
|
||||
|
||||
public class TeamAndSkillSelectBinder
|
||||
{
|
||||
|
||||
public static void GetComponents(UI_TeamAndSkillSelectController window)
|
||||
{
|
||||
window.Button_Back = window.GetComponent<Button>("ImageBG/UI_Topbtn/Button_Back");
|
||||
window.Button_Home = window.GetComponent<Button>("ImageBG/UI_Topbtn/Button_Home");
|
||||
window.Button_Start = window.GetComponent<Button>("ImageBG/Button_Start");
|
||||
|
||||
}
|
||||
|
||||
/****** 定义变量语句 ******
|
||||
public Button Button_Back;
|
||||
public TMP_Text Text_Back;
|
||||
public Button Button_Home;
|
||||
public Button Button_Team1;
|
||||
public Button Button_Team2;
|
||||
public Button Button_Team3;
|
||||
public Button Button_Team4;
|
||||
public Button Button_Team5;
|
||||
public Button Button_Team6;
|
||||
public Button Button_Team7;
|
||||
public Button Button_Team8;
|
||||
public Button Button_Skill01;
|
||||
public Button Button_Skill02;
|
||||
public Button Button_Skill03;
|
||||
public Button Button_Start;
|
||||
public Image Image_physicalBG;
|
||||
public Image Image_Physical;
|
||||
public TMP_Text Text_PhysicalNum;
|
||||
public TMP_Text Text_StartSweep;
|
||||
public Image Image_Cover;
|
||||
public Image Image_BG;
|
||||
public Image Image_RightBG;
|
||||
public TMP_Text Text_SkillTitle;
|
||||
public TMP_Text Text_SkillCollingTime;
|
||||
public TMP_Text Text_Describe;
|
||||
public Button Button_Close;
|
||||
public TMP_Text Text_CMDSkill;
|
||||
public Button Button_ConductTitle;
|
||||
public Button Button_ConductTitleChoose;
|
||||
public Button Button_AttackTitle;
|
||||
public Button Button_AttackTitleChoose;
|
||||
public Button Button_HealingTitle;
|
||||
public Button Button_HealingTitleChoose;
|
||||
public Button Button_Cancel;
|
||||
public TMP_Text Text_Cancel;
|
||||
public Button Button_Confirm;
|
||||
public TMP_Text Text_Confirm;
|
||||
|
||||
****** End ******/
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6cb5868401aeb25479fc3bcab3b9bed2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 11f1186e74a59c9ffb07457e88e71dbc98ae9c7b
|
||||
Subproject commit d869709486f6217b228b00f81a70032e6948e009
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 16995157, guid: a811bde74b26b53498b4f6d872b09b6d, type: 3}
|
||||
m_Name: DOTweenSettings
|
||||
m_EditorClassIdentifier:
|
||||
useSafeMode: 1
|
||||
safeModeOptions:
|
||||
logBehaviour: 2
|
||||
nestedTweenFailureBehaviour: 0
|
||||
timeScale: 1
|
||||
unscaledTimeScale: 1
|
||||
useSmoothDeltaTime: 0
|
||||
maxSmoothUnscaledTime: 0.15
|
||||
rewindCallbackMode: 0
|
||||
showUnityEditorReport: 0
|
||||
logBehaviour: 0
|
||||
drawGizmos: 1
|
||||
defaultRecyclable: 0
|
||||
defaultAutoPlay: 3
|
||||
defaultUpdateType: 0
|
||||
defaultTimeScaleIndependent: 0
|
||||
defaultEaseType: 6
|
||||
defaultEaseOvershootOrAmplitude: 1.70158
|
||||
defaultEasePeriod: 0
|
||||
defaultAutoKill: 1
|
||||
defaultLoopType: 0
|
||||
debugMode: 0
|
||||
debugStoreTargetId: 1
|
||||
showPreviewPanel: 1
|
||||
storeSettingsLocation: 0
|
||||
modules:
|
||||
showPanel: 0
|
||||
audioEnabled: 1
|
||||
physicsEnabled: 1
|
||||
physics2DEnabled: 1
|
||||
spriteEnabled: 1
|
||||
uiEnabled: 1
|
||||
textMeshProEnabled: 0
|
||||
tk2DEnabled: 0
|
||||
deAudioEnabled: 0
|
||||
deUnityExtendedEnabled: 0
|
||||
epoOutlineEnabled: 0
|
||||
createASMDEF: 0
|
||||
showPlayingTweens: 0
|
||||
showPausedTweens: 0
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c2dc67962139c0945a9d281a6d9903c6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue