main
parent
3b54d48dfc
commit
c5cb2a4099
File diff suppressed because it is too large
Load Diff
|
|
@ -48,7 +48,7 @@ public partial class UIManager
|
|||
_WindowMeta(UINameConst.UIGiftCode, UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UI_MainPanel, UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UI_LevelSelect,UIWindowLayer.Normal);
|
||||
|
||||
_WindowMeta(UINameConst.UI_BeforeFight,UIWindowLayer.Normal);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -108,4 +108,5 @@ public static class UINameConst
|
|||
public static readonly string UIGiftCode = "MainScene/GiftCode/UIGiftCode";
|
||||
public static readonly string UI_MainPanel = "MainPanel/UI_MainPanel";
|
||||
public static readonly string UI_LevelSelect = "LevelSelect/UI_LevelSelect";
|
||||
public static readonly string UI_BeforeFight = "LevelSelect/UI_BeforeFight";
|
||||
}
|
||||
|
|
@ -97,6 +97,12 @@ public abstract class UIWindow : MonoBehaviour
|
|||
Hide();
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseSelf(bool destroy = true)
|
||||
{
|
||||
UIManager.Instance.CloseWindow(WindowName, destroy);
|
||||
}
|
||||
|
||||
public bool OnBack()
|
||||
{
|
||||
//AudioManager.Instance.PlaySound(SfxNameConst.button_s);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ public class TeamEditManager : Singlenton<TeamEditManager>, IInitable
|
|||
|
||||
public Team GetSelectTeam()
|
||||
{
|
||||
if (_teamList.Count == 0)
|
||||
{
|
||||
DebugUtil.LogError("当前没有任何编队");
|
||||
return null;
|
||||
}
|
||||
_selectTeam = _teamList[0];
|
||||
return _selectTeam;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
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;
|
||||
|
||||
public class UI_BeforeFightBinder
|
||||
{
|
||||
|
||||
public static void GetComponents(UI_BeforeFightController window)
|
||||
{
|
||||
window.Button_Back = window.GetComponent<Button>("UI_Topbtn/Button_Back");
|
||||
window.Text_Back = window.GetComponent<TMP_Text>("UI_Topbtn/Button_Back/Text_Back");
|
||||
window.Button_Home = window.GetComponent<Button>("UI_Topbtn/Button_Home");
|
||||
window.Image_TeamName = window.GetComponent<Image>("Image_TeamName");
|
||||
window.Button_Arrow = window.GetComponent<Button>("Image_TeamName/Button_Arrow");
|
||||
window.Button_Setting = window.GetComponent<Button>("Image_TeamName/Button_Setting");
|
||||
window.Text_Setting = window.GetComponent<TMP_Text>("Image_TeamName/Button_Setting/Text_Setting");
|
||||
window.Text_TeamName = window.GetComponent<TMP_Text>("Image_TeamName/Text_TeamName");
|
||||
window.Button_Right = window.GetComponent<Button>("Button_Right");
|
||||
window.Button_Left = window.GetComponent<Button>("Button_Left");
|
||||
window.Image_SweepBar = window.GetComponent<Image>("UI_Sweep/Image_SweepBar");
|
||||
window.Button_Plus = window.GetComponent<Button>("UI_Sweep/Image_SweepBar/Button_Plus");
|
||||
window.Button_Minus = window.GetComponent<Button>("UI_Sweep/Image_SweepBar/Button_Minus");
|
||||
window.Text_SweepNum = window.GetComponent<TMP_Text>("UI_Sweep/Image_SweepBar/Text_SweepNum");
|
||||
window.Button_FightStart = window.GetComponent<Button>("UI_Sweep/Button_FightStart");
|
||||
window.Image_MaterialBar = window.GetComponent<Image>("UI_Sweep/Button_FightStart/Image_MaterialBar");
|
||||
window.Text_MaterialNum01 = window.GetComponent<TMP_Text>("UI_Sweep/Button_FightStart/Image_MaterialBar/Text_MaterialNum01");
|
||||
window.Text_MaterialNum02 = window.GetComponent<TMP_Text>("UI_Sweep/Button_FightStart/Image_MaterialBar/Text_MaterialNum02");
|
||||
window.Image_MaterialArrow = window.GetComponent<Image>("UI_Sweep/Button_FightStart/Image_MaterialBar/Image_MaterialArrow");
|
||||
window.Text_FightStart = window.GetComponent<TMP_Text>("UI_Sweep/Button_FightStart/Text_FightStart");
|
||||
window.Button_SweepOn = window.GetComponent<Button>("UI_Sweep/Button_SweepOn");
|
||||
window.Button_SweepOff = window.GetComponent<Button>("UI_Sweep/Button_SweepOff");
|
||||
|
||||
}
|
||||
|
||||
/****** 定义变量语句 ******
|
||||
public Button Button_Back;
|
||||
public TMP_Text Text_Back;
|
||||
public Button Button_Home;
|
||||
public Image Image_TeamName;
|
||||
public Button Button_Arrow;
|
||||
public Button Button_Setting;
|
||||
public TMP_Text Text_Setting;
|
||||
public TMP_Text Text_TeamName;
|
||||
public Button Button_Right;
|
||||
public Button Button_Left;
|
||||
public Image Image_SweepBar;
|
||||
public Button Button_Plus;
|
||||
public Button Button_Minus;
|
||||
public TMP_Text Text_SweepNum;
|
||||
public Button Button_FightStart;
|
||||
public Image Image_MaterialBar;
|
||||
public TMP_Text Text_MaterialNum01;
|
||||
public TMP_Text Text_MaterialNum02;
|
||||
public Image Image_MaterialArrow;
|
||||
public TMP_Text Text_FightStart;
|
||||
public Button Button_SweepOn;
|
||||
public Button Button_SweepOff;
|
||||
|
||||
****** End ******/
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6ea33bd58c8fd8d4abf5fd09ee0a85de
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Gameplay.Level;
|
||||
using NPOI.SS.Formula.PTG;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
using EventManager = Framework.EventManager;
|
||||
using Image = UnityEngine.UI.Image;
|
||||
|
||||
public class UI_BeforeFightController : UIWindow
|
||||
{
|
||||
//UI GameObj
|
||||
///Auto Gen Start///
|
||||
public Button Button_Back;
|
||||
|
||||
public TMP_Text Text_Back;
|
||||
public Button Button_Home;
|
||||
public Image Image_TeamName;
|
||||
public Button Button_Arrow;
|
||||
public Button Button_Setting;
|
||||
public TMP_Text Text_Setting;
|
||||
public TMP_Text Text_TeamName;
|
||||
public Button Button_Right;
|
||||
public Button Button_Left;
|
||||
public Image Image_SweepBar;
|
||||
public Button Button_Plus;
|
||||
public Button Button_Minus;
|
||||
public TMP_Text Text_SweepNum;
|
||||
public Button Button_FightStart;
|
||||
public Image Image_MaterialBar;
|
||||
public TMP_Text Text_MaterialNum01;
|
||||
public TMP_Text Text_MaterialNum02;
|
||||
public Image Image_MaterialArrow;
|
||||
public TMP_Text Text_FightStart;
|
||||
public Button Button_SweepOn;
|
||||
public Button Button_SweepOff;
|
||||
|
||||
///Auto Gen End///
|
||||
private int _currLevelID;
|
||||
|
||||
private Team _currTeam;
|
||||
private int _currTeamIndex = -1;
|
||||
private int _teamIndexMax;
|
||||
private bool HasTeam => _currTeam != null;
|
||||
|
||||
// Use this for initialization
|
||||
public override void OnAwake()
|
||||
{
|
||||
//bind UI GameObj
|
||||
UI_BeforeFightBinder.GetComponents(this);
|
||||
BindProperty();
|
||||
BindEvent();
|
||||
RegisterSignal();
|
||||
Init();
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
}
|
||||
|
||||
private void BindProperty()
|
||||
{
|
||||
}
|
||||
|
||||
private void BindEvent()
|
||||
{
|
||||
BindButton(Button_Back, OnClickBack);
|
||||
BindButton(Button_Home, OnClickHome);
|
||||
BindButton(Button_FightStart, OnClickFight);
|
||||
BindButton(Button_Right, OnClickRight);
|
||||
BindButton(Button_Left, OnClickLeft);
|
||||
BindButton(Button_Setting, OnClickGoToTeamEdit);
|
||||
}
|
||||
|
||||
private void RegisterSignal()
|
||||
{
|
||||
EventManager.Instance.Register(EventManager.EventName.TeamUpdate, OnTeamEditFinished);
|
||||
}
|
||||
|
||||
private void UnRegisterSignal()
|
||||
{
|
||||
EventManager.Instance.Unregister(EventManager.EventName.TeamUpdate, OnTeamEditFinished);
|
||||
}
|
||||
|
||||
private void InitTeamInfo()
|
||||
{
|
||||
var teamList = TeamEditManager.Instance.TeamList;
|
||||
_teamIndexMax = teamList.Count - 1;
|
||||
_currTeam = _currTeamIndex == -1 ? TeamEditManager.Instance.GetSelectTeam() : teamList[_currTeamIndex];
|
||||
if (_currTeam == null)
|
||||
{
|
||||
DebugUtil.LogError("当前没有任何编队!");
|
||||
return;
|
||||
}
|
||||
|
||||
_currTeamIndex = teamList.IndexOf(_currTeam);
|
||||
}
|
||||
|
||||
private void Refresh()
|
||||
{
|
||||
if (HasTeam)
|
||||
{
|
||||
RefreshInfo();
|
||||
RefreshScene();
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshInfo()
|
||||
{
|
||||
Text_TeamName.text = _currTeam.Name;
|
||||
Button_Left.interactable = _currTeamIndex > 0;
|
||||
Button_Right.interactable = _currTeamIndex < _teamIndexMax;
|
||||
}
|
||||
|
||||
private async void RefreshScene()
|
||||
{
|
||||
DebugUtil.LogError("_currTeamIndex:{0}", _currTeamIndex);
|
||||
await TeamEditManager.Instance.LoadTeamPreviewNode(_currTeamIndex);
|
||||
var previewNode = TeamEditManager.Instance.TeamPreviewNode;
|
||||
GetComponent<RawImage>().texture = previewNode.RTexture;
|
||||
}
|
||||
|
||||
#region Event
|
||||
|
||||
private void OnClickBack()
|
||||
{
|
||||
CloseSelf();
|
||||
}
|
||||
|
||||
private void OnClickHome()
|
||||
{
|
||||
CloseSelf();
|
||||
}
|
||||
|
||||
private void OnClickFight()
|
||||
{
|
||||
LevelManager.Instance.TryEnterLevel(_currLevelID, OnEnterLevelFinished);
|
||||
}
|
||||
|
||||
private void OnClickRight()
|
||||
{
|
||||
_currTeamIndex++;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void OnClickLeft()
|
||||
{
|
||||
_currTeamIndex--;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void OnClickGoToTeamEdit()
|
||||
{
|
||||
UIManager.Instance.OpenWindow(UINameConst.UITeamChoose);
|
||||
}
|
||||
|
||||
private void OnEnterLevelFinished()
|
||||
{
|
||||
CloseSelf();
|
||||
UIManager.Instance.CloseWindow(UINameConst.UI_LevelSelect, true);
|
||||
}
|
||||
|
||||
private void OnTeamEditFinished()
|
||||
{
|
||||
InitTeamInfo();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Override
|
||||
|
||||
//invoke when open window
|
||||
protected override void OnOpenWindow(object data = null)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
DebugUtil.LogError("data is null!");
|
||||
return;
|
||||
}
|
||||
|
||||
_currLevelID = (int)data;
|
||||
InitTeamInfo();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
//invoke when reload window
|
||||
protected override void OnReloadWindow(object data = null)
|
||||
{
|
||||
}
|
||||
|
||||
//invoke when close window
|
||||
protected override void OnCloseWindow(bool destroy = false)
|
||||
{
|
||||
UnRegisterSignal();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c2c827095175cc94ca74ceccfd998e0a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -395,13 +395,8 @@ public class UI_LevelSelectController : UIWindow
|
|||
{
|
||||
if (_currSelectLevelInfo == null)
|
||||
return;
|
||||
//UIManager.Instance.OpenWindow(UINameConst.UITeamChoose);
|
||||
LevelManager.Instance.TryEnterLevel(_currSelectLevelInfo.ID, CloseSelf);
|
||||
}
|
||||
|
||||
private void CloseSelf()
|
||||
{
|
||||
UIManager.Instance.CloseWindow(WindowName, true);
|
||||
UIManager.Instance.OpenWindow(UINameConst.UI_BeforeFight,_currSelectLevelInfo.ID);
|
||||
//LevelManager.Instance.TryEnterLevel(_currSelectLevelInfo.ID, CloseSelf);
|
||||
}
|
||||
|
||||
private int GetLevelGroupCount()
|
||||
|
|
@ -520,7 +515,7 @@ public class UI_LevelSelectController : UIWindow
|
|||
switch (_currPage)
|
||||
{
|
||||
case PageType.Mode:
|
||||
UIManager.Instance.CloseWindow(WindowName, true);
|
||||
CloseSelf();
|
||||
break;
|
||||
case PageType.LevelGroup:
|
||||
ExitSelectLevelGroup();
|
||||
|
|
@ -533,7 +528,7 @@ public class UI_LevelSelectController : UIWindow
|
|||
|
||||
private void OnClickHome()
|
||||
{
|
||||
UIManager.Instance.CloseWindow(WindowName, true);
|
||||
CloseSelf();
|
||||
}
|
||||
|
||||
private void OnClickEasy()
|
||||
|
|
|
|||
|
|
@ -249,14 +249,14 @@ public class ConfigWindow : EditorWindow
|
|||
ExportClient = exportC;
|
||||
}
|
||||
|
||||
bool exportS = EditorGUILayout.ToggleLeft("导出服务器", ExportServer);
|
||||
if (exportS != ExportServer)
|
||||
{
|
||||
if (exportS)
|
||||
ExportClient = false;
|
||||
|
||||
ExportServer = exportS;
|
||||
}
|
||||
// bool exportS = EditorGUILayout.ToggleLeft("导出服务器", ExportServer);
|
||||
// if (exportS != ExportServer)
|
||||
// {
|
||||
// if (exportS)
|
||||
// ExportClient = false;
|
||||
//
|
||||
// ExportServer = exportS;
|
||||
// }
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(10);
|
||||
|
|
|
|||
Loading…
Reference in New Issue