1 Star 0 Fork 3

wayfarer/rongYaoDaLuCode

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
PlaytList.cs 4.39 KB
一键复制 编辑 原始数据 按行查看 历史
liyonghelpme 提交于 2015-05-19 23:14 +08:00 . rong Yao Da Lu Some Code For Game
using com.game.module.core;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngine;
public class PlaytList
{
private int index;
public List<IPlay> playList = new List<IPlay>();
public void AddCoroutine(IEnumerator coroutine, int index = -1)
{
this.AddPlay(new Task(coroutine, false), index);
}
public void AddDelegate(EventDelegate.Callback callBack, int index = -1)
{
this.AddPlay(new DelegatePlay(callBack), index);
}
public void AddPlay(IPlay play, int index = -1)
{
if (play != null)
{
if (index == -1)
{
this.playList.Add(play);
}
else if ((index >= 0) && (index <= this.playList.Count))
{
this.playList.Insert(index, play);
}
}
}
public void AddTimeInterval(float seconds, EventDelegate.Callback callBack)
{
Task play = this.WaitForSeconds(seconds);
EventDelegate.Add(play.onFinish, callBack);
this.AddPlay(play, this.index);
}
public void AddTimeInterval(float seconds, int index = -1)
{
this.AddPlay(this.WaitForSeconds(seconds), index);
}
public void ClearPlay()
{
this.playList.Clear();
}
public void ContatPlay()
{
int num = 0;
int num2 = this.playList.Count - 1;
while (num < num2)
{
if (this.playList[num].OnEnd != null)
{
EventDelegate.Add(this.playList[num].OnEnd, new EventDelegate.Callback(this.PlayNext));
}
num++;
}
}
public void Continue()
{
this.PlayNext();
}
private void PlayNext()
{
this.index++;
if (this.index < this.playList.Count)
{
this.playList[this.index].Begin();
}
}
public void Start()
{
this.ContatPlay();
this.index = 0;
if (this.playList.Count > 0)
{
this.playList[0].Begin();
}
}
public Task WaitForSeconds(float seconds)
{
return new Task(this.WaitForSecondsHandle(seconds), false);
}
[DebuggerHidden]
private IEnumerator WaitForSecondsHandle(float seconds)
{
return new <WaitForSecondsHandle>c__Iterator25 { seconds = seconds, <$>seconds = seconds };
}
[CompilerGenerated]
private sealed class <WaitForSecondsHandle>c__Iterator25 : IEnumerator, IDisposable, IEnumerator<object>
{
internal object $current;
internal int $PC;
internal float <$>seconds;
internal float seconds;
[DebuggerHidden]
public void Dispose()
{
this.$PC = -1;
}
public bool MoveNext()
{
uint num = (uint) this.$PC;
this.$PC = -1;
switch (num)
{
case 0:
this.$current = new WaitForSeconds(this.seconds);
this.$PC = 1;
return true;
case 1:
this.$PC = -1;
break;
}
return false;
}
[DebuggerHidden]
public void Reset()
{
throw new NotSupportedException();
}
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return this.$current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return this.$current;
}
}
}
private class DelegatePlay : IPlay
{
private EventDelegate.Callback callBack;
public DelegatePlay(EventDelegate.Callback callBack)
{
this.callBack = callBack;
}
public void Begin()
{
if (this.callBack != null)
{
this.callBack();
}
}
public List<EventDelegate> OnEnd
{
get
{
return null;
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wayfarer/rongYaoDaLuCode.git
git@gitee.com:wayfarer/rongYaoDaLuCode.git
wayfarer
rongYaoDaLuCode
rongYaoDaLuCode
master

搜索帮助