private void Use() { if (isWait) { var list = action?.GetListComponents(); _methodWaitForCount = list.Count; if (list.IsAlmostSpecificCount()) { FarUsableObj(_colliderObj); _isEnable = false; foreach (var element in list) { WaitManager.Wait(element, OnFinishWait); } action?.Invoke(_colliderObj); } else { LogManager.LogWarning("There isn't one action with IWaitAction interface"); } } else { action?.Invoke(_colliderObj); } }
//业务层协议 public static void BusinessRequest <toc>(IMessage sendMsg, OpCodeType opCodeType, Action <toc> onSuccess, Action <ErrorInfo> onFail, bool isShowDefaultTip = true) where toc : IMessage <toc> { WaitManager.BeginRotate(); WebSocketComponent._instance.SendMsg(sendMsg, opCodeType, (res) => { toc tocRes = (toc)res; onSuccess(tocRes); }, async(error) => { StaticData.DebugGreen(sendMsg.GetType().ToString() + " webErrorCode:" + error.webErrorCode + " ErrorMessage:" + error.ErrorMessage); if (isShowDefaultTip) { var defineErrorCode = StaticData.configExcel.ServerErrorCode.Find(x => x.errorCode == (Company.Cfg.WebErrorCode)error.webErrorCode); if (defineErrorCode.isShowTips) { StaticData.CreateToastTips($"{defineErrorCode.SimplifiedChinese}"); } } else { onFail(error); } }); }
//クリア処理(開始時やセーブデータロードからの開始時、終了時など、完全にデータをクリアするときに呼ばれる) internal void Clear() { IsPlaying = false; CleaSubTreadList(); ResetOnJump(); WaitManager.Clear(); jumpManager.Clear(); StopAllCoroutines(); }
void Awake() { flyOverLayer = GameObject.Find("GroundBlockingLayer"); surfOverLayer = GameObject.Find("Water"); flyOverTiles = flyOverLayer.GetComponent <TilemapCollider2D>(); surfOverTiles = surfOverLayer.GetComponent <TilemapCollider2D>(); displayScript = GetComponent <DisplayManager>(); boxCollider = GetComponent <BoxCollider2D>(); waitScript = GetComponent <WaitManager>(); }
//クリア処理(開始時やセーブデータロードからの開始時、終了時など、完全にデータをクリアするときに呼ばれる) internal void Clear() { IsPlaying = false; WaitingThreadName = ""; loadedSaveData.Clear(); CleaSubTreadList(); ResetOnJump(); WaitManager.Clear(); jumpManager.Clear(); StopAllCoroutines(); }
/// <summary> /// 退出 到登录页面 /// </summary> public void QuitUILogin(bool isAccountWasSqueezed = false) { _isAutoDisconnect = true; CloseNetworkAnomalyTips(); ClearWebSocket(); CloseConnect(); InitData(); // WaitManager.EndRotate(); StaticData.ReturnUILogin(isAccountWasSqueezed); }
public async Task DoLevelIncrementAsync(List <Bug> bugs, float timestamp) { if (bugs.Count == 0) { WaitManager.DoOnce(() => { EnemyGridManager.EnemyGridBreathing = false; }, WaitManager.WaitStep.enStep.CleanUp); //are we at a challenging stage? if ((IsChallengeLevel()) && !WaitManager.Steps.Any(a => a.Step == WaitManager.WaitStep.enStep.Pause1)) { if (hits == 40) { SoundManager.PlaySound(SoundManager.SoundManagerSounds.challengingstageperfect, true); } else { SoundManager.PlaySound(SoundManager.SoundManagerSounds.challengingstageover, true); } if (WaitManager.WaitFor(1500, timestamp, WaitManager.WaitStep.enStep.ShowNumberOfHitsLabel)) { await ConsoleManager.DrawConsoleNumberOfHitsLabel(spriteService, hits); if (WaitManager.WaitFor(1500, timestamp, WaitManager.WaitStep.enStep.ShowNumberOfHits)) { await ConsoleManager.DrawConsoleNumberOfHits(spriteService, hits); if (WaitManager.WaitFor(1500, timestamp, WaitManager.WaitStep.enStep.ShowBonusLabel)) { await ConsoleManager.DrawConsoleBonusLabel(spriteService, hits); if (WaitManager.WaitFor(1500, timestamp, WaitManager.WaitStep.enStep.ShowBonus)) { await ConsoleManager.DrawConsoleBonus(spriteService, hits); if (WaitManager.WaitFor(2000, timestamp, WaitManager.WaitStep.enStep.Pause3)) { Score += hits == 40 ? 10000 : hits * 100; await ConsoleManager.ClearConsoleLevelText(spriteService); MoveToNextLevel(timestamp); } } } } } } else { MoveToNextLevel(timestamp); } } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); throw new System.Exception("Wait manager already exists destroying the sencond one"); } }
/// <summary> /// 打开网络异常提示 /// </summary> private void OpenNetworkAnomalyTips() { _isOpenNetworkAnomalyTips = true; // WaitManager.EndRotate(); //打开异常提示界面 Debug.Log("打开异常提示界面"); //string desc = "网络开小差了,重新连接一下吧"; string desc = LocalizationDefineHelper.GetStringNameById(120219); //120075 //取消 StaticData.OpenCommonTips(desc, 120220, NetworkAnomalyTipsReconnect, NetworkAnomalyTipsQuitLogin, 120075); }
/// <summary> /// 开始重新连接 //设置重新链接 /// </summary> private async void StartReconnect(bool isServerClosed = false) { _isNeedSendHeartBeat = false; //服务器关闭 直接退到 登录界面 if (isServerClosed) { QuitUILogin(); return; } isBeginRetry = true; //网络异常提示界面已经打开 if (_isOpenNetworkAnomalyTips) { return; } //判断重连次数 if (currRetryTimes >= StaticData.configExcel.GetVertical().ReconnectTimer) { Debug.Log(string.Format("判断重连次数 currRetryTimes = {0}", currRetryTimes)); //打开提示界面 提示网络异常 OpenNetworkAnomalyTips(); return; } currRetryTimes++; //打开等待界面 WaitManager.BeginRotate(); //是否有网络 if (Application.internetReachability == NetworkReachability.NotReachable) { //无网络 //等待重连 await UniTask.Delay(StaticData.configExcel.GetVertical().ReconnectDelayTime); StartReconnect(); return; } //重连 EnterReconnect(); }
public void SetupDriver() { driver = DriverManager.GetDriver(); wait = WaitManager.GetDefaultWait(driver); extentTest = extentReports.CreateTest(ScenarioContext.Current.ScenarioInfo.Title); homePage = new HomePage(driver, wait); bookDetailsPage = new BookDetailsPage(driver, wait); foundResultsPage = new FoundResultsPage(driver, wait); basketPage = new BasketPage(driver, wait); ScenarioContext.Current.Set <IWebDriver>(driver); ScenarioContext.Current.Set <IWait <IWebDriver> >(wait); ScenarioContext.Current.Set <HomePage>(homePage); ScenarioContext.Current.Set <FoundResultsPage>(foundResultsPage); ScenarioContext.Current.Set <BookDetailsPage>(bookDetailsPage); ScenarioContext.Current.Set <BasketPage>(basketPage); ScenarioContext.Current.Set <ExtentTest>(extentTest); }
public void MoveToNextLevel(float timestamp) { if (WaitManager.WaitFor(2000, timestamp, WaitManager.WaitStep.enStep.Pause1)) { WaitManager.DoOnce(async() => { Level += 1; if (Level == 12) { LevelOffset += 8; Level = 4; } capturehappened = false; hits = 0; wave = 1; GalagaCaptureManager.Reset(); await ConsoleManager.DrawConsole(Lives, spriteService, Ship, true, Level - 1 + LevelOffset, Score, HighScore); await ConsoleManager.ClearConsoleLevelText(spriteService); await ConsoleManager.DrawConsoleLevelText(spriteService, Level + LevelOffset, IsChallengeLevel()); SoundManager.StopAllSounds(); if (IsChallengeLevel()) { SoundManager.PlaySound(SoundManager.SoundManagerSounds.challengingstage); } else { SoundManager.PlaySound(SoundManager.SoundManagerSounds.levelup); } }, WaitManager.WaitStep.enStep.ShowLevelText); if (WaitManager.WaitFor(2000, timestamp, WaitManager.WaitStep.enStep.Pause2)) { WaitManager.DoOnce(async() => { await ConsoleManager.ClearConsoleLevelText(spriteService); InitLevel(Level); Ship.Visible = true; EnemyGridManager.BreathSoundPlayed = false; WaitManager.ClearSteps(); }, WaitManager.WaitStep.enStep.ClearLevelText); } } }
private void Start() { dm = new DialogManager(); am = new AnimationManager(); rm = new ResponseManager(); wm = new WildcardManager(); tm = new TriggerManager(); wwm = new WaitManager(); mm = new MoveManager(); em = new EmoteManager(); mcm = new MemoryCheckManager(); cm = new ConversationIM(); rm = gameObject.GetComponent <ResponseManager>(); wm = gameObject.GetComponent <WildcardManager>(); tm = gameObject.GetComponent <TriggerManager>(); wwm = gameObject.GetComponent <WaitManager>(); mcm = gameObject.GetComponent <MemoryCheckManager>(); cm = gameObject.GetComponent <ConversationIM>(); }
private void Start() { dm = new DialogManager(); am = new AnimationManager(); rm = new ResponseManager(); wm = new WildcardManager(); tm = new TriggerManager(); wwm = new WaitManager(); mm = new MoveManager(); em = new EmoteManager(); mcm = new MemoryCheckManager(); sm = new AgentStatusManager(); rm = gameObject.GetComponent <ResponseManager>(); wm = gameObject.GetComponent <WildcardManager>(); tm = gameObject.GetComponent <TriggerManager>(); wwm = gameObject.GetComponent <WaitManager>(); mcm = gameObject.GetComponent <MemoryCheckManager>(); foreach (Transform child in transform) { events.Add(child.GetComponentInChildren <EventIM>()); } start = true; }
// Update is called once per frame void Test(float a) { UnityEngine.Debug.Log(a); WaitManager.Call(typeof(Waitxamples1)); }
public bool IsErrorMessageDisplayed() { return(WaitManager.IsDisplayedByXpathWithFluent("//*[@class='swal-title']")); }
public void WhenTravellerSelectFinishButton() { CurrentPage.As <CreatePage>().SelectFinishButton(); WaitManager.Wait(10000); }
private void OnWaitTestWait() { WaitManager.Call(this); }
void Call() { WaitManager.Call(typeof(Waitxamples2)); }
// Start is called before the first frame update void Start() { WaitManager.Wait <float>(typeof(Call), Test); }
public ShopingCartPage() { WaitManager.WaitForTrueCondition( () => shoppingCartTable.GetHeaderElements().Count > 0, "Wait for cart table"); }
/// <summary> /// 设置一次消息请求回调完成 /// </summary> private void SetOnceMessageCompelete() { isSendRequest = false; WaitManager.EndRotate(); }
void Caller() { WaitManager.Call <float>(typeof(Call), 2f); WaitManager.Call <float>(typeof(Call), 4f); }
// Start is called before the first frame update void Start() { WaitManager.Wait(typeof(Waitxamples1), Wait); WaitManager.Wait(typeof(Waitxamples2), Wait); Invoke("Caller", 2f); }
public async void Process(float timestamp, GameLoopObject glo) { if (skipintro) { skipintro = false; hideintroscreen = true; introsounddone = true; Started = true; Ship.Visible = true; KeyBoardHelper.SpaceBarPressed = true; } if (soundoff && !SoundManager.SoundIsOff) { SoundManager.TurnSoundOff(); } //show the intro screen if the space bar hasn't been pressed yet if (!hideintroscreen) { if (KeyBoardHelper.SpaceBarPressed) { SoundManager.PlaySound(SoundManager.SoundManagerSounds.coin, true); await ConsoleManager.ClearConsole(spriteService); await ConsoleManager.DrawConsole(Lives, spriteService, Ship, true, Level + LevelOffset, Score, HighScore); Started = true; } else { spriteService.DrawBlazorImage(new PointF(25, 10)); await ConsoleManager.ClearConsole(spriteService); await ConsoleManager.DrawIntroScreen(spriteService, Ship); return; } } //if the intro sound isn't done, exit if (!introsounddone) { await ConsoleManager.DrawConsolePlayer1(spriteService); return; } var bugs = GetBugs(); //do AI if enabled for debugging if (aion) { AIManager.AI(bugs, animationService, Ship); } //dive the bugs if (timestamp - LastDiveTimeStamp > NextDiveWaitTime && EnemyGridManager.EnemyGridBreathing && !glo.editcurveschecked) { Dive(); LastDiveTimeStamp = timestamp; NextDiveWaitTime = Utils.Rnd(500, maxwaittimebetweendives); } //if the bug intro wave is done, increment to the next wave] //or start diving and firing if ((bugs.Count(a => a.Started && !a.IsMoving && a.Wave == wave) > 0 || bugs.Count(a => a.Wave == wave) == 0) && wave <= 6 && bugs.Count() > 0 && Ship.Visible) { wave += 1; if (wave == 6) { EnemyGridManager.EnemyGridBreathing = true; NextDiveWaitTime = Utils.Rnd(500, maxwaittimebetweendives); } else { GetBugs().Where(a => a.Wave == wave).ToList().ForEach(a => a.Started = true); } } //adjust score when bugs are destroyed if (bugs.Count != prevbugcount || bugs.Count == 0) { if (Score >= nextextralifescore) { Lives += 1; nextextralifescore += 30000; SoundManager.PlaySound(SoundManager.SoundManagerSounds.extralife); await ConsoleManager.ClearConsole(spriteService); await ConsoleManager.DrawConsole(Lives, spriteService, Ship, true, Level + LevelOffset, Score, HighScore); } if (Score > HighScore) { HighScore = Score; } await ConsoleManager.DrawScore(spriteService, Score, HighScore); prevbugcount = bugs.Count(); } //all bugs destroyed, increment to next level await DoLevelIncrementAsync(bugs, timestamp); //animate explosions if (timestamp - EnemyGridManager.LastEnemyGridMoveTimeStamp > 35) { EnemyExplosionManager.DoEnemyExplosions(bugs, animationService, this); if (Ship.IsExploding) { if (!Ship.IsDoubleShip) { Ship.Disabled = true; } ShipManager.DoShipExplosion(Ship, animationService, this); } } //animate child bugs ChildBugsManager.MoveChildBugs(bugs, animationService); //animated the moving enemy grid if (timestamp - EnemyGridManager.LastEnemyGridMoveTimeStamp > 100 || EnemyGridManager.LastEnemyGridMoveTimeStamp == 0) { EnemyGridManager.MoveEnemyGrid(bugs, animationService, Ship, gameover); EnemyGridManager.LastEnemyGridMoveTimeStamp = timestamp; //fire enemy missiles foreach (var bug in bugs.Where(a => (a.MissileCountDowns.Count > 0 && a.Started) && ((a.IsDiving && a.Location.Y <= Constants.CanvasSize.Height - 400 && a.IsMovingDown && !a.IsMorphedBug) || //for diving bugs (a.IsInIntro && a.Wave == wave && a.Location.Y > 100 && a.Location.X > 150 & a.Location.X < Constants.CanvasSize.Width - 150 && a.Location.Y <= Constants.CanvasSize.Height - 500)))) //for intro bugs { for (int i = 0; i <= bug.MissileCountDowns.Count - 1; i++) { bug.MissileCountDowns[i] -= 1; if (bug.MissileCountDowns[i] <= 0) { EnemyDiveManager.DoEnemyFire(bug, animationService, Ship); bug.MissileCountDowns.RemoveAll(a => a <= 0); } } } } //animate the flapping wings if (timestamp - FlapWingsManager.LastWingFlapTimeStamp > 500 || FlapWingsManager.LastWingFlapTimeStamp == 0) { FlapWingsManager.FlapWings(bugs); FlapWingsManager.LastWingFlapTimeStamp = timestamp; } //animate ship missiles if (Ship.IsFiring && !Ship.Disabled && Ship.Visible) { SoundManager.PlaySound(SoundManager.SoundManagerSounds.fire); Ship.IsFiring = false; ShipManager.Fire(Ship, animationService); } //center the ship if it's disabled //happens after a galaga capture if ((Ship.Disabled && !Ship.IsDoubleShip) || (Ship.HasExploded && !Ship.IsDoubleShip)) { if (Ship.Location.X > 320) { Ship.Speed = Constants.ShipMoveSpeed * -1; } else if (Ship.Location.X < 310) { Ship.Speed = Constants.ShipMoveSpeed; } else { Ship.Speed = 0; } } //ship missile detection if (!Ship.Disabled) { //ship mission collision with bug hits += ShipManager.CheckMissileCollisions(bugs, animationService); //bug or missile collision with ship if (!shipinvincable) { if (!Ship.IsExploding && Ship.Visible && ShipManager.CheckShipCollisions(bugs, animationService, Ship)) { SoundManager.StopAllSounds(); Ship.IsExploding = true; } } } //draw fighter captured text if a fighter is captured if (bugs.Any(a => a.FighterCapturedMessageShowing)) { await ConsoleManager.DrawConsoleFighterCaptured(spriteService); } //hide fighter captured text if a fighter is captured //and bug had flown back home if (bugs.Any(a => a.ClearFighterCapturedMessage)) { await ConsoleManager.ClearConsoleLevelText(spriteService); bugs.FirstOrDefault(a => a.ClearFighterCapturedMessage).ClearFighterCapturedMessage = false; Lives -= 1; if (Lives < 0) { gameover = true; } await ConsoleManager.ClearConsole(spriteService); await ConsoleManager.DrawConsole(Lives, spriteService, Ship, true, Level + LevelOffset, Score, HighScore); } //if morphed bugs go offscreen, destroy them immediately bugs.Where(a => a.IsMorphedBug && a.Location.Y >= Constants.CanvasSize.Height).ToList().ForEach(a => a.DestroyImmediately = true); //ship exploded if (Ship.HasExploded) { if (Ship.IsDoubleShip) { Ship.IsDoubleShip = false; Ship.HasExploded = false; Ship.IsExploding = false; Ship.Visible = true; Ship.Disabled = false; Ship.LeftShipHit = false; Ship.RightShipHit = false; return; } WaitManager.DoOnce(async() => { if (infinitelives) { Lives += 1; } if (Lives >= 1) { //display ready for next life await ConsoleManager.DrawConsoleReady(spriteService); Ship.Disabled = true; } else { //game over await ConsoleManager.DrawConsoleGameOver(spriteService); gameover = true; SoundManager.MuteAllSounds = false; SoundManager.PlaySound(SoundManager.SoundManagerSounds.gameoversong, true); } }, WaitManager.WaitStep.enStep.ShowReady); if (WaitManager.WaitFor(3000, timestamp, WaitManager.WaitStep.enStep.WaitReady)) { if (!animationService.Animatables.Any(a => a.Sprite.SpriteType == Sprite.SpriteTypes.BugMissle) && !bugs.Any(a => a.CaptureState == Bug.enCaptureState.Started) && !bugs.Any(a => a.IsDiving)) { if (infinitelives) { Lives -= 1; } Ship.HasExploded = false; Ship.IsExploding = false; if (Lives >= 0) { //load next life Ship.Visible = true; Ship.Disabled = false; await ConsoleManager.ClearConsole(spriteService); await ConsoleManager.DrawConsole(Lives, spriteService, Ship, true, Level + LevelOffset, Score, HighScore); await ConsoleManager.ClearConsoleLevelText(spriteService); } WaitManager.ClearSteps(); } } } //this should never happen if (infinitelives && gameover) { throw new Exception("game over"); } if (showdebugdetails) { Utils.dOut("hits", hits); Utils.dOut("Ship.IsExploding", Ship.IsExploding); Utils.dOut("Ship.HasExploded", Ship.HasExploded); Utils.dOut("Ship.Disabled", Ship.Disabled); Utils.dOut("gameover", gameover); Utils.dOut("Lives", Lives); Utils.dOut("Level", Level); Utils.dOut("LevelOffset", LevelOffset); Utils.dOut("Score", Score); Utils.dOut("nextextralifescore", nextextralifescore); } DebugManager.DoDebugLogic(glo, bugs, animationService, Ship); }
private void Wait() { WaitManager.Call(this); }
public OShopMainPage() { WaitManager.WaitForTrueCondition( () => ProductCards.Count > 0, "Wait for product cards"); }