mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 06:57:12 +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:
86
Client/Assets/Scripts/UI/SettlementUI.cs
Normal file
86
Client/Assets/Scripts/UI/SettlementUI.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Base;
|
||||
using Entity;
|
||||
using Managers;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class SettlementUI:FullScreenUI,IPointerClickHandler
|
||||
{
|
||||
public Image title;
|
||||
|
||||
public SettlementUIInventoryDisplay weaponDisplay;
|
||||
public SettlementUIInventoryDisplay itemDisplay;
|
||||
public SettlementUIText threatDisplay;
|
||||
public SettlementUIText materialsDisplay;
|
||||
|
||||
|
||||
public Sprite success, agentDead, baseDestroyed;
|
||||
|
||||
public float animationTime = 1;
|
||||
public bool toBase;
|
||||
|
||||
private float timer;
|
||||
private float endTime = 30;
|
||||
|
||||
public SettlementUI()
|
||||
{
|
||||
needPause = false;
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
weaponDisplay.StartShow(animationTime,
|
||||
(Program.Instance.FocusedEntity as Character)?.WeaponInventory.GetSlots().ToArray());
|
||||
itemDisplay.StartShow(animationTime,
|
||||
(Program.Instance.FocusedEntity as Character)?.ItemInventory.GetSlots().ToArray());
|
||||
var totalThreat=KeyValueArchiveManager.Instance.Get<int>("LastGameTotalThreat");
|
||||
var gameEnding= KeyValueArchiveManager.Instance.Get<GameEnding>("LastGameEnding");
|
||||
SetTitle(gameEnding);
|
||||
threatDisplay.StartShow(animationTime,totalThreat);
|
||||
materialsDisplay.StartShow(animationTime, (totalThreat + 99) / 100);
|
||||
Program.Instance.CoinCount += (totalThreat + 99) / 100;
|
||||
}
|
||||
|
||||
public override void TickUI()
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
if (timer >= endTime)
|
||||
{
|
||||
Program.Instance.ReturnBase();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetTitle(GameEnding gameEnding)
|
||||
{
|
||||
title.sprite = gameEnding switch
|
||||
{
|
||||
GameEnding.AreaSecured => success,
|
||||
GameEnding.AgentMissing => agentDead,
|
||||
GameEnding.BaseDestroyed => baseDestroyed,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(gameEnding), gameEnding, null)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if(eventData.button != PointerEventData.InputButton.Left)
|
||||
return;
|
||||
if(toBase)
|
||||
Program.Instance.ReturnBase();
|
||||
else
|
||||
{
|
||||
toBase = true;
|
||||
weaponDisplay.ShowAllImmediately();
|
||||
itemDisplay.ShowAllImmediately();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user