91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-11
  • 語言: 其他
  • 標簽: unity3d??script??

資源簡介

用于unity3d的延遲消息機 具體參考http://blog.csdn.net/hale445566/article/details/38357123

資源截圖

代碼片段和文件信息

using?UnityEngine;
using?System.Collections.Generic;
using?System;

//發送信息的方法簽名??消息處理成功?返回true?else?false
public?delegate?bool?Message();
public?delegate?bool?Message(T?arg0);
public?delegate?bool?Message(T?arg0U?arg1V?arg2X?arg3);

///?
///?信息中心
///?

public?class?NotificationCenter?
{

????//事件表?key是事件名稱??value是方法委托
????public?static?Dictionary?eventTable?=?new?Dictionary(100);

????//錯誤消息?已有收聽者
????public?static?NotificationException?HasListenerException(string?msg)
????{
????????return?new?NotificationException(string.Format(“消息機添加收聽者錯誤?\“{0}\“已有該收聽者,相同收聽者只能有一個“?msg));
????}

????//錯誤消息?沒有收聽者
????public?static?NotificationException?NoListenerException(string?msg)?{
????????return?new?NotificationException(string.Format(“消息機發送消息錯誤?\“{0}\“沒有收聽者“?msg));
????}

????//錯誤消息?沒有方法
????public?static?NotificationException?NoDelegateException(string?msg)
????{
????????return?new?NotificationException(string.Format(“消息機發送消息錯誤?\“{0}\“收聽者沒有該委托方法“?msg));
????}

????//錯誤消息?方法轉換錯誤
????public?static?NotificationException?NullMessageException(string?msg)
????{
????????return?new?NotificationException(string.Format(“消息機發送消息錯誤?\“{0}\“方法轉換錯誤轉換后的message為空可能是方法參數不對“?msg));
????}

????//檢查收聽者是否可添加
????public?static?void?CheckAddListener(string?lis)?{
????????//已有收聽者?發送錯誤消息
????????if?(eventTable.ContainsKey(lis))
????????????throw?HasListenerException(lis);
????}

????//檢查收聽者是否可移除
????public?static?void?CheckRemoveListener(string?lis)
????{
????????//沒有收聽者?發送錯誤消息
????????if?(!eventTable.ContainsKey(lis))
????????????throw?NoListenerException(lis);
????}

????//檢查消息是否可發送
????public?static?void?CheckBroadcastListener(string?lis)
????{
????????//如果沒有該方法收聽者?
????????if(!eventTable.ContainsKey(lis))
????????????throw?NoListenerException(lis);

????????Delegate?d;
????????//如果方法收聽者沒有該方法
????????if?(!eventTable.TryGetValue(lis?out?d))
????????????throw?NoDelegateException(lis);
????}

????//添加收聽者
????public?static?void?AddListener(string?lisMessage?mess)?{
????????CheckAddListener(lis);
????????eventTable.Add(lis?mess);
????}

????public?static?void?AddListener(string?lis?Message?mess)
????{
????????CheckAddListener(lis);
????????eventTable.Add(lis?mess);
????}

????public?static?void?AddListener(string?lis?Message?mess)
????{
????????CheckAddListener(lis);
????????eventTable.Add(lis?mess);
????}

????//移除收聽者
????public?static?void?RemoveListener(string?lis)?{
????????CheckRemoveListener(lis);
????????eventTable.Remove(lis);
????}
????
????//發送信息?接受者成功處理?返回true?else?false
????public?static?bool?Broadcase(string?lis)
????{
????????CheckBroadcastListener(lis);

????????Delegate?d;
????????eventTable.TryGetValue(lis?out?d);
????????Message?me?=?d?as?Message;
????????if?(me?!=?null)
????????{
????????????if?(me())
????????????????return?true;
????????????else?return?false;

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????5378??2014-08-03?13:08??NotificationCenter.cs

?????文件???????1897??2014-08-03?13:21??TimeClock.cs

-----------?---------??----------?-----??----

?????????????????7275????????????????????2


評論

共有 條評論