【m】框架大更新
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIAboutWindow : MonoBehaviour
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
var maskBtn = this.transform.Find("mask").GetComponent<Button>();
|
||||
maskBtn.onClick.AddListener(OnClicMaskBtn);
|
||||
}
|
||||
|
||||
private void OnClicMaskBtn()
|
||||
{
|
||||
GameObject.Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e24fc68d39841044901f3df71616040
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UniFramework.Event;
|
||||
|
||||
public class UIBattleWindow : MonoBehaviour
|
||||
{
|
||||
private readonly EventGroup _eventGroup = new EventGroup();
|
||||
private GameObject _overView;
|
||||
private Text _scoreLabel;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_overView = this.transform.Find("OverView").gameObject;
|
||||
_scoreLabel = this.transform.Find("ScoreView/Score").GetComponent<Text>();
|
||||
_scoreLabel.text = "Score : 0";
|
||||
|
||||
var restartBtn = this.transform.Find("OverView/ReplayButton").GetComponent<Button>();
|
||||
restartBtn.onClick.AddListener(OnClickReplayBtn);
|
||||
|
||||
var homeBtn = this.transform.Find("OverView/HomeButton").GetComponent<Button>();
|
||||
homeBtn.onClick.AddListener(OnClickHomeBtn);
|
||||
|
||||
_eventGroup.AddListener<BattleEventDefine.ScoreChange>(OnHandleEventMessage);
|
||||
_eventGroup.AddListener<BattleEventDefine.GameOver>(OnHandleEventMessage);
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
_eventGroup.RemoveAllListener();
|
||||
}
|
||||
|
||||
private void OnClickReplayBtn()
|
||||
{
|
||||
SceneEventDefine.ChangeToBattleScene.SendEventMessage();
|
||||
}
|
||||
private void OnClickHomeBtn()
|
||||
{
|
||||
SceneEventDefine.ChangeToHomeScene.SendEventMessage();
|
||||
}
|
||||
private void OnHandleEventMessage(IEventMessage message)
|
||||
{
|
||||
if(message is BattleEventDefine.ScoreChange)
|
||||
{
|
||||
var msg = message as BattleEventDefine.ScoreChange;
|
||||
_scoreLabel.text = $"Score : {msg.CurrentScores}";
|
||||
}
|
||||
else if(message is BattleEventDefine.GameOver)
|
||||
{
|
||||
_overView.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9776c197a7f86e94c9484946495616bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIHomeWindow : MonoBehaviour
|
||||
{
|
||||
private Text _version;
|
||||
private GameObject _aboutView;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_version = this.transform.Find("version").GetComponent<Text>();
|
||||
_aboutView = this.transform.Find("AboutView").gameObject;
|
||||
|
||||
var loginBtn = this.transform.Find("PlayGameButton").GetComponent<Button>();
|
||||
loginBtn.onClick.AddListener(OnClickPlayGameBtn);
|
||||
|
||||
var aboutBtn = this.transform.Find("AboutButton").GetComponent<Button>();
|
||||
aboutBtn.onClick.AddListener(OnClicAboutBtn);
|
||||
|
||||
var maskBtn = this.transform.Find("AboutView/mask").GetComponent<Button>();
|
||||
maskBtn.onClick.AddListener(OnClickMaskBtn);
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
var package = YooAsset.YooAssets.GetPackage("DefaultPackage");
|
||||
_version.text = "Version : " + package.GetPackageVersion();
|
||||
}
|
||||
|
||||
private void OnClickPlayGameBtn()
|
||||
{
|
||||
SceneEventDefine.ChangeToBattleScene.SendEventMessage();
|
||||
}
|
||||
private void OnClicAboutBtn()
|
||||
{
|
||||
_aboutView.SetActive(true);
|
||||
}
|
||||
private void OnClickMaskBtn()
|
||||
{
|
||||
_aboutView.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4792d7c57be85c845bc50d7215160853
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UniFramework.Utility;
|
||||
|
||||
public class UILoadingWindow : MonoBehaviour
|
||||
{
|
||||
private readonly UniTimer _timer = UniTimer.CreatePepeatTimer(0, 0.2f);
|
||||
private Text _info;
|
||||
private int _countdown;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_info = this.transform.Find("info").GetComponent<Text>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
_info.text = "Loading";
|
||||
_timer.Reset();
|
||||
_countdown = 0;
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (_timer.Update(Time.deltaTime))
|
||||
{
|
||||
_countdown++;
|
||||
if (_countdown > 6)
|
||||
_countdown = 0;
|
||||
|
||||
string tips = "Loading";
|
||||
for (int i = 0; i < _countdown; i++)
|
||||
{
|
||||
tips += ".";
|
||||
}
|
||||
_info.text = tips;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2bfcc4f450a0b94bb7748fb4788630e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user