mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 05:37:11 +08:00
(client) feat:健康给予,路径优化,结算界面,商店界面 (#60)
Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite/pulls/60
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Data;
|
||||
using Managers;
|
||||
@@ -6,10 +5,13 @@ using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class StartPlayUI:FullScreenUI
|
||||
public class StartPlayUI : FullScreenUI
|
||||
{
|
||||
public Transform iconList;
|
||||
|
||||
public MapViewUI mapViewUIPrefab;
|
||||
public List<MapViewUI> mapViewUIList = new();
|
||||
|
||||
private int _currentIndex;
|
||||
|
||||
public int CurrentDimensionIndex
|
||||
@@ -19,31 +21,23 @@ namespace UI
|
||||
{
|
||||
_currentIndex = value;
|
||||
if (_currentIndex < 0)
|
||||
{
|
||||
_currentIndex += mapViewUIList.Count;
|
||||
}
|
||||
else if (_currentIndex >= mapViewUIList.Count)
|
||||
{
|
||||
_currentIndex %= mapViewUIList.Count;
|
||||
}
|
||||
else if (_currentIndex >= mapViewUIList.Count) _currentIndex %= mapViewUIList.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public DimensionDef CurrentDimension => mapViewUIList[CurrentDimensionIndex].DimensionDefine;
|
||||
|
||||
public MapViewUI mapViewUIPrefab;
|
||||
public List<MapViewUI> mapViewUIList = new List<MapViewUI>();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
var dimensionDefs = DefineManager.Instance.QueryDefinesByType<DimensionDef>();
|
||||
if(dimensionDefs==null)
|
||||
if (dimensionDefs == null)
|
||||
return;
|
||||
foreach (var d in dimensionDefs)
|
||||
{
|
||||
if(!d.canSelect)
|
||||
if (!d.canSelect)
|
||||
continue;
|
||||
var newObj=Instantiate(mapViewUIPrefab,iconList);
|
||||
var newObj = Instantiate(mapViewUIPrefab, iconList);
|
||||
mapViewUIList.Add(newObj);
|
||||
newObj.Init(d);
|
||||
newObj.gameObject.SetActive(false);
|
||||
@@ -58,9 +52,7 @@ namespace UI
|
||||
if (mapViewUIList == null)
|
||||
return;
|
||||
for (var i = 0; i < mapViewUIList.Count; i++)
|
||||
{
|
||||
mapViewUIList[i].gameObject.SetActive(i == CurrentDimensionIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnStartGame()
|
||||
@@ -70,13 +62,13 @@ namespace UI
|
||||
|
||||
public void OnLeft()
|
||||
{
|
||||
CurrentDimensionIndex-=1;
|
||||
CurrentDimensionIndex -= 1;
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
public void OnRight()
|
||||
{
|
||||
CurrentDimensionIndex+=1;
|
||||
CurrentDimensionIndex += 1;
|
||||
UpdateUI();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user