コード例 #1
0
        /// <summary>
        /// 等待某消息到达
        /// </summary>
        /// <param name="msg">等待的消息名称</param>
        /// <param name="waitTime">超时时间</param>
        /// <param name="success">成功的回调</param>
        /// <param name="fail">失败的回调</param>
        /// <returns>操作成功则返回true</returns>
        public static bool WaitMsgArrival(int MsgID, float waitTime, taskFunc success, taskFunc fail)
        {
            if (msgWainList.ContainsKey(MsgID))
            {
                RemoveWaitMsg(MsgID);
            }
            // 记录起来
            WaitMsgNode node = new WaitMsgNode(waitTime, success, fail);

            msgWainList.Add(MsgID, node);

            return(true);
        }
コード例 #2
0
 public WaitMsgNode(float timeout, taskFunc success, taskFunc fail)
 {
     this.timeout = timeout + Time.time;
     this.success = success;
     this.fail    = fail;
 }
コード例 #3
0
 public Task(taskFunc cb, object para)
 {
     this.cb   = cb;
     this.para = para;
 }
コード例 #4
0
 public Task(taskFunc cb)
 {
     this.cb = cb;
 }