主界面替换
parent
6868bd1c59
commit
d58f7d8b63
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ef5bba0e38fc05d4cb42f66a835e4641
|
||||
guid: 8c31c5dbc6c579d4bb082612d97ca6da
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1d8e2cf4a8c91c14c9b3840b8755e6a1
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ef5bba0e38fc05d4cb42f66a835e4641
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -153,6 +153,9 @@ public static class UINameConst
|
|||
|
||||
public static readonly string UINewLogin = "StartScene/UINewLogin";
|
||||
public static readonly string UIGiftCode = "MainScene/GiftCode/UIGiftCode";
|
||||
/// <summary>
|
||||
/// 主界面
|
||||
/// </summary>
|
||||
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";
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ using Image = UnityEngine.UI.Image;
|
|||
public class UI_MainPanelBinder
|
||||
{
|
||||
|
||||
public static void GetComponents(UI_MainPanelController window)
|
||||
public static void GetComponents(UI_MainPanelControllerOld window)
|
||||
{
|
||||
|
||||
window.Button_Warning = window.GetComponent<Button>("UI_TopButtom/Button_Warning");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using UnityEngine;
|
||||
using static UI_MainPanelController;
|
||||
using static UI_MainPanelControllerOld;
|
||||
|
||||
public class MusicCubeRun : MonoBehaviour
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
using cfg.UIInterfaceBannerGoToCfg;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Framework;
|
||||
using Gameplay;
|
||||
using Gameplay.Common;
|
||||
using Gameplay.Net;
|
||||
using PhxhSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
|
@ -12,532 +12,362 @@ using UnityEngine.UI;
|
|||
using Button = UnityEngine.UI.Button;
|
||||
using Image = UnityEngine.UI.Image;
|
||||
|
||||
public class UI_MainPanelController: UIWindow
|
||||
/// <summary>
|
||||
/// 主界面
|
||||
/// </summary>
|
||||
public class UI_MainPanelController : UIWindow
|
||||
{
|
||||
//UI GameObj
|
||||
///Auto Gen Start///
|
||||
public Image Image_PhysicPower;
|
||||
|
||||
public Button Button_Plus;
|
||||
public TMP_Text Text_PPNow;
|
||||
public TMP_Text Text_PPMax;
|
||||
public Image Image_PPBar;
|
||||
public Image Image_Damond;
|
||||
public TMP_Text Text_DamondNum;
|
||||
public Image Image_Coin;
|
||||
public TMP_Text Text_CoinNum;
|
||||
public Button Button_Warning;
|
||||
public Image Image_RedPoint;
|
||||
public Button Button_Email;
|
||||
public Button Button_Install;
|
||||
public Button Button_Unknown;
|
||||
public Button Button_CharacterChange;
|
||||
public Button Button_Camera;
|
||||
public Image Image_CharacterInfo;
|
||||
public TMP_Text Text_CharacterName;
|
||||
public Image Image_ExBar01;
|
||||
public TMP_Text Text_ExHad;
|
||||
public TMP_Text Text_ExMax;
|
||||
public Image Image_ExBar;
|
||||
public TMP_Text Text_LevelNum;
|
||||
public Button Button_ActivityPoster;
|
||||
public Image Image_WhiteBar;
|
||||
public Image Image_BlackBar;
|
||||
public Image Image_LeftBG;
|
||||
public Button Button_Music01;
|
||||
public Image Image_GreenPoint;
|
||||
public TMP_Text Text_Time;
|
||||
public Button Button_Music02;
|
||||
public Image Image_ButtonBG;
|
||||
public Button Button_Character;
|
||||
public TMP_Text Text_Character;
|
||||
public Button Button_Vehicle;
|
||||
public TMP_Text Text_Vehicle;
|
||||
public Button Button_Camp;
|
||||
public TMP_Text Text_Camp;
|
||||
public Button Button_Team;
|
||||
public TMP_Text Text_Team;
|
||||
public Button Button_Store;
|
||||
public TMP_Text Text_Store;
|
||||
public Button Button_DrawCard;
|
||||
public TMP_Text Text_DrawCard;
|
||||
public Image Image_RightBG;
|
||||
public Button Button_ChooseLevel;
|
||||
public TMP_Text Text_ChooseLevel;
|
||||
public Button Button_PVP;
|
||||
public TMP_Text Text_PVP;
|
||||
ScrollRect _mCurrentScrollView = null;
|
||||
private TMP_InputField _inputLevel;
|
||||
private GameObject whiteBarItem;
|
||||
private int scrollCount;
|
||||
private List<GameObject> bannerTiaoList;
|
||||
|
||||
public RawImage RawImage_Scene;
|
||||
public Button GiftCodeBtn;
|
||||
|
||||
private bool isMusicStart = false;
|
||||
|
||||
private List<MusicCube> cubeList = new List<MusicCube>();
|
||||
private List<float[]>musicData = new List<float[]>();
|
||||
|
||||
///Auto Gen End///
|
||||
UI_CurrencyItem diamondItem;
|
||||
UI_CurrencyItem coinItem;
|
||||
UI_CurrencyItem energyItem;
|
||||
|
||||
List<GameObject> cameraGoList;
|
||||
GameObject subCameraObj;
|
||||
|
||||
bool isFirst = true;
|
||||
const float minutes=60;
|
||||
// Use this for initialization
|
||||
public override void OnInit()
|
||||
#region 类
|
||||
/// <summary>
|
||||
/// 音乐跳动
|
||||
/// </summary>
|
||||
private class MusicDance : UIGameObjectWrapper
|
||||
{
|
||||
//bind UI GameObj
|
||||
bannerTiaoList = new List<GameObject>();
|
||||
|
||||
|
||||
UI_MainPanelBinder.GetComponents(this);
|
||||
_mCurrentScrollView = GetComponent<ScrollRect>("ScrollView");
|
||||
_inputLevel = transform.Find("InputField")?.GetComponent<TMP_InputField>();
|
||||
whiteBarItem = FindObj("BarItem");
|
||||
BindButton(Button_Character, OnButton_CharacterClickAsync);
|
||||
BindButton(Button_ChooseLevel, OnButton_ChooseLevelClick);
|
||||
BindButton(Button_Team, OnButtonTeamClick);
|
||||
BindButton(Button_Camp, OnButtonCampClick);
|
||||
GiftCodeBtn = GetComponent<Button>("Button_DuiHuanMa");
|
||||
BindButton(GiftCodeBtn, OnGiftBtnClick);
|
||||
BindButton(Button_Vehicle, OnButton_VehicleClickAsync);
|
||||
|
||||
RawImage_Scene = GetComponent<RawImage>("RawImage_Scene");
|
||||
InitCube();
|
||||
GetGeneralMusicData();
|
||||
BindButton(Button_Install, OnOpenSettingPanel);
|
||||
diamondItem =FindObj("UI_TopButtom/DiamondItem").GetComponent<UI_CurrencyItem>();
|
||||
coinItem = FindObj("UI_TopButtom/CoinItem").GetComponent<UI_CurrencyItem>();
|
||||
energyItem = FindObj("UI_TopButtom/EnergyItem").GetComponent<UI_CurrencyItem>();
|
||||
|
||||
BindButton(Button_Email, OnEmailBtnClick);
|
||||
BindButton(Button_DrawCard, OnDrawCardClick);
|
||||
BindButton(Button_Store, OnStoreBtnClick);
|
||||
|
||||
|
||||
BindButton(Button_Unknown, _OnClickTask);
|
||||
//BindButton(Button_Camera, OnCameraClick);
|
||||
BindButton(Button_CharacterChange, OnCameraClick);
|
||||
|
||||
BindButton(GetComponent<Button>("CommandSkillBtn"), OnCommandSkillClick);
|
||||
cameraGoList = new List<GameObject>();
|
||||
RegisterScreenAdaption();
|
||||
//测试增量热更
|
||||
Debug.Log("test mainScene");
|
||||
var go = GameObject.Find("NLD_URP_NLD_Scene_Lambert");
|
||||
if (go != null)
|
||||
public MusicDance(GameObject root) : base(root)
|
||||
{
|
||||
Debug.Log("go is not null");
|
||||
Debug.Log(go.GetComponent<MeshFilter>().sharedMesh);
|
||||
Debug.Log(go.GetComponent<MeshRenderer>().sharedMaterial);
|
||||
}
|
||||
|
||||
BindButton(Button_PVP, OnPVPClick);
|
||||
|
||||
EventManager.Instance.Register(EventManager.EventName.ChangeMainPanelPoster, _OnChangePoster);
|
||||
}
|
||||
|
||||
private async void OnCommandSkillClick()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_CommandSkillCultivate);
|
||||
}
|
||||
|
||||
private async void OnStoreBtnClick()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Shop);
|
||||
}
|
||||
|
||||
private async void OnCameraClick()
|
||||
{
|
||||
//await UIManager.Instance.OpenWindow(UINameConst.UI_CameraChange,cameraGoList);
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UICameraAndPosterChange);
|
||||
}
|
||||
|
||||
private async void OnDrawCardClick()
|
||||
{
|
||||
await UI_RaffleController.Open();
|
||||
}
|
||||
|
||||
private async void OnPVPClick()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_PVPMain);
|
||||
}
|
||||
|
||||
|
||||
private async void OnEmailBtnClick()
|
||||
{
|
||||
CommonUtils.CaptureScreenshot();
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Email);
|
||||
|
||||
}
|
||||
|
||||
private async void OnButton_VehicleClickAsync()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_VehicleChoose);
|
||||
}
|
||||
|
||||
private async void GetGeneralMusicData()
|
||||
{
|
||||
musicData = await MusicCubeManager.Instance.GetGeneralMusicCfg();
|
||||
}
|
||||
|
||||
private void SetNowRefreshTime()
|
||||
{
|
||||
refreshTime = 0.01f;
|
||||
}
|
||||
private async void OnGiftBtnClick()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UIGiftCode);
|
||||
}
|
||||
private async void OnButtonTeamClick()
|
||||
{
|
||||
await UI_TeamAndSkillSelectController.Open();
|
||||
}
|
||||
|
||||
private void OnButtonCampClick()
|
||||
{
|
||||
CampManager.Instance.EnterCamp();
|
||||
}
|
||||
|
||||
private async void OnOpenSettingPanel()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Setting);
|
||||
}
|
||||
|
||||
private void InitCube()
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
cubeList.Add(new MusicCube(FindObj(string.Format("MusicCube/{0}",i))));
|
||||
}
|
||||
}
|
||||
|
||||
float refreshTime = 0.1f;
|
||||
float nowTime = 0;
|
||||
int index;
|
||||
string tempStr = "";
|
||||
/// <summary>
|
||||
/// 电池
|
||||
/// </summary>
|
||||
private class Batterie : UIGameObjectWrapper
|
||||
{
|
||||
public Batterie(GameObject root) : base(root)
|
||||
{
|
||||
|
||||
float nowTimeForRefreshTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WIFI
|
||||
/// </summary>
|
||||
private class Wifi : UIGameObjectWrapper
|
||||
{
|
||||
public Wifi(GameObject root) : base(root)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 玩家信息
|
||||
/// </summary>
|
||||
private class PlayerInfo : UIGameObjectWrapper
|
||||
{
|
||||
public PlayerInfo(GameObject root) : base(root)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 看板娘
|
||||
/// </summary>
|
||||
private class Kanbanban : UIGameObjectWrapper
|
||||
{
|
||||
public Kanbanban(GameObject root) : base(root)
|
||||
{ }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 音乐
|
||||
/// </summary>
|
||||
private class Music : UIGameObjectWrapper
|
||||
{
|
||||
public Music(GameObject root) : base(root)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UI
|
||||
/// <summary>
|
||||
/// 相机按钮
|
||||
/// </summary>
|
||||
private Button buttonCamera;
|
||||
/// <summary>
|
||||
/// 切换立绘按钮
|
||||
/// </summary>
|
||||
private Button buttonCharacterChange;
|
||||
/// <summary>
|
||||
/// 抽卡按钮
|
||||
/// </summary>
|
||||
private Button buttonRaffle;
|
||||
/// <summary>
|
||||
/// 商店按钮
|
||||
/// </summary>
|
||||
private Button buttonStore;
|
||||
/// <summary>
|
||||
/// 角色按钮
|
||||
/// </summary>
|
||||
private Button buttonCharacter;
|
||||
/// <summary>
|
||||
/// 队伍按钮
|
||||
/// </summary>
|
||||
private Button buttonTeam;
|
||||
/// <summary>
|
||||
/// 载具按钮
|
||||
/// </summary>
|
||||
private Button buttonVehicle;
|
||||
/// <summary>
|
||||
/// 营地按钮
|
||||
/// </summary>
|
||||
private Button buttonCamp;
|
||||
/// <summary>
|
||||
/// 进入关卡按钮
|
||||
/// </summary>
|
||||
private Button buttonChooseLevel;
|
||||
/// <summary>
|
||||
/// PVP按钮
|
||||
/// </summary>
|
||||
private Button buttonPVP;
|
||||
/// <summary>
|
||||
/// 加体力按钮
|
||||
/// </summary>
|
||||
private Button buttonPlusP;
|
||||
/// <summary>
|
||||
/// 通知按钮
|
||||
/// </summary>
|
||||
private Button buttonNotice;
|
||||
/// <summary>
|
||||
/// 邮件按钮
|
||||
/// </summary>
|
||||
private Button buttonEmail;
|
||||
/// <summary>
|
||||
/// 设置按钮
|
||||
/// </summary>
|
||||
private Button buttonSetting;
|
||||
/// <summary>
|
||||
/// 音乐按钮
|
||||
/// </summary>
|
||||
private Button buttonMusic;
|
||||
/// <summary>
|
||||
/// 看板娘立绘
|
||||
/// </summary>
|
||||
private Image imageCharacterPoster;
|
||||
/// <summary>
|
||||
/// 体力条
|
||||
/// </summary>
|
||||
private Image imageStamina;
|
||||
/// <summary>
|
||||
/// 体力恢复提示文本
|
||||
/// </summary>
|
||||
private TMP_Text textStaminaRecovery;
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
private TMP_Text textTime;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 刷新时间间隔
|
||||
/// </summary>
|
||||
private const float REFRESH_TIME_SPAN = 1f;
|
||||
/// <summary>
|
||||
/// 刷新时间计时器
|
||||
/// </summary>
|
||||
private float refreshTimeTimer;
|
||||
|
||||
public override void OnInit()
|
||||
{
|
||||
buttonCamera = GetComponent<Button>("UI_LiuHaiLeft/Button_Camera");
|
||||
buttonCharacterChange = GetComponent<Button>("UI_LiuHaiLeft/Button_CharacterChange");
|
||||
buttonRaffle = GetComponent<Button>("RecruitAndShopBG/Button_DrawCard");
|
||||
buttonStore = GetComponent<Button>("RecruitAndShopBG/Button_Store");
|
||||
buttonCharacter = GetComponent<Button>("Image_ButtonBG/Button_Character");
|
||||
buttonTeam = GetComponent<Button>("Image_ButtonBG/Button_Team");
|
||||
buttonVehicle = GetComponent<Button>("Image_ButtonBG/Button_Vehicle");
|
||||
buttonCamp = GetComponent<Button>("Image_ButtonBG/Button_Camp");
|
||||
buttonChooseLevel = GetComponent<Button>("Image_RightBG/Button_ChooseLevel");
|
||||
buttonPVP = GetComponent<Button>("Image_RightBG/Button_PVP");
|
||||
buttonPlusP = GetComponent<Button>("Image_RightBG/Button_PlusP");
|
||||
buttonNotice = GetComponent<Button>("UI_TopButtom/Button_Warning");
|
||||
buttonEmail = GetComponent<Button>("UI_TopButtom/Button_Email");
|
||||
buttonSetting = GetComponent<Button>("UI_TopButtom/Button_Install");
|
||||
imageCharacterPoster = GetComponent<Image>("Button_CharacterPoster");
|
||||
imageStamina = GetComponent<Image>("Image_RightBG/PhysicalBar");
|
||||
textStaminaRecovery = GetComponent<TMP_Text>("DownBG/Image_Flash/Text_PhysicalRecovery");
|
||||
textTime = GetComponent<TMP_Text>("DownBG/Text_Time");
|
||||
|
||||
buttonCamera.onClick.AddListener(OnCameraOrCharacterChange);
|
||||
buttonCharacterChange.onClick.AddListener(OnCameraOrCharacterChange);
|
||||
buttonRaffle.onClick.AddListener(OnRaffle);
|
||||
buttonStore.onClick.AddListener(OnStore);
|
||||
buttonCharacter.onClick.AddListener(OnCharacter);
|
||||
buttonTeam.onClick.AddListener(OnTeam);
|
||||
buttonVehicle.onClick.AddListener(OnVehicle);
|
||||
buttonCamp.onClick.AddListener(OnCamp);
|
||||
buttonChooseLevel.onClick.AddListener(OnChooseLevel);
|
||||
buttonPVP.onClick.AddListener(OnPVP);
|
||||
buttonPlusP.onClick.AddListener(OnPlusP);
|
||||
buttonNotice.onClick.AddListener(OnNotice);
|
||||
buttonEmail.onClick.AddListener(OnEmail);
|
||||
buttonSetting.onClick.AddListener(OnSetting);
|
||||
|
||||
RegisterScreenAdaption();
|
||||
|
||||
EventManager.Instance.Register(EventManager.EventName.ChangeMainPanelPoster, SetPoster);
|
||||
}
|
||||
|
||||
protected override void OnShowWindow(object data)
|
||||
{
|
||||
SetPoster();
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
RefreshTime(Time.deltaTime);
|
||||
|
||||
|
||||
if (!isMusicStart)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (nowTime >= refreshTime)
|
||||
{
|
||||
nowTime = 0;
|
||||
|
||||
if (index < musicData.Count)
|
||||
{
|
||||
RefreshCube(musicData[index]);
|
||||
tempStr = "";
|
||||
for (int i = 0; i < musicData[index].Length; i++)
|
||||
{
|
||||
tempStr += musicData[index][i]+"";
|
||||
}
|
||||
//DebugUtil.LogError("musicData[index] "+ tempStr);
|
||||
|
||||
index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
nowTime += Time.deltaTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RefreshTime(float time)
|
||||
{
|
||||
if(nowTimeForRefreshTime>=minutes)
|
||||
{
|
||||
RefreshTimeLabel();
|
||||
nowTimeForRefreshTime = 0;
|
||||
}
|
||||
nowTimeForRefreshTime += time;
|
||||
|
||||
}
|
||||
|
||||
private void RefreshCube(float[] levels)
|
||||
{
|
||||
|
||||
for (int i = 0; i < levels.Length; i++)
|
||||
{
|
||||
cubeList[i].ShowCube(levels[i]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public class MusicCube
|
||||
{
|
||||
List<Image> cubeImages = new List<Image>();
|
||||
private Color unTranCol=new Color(1, 1, 1, 1);
|
||||
private Color TranColor=new Color(1, 1, 1, 0);
|
||||
|
||||
public MusicCube(GameObject parentGo)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
cubeImages.Add(CommonUtils.GetComponent<Image>(parentGo, i.ToString()));
|
||||
}
|
||||
}
|
||||
public void ShowCube(float val)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
|
||||
if(i<val)
|
||||
{
|
||||
cubeImages[i].color=unTranCol;
|
||||
}else
|
||||
{
|
||||
cubeImages[i].color = TranColor;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnButton_ChooseLevelClick()
|
||||
{
|
||||
//UIManager.Instance.OpenWindow(UINameConst.UI_LevelSelect);
|
||||
CommonUtils.OpenUIWithScene(UINameConst.UI_LevelSelect, Framework.Constants.UI_LEVEL_SELECTED_SCENE_PATH);
|
||||
}
|
||||
private void OnEnterLevelFinish()
|
||||
{
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
|
||||
private async void OnButton_CharacterClickAsync()
|
||||
{
|
||||
var inputData = new UISelectCharacterController.InputData()
|
||||
{ OpenType = UISelectCharacterController.OpenType.Default };
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UISelectCharacter, inputData);
|
||||
}
|
||||
|
||||
public void RefreshScrollView()
|
||||
{
|
||||
GameObject item = FindObj("BannerItem");
|
||||
PageScrollview pageScrollview = _mCurrentScrollView.gameObject.GetComponent<PageScrollview>();
|
||||
pageScrollview.SetIndexChangeAction(ChangeBannerScrollTo);
|
||||
for (int i = 0; i < scrollCount; i++)
|
||||
{
|
||||
GameObject go = GameObject.Instantiate(item);
|
||||
go.transform.SetParent( _mCurrentScrollView.content);
|
||||
go.transform.localPosition = Vector3.zero;
|
||||
go.transform.localScale = Vector3.one;
|
||||
RefreshItem(go, TableManager.Instance.Tables.bannerCfg.DataList[i]);
|
||||
go.SetActive(true);
|
||||
BindButton(go.GetComponent<Button>(), OnOpenNotice);
|
||||
}
|
||||
pageScrollview.SetStart();
|
||||
|
||||
|
||||
}
|
||||
private async void RefreshItem(GameObject go, DataUIBanner data)
|
||||
{
|
||||
go.gameObject.GetComponent<Image>().sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(data.BannerImgPath);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ChangeBannerScrollTo(int index)
|
||||
{
|
||||
|
||||
for (int i = 0; i < bannerTiaoList.Count; i++)
|
||||
{
|
||||
CommonUtils.GetGameObject(bannerTiaoList[i], "Black").SetActive(index != i);
|
||||
CommonUtils.GetGameObject(bannerTiaoList[i], "White").SetActive(index == i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async void RefreshItem(int index, RectTransform item)
|
||||
{
|
||||
item.gameObject.SetActive(true);
|
||||
for (int i = 0; i < TableManager.Instance.Tables.bannerCfg.DataList.Count; i++)
|
||||
{
|
||||
DataUIBanner banner = TableManager.Instance.Tables.bannerCfg.DataList[i];
|
||||
|
||||
item.gameObject.GetComponent<Image>().sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(banner.BannerImgPath);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void OnOpenNotice()
|
||||
{
|
||||
UIManager.Instance.OpenWindow(UINameConst.UI_Notice);
|
||||
}
|
||||
|
||||
|
||||
//invoke when open window
|
||||
protected override void OnShowWindow(object data = null)
|
||||
{
|
||||
// await UI_InterfacePreviewManager.Instance.LoadPreviewNode();
|
||||
StartRefresh();
|
||||
_SetPoster();
|
||||
//InputManager.Instance.OnFingerMoveUI += RotateScene;
|
||||
//AudioManager.Instance.RegisterAnalyzer(analyzer);
|
||||
//本地暂时关掉BGM
|
||||
//UniTask<int>task= AudioManager.Instance.PlayAudio("DemoProj_M1");
|
||||
isMusicStart = true;
|
||||
//NetHelper.RequestMailList(!MailSystem.Instance.isHaveAll);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void RotateScene(Vector2 delta)
|
||||
{
|
||||
if (delta == Vector2.zero) return;
|
||||
UI_InterfacePreviewManager.Instance.RotatePreviewContent(delta/10);
|
||||
}
|
||||
|
||||
private void StartRefresh()
|
||||
{
|
||||
RefreshBase();
|
||||
RefreshScrollView();
|
||||
CreateBannerScroll();
|
||||
RefreshPreviewNodeRawImage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void RefreshPreviewNodeRawImage()
|
||||
{
|
||||
var teamPreNode = UI_InterfacePreviewManager.Instance.UI_InterPreNode;
|
||||
if (teamPreNode)
|
||||
{
|
||||
RawImage_Scene.texture = teamPreNode.RTexture;
|
||||
}
|
||||
}
|
||||
private void CreateBannerScroll()
|
||||
{
|
||||
int count = scrollCount;
|
||||
GameObject whiteBarParent = FindObj("Button_ActivityPoster/WhiteBarParent");
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
GameObject go = GameObject.Instantiate(whiteBarItem);
|
||||
go.transform.SetParent(whiteBarParent.transform);
|
||||
go.transform.localScale = Vector3.one;
|
||||
go.gameObject.SetActive(true);
|
||||
whiteBarParent.GetComponent<HorizontalLayoutGroup>().childControlWidth = (count > 5);
|
||||
|
||||
bannerTiaoList.Add(go);
|
||||
}
|
||||
|
||||
}
|
||||
private void RefreshBase()
|
||||
{
|
||||
RefreshMoney();
|
||||
RefreshScrollCount();
|
||||
}
|
||||
private void RefreshScrollCount()
|
||||
{
|
||||
scrollCount = TableManager.Instance.Tables.bannerCfg.DataList.Count;
|
||||
}
|
||||
private void RefreshMoney()
|
||||
{
|
||||
cfg.ActorCfg.DataActorLevel maxLevel = ActorLevelTableHelper.Instance.Get((int)Actor.Instance.Base.GetProp(NLDPB.ActorProp.Level));
|
||||
|
||||
int maxExp = ActorLevelTableHelper.Instance.Get((int)Actor.Instance.Base.GetProp(NLDPB.ActorProp.Level)).Exp;
|
||||
|
||||
Text_CharacterName.text =PlayerInfo.Instance.Name;
|
||||
Text_LevelNum.text = Actor.Instance.Base.GetProp(NLDPB.ActorProp.Level).ToString();
|
||||
Image_ExBar.fillAmount = (float)Actor.Instance.Base.GetProp(NLDPB.ActorProp.Exp) / maxExp;
|
||||
Text_ExHad.text = Actor.Instance.Base.GetProp(NLDPB.ActorProp.Exp).ToString();
|
||||
Text_ExMax.text = maxLevel.Exp.ToString();
|
||||
|
||||
diamondItem.currencyID = GLConfig.Inst.data.DiamondItemId;
|
||||
coinItem.currencyID = GLConfig.Inst.data.GoldItemId;
|
||||
energyItem.currencyID = GLConfig.Inst.data.EnergyPointID;
|
||||
RefreshTimeLabel();
|
||||
|
||||
}
|
||||
private void RefreshTimeLabel()
|
||||
{
|
||||
Text_Time.text = GetNowTime();
|
||||
|
||||
}
|
||||
private string GetNowTime()
|
||||
{
|
||||
string minutes = "";
|
||||
int min = System.DateTime.Now.Minute;
|
||||
if(min>=10)
|
||||
{
|
||||
minutes = min.ToString();
|
||||
}else
|
||||
{
|
||||
minutes = "0" + min.ToString();
|
||||
}
|
||||
return System.DateTime.Now.Hour.ToString()+":"+minutes;
|
||||
}
|
||||
|
||||
private async void _OnClickTask()
|
||||
{
|
||||
await TaskManager.OpenTaskUI();
|
||||
}
|
||||
|
||||
private void _OnChangePoster()
|
||||
{
|
||||
_SetPoster();
|
||||
}
|
||||
|
||||
private async void _SetPoster()
|
||||
{
|
||||
var storeData = StorageMgr.Instance.GetStorage<MainPanelSceneStoreData>("MainPanelSceneStoreData");
|
||||
if (storeData != null)
|
||||
{
|
||||
var id = storeData.PosterID;
|
||||
var posterPath =
|
||||
CommonUtils.GetCharacterPicPath(id, CommonUtils.ECharacterPicPathType.Poster, storeData.PosterSkinIdx + 1);
|
||||
//test
|
||||
var test = true;
|
||||
if (test)
|
||||
{
|
||||
posterPath = "Assets/Art/UI/Texture/Poster/Poster_Default/Poster_A00104.png";
|
||||
}
|
||||
|
||||
var sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(posterPath);
|
||||
var img = GetComponent<Image>("Button_CharacterPoster");
|
||||
img.sprite = sprite;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnHideWindow()
|
||||
{
|
||||
//InputManager.Instance.OnFingerMoveUI -= RotateScene;
|
||||
MainPanelCameraPos.defaultIndex = 0;
|
||||
UI_InterfacePreviewManager.Instance.ReleasePreviewNode();
|
||||
subCameraObj.Destroy();
|
||||
cameraGoList.Clear();
|
||||
}
|
||||
|
||||
public override void OnRelease()
|
||||
{
|
||||
EventManager.Instance.Unregister(EventManager.EventName.ChangeMainPanelPoster, SetPoster);
|
||||
|
||||
base.OnRelease();
|
||||
EventManager.Instance.Unregister(EventManager.EventName.ChangeMainPanelPoster, _OnChangePoster);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置看板娘立绘
|
||||
/// </summary>
|
||||
private async void SetPoster()
|
||||
{
|
||||
MainPanelSceneStoreData storeData = StorageMgr.Instance.GetStorage<MainPanelSceneStoreData>("MainPanelSceneStoreData");
|
||||
if (storeData == null)
|
||||
return;
|
||||
|
||||
string posterPath = CommonUtils.GetCharacterPicPath(storeData.PosterID, CommonUtils.ECharacterPicPathType.Poster, storeData.PosterSkinIdx + 1);
|
||||
posterPath = "Assets/Art/UI/Texture/Poster/Poster_Default/Poster_A00104.png"; // TODO 测试
|
||||
|
||||
imageCharacterPoster.sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(posterPath);
|
||||
}
|
||||
|
||||
#region 刷新方法
|
||||
/// <summary>
|
||||
/// 刷新时间
|
||||
/// </summary>
|
||||
private void RefreshTime(float deltaTime)
|
||||
{
|
||||
refreshTimeTimer += deltaTime;
|
||||
if (refreshTimeTimer >= REFRESH_TIME_SPAN)
|
||||
{
|
||||
DateTime dateTime = CommonUtils.GetCurTime(CommonUtils.E_TimeType.Server);
|
||||
textTime.text = $"{dateTime:hh:mm} {(CommonUtils.IsAM(dateTime) ? "AM" : "PM")}";
|
||||
refreshTimeTimer -= REFRESH_TIME_SPAN;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 按钮点击事件
|
||||
/// <summary>
|
||||
/// 相机或看板娘切换
|
||||
/// </summary>
|
||||
private async void OnCameraOrCharacterChange()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UICameraAndPosterChange);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 抽卡
|
||||
/// </summary>
|
||||
private async void OnRaffle()
|
||||
{
|
||||
await UI_RaffleController.Open();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 商店
|
||||
/// </summary>
|
||||
private async void OnStore()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Shop);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色
|
||||
/// </summary>
|
||||
private async void OnCharacter()
|
||||
{
|
||||
UISelectCharacterController.InputData inputData = new()
|
||||
{
|
||||
OpenType = UISelectCharacterController.OpenType.Default
|
||||
};
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UISelectCharacter, inputData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 队伍
|
||||
/// </summary>
|
||||
private async void OnTeam()
|
||||
{
|
||||
await UI_TeamAndSkillSelectController.Open();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 载具
|
||||
/// </summary>
|
||||
private async void OnVehicle()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_VehicleChoose);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 营地
|
||||
/// </summary>
|
||||
private void OnCamp()
|
||||
{
|
||||
CampManager.Instance.EnterCamp();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PVP
|
||||
/// </summary>
|
||||
private async void OnPVP()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_PVPMain);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择关卡
|
||||
/// </summary>
|
||||
private async void OnChooseLevel()
|
||||
{
|
||||
await CommonUtils.OpenUIWithScene(UINameConst.UI_LevelSelect, Framework.Constants.UI_LEVEL_SELECTED_SCENE_PATH);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加体力
|
||||
/// </summary>
|
||||
private void OnPlusP()
|
||||
{
|
||||
// TODO 打开增加体力界面
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通知
|
||||
/// </summary>
|
||||
private async void OnNotice()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Notice);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 邮件
|
||||
/// </summary>
|
||||
private async void OnEmail()
|
||||
{
|
||||
CommonUtils.CaptureScreenshot();
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Email);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置
|
||||
/// </summary>
|
||||
private async void OnSetting()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Setting);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1bce35cec3b074349992d4d987a5d329
|
||||
guid: a8bf973a5bb5c0e4f8f9799e2dde2290
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
|
|
|||
|
|
@ -0,0 +1,560 @@
|
|||
using cfg.UIInterfaceBannerGoToCfg;
|
||||
using Framework;
|
||||
using Gameplay;
|
||||
using Gameplay.Common;
|
||||
using Gameplay.Net;
|
||||
using PhxhSDK;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
using Image = UnityEngine.UI.Image;
|
||||
|
||||
/// <summary>
|
||||
/// 主界面
|
||||
/// </summary>
|
||||
public class UI_MainPanelControllerOld: UIWindow
|
||||
{
|
||||
//UI GameObj
|
||||
///Auto Gen Start///
|
||||
public Image Image_PhysicPower;
|
||||
|
||||
public Button Button_Plus;
|
||||
public TMP_Text Text_PPNow;
|
||||
public TMP_Text Text_PPMax;
|
||||
public Image Image_PPBar;
|
||||
public Image Image_Damond;
|
||||
public TMP_Text Text_DamondNum;
|
||||
public Image Image_Coin;
|
||||
public TMP_Text Text_CoinNum;
|
||||
public Button Button_Warning;
|
||||
public Image Image_RedPoint;
|
||||
public Button Button_Email;
|
||||
public Button Button_Install;
|
||||
public Button Button_Unknown;
|
||||
public Button Button_CharacterChange;
|
||||
public Button Button_Camera;
|
||||
public Image Image_CharacterInfo;
|
||||
public TMP_Text Text_CharacterName;
|
||||
public Image Image_ExBar01;
|
||||
public TMP_Text Text_ExHad;
|
||||
public TMP_Text Text_ExMax;
|
||||
public Image Image_ExBar;
|
||||
public TMP_Text Text_LevelNum;
|
||||
public Button Button_ActivityPoster;
|
||||
public Image Image_WhiteBar;
|
||||
public Image Image_BlackBar;
|
||||
public Image Image_LeftBG;
|
||||
public Button Button_Music01;
|
||||
public Image Image_GreenPoint;
|
||||
public TMP_Text Text_Time;
|
||||
public Button Button_Music02;
|
||||
public Image Image_ButtonBG;
|
||||
public Button Button_Character;
|
||||
public TMP_Text Text_Character;
|
||||
public Button Button_Vehicle;
|
||||
public TMP_Text Text_Vehicle;
|
||||
public Button Button_Camp;
|
||||
public TMP_Text Text_Camp;
|
||||
public Button Button_Team;
|
||||
public TMP_Text Text_Team;
|
||||
public Button Button_Store;
|
||||
public TMP_Text Text_Store;
|
||||
public Button Button_DrawCard;
|
||||
public TMP_Text Text_DrawCard;
|
||||
public Image Image_RightBG;
|
||||
public Button Button_ChooseLevel;
|
||||
public TMP_Text Text_ChooseLevel;
|
||||
public Button Button_PVP;
|
||||
public TMP_Text Text_PVP;
|
||||
ScrollRect _mCurrentScrollView = null;
|
||||
private TMP_InputField _inputLevel;
|
||||
private GameObject whiteBarItem;
|
||||
private int scrollCount;
|
||||
private List<GameObject> bannerTiaoList;
|
||||
|
||||
public RawImage RawImage_Scene;
|
||||
public Button GiftCodeBtn;
|
||||
|
||||
private bool isMusicStart = false;
|
||||
|
||||
private List<MusicCube> cubeList = new List<MusicCube>();
|
||||
private List<float[]>musicData = new List<float[]>();
|
||||
|
||||
///Auto Gen End///
|
||||
UI_CurrencyItem diamondItem;
|
||||
UI_CurrencyItem coinItem;
|
||||
UI_CurrencyItem energyItem;
|
||||
|
||||
List<GameObject> cameraGoList;
|
||||
GameObject subCameraObj;
|
||||
|
||||
bool isFirst = true;
|
||||
const float minutes=60;
|
||||
|
||||
public override void OnInit()
|
||||
{
|
||||
//bind UI GameObj
|
||||
bannerTiaoList = new List<GameObject>();
|
||||
|
||||
|
||||
UI_MainPanelBinder.GetComponents(this);
|
||||
_mCurrentScrollView = GetComponent<ScrollRect>("ScrollView");
|
||||
_inputLevel = transform.Find("InputField")?.GetComponent<TMP_InputField>();
|
||||
whiteBarItem = FindObj("BarItem");
|
||||
BindButton(Button_Character, OnButton_CharacterClickAsync);
|
||||
BindButton(Button_ChooseLevel, OnButton_ChooseLevelClick);
|
||||
BindButton(Button_Team, OnButtonTeamClick);
|
||||
BindButton(Button_Camp, OnButtonCampClick);
|
||||
GiftCodeBtn = GetComponent<Button>("Button_DuiHuanMa");
|
||||
BindButton(GiftCodeBtn, OnGiftBtnClick);
|
||||
BindButton(Button_Vehicle, OnButton_VehicleClickAsync);
|
||||
|
||||
RawImage_Scene = GetComponent<RawImage>("RawImage_Scene");
|
||||
InitCube();
|
||||
GetGeneralMusicData();
|
||||
BindButton(Button_Install, OnOpenSettingPanel);
|
||||
diamondItem =FindObj("UI_TopButtom/DiamondItem").GetComponent<UI_CurrencyItem>();
|
||||
coinItem = FindObj("UI_TopButtom/CoinItem").GetComponent<UI_CurrencyItem>();
|
||||
energyItem = FindObj("UI_TopButtom/EnergyItem").GetComponent<UI_CurrencyItem>();
|
||||
|
||||
BindButton(Button_Email, OnEmailBtnClick);
|
||||
BindButton(Button_DrawCard, OnDrawCardClick);
|
||||
BindButton(Button_Store, OnStoreBtnClick);
|
||||
|
||||
|
||||
BindButton(Button_Unknown, _OnClickTask);
|
||||
//BindButton(Button_Camera, OnCameraClick);
|
||||
BindButton(Button_CharacterChange, OnCameraClick);
|
||||
|
||||
BindButton(GetComponent<Button>("CommandSkillBtn"), OnCommandSkillClick);
|
||||
cameraGoList = new List<GameObject>();
|
||||
RegisterScreenAdaption();
|
||||
//测试增量热更
|
||||
Debug.Log("test mainScene");
|
||||
var go = GameObject.Find("NLD_URP_NLD_Scene_Lambert");
|
||||
if (go != null)
|
||||
{
|
||||
Debug.Log("go is not null");
|
||||
Debug.Log(go.GetComponent<MeshFilter>().sharedMesh);
|
||||
Debug.Log(go.GetComponent<MeshRenderer>().sharedMaterial);
|
||||
}
|
||||
|
||||
BindButton(Button_PVP, OnPVPClick);
|
||||
|
||||
EventManager.Instance.Register(EventManager.EventName.ChangeMainPanelPoster, _OnChangePoster);
|
||||
}
|
||||
|
||||
protected override void OnShowWindow(object data = null)
|
||||
{
|
||||
// await UI_InterfacePreviewManager.Instance.LoadPreviewNode();
|
||||
StartRefresh();
|
||||
_SetPoster();
|
||||
//InputManager.Instance.OnFingerMoveUI += RotateScene;
|
||||
//AudioManager.Instance.RegisterAnalyzer(analyzer);
|
||||
//本地暂时关掉BGM
|
||||
//UniTask<int>task= AudioManager.Instance.PlayAudio("DemoProj_M1");
|
||||
isMusicStart = true;
|
||||
//NetHelper.RequestMailList(!MailSystem.Instance.isHaveAll);
|
||||
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
RefreshTime(Time.deltaTime);
|
||||
|
||||
|
||||
if (!isMusicStart)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (nowTime >= refreshTime)
|
||||
{
|
||||
nowTime = 0;
|
||||
|
||||
if (index < musicData.Count)
|
||||
{
|
||||
RefreshCube(musicData[index]);
|
||||
tempStr = "";
|
||||
for (int i = 0; i < musicData[index].Length; i++)
|
||||
{
|
||||
tempStr += musicData[index][i] + "";
|
||||
}
|
||||
//DebugUtil.LogError("musicData[index] "+ tempStr);
|
||||
|
||||
index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
nowTime += Time.deltaTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void OnHideWindow()
|
||||
{
|
||||
//InputManager.Instance.OnFingerMoveUI -= RotateScene;
|
||||
MainPanelCameraPos.defaultIndex = 0;
|
||||
UI_InterfacePreviewManager.Instance.ReleasePreviewNode();
|
||||
subCameraObj.Destroy();
|
||||
cameraGoList.Clear();
|
||||
}
|
||||
|
||||
public override void OnRelease()
|
||||
{
|
||||
EventManager.Instance.Unregister(EventManager.EventName.ChangeMainPanelPoster, _OnChangePoster);
|
||||
|
||||
base.OnRelease();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private async void GetGeneralMusicData()
|
||||
{
|
||||
musicData = await MusicCubeManager.Instance.GetGeneralMusicCfg();
|
||||
}
|
||||
|
||||
#region 按钮点击回调
|
||||
private async void OnCommandSkillClick()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_CommandSkillCultivate);
|
||||
}
|
||||
|
||||
private async void OnStoreBtnClick()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Shop);
|
||||
}
|
||||
|
||||
private async void OnCameraClick()
|
||||
{
|
||||
//await UIManager.Instance.OpenWindow(UINameConst.UI_CameraChange,cameraGoList);
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UICameraAndPosterChange);
|
||||
}
|
||||
|
||||
private async void OnDrawCardClick()
|
||||
{
|
||||
await UI_RaffleController.Open();
|
||||
}
|
||||
|
||||
private async void OnPVPClick()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_PVPMain);
|
||||
}
|
||||
|
||||
private async void OnEmailBtnClick()
|
||||
{
|
||||
CommonUtils.CaptureScreenshot();
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Email);
|
||||
|
||||
}
|
||||
|
||||
private async void OnButton_VehicleClickAsync()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_VehicleChoose);
|
||||
}
|
||||
|
||||
private async void OnGiftBtnClick()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UIGiftCode);
|
||||
}
|
||||
private async void OnButtonTeamClick()
|
||||
{
|
||||
await UI_TeamAndSkillSelectController.Open();
|
||||
}
|
||||
|
||||
private void OnButtonCampClick()
|
||||
{
|
||||
CampManager.Instance.EnterCamp();
|
||||
}
|
||||
|
||||
private async void OnOpenSettingPanel()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Setting);
|
||||
}
|
||||
|
||||
private void OnEnterLevelFinish()
|
||||
{
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
|
||||
private async void OnButton_CharacterClickAsync()
|
||||
{
|
||||
var inputData = new UISelectCharacterController.InputData()
|
||||
{ OpenType = UISelectCharacterController.OpenType.Default };
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UISelectCharacter, inputData);
|
||||
}
|
||||
|
||||
private async void OnButton_ChooseLevelClick()
|
||||
{
|
||||
//UIManager.Instance.OpenWindow(UINameConst.UI_LevelSelect);
|
||||
await CommonUtils.OpenUIWithScene(UINameConst.UI_LevelSelect, Framework.Constants.UI_LEVEL_SELECTED_SCENE_PATH);
|
||||
}
|
||||
|
||||
private async void OnOpenNotice()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Notice);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
private void InitCube()
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
cubeList.Add(new MusicCube(FindObj(string.Format("MusicCube/{0}",i))));
|
||||
}
|
||||
}
|
||||
|
||||
float refreshTime = 0.1f;
|
||||
float nowTime = 0;
|
||||
int index;
|
||||
string tempStr = "";
|
||||
|
||||
float nowTimeForRefreshTime = 0;
|
||||
|
||||
|
||||
|
||||
private void RefreshTime(float time)
|
||||
{
|
||||
if(nowTimeForRefreshTime>=minutes)
|
||||
{
|
||||
RefreshTimeLabel();
|
||||
nowTimeForRefreshTime = 0;
|
||||
}
|
||||
nowTimeForRefreshTime += time;
|
||||
|
||||
}
|
||||
|
||||
private void RefreshCube(float[] levels)
|
||||
{
|
||||
|
||||
for (int i = 0; i < levels.Length; i++)
|
||||
{
|
||||
cubeList[i].ShowCube(levels[i]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public class MusicCube
|
||||
{
|
||||
List<Image> cubeImages = new List<Image>();
|
||||
private Color unTranCol=new Color(1, 1, 1, 1);
|
||||
private Color TranColor=new Color(1, 1, 1, 0);
|
||||
|
||||
public MusicCube(GameObject parentGo)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
cubeImages.Add(CommonUtils.GetComponent<Image>(parentGo, i.ToString()));
|
||||
}
|
||||
}
|
||||
public void ShowCube(float val)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
|
||||
if(i<val)
|
||||
{
|
||||
cubeImages[i].color=unTranCol;
|
||||
}else
|
||||
{
|
||||
cubeImages[i].color = TranColor;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void RefreshScrollView()
|
||||
{
|
||||
GameObject item = FindObj("BannerItem");
|
||||
PageScrollview pageScrollview = _mCurrentScrollView.gameObject.GetComponent<PageScrollview>();
|
||||
pageScrollview.SetIndexChangeAction(ChangeBannerScrollTo);
|
||||
for (int i = 0; i < scrollCount; i++)
|
||||
{
|
||||
GameObject go = GameObject.Instantiate(item);
|
||||
go.transform.SetParent( _mCurrentScrollView.content);
|
||||
go.transform.localPosition = Vector3.zero;
|
||||
go.transform.localScale = Vector3.one;
|
||||
RefreshItem(go, TableManager.Instance.Tables.bannerCfg.DataList[i]);
|
||||
go.SetActive(true);
|
||||
BindButton(go.GetComponent<Button>(), OnOpenNotice);
|
||||
}
|
||||
pageScrollview.SetStart();
|
||||
|
||||
|
||||
}
|
||||
private async void RefreshItem(GameObject go, DataUIBanner data)
|
||||
{
|
||||
go.gameObject.GetComponent<Image>().sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(data.BannerImgPath);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ChangeBannerScrollTo(int index)
|
||||
{
|
||||
|
||||
for (int i = 0; i < bannerTiaoList.Count; i++)
|
||||
{
|
||||
CommonUtils.GetGameObject(bannerTiaoList[i], "Black").SetActive(index != i);
|
||||
CommonUtils.GetGameObject(bannerTiaoList[i], "White").SetActive(index == i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async void RefreshItem(int index, RectTransform item)
|
||||
{
|
||||
item.gameObject.SetActive(true);
|
||||
for (int i = 0; i < TableManager.Instance.Tables.bannerCfg.DataList.Count; i++)
|
||||
{
|
||||
DataUIBanner banner = TableManager.Instance.Tables.bannerCfg.DataList[i];
|
||||
|
||||
item.gameObject.GetComponent<Image>().sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(banner.BannerImgPath);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void RotateScene(Vector2 delta)
|
||||
{
|
||||
if (delta == Vector2.zero) return;
|
||||
UI_InterfacePreviewManager.Instance.RotatePreviewContent(delta/10);
|
||||
}
|
||||
|
||||
private void StartRefresh()
|
||||
{
|
||||
RefreshBase();
|
||||
RefreshScrollView();
|
||||
CreateBannerScroll();
|
||||
RefreshPreviewNodeRawImage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void RefreshPreviewNodeRawImage()
|
||||
{
|
||||
var teamPreNode = UI_InterfacePreviewManager.Instance.UI_InterPreNode;
|
||||
if (teamPreNode)
|
||||
{
|
||||
RawImage_Scene.texture = teamPreNode.RTexture;
|
||||
}
|
||||
}
|
||||
private void CreateBannerScroll()
|
||||
{
|
||||
int count = scrollCount;
|
||||
GameObject whiteBarParent = FindObj("Button_ActivityPoster/WhiteBarParent");
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
GameObject go = GameObject.Instantiate(whiteBarItem);
|
||||
go.transform.SetParent(whiteBarParent.transform);
|
||||
go.transform.localScale = Vector3.one;
|
||||
go.gameObject.SetActive(true);
|
||||
whiteBarParent.GetComponent<HorizontalLayoutGroup>().childControlWidth = (count > 5);
|
||||
|
||||
bannerTiaoList.Add(go);
|
||||
}
|
||||
|
||||
}
|
||||
private void RefreshBase()
|
||||
{
|
||||
RefreshMoney();
|
||||
RefreshScrollCount();
|
||||
}
|
||||
private void RefreshScrollCount()
|
||||
{
|
||||
scrollCount = TableManager.Instance.Tables.bannerCfg.DataList.Count;
|
||||
}
|
||||
private void RefreshMoney()
|
||||
{
|
||||
cfg.ActorCfg.DataActorLevel maxLevel = ActorLevelTableHelper.Instance.Get((int)Actor.Instance.Base.GetProp(NLDPB.ActorProp.Level));
|
||||
|
||||
int maxExp = ActorLevelTableHelper.Instance.Get((int)Actor.Instance.Base.GetProp(NLDPB.ActorProp.Level)).Exp;
|
||||
|
||||
Text_CharacterName.text =PlayerInfo.Instance.Name;
|
||||
Text_LevelNum.text = Actor.Instance.Base.GetProp(NLDPB.ActorProp.Level).ToString();
|
||||
Image_ExBar.fillAmount = (float)Actor.Instance.Base.GetProp(NLDPB.ActorProp.Exp) / maxExp;
|
||||
Text_ExHad.text = Actor.Instance.Base.GetProp(NLDPB.ActorProp.Exp).ToString();
|
||||
Text_ExMax.text = maxLevel.Exp.ToString();
|
||||
|
||||
diamondItem.currencyID = GLConfig.Inst.data.DiamondItemId;
|
||||
coinItem.currencyID = GLConfig.Inst.data.GoldItemId;
|
||||
energyItem.currencyID = GLConfig.Inst.data.EnergyPointID;
|
||||
RefreshTimeLabel();
|
||||
|
||||
}
|
||||
private void RefreshTimeLabel()
|
||||
{
|
||||
Text_Time.text = GetNowTime();
|
||||
|
||||
}
|
||||
private string GetNowTime()
|
||||
{
|
||||
string minutes = "";
|
||||
int min = System.DateTime.Now.Minute;
|
||||
if(min>=10)
|
||||
{
|
||||
minutes = min.ToString();
|
||||
}else
|
||||
{
|
||||
minutes = "0" + min.ToString();
|
||||
}
|
||||
return System.DateTime.Now.Hour.ToString()+":"+minutes;
|
||||
}
|
||||
|
||||
private async void _OnClickTask()
|
||||
{
|
||||
await TaskManager.OpenTaskUI();
|
||||
}
|
||||
|
||||
private void _OnChangePoster()
|
||||
{
|
||||
_SetPoster();
|
||||
}
|
||||
|
||||
private async void _SetPoster()
|
||||
{
|
||||
var storeData = StorageMgr.Instance.GetStorage<MainPanelSceneStoreData>("MainPanelSceneStoreData");
|
||||
if (storeData != null)
|
||||
{
|
||||
var id = storeData.PosterID;
|
||||
var posterPath =
|
||||
CommonUtils.GetCharacterPicPath(id, CommonUtils.ECharacterPicPathType.Poster, storeData.PosterSkinIdx + 1);
|
||||
//test
|
||||
var test = true;
|
||||
if (test)
|
||||
{
|
||||
posterPath = "Assets/Art/UI/Texture/Poster/Poster_Default/Poster_A00104.png";
|
||||
}
|
||||
|
||||
var sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(posterPath);
|
||||
var img = GetComponent<Image>("Button_CharacterPoster");
|
||||
img.sprite = sprite;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7681aed9e6f550e47917994832ac0f1e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
using cfg.ActorCfg;
|
||||
using cfg.CharacterCfg;
|
||||
using Framework;
|
||||
using Gameplay.Net;
|
||||
using System;
|
||||
|
||||
namespace Gameplay
|
||||
{
|
||||
public partial class CommonUtils
|
||||
{
|
||||
public enum E_TimeType
|
||||
{
|
||||
/// <summary>
|
||||
/// 本地
|
||||
/// </summary>
|
||||
Local,
|
||||
/// <summary>
|
||||
/// 服务器
|
||||
/// </summary>
|
||||
Server,
|
||||
}
|
||||
|
||||
private static readonly DateTime Epoch = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前时间
|
||||
/// </summary>
|
||||
/// <param name="timeType"></param>
|
||||
/// <returns></returns>
|
||||
public static DateTime GetCurTime(E_TimeType timeType)
|
||||
{
|
||||
return timeType switch
|
||||
{
|
||||
E_TimeType.Local => DateTime.Now,
|
||||
E_TimeType.Server => Epoch.AddMilliseconds(NetManager.Instance.ServerTimeMS).ToLocalTime(),
|
||||
_ => DateTime.MinValue,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断时间是否是上午
|
||||
/// </summary>
|
||||
/// <param name="dateTime"></param>
|
||||
/// <returns>true:上午,false:下午</returns>
|
||||
public static bool IsAM(DateTime dateTime)
|
||||
{
|
||||
return dateTime.Hour < 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4aa67c5cab6a53a41936473f51392a24
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -18,7 +18,7 @@ PhysicsManager:
|
|||
m_ClothInterCollisionDistance: 0.1
|
||||
m_ClothInterCollisionStiffness: 0.2
|
||||
m_ContactsGeneration: 1
|
||||
m_LayerCollisionMatrix: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
m_SimulationMode: 0
|
||||
m_AutoSyncTransforms: 0
|
||||
m_ReuseCollisionCallbacks: 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue