mycj_demo/mycj/Assets/Game/Scripts/Application/02View/Level/FBUIWin.cs
2024-12-02 09:37:47 +08:00

124 lines
2.9 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Felix-BangFBUIWin
//   へ     /|
//  /7    ∠_/
//  / │    
//  Z _,    /`ヽ
// │     ヽ   /  〉
//  Y     `  /  /
// イ● 、 ●  ⊂⊃〈  /
// ()  へ    | \〈
//  >ー 、_  ィ  │
//  / へ   / ノ<|
//  ヽ_ノ  (_  │//
//  7       |
//  ―r ̄ ̄`ー―_
// Describe关卡-获胜
// Createtime2018/10/09
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FBFramework;
using UnityEngine.UI;
using System;
namespace FBApplication
{
public class FBUIWin : FBView
{
#region
[SerializeField]
private Text txtCurrent;
[SerializeField]
private Text txtTotal;
[SerializeField]
private Button btnRestart;
[SerializeField]
private Button btnContinute;
#endregion
#region
public override string Name
{
get
{
return FBConsts.V_Win;
}
}
#endregion
#region Unity回调
private void Awake()
{
UpdatteRoundInfo(0,0);
}
private void Start()
{
btnRestart.onClick.AddListener(OnRestartClick);
btnContinute.onClick.AddListener(OnContinuteClick);
}
#endregion
#region
public override void HandleEvent(string eventName, object data = null)
{
}
#endregion
#region
private void OnRestartClick()
{
FBGameModel gameModel = GetModel<FBGameModel>();
SendEvent(FBConsts.E_LevelStart, new FBStartLevelArgs() { ID = gameModel.PlayLevelIndex });
}
private void OnContinuteClick()
{
FBGameModel gameModel = GetModel<FBGameModel>();
if (gameModel.PlayLevelIndex >= gameModel.LevelCount - 1)
{
//游戏通关
FBGame.Instance.LoadScene(4);
}
else
SendEvent(FBConsts.E_LevelStart, new FBStartLevelArgs() { ID = gameModel.PlayLevelIndex + 1 }); //开始下一关卡
}
public void Show()
{
gameObject.SetActive(true);
FBRoundModel roundModel = GetModel<FBRoundModel>();
UpdatteRoundInfo(roundModel.RoundIndex + 1, roundModel.RoundTotal);
}
private void Hide()
{
gameObject.SetActive(false);
}
private void UpdatteRoundInfo(int currentRound,int totalRound)
{
txtCurrent.text = currentRound.ToString("D2");
txtTotal.text = totalRound.ToString();
}
#endregion
#region
#endregion
}
}