update sample
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UniFramework.Window;
|
||||
|
||||
[WindowAttribute(100, false)]
|
||||
public class UIAboutWindow : UIWindow
|
||||
{
|
||||
public override void OnCreate()
|
||||
{
|
||||
var maskBtn = this.transform.Find("mask").GetComponent<Button>();
|
||||
maskBtn.onClick.AddListener(OnClicMaskBtn);
|
||||
}
|
||||
public override void OnDestroy()
|
||||
{
|
||||
}
|
||||
public override void OnRefresh()
|
||||
{
|
||||
}
|
||||
public override void OnUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
private void OnClicMaskBtn()
|
||||
{
|
||||
UniWindow.CloseWindow<UIAboutWindow>();
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e24fc68d39841044901f3df71616040
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+22
-14
@@ -2,43 +2,51 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using YooAsset;
|
||||
using UniFramework.Window;
|
||||
using UniFramework.Event;
|
||||
|
||||
public class UIBattleWindow : MonoBehaviour
|
||||
[WindowAttribute(100, false)]
|
||||
public class UIBattleWindow : UIWindow
|
||||
{
|
||||
private EventGroup _eventGroup = new EventGroup();
|
||||
private Text _scoreLabel;
|
||||
private GameObject _overView;
|
||||
|
||||
void Awake()
|
||||
public override void OnCreate()
|
||||
{
|
||||
_scoreLabel = this.transform.Find("ScoreView/Score").GetComponent<Text>();
|
||||
_scoreLabel.text = "Score : 0";
|
||||
|
||||
|
||||
var restartBtn = this.transform.Find("OverView/Restart").GetComponent<Button>();
|
||||
restartBtn.onClick.AddListener(OnClickLoginBtn);
|
||||
restartBtn.onClick.AddListener(OnClickRestartBtn);
|
||||
|
||||
var homeBtn = this.transform.Find("OverView/Home").GetComponent<Button>();
|
||||
homeBtn.onClick.AddListener(OnClickHomeBtn);
|
||||
|
||||
_overView = this.transform.Find("OverView").gameObject;
|
||||
_overView.gameObject.SetActive(false);
|
||||
|
||||
EventManager.AddListener<BattleEventDefine.ScoreChange>(OnHandleEventMessage);
|
||||
EventManager.AddListener<BattleEventDefine.GameOver>(OnHandleEventMessage);
|
||||
_eventGroup.AddListener<BattleEventDefine.ScoreChange>(OnHandleEventMessage);
|
||||
_eventGroup.AddListener<BattleEventDefine.GameOver>(OnHandleEventMessage);
|
||||
}
|
||||
void OnDestroy()
|
||||
public override void OnDestroy()
|
||||
{
|
||||
_eventGroup.RemoveAllListener();
|
||||
}
|
||||
public override void OnRefresh()
|
||||
{
|
||||
_overView.SetActive(false);
|
||||
}
|
||||
public override void OnUpdate()
|
||||
{
|
||||
EventManager.RemoveListener<BattleEventDefine.ScoreChange > (OnHandleEventMessage);
|
||||
EventManager.RemoveListener<BattleEventDefine.GameOver>(OnHandleEventMessage);
|
||||
}
|
||||
|
||||
private void OnClickLoginBtn()
|
||||
private void OnClickRestartBtn()
|
||||
{
|
||||
YooAssets.LoadSceneAsync("scene_game");
|
||||
SceneEventDefine.ChangeToBattleScene.SendEventMessage();
|
||||
}
|
||||
private void OnClickHomeBtn()
|
||||
{
|
||||
YooAssets.LoadSceneAsync("scene_home");
|
||||
SceneEventDefine.ChangeToHomeScene.SendEventMessage();
|
||||
}
|
||||
private void OnHandleEventMessage(IEventMessage message)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UniFramework.Window;
|
||||
|
||||
[WindowAttribute(100, false)]
|
||||
public class UIHomeWindow : UIWindow
|
||||
{
|
||||
public override void OnCreate()
|
||||
{
|
||||
var loginBtn = this.transform.Find("Start").GetComponent<Button>();
|
||||
loginBtn.onClick.AddListener(OnClickLoginBtn);
|
||||
|
||||
var aboutBtn = this.transform.Find("About").GetComponent<Button>();
|
||||
aboutBtn.onClick.AddListener(OnClicAboutBtn);
|
||||
}
|
||||
public override void OnDestroy()
|
||||
{
|
||||
}
|
||||
public override void OnRefresh()
|
||||
{
|
||||
}
|
||||
public override void OnUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
private void OnClickLoginBtn()
|
||||
{
|
||||
SceneEventDefine.ChangeToBattleScene.SendEventMessage();
|
||||
}
|
||||
private void OnClicAboutBtn()
|
||||
{
|
||||
UniWindow.OpenWindowAsync<UIAboutWindow>("UIAbout");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UniFramework.Window;
|
||||
|
||||
[WindowAttribute(1000, true)]
|
||||
public class UILoadingWindow : UIWindow
|
||||
{
|
||||
private Text _info;
|
||||
private float _timer;
|
||||
private int _countdown;
|
||||
|
||||
public override void OnCreate()
|
||||
{
|
||||
_info = this.transform.Find("info").GetComponent<Text>();
|
||||
}
|
||||
public override void OnDestroy()
|
||||
{
|
||||
}
|
||||
public override void OnRefresh()
|
||||
{
|
||||
_info.text = "Loading";
|
||||
_timer = 0;
|
||||
_countdown = 0;
|
||||
}
|
||||
public override void OnUpdate()
|
||||
{
|
||||
_timer += Time.deltaTime;
|
||||
if (_timer>= 0.1f)
|
||||
{
|
||||
_timer = 0f;
|
||||
_countdown++;
|
||||
if (_countdown > 6)
|
||||
_countdown = 0;
|
||||
|
||||
string tips = "Loading";
|
||||
for(int i=0; i<_countdown; i++)
|
||||
{
|
||||
tips += ".";
|
||||
}
|
||||
_info.text = tips;
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2bfcc4f450a0b94bb7748fb4788630e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using YooAsset;
|
||||
|
||||
public class UILoginWindow : MonoBehaviour
|
||||
{
|
||||
void Awake()
|
||||
{
|
||||
var loginBtn = this.transform.Find("Start").GetComponent<Button>();
|
||||
loginBtn.onClick.AddListener(OnClickLoginBtn);
|
||||
}
|
||||
|
||||
private void OnClickLoginBtn()
|
||||
{
|
||||
YooAssets.LoadSceneAsync("scene_game");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user