using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class StartView : MonoBehaviour {
public Button Btn_Start { get; set; }
public Button Btn_ReStart { get; set; }
public Button Btn_Set { get; set; }
public Button Btn_Rank { get; set; }
public Text Txt_Title { get; set; }
// Use this for initialization
void Awake() {
Btn_Start = transform.Find("ButtonGroup/btn_Start").GetComponent
RunView脚本:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class RunView : MonoBehaviour {
public Button Btn_Pause { get; set; }
public Text Txt_Curr { get; set; }
public Text Txt_Max { get; set; }
// Use this for initialization
void Awake() {
Btn_Pause = transform.Find("TopGroup/btn_Pasue").GetComponent();
Txt_Curr = transform.Find("TopGroup/txt_Current/Text").GetComponent();
Txt_Max = transform.Find("TopGroup/txt_Max/Text").GetComponent();
}
public void SetScoreText(int curr,int max) {
Txt_Curr.text = curr.ToString();
Txt_Max.text = max.ToString();
}
public void SetScoreText(string curr, string max)
{
Txt_Curr.text = curr;
Txt_Max.text = max;
}
}
SetView脚本:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class SetView : MonoBehaviour {
public Button Btn_Forum { get; set; }
public Button Btn_WebSite { get; set; }
public Button Btn_Collect { get; set; }
public Button Btn_Sound { get; set; }
public Button Btn_Return { get; set; }
public GameObject mask { get; set; }
// Use this for initialization
void Awake() {
Btn_Forum = transform.Find("Img_Bg/Btn_Forum").GetComponent();
Btn_WebSite = transform.Find("Img_Bg/Btn_WebSite").GetComponent();
Btn_Collect = transform.Find("Img_Bg/Btn_Collect").GetComponent();
Btn_Sound = transform.Find("Img_Bg/Btn_Sound").GetComponent();
mask = Btn_Sound.transform.Find("Mask").gameObject;
Btn_Return = GetComponent();
}
public void SetSoundMask(bool isActive)
{
mask.SetActive(isActive);
}
public void SetSoundMask() {
mask.SetActive(!mask.activeSelf);
GameManager.instance.Sound = mask.activeSelf;
AudioManager.instance.SetAudioSource(!mask.activeSelf);
}
}
RankView脚本:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class RankView : MonoBehaviour {
public Button Btn_Clear { get; set; }
public Button Btn_Return { get; set; }
public Text Txt_Curr { get; set; }
public Text Txt_Max { get; set; }
public Text Txt_Count { get; set; }
// Use this for initialization
void Awake() {
Btn_Clear = transform.Find("Img_Bg/Btn_Clear").GetComponent();
Txt_Curr = transform.Find("Img_Bg/Txt_Name").GetComponent();
Txt_Max = transform.Find("Img_Bg/Txt_Max/Text").GetComponent();
Txt_Count = transform.Find("Img_Bg/Txt_Count/Text").GetComponent();
Btn_Return = GetComponent();
}
void Start()
{
SetScoreText();
}
public void TextClearData() {
Txt_Max.text = 0.ToString();
Txt_Count.text = 0.ToString();
GameManager.instance.Score = 0;
GameManager.instance.highScore = 0;
GameManager.instance.numbersGame = 0;
}
public void SetScoreText() {
Txt_Max.text = GameManager.instance.highScore.ToString();
Txt_Count.text = GameManager.instance.numbersGame.ToString();
}
}
PasueView脚本:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class PasueView : MonoBehaviour {
public Button Btn_Home { get; set; }
public Button Btn_Start { get; set; }
public Text Txt_Curr { get; set; }
// Use this for initialization
void Awake()
{
Btn_Home = transform.Find("Img_Bg/Btn_Home").GetComponent();
Btn_Start = transform.Find("Img_Bg/Btn_Start").GetComponent();
Txt_Curr = transform.Find("Img_Bg/Txt_Count").GetComponent();
}
}
OverView脚本:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class OverView : MonoBehaviour {
public Button Btn_Home { get; set; }
public Button Btn_ReStart { get; set; }
public Text Txt_Curr { get; set; }
// Use this for initialization
void Awake () {
Btn_Home = transform.Find("Img_Bg/Btn_Home").GetComponent();
Btn_ReStart = transform.Find("Img_Bg/Btn_ReStart").GetComponent();
Txt_Curr = transform.Find("Img_Bg/Txt_Count").GetComponent();
}
public void SetScoreText(int score) {
Txt_Curr.text = score.ToString();
}
}
using UnityEngine;
using System.Collections;
public class RunCtrl : MonoBehaviour {
public bool isPause { get; set; }
public RunView view { get; set; }
Camera mainCamera { get; set; }
private void Awake()
{
view = gameObject.AddComponent();
GameManager.instance.isOver = false;
isPause = false;
mainCamera = GameObject.Find("Main Camera").GetComponent();
}
// Use this for initialization
void Start () {
view.SetScoreText(0, GameManager.instance.highScore);
StartCoroutine(doZoomIn());
view.Btn_Pause.onClick.AddListener(delegate () {
isPause = true;
GameManager.instance.currentShape.isPause = true;
GameManager.instance.CreatePanel(PanelType.PasuePanel);
AudioManager.instance.PlayCursor();
});
}
///
/// 放大
///
///
IEnumerator doZoomIn()
{
bool isdo = false;
yield return null;
while (!isdo)
{
if (Camera.main.orthographicSize < 10f)
{
isdo = true;
}
Camera.main.orthographicSize -= 0.1f;
yield return new WaitForSeconds(0.02f);
}
}
void Update()
{
if (isPause) return;
while (GameManager.instance.currentShape == null)
{
SquareType st = (SquareType)Random.Range(0, 7);
//测试生成
GameManager.instance.CreateSquare(st);
}
}
}
SetCtrl脚本:
using UnityEngine;
using System.Collections;
public class SetCtrl : MonoBehaviour {
public SetView view { get; set; }
// Use this for initialization
void Start () {
view = gameObject.AddComponent();
view.SetSoundMask(GameManager.instance.Sound);
//声音按钮事件
view.Btn_Sound.onClick.AddListener(delegate () {
view.SetSoundMask();
DataModel.SaveData();
AudioManager.instance.PlayControl();
});
view.Btn_Collect.onClick.AddListener(delegate () {
});
view.Btn_Forum.onClick.AddListener(delegate () {
});
view.Btn_WebSite.onClick.AddListener(delegate () {
});
//返回按钮事件
view.Btn_Return.onClick.AddListener(delegate () {
Destroy(gameObject);
});
}
// Update is called once per frame
void Update () {
}
}
RankCtrl脚本:
using UnityEngine;
using System.Collections;
public class RankCtrl : MonoBehaviour {
public RankView view { get; set; }
// Use this for initialization
void Start () {
view = gameObject.AddComponent();
view.Btn_Clear.onClick.AddListener(delegate () {
view.TextClearData();
DataModel.SaveData();
});
//返回按钮事件
view.Btn_Return.onClick.AddListener(delegate () {
Destroy(gameObject);
});
}
// Update is called once per frame
void Update () {
}
}
PasueCtrl脚本:
using UnityEngine;
using System.Collections;
public class PasueCtrl : MonoBehaviour {
public PasueView view { get; set; }
// Use this for initialization
void Start () {
view = gameObject.AddComponent();
view.Txt_Curr.text = GameManager.instance.Score.ToString();
//继续游戏按钮事件
view.Btn_Start.onClick.AddListener(delegate () {
GameManager.instance.isOver = false;
GameManager.instance.ctrl_run.isPause = false;
GameManager.instance.currentShape.isPause = false;
Destroy(gameObject);
AudioManager.instance.PlayCursor();
});
view.Btn_Home.onClick.AddListener(delegate () {
DestroyAll();
GameManager.instance.isOver = true;
AudioManager.instance.PlayCursor();
GameManager.instance.CreatePanel(PanelType.StartPanel);
});
}
void DestroyAll() {
for (int i = 1; i < GameManager.instance.transform.childCount; i++)
{
Destroy(GameManager.instance.transform.GetChild(i).gameObject);
}
for (int i = 0; i < GameManager.instance.CreatePoint.childCount; i++)
{
Destroy(GameManager.instance.CreatePoint.GetChild(i).gameObject);
}
}
}
OverCtrl脚本:
using UnityEngine;
using System.Collections;
public class OverCtrl : MonoBehaviour {
public OverView view { get; set; }
// Use this for initialization
void Start () {
view = gameObject.AddComponent();
view.SetScoreText(GameManager.instance.Score);
AudioManager.instance.PlayGameOver();
//重新开始
view.Btn_ReStart.onClick.AddListener(delegate() {
ClearSquare();
GameManager.instance.isOver = false;
//取消暂停
GameManager.instance.ctrl_run.isPause = false;
});
//返回主页
view.Btn_Home.onClick.AddListener(delegate() {
ClearSquare();
GameManager.instance.isOver = true;
Destroy(GameManager.instance.ctrl_run.gameObject);
GameManager.instance.CreatePanel(PanelType.StartPanel);
});
}
// Update is called once per frame
void ClearSquare () {
//清除已生成的方块
for (int i = 0; i < GameManager.instance.CreatePoint.childCount; i++)
{
Destroy(GameManager.instance.CreatePoint.GetChild(i).gameObject);
}
//清除当前分数
GameManager.instance.Score = 0;
GameManager.instance.ctrl_run.view.Txt_Curr.text = 0.ToString();
//销毁自身
Destroy(gameObject);
}
}
由于自己项目中使用XML作为配置文件,为了解析起来方便,其实更加方便的是解析XML的.cs文件都通过程序去生成,读者可以自己去实现,下面是XML解析器,仅供大家参考!先来看看最终使用例子的代码(在我们的项目中,我们需要借助上一篇的资源加载管理器来预先加载我们的配置文件):using UnityEngine;using System.Collections;public class LoaderXm
1.java.util.Timer.schedule(TimerTask task, long delay):多长时间(毫秒)后执行任务
2.java.util.Timer.schedule(TimerTask task, Date time):设定某个时间执行任务
3.java.util.Timer.schedule(TimerTask task, long delay,longperiod
java.lang.UnsupportedClassVersionError: cn/support/cache/CacheType : Unsupported major.minor version 51.0 (unable to load class cn.support.cache.CacheType)
at org.apache.catalina.loader.WebappClassL
昨天发了一个提问,启动5个线程将一个List中的内容,然后将5个线程的内容拼接起来,由于时间比较急迫,自己就写了一个Demo,希望对菜鸟有参考意义。。
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
public c
select list.listname, list.createtime,listcount from dream_list as list , (select listid,count(listid) as listcount from dream_list_user group by listid order by count(
此文转自IBM.
Apache 服务简介
Web 服务器也称为 WWW 服务器或 HTTP 服务器 (HTTP Server),它是 Internet 上最常见也是使用最频繁的服务器之一,Web 服务器能够为用户提供网页浏览、论坛访问等等服务。
由于用户在通过 Web 浏览器访问信息资源的过程中,无须再关心一些技术性的细节,而且界面非常友好,因而 Web 在 Internet 上一推出就得到
1) I love you not because of who you are, but because of who I am when I am with you. 我爱你,不是因为你是一个怎样的人,而是因为我喜欢与你在一起时的感觉。 2) No man or woman is worth your tears, and the one who is, won‘t