private Dictionary<string, UILabel> mLabels;

private Dictionary<string,UISprite> mSprites;

Coroutine myTimer;

protected pverride void OnAwake()

{

mLabels = UI.GetElement<UILabel>(transform);

mSprites = UI.GetElement<UISprite>(transform);

Register();

transform.Find("grid").localPosition = GetTop();  //在游戏上方显示

}

private void OnDestory()

{

UnRegister();  

}

private void Register()

{

EventManager.AddListener(EventConst.StartBattleTime,StartTime);

EventManager.AddListener(EventConst.RefreshBattleNum,RefreshAliveNum);

EventManager.AddListener(EventConst.RefreshBattleName,RefreshHonourValue);

EventManager.AddListener(EventConst.RefreshBattleHonourValue,RefreshHonourValue);

EventManager.AddListener(EventConst.StopBattleTime,StopTime);

}

private void UnRegister()

{

EventManager.RemoveListener(EventConst.StartBattleTime,StartTime);

EventManager.RemoveListener(EventConst.RefreshBattleNum,RefreshAliveNum);

EventManager.RemoveListener(EventConst.RefreshBattleName,RefreshHonourValue);

EventManager.RemoveListener(EventConst.RefreshBattleHonourValue,RefreshHonourValue);

EventManager.RemoveListener(EventConst.StopBattleTime,StopTime);

}

private void StartTime(object param)

{

List<object> list = (List<object>)param;

TimeSpan ts = TimeSpan.Parse((string)list[0]);

myTimer = StartCoroutine(UI.DoTimerMinuteSec(ts,mLabels["CountDown"]));

}

private void StopTime(object param)

{

List<object> list = (List<object>)param;

StopCoroutine(myTimer);

int type = (int)  list[0];

if(type == 0)

{

}else if(type == 1){

mLabels["CountDown"].text = "00:00";

}

}

private void RefreshAliveNum(object param)

{

Lisr<object> items = (List<object>)param;

string type = (string)items[0];

if(type == "all")

{

mLabels["AppearUnits1"].text = items[1].ToString();

mLabels["AppearUnits1"].text = items[2].ToString();

}

else if(type == "player")

{

mLabels["AppearUnits1"].text = items[1].ToString();

}

else if(type == "enemy")

{

mLabels["AppearUnits1"].text = items[1].ToString();

}

}

private void RefreshName(object param)

{

Lisr<object> items = (List<object>)param;

string type = (string)items[0];

if(type == "all")

{

mLabels["Name1"].text = items[1].ToString();

mLabels["Name2"].text = items[2].ToString();

}

else if(type == "player")

{

mLabels["Name1"].text = items[1].ToString();

}

else if(type == "enemy")

{

mLabels["Name2"].text = items[1].ToString();

}

}

private void RefreshHonourValue(object param)

{

Lisr<object> items = (List<object>)param;

string type = (string)items[0];

if(type == "all")

{

mLabels["HorourValue1"].text = items[1].ToString();

mLabels["HorourValue2"].text = items[2].ToString();

}

else if(type == "player")

{

mLabels["HorourValue1"].text = items[1].ToString();

}

else if(type == "enemy")

{

mLabels["HorourValue2"].text = items[1].ToString();

}

}

BattleInfo的更多相关文章

  1. [TcaplusDB知识库]TcaplusDB客户端及常用命令

    数据库大都支持命令行访问,TcaplusDB也不例外,通过安装TcaplusDB客户端,您可以方便快捷地从命令行管理与访问数据库. TcaplusDB客户端 首先在 TcaplusServiceApi ...

随机推荐

  1. stick footer布局

    需求: 将footer固定到底部.文章内容不足满屏时 footer在底部,超过满屏时footer在内容末尾. 方法一: <div id="wrap"> <div ...

  2. 线段树(hdu 2795)

    Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  3. linux入门之用户管理

    用户管理 添加用户 以root用户执行 adduser  或 useradd [new_account] -u  UID   -d 指定家目录 -g GID 指定一个基本组ID   -G指定一个附加组 ...

  4. unity 看到Sphere内部,通过Sphere播放全景视频时候遇到的问题

    Unity创建一Sphere默认是看不到球体内部的,所以需要用 Cull Front  修改剔除的方向,这就会带来一个新的问题,所播放的视频是像镜子一样翻转着的,所以要改变它的UV坐标使其翻转过来 f ...

  5. CF #edu 11 C. Hard Process

    题目链接:http://codeforces.com/problemset/problem/660/C 大意是给一个01数组,至多可以将k个0变为1,问最后数组中最长能有多少个连续的1,并输出. 问题 ...

  6. SQL生成一年每一天的时间列表的几种方法

    工作好几年了,一直没有写博客,准备捡起来...   以下脚本适用环境:SQL SERVER (starting with 2012)   1.构建序列:   /*1-1:利用交叉连接,推荐下列这种写法 ...

  7. rapidPHP 下载并安装

    安装 rapidPHP对运行环境的要求 php 5.4以上,包括5.4,支持php7,依赖包,php-curl,php-mysql,php-gd 官网下载 http://rapidphp.gx521. ...

  8. AspNetCore-MVC实战系列(二)之通过绑定邮箱找回密码

    AspNetCore - MVC实战系列目录 . 爱留图网站诞生 . AspNetCore - MVC实战系列(一)之Sqlserver表映射实体模型 . AspNetCore-MVC实战系列(二)之 ...

  9. undo表空间

    undo表空间undo表空间的管理,主要包括创建.删除.修改.切换.其中需要注意的是不能在undo表空间创建数据库对象,还有就是只能是单文件或大文件表空间. 创建创建主要有两种方法,一种是在创建数据库 ...

  10. linux的大小端、网络字节序问题 .

    1.80X86使用小端法,网络字节序使用大端法. 2.二进制的网络编程中,传送数据,最好以unsigned char, unsigned short, unsigned int来处理, unsigne ...