private static void UpdateFakeSelectHero(int seq) { int num = 0; for (int i = 0; i < CFakePvPHelper.FakeHeroSelectList.get_Count(); i++) { CFakePvPHelper.FakeHeroSelect fakeHeroSelect = CFakePvPHelper.FakeHeroSelectList.get_Item(i); if (fakeHeroSelect.bConfirmed) { num++; } else if (fakeHeroSelect.idleSec == fakeHeroSelect.nextActionSec) { CFakePvPHelper.DoSelectAction(ref fakeHeroSelect); fakeHeroSelect.idleSec = 0; fakeHeroSelect.nextActionSec = Random.Range(3, 6); } else { fakeHeroSelect.idleSec++; } } if (num == CFakePvPHelper.FakeHeroSelectList.get_Count()) { Singleton <CTimerManager> .GetInstance().RemoveTimer(new CTimer.OnTimeUpHandler(CFakePvPHelper.UpdateFakeSelectHero)); } }
public static void BeginFakeSelectHero() { CFakePvPHelper.HeroConfirmedPlayerNum = 0; CFakePvPHelper.FakeHeroSelectList.Clear(); CFakePvPHelper.ChosenHeroes.Clear(); CFakePvPHelper.EnemyChosenHeroes.Clear(); RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo; DebugHelper.Assert(roomInfo != null); DebugHelper.Assert(roomInfo.roomAttrib.bWarmBattle); COM_PLAYERCAMP selfCamp = roomInfo.GetSelfCamp(); ListView <MemberInfo> listView = roomInfo[selfCamp]; for (int i = 0; i < listView.get_Count(); i++) { MemberInfo memberInfo = listView.get_Item(i); if (memberInfo.RoomMemberType == 2u) { CFakePvPHelper.FakeHeroSelect fakeHeroSelect = new CFakePvPHelper.FakeHeroSelect(); fakeHeroSelect.FakePlayer = memberInfo.WarmNpc; if (Singleton <CHeroSelectBaseSystem> .get_instance().selectType == enSelectType.enRandom) { fakeHeroSelect.maxChangeHeroCount = Random.Range(0, 2); CFakePvPHelper.DoSelectAction(ref fakeHeroSelect); } else { fakeHeroSelect.maxChangeHeroCount = Random.Range(1, 4); } fakeHeroSelect.nextActionSec = Random.Range(3, 6); CFakePvPHelper.FakeHeroSelectList.Add(fakeHeroSelect); } } if (CFakePvPHelper.FakeHeroSelectList.get_Count() > 0) { Singleton <CTimerManager> .GetInstance().AddTimer(1000, 60, new CTimer.OnTimeUpHandler(CFakePvPHelper.UpdateFakeSelectHero)); CFakePvPHelper.bInFakeSelect = true; } Singleton <CTimerManager> .GetInstance().AddTimer(60000, 1, new CTimer.OnTimeUpHandler(CFakePvPHelper.OnSelectHeroTimeout)); }