public static ExpressTrackingViewModel ConvertFromFedEx(FedExTrackingViewModel fedExModel, GetExpressTrackResponse_V01 expressInfoResponse) { ExpressTrackingViewModel expressTrack = new ExpressTrackingViewModel(); List <steps> expressTrackSteps = new List <steps>(); TrackingStatus status = TrackingStatus.PreparingShipment; expressTrack.mailno = fedExModel.tracking.detail.tn; expressTrack.remark = expressInfoResponse.ExpressCompanyName; expressTrack.result = "false"; if (fedExModel.tracking.detail.activities.Count >= 1) { expressTrack.result = "true"; status = TrackingStatus.InTransit; } if (fedExModel.tracking.detail.status == "已取件") { //Shipped status = TrackingStatus.Shipped; expressTrack.time = fedExModel.tracking.detail.shipdate; } else if (fedExModel.tracking.detail.status == "已送达") { status = TrackingStatus.Delivered; expressTrack.time = fedExModel.tracking.detail.deliverydate; } else { status = TrackingStatus.InTransit; expressTrack.time = fedExModel.tracking.detail.deliverydate; } if (fedExModel.tracking.detail.activities != null && fedExModel.tracking.detail.activities.Count >= 1) { foreach (var trace in fedExModel.tracking.detail.activities) { var eachstep = new steps { time = trace.datetime, address = trace.scan, station = trace.location, station_phone = string.Empty, status = string.Empty, remark = trace.details, next = string.Empty, next_name = string.Empty }; expressTrackSteps.Add(eachstep); } } expressTrack.status = getNumberValue(status).ToString(); expressTrack.steps = expressTrackSteps; return(expressTrack); }
void advance_step() { Debug.Log(actual_step); switch (actual_step) { case steps.FIRST: actual_step = steps.SECOND; buttonRend.material.color = second_step; flagRend.material.color = second_step; RaiseAnimation(); break; case steps.SECOND: actual_step = steps.THIRD; buttonRend.material.color = third_step; flagRend.material.color = third_step; FallAnimation(); break; case steps.THIRD: actual_step = steps.FINISH; FadeToDeath(); break; } }
private void initTask(steps next) { }
/* public static bool ObjisInRange(Obj_AI_Base target , Obj_AI_Base target2 , float range) { if (target2.Distance(target) < range) { return true; } return false; }*/ public static void Do(Obj_AI_Hero target) { var minion = ObjectManager.Get<Obj_AI_Base>() .Where(x => x.IsEnemy && Program.Q.CanCast(x) && Program.Q.IsInRange(x)) .FirstOrDefault<Obj_AI_Base>(); if (insecActive == false) { if (Program.Q.IsReady() && ((Program.W.IsReady() && WardJump.getBestWardItem().IsValidSlot()) || (Program.menu.Item("useflash").GetValue<bool>() && ObjectManager.Player.Spellbook.GetSpell( ObjectManager.Player.GetSpellSlot("SummonerFlash")).IsReady())) && Program.R.IsReady() && Program.Player.Mana >= 130) { if (Program.Player.Distance(target) <= 500) { Steps = steps.WardJump; } insecActive = true; WardJump.wardj = false; } } if (!insecActive) return; if (target.IsValidTarget(Program.Q.Range)) { if (Steps == steps.Q1) { if (Program.Q.IsReady() && ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Q).Name == "BlindMonkQOne") { Program.cast(target,Program.Q); } } if (ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Q).Name == "blindmonkqtwo") { if (Program.Q.Cast()) { if (!WardJump.getBestWardItem().IsValidSlot() && Program.menu.Item("useflash").GetValue<bool>()) { Steps = steps.Flash; } else { Steps = steps.WardJump; } } } } if (Steps == steps.WardJump) // put ward { if (Program.W.IsReady()) { WardJump.JumpTo(GetInsecPos(target)); } } else if (Steps == steps.Flash) // hit w { if (WardJump.Insecpos(target).Distance(Program.Player.Position) < 400) { ObjectManager.Player.Spellbook.CastSpell( ObjectManager.Player.GetSpellSlot("SummonerFlash"), GetInsecPos(target)); Steps = steps.R; } } else if (Steps == steps.R) // and hit the kick { RCast(target); } else { // insecActive = false; // Steps = steps.Q1; } }
public static void ResetInsecStats() { // beforeall = false; insecActive = false; Steps = steps.Q1; }
private ApiResult LoadandRunSteps(IKernel kernel, bool isReSample, List <ReferenceDataObject> referenceDatas, List <FunctionObject> functions) { try { bool normalizationWarning = false; // Load steps from blob XmlSerializer ser = new XmlSerializer(typeof(steps)); using (StringReader sreader = new StringReader(_setupStepsXml)) { using (XmlReader reader = XmlReader.Create(sreader)) { _steps = (steps)ser.Deserialize(reader); } } string result = ""; if (!isReSample) { // Run the steps for (int i = 0; i < _steps.Items.Count(); i++) { Logger.LogInformation($"steps.Items[{i}] ran successfully"); result = kernel.ExecuteCode(_steps.Items[i].Value); LogErrors(result, _steps.Items[i].Value, $"InitializationStep[{i}]"); _steps.Items[i].Value = NormalizationSnippetHelper(ref i, ref normalizationWarning, result, _steps.Items); } } else { // Run the resample steps for (int i = _steps.Items.Count() - 2; i < _steps.Items.Count(); i++) { Logger.LogInformation($"steps.Items[i].Value: _steps.Items[{i}]"); result = kernel.ExecuteCode(_steps.Items[i].Value); var errors = CheckErrors(result); if (!string.IsNullOrEmpty(errors)) { Logger.LogError($"Initialization step: {_steps.Items[i].Value}. Resulting Error: {result}"); } _steps.Items[i].Value = NormalizationSnippetHelper(ref i, ref normalizationWarning, result, _steps.Items); } } // Now run the steps to load the reference data LoadReferenceData(kernel, referenceDatas); // Now load the UDFs and UDAFs LoadFunctions(kernel, functions); var error = CheckErrors(result); if (!string.IsNullOrEmpty(error)) { return(ApiResult.CreateError("{'Error':'" + error + "'}")); } else { KernelResult responseObject = new KernelResult { Result = kernel.Id }; if (normalizationWarning) { responseObject.Message = "Warning: Normalization query in the Input tab could not be applied, probably because some columns in the query are not part of the schema. Please update the schema or try auto-generating it using longer duration in the Input tab."; } else { responseObject.Message = string.Empty; } return(ApiResult.CreateSuccess(JObject.FromObject(responseObject))); } } catch (Exception ex) { Logger.LogError(ex, $"ErrorMessage: {ex.Message} SetupSteps: {_setupStepsXml}"); return(ApiResult.CreateError(ex.ToString())); } }
public static ExpressTrackingViewModel ConvertFromSfModel(SFTrackingViewModel sfModel, GetExpressTrackResponse_V01 expressInfoResponse) { ExpressTrackingViewModel expressTrack = new ExpressTrackingViewModel(); List <steps> expressTrackSteps = new List <steps>(); TrackingStatus status = TrackingStatus.PreparingShipment; List <Route> traceses; if (expressInfoResponse != null) { expressTrack.remark = expressInfoResponse.ExpressCompanyName; } expressTrack.result = "false"; if (sfModel.Response != null && sfModel.Response.Body != null && sfModel.Response.Body.RouteResponse != null && sfModel.Response.Body.RouteResponse.Route != null && sfModel.Response.Body.RouteResponse.Route.Count >= 1) { expressTrack.mailno = sfModel.Response.Body.RouteResponse.mailno; expressTrack.result = "true"; expressTrack.time = sfModel.Response.Body.RouteResponse.Route[0].accept_time; status = TrackingStatus.InTransit; } if (sfModel.Response != null && sfModel.Response.Body != null && sfModel.Response.Body.RouteResponse != null && sfModel.Response.Body.RouteResponse.Route != null) { traceses = sfModel.Response.Body.RouteResponse.Route; } else { traceses = null; } if (traceses != null) { foreach (var trace in traceses) { steps eachStep = new steps(); if (trace.opcode == "50") { status = TrackingStatus.Shipped; } else if (trace.opcode == "8000") { status = TrackingStatus.Delivered; } else { status = TrackingStatus.InTransit; } eachStep.time = trace.accept_time; eachStep.address = trace.accept_address; eachStep.status = trace.opcode; eachStep.remark = trace.remark; eachStep.station = ""; eachStep.station_phone = ""; eachStep.next = ""; eachStep.next_name = ""; expressTrackSteps.Add(eachStep); } } expressTrack.status = getNumberValue(status).ToString(); expressTrack.steps = expressTrackSteps; return(expressTrack); }
public static ExpressTrackingViewModel ConvertFromBestway(BestwayTrackingViewModel bestwayModel, GetExpressTrackResponse_V01 expressInfoResponse) { ExpressTrackingViewModel expressTrack = new ExpressTrackingViewModel(); List <steps> expressTrackSteps = new List <steps>(); TrackingStatus status = TrackingStatus.PreparingShipment; if (bestwayModel != null && bestwayModel.traceLogs != null && bestwayModel.traceLogs.Count > 0) { expressTrack.mailno = bestwayModel.traceLogs[0].mailNo; } if (expressInfoResponse != null && !string.IsNullOrEmpty(expressInfoResponse.ExpressCompanyName)) { expressTrack.remark = expressInfoResponse.ExpressCompanyName; } expressTrack.result = "false"; if (bestwayModel != null && bestwayModel.traceLogs != null && bestwayModel.traceLogs.Count > 0 && bestwayModel.traceLogs[0].traces != null && bestwayModel.traceLogs[0].traces.Count >= 1) { expressTrack.result = "true"; expressTrack.time = bestwayModel.traceLogs[0].traces[0].acceptTime; status = TrackingStatus.Delivered; } if (bestwayModel != null && bestwayModel.traceLogs != null && bestwayModel.traceLogs.Count > 0) { var traceses = bestwayModel.traceLogs[0].traces; if (traceses != null) { foreach (var trace in traceses) { steps eachStep = new steps(); if (trace.scanType == "收件") { status = TrackingStatus.Shipped; } else if (trace.scanType == "签收") { status = TrackingStatus.Delivered; } else { status = TrackingStatus.InTransit; } eachStep.time = trace.acceptTime; eachStep.address = trace.acceptAddress; eachStep.status = trace.scanType; eachStep.remark = trace.remark; eachStep.station = ""; eachStep.station_phone = ""; eachStep.next = ""; eachStep.next_name = ""; expressTrackSteps.Add(eachStep); } } } expressTrack.status = getNumberValue(status).ToString(); expressTrack.steps = expressTrackSteps; return(expressTrack); }
/* public static bool ObjisInRange(Obj_AI_Base target , Obj_AI_Base target2 , float range) * { * if (target2.Distance(target) < range) * { * return true; * } * return false; * }*/ public static void Do(Obj_AI_Hero target) { Obj_AI_Base minion = ObjectManager.Get <Obj_AI_Base>().Where(x => x.IsEnemy && Program.Q.CanCast(x) && Program.Q.IsInRange(x)).FirstOrDefault <Obj_AI_Base>(); if (insecActive == false) { if (Program.Q.IsReady() && ((Program.W.IsReady() && WardJump.getBestWardItem().IsValidSlot()) || (Program.menu.Item("useflash").GetValue <bool>() && ObjectManager.Player.Spellbook.GetSpell(ObjectManager.Player.GetSpellSlot("SummonerFlash")).IsReady())) && Program.R.IsReady() && Program.Player.Mana >= 130) { insecActive = true; WardJump.wardj = false; } } if (!insecActive) { return; } if (target.IsValidTarget(Program.Q.Range)) { if (Steps == steps.Q1) { if (Program.Q.IsReady() && ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Q).Name == "BlindMonkQOne") { if (Program.Q.CastIfHitchanceEquals(target, Combos.Combo.HitchanceCheck(Program.menu.Item("seth").GetValue <Slider>().Value))) { Steps = steps.Q2; } /* else if (Program.Q.CanCast(minion) && useQMinion) * { * if (!Program.Q.IsKillable(minion)&&ObjisInRange(minion, target, Program.W.Range)) * { * if(Program.Q.CastIfHitchanceEquals(minion, Combos.Combo.HitchanceCheck(Program.menu.Item("seth").GetValue<Slider>().Value))) * Steps = steps.Q2; * } * }*/ } } else if (Steps == steps.Q2) // hit second q { if (ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Q).Name == "blindmonkqtwo") { if (Program.Q.Cast()) { if (!WardJump.getBestWardItem().IsValidSlot() && Program.menu.Item("useflash").GetValue <bool>()) { Steps = steps.Flash; } else { Steps = steps.WardJump; } } } } else if (Steps == steps.WardJump) // put ward { if (Program.Player.Distance(WardJump.getward(target)) <= 600 && Program.W.IsReady()) { WardJump.JumpTo(GetInsecPos(target)); } } else if (Steps == steps.Flash) // hit w { if (WardJump.Insecpos(target).Distance(Program.Player.Position) < 400) { ObjectManager.Player.Spellbook.CastSpell(ObjectManager.Player.GetSpellSlot("SummonerFlash"), GetInsecPos(target)); Steps = steps.R; } } else if (Steps == steps.R) // and hit the kick { RCast(target); } else { // insecActive = false; // Steps = steps.Q1; } } }
/* public static bool ObjisInRange(Obj_AI_Base target , Obj_AI_Base target2 , float range) * { * if (target2.Distance(target) < range) * { * return true; * } * return false; * }*/ public static void Do(Obj_AI_Hero target) { var minion = ObjectManager.Get <Obj_AI_Base>() .Where(x => x.IsEnemy && Program.Q.CanCast(x) && Program.Q.IsInRange(x)) .FirstOrDefault <Obj_AI_Base>(); if (insecActive == false) { if (Program.Q.IsReady() && ((Program.W.IsReady() && WardJump.getBestWardItem().IsValidSlot()) || (Program.menu.Item("useflash").GetValue <bool>() && ObjectManager.Player.Spellbook.GetSpell( ObjectManager.Player.GetSpellSlot("SummonerFlash")).IsReady())) && Program.R.IsReady() && Program.Player.Mana >= 130) { if (Program.Player.Distance(target) <= 500) { Steps = steps.WardJump; } insecActive = true; WardJump.wardj = false; } } if (!insecActive) { return; } if (target.IsValidTarget(Program.Q.Range)) { if (Steps == steps.Q1) { if (Program.Q.IsReady() && ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Q).Name == "BlindMonkQOne") { Program.cast(target, Program.Q); } } if (ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Q).Name.ToLower() == "blindmonkqtwo") { if (Program.Q.Cast()) { if (!WardJump.getBestWardItem().IsValidSlot() && Program.menu.Item("useflash").GetValue <bool>()) { Steps = steps.Flash; } else { Steps = steps.WardJump; } } } } if (Steps == steps.WardJump) // put ward { if (Program.W.IsReady()) { WardJump.JumpTo(GetInsecPos(target)); } } else if (Steps == steps.Flash) // hit w { if (WardJump.Insecpos(target).Distance(Program.Player.Position) < 400) { ObjectManager.Player.Spellbook.CastSpell( ObjectManager.Player.GetSpellSlot("SummonerFlash"), GetInsecPos(target)); Steps = steps.R; } } else if (Steps == steps.R) // and hit the kick { RCast(target); } else { // insecActive = false; // Steps = steps.Q1; } }
/* public static bool ObjisInRange(Obj_AI_Base target , Obj_AI_Base target2 , float range) { if (target2.Distance(target) < range) { return true; } return false; }*/ public static void Do(Obj_AI_Hero target) { Obj_AI_Base minion = ObjectManager.Get<Obj_AI_Base>().Where(x => x.IsEnemy && Program.Q.CanCast(x) && Program.Q.IsInRange(x)).FirstOrDefault<Obj_AI_Base>(); // var useQMinion = Program.menu.Item("IQMinion").GetValue<bool>(); if (insecActive == false) { if (Program.Q.IsReady() && ((Program.W.IsReady() && WardJump.getBestWardItem().IsValidSlot()) || (Program.menu.Item("useflash").GetValue<bool>() && ObjectManager.Player.Spellbook.GetSpell(ObjectManager.Player.GetSpellSlot("SummonerFlash")).IsReady())) && Program.R.IsReady() && Program.Player.Mana >= 130) { insecActive = true; WardJump.wardj = false; } } if (!insecActive) return; if (target.IsValidTarget(Program.Q.Range)) { if (Steps == steps.Q1) { if (Program.Q.IsReady() && ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Q).Name == "BlindMonkQOne") { if (Program.Q.CastIfHitchanceEquals(target, Combos.Combo.HitchanceCheck(Program.menu.Item("seth").GetValue<Slider>().Value))) Steps = steps.Q2; /* else if (Program.Q.CanCast(minion) && useQMinion) { if (!Program.Q.IsKillable(minion)&&ObjisInRange(minion, target, Program.W.Range)) { if(Program.Q.CastIfHitchanceEquals(minion, Combos.Combo.HitchanceCheck(Program.menu.Item("seth").GetValue<Slider>().Value))) Steps = steps.Q2; } }*/ } } else if (Steps == steps.Q2) // hit second q { if (ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Q).Name == "blindmonkqtwo") { if (Program.Q.Cast()) { if (!WardJump.getBestWardItem().IsValidSlot() && Program.menu.Item("useflash").GetValue<bool>()) { Steps = steps.Flash; } else { Steps = steps.WardJump; } } } } else if (Steps == steps.WardJump) // put ward { if (Program.Player.Distance(WardJump.getward(target)) <= 600 && Program.W.IsReady()) { WardJump.JumpTo(GetInsecPos(target)); } } else if (Steps == steps.Flash) // hit w { if (WardJump.Insecpos(target).Distance(Program.Player.Position) < 400) { ObjectManager.Player.Spellbook.CastSpell(ObjectManager.Player.GetSpellSlot("SummonerFlash"), GetInsecPos(target)); Steps = steps.R; } } else if (Steps == steps.R) // and hit the kick { RCast(target); } else { // insecActive = false; // Steps = steps.Q1; } } }
void changeStep() { if (currentStep == steps.question) { currentStep = steps.lag; tickTime = lagTime; } else if (currentStep == steps.lag) { votingOpen = false; answerCount = new int[4]; totalAnswers = 0; foreach (playerObj p in players) { if (p.getAnswer() >= 0) { answerCount[p.getAnswer()] += 1; totalAnswers += 1; } if (p.getAnswer() == qm.getQuestion().correct_answer_id) { p.addScore(1); p.addBouns(); } else if (p.getAnswer() == -2) { //TODO: go with crowd. Debug.LogWarning("TODO: go with crowd."); } else { p.setBonus(0); } } int i = 0; foreach (int per in answerCount) { if (totalAnswers > 0) { perPan[i].anchorMin = new Vector2((float)answerCount[i] / (float)totalAnswers, 0); } else { perPan[i].anchorMin = new Vector2(1, 0); } i++; } currentStep = steps.answer; tickTime = answerTime; ui.showCorrectAnswer(qm.getQuestion()); qm.loadNewQuestion(categoryID.ToString()); } else if (currentStep == steps.answer) { roundNumber -= 1; if (roundNumber < 0) { categoryID = Random.Range(9, 33); qm.loadNewQuestion(); scoreCanvas.enabled = true; gameCanvas.enabled = false; currentStep = steps.scores; tickTime = scoresTime; players.Sort(playerObj.SortByScore); players.Reverse(); Debug.Log(players.Count); int i = 0; scoresLeft.text = ""; while (i < players.Count && i < 20) { scoresLeft.text += players[i].getUsername() + " - " + players[i].getScore() + "\n"; i++; } i = 20; scoresRight.text = ""; while (i < players.Count && i < 40) { scoresLeft.text += players[i].getUsername() + " - " + players[i].getScore() + "\n"; i++; } roundNumber = questionsPerRound; } else { currentStep = steps.question; votingOpen = true; tickTime = questionTime; foreach (playerObj p in players) { p.setAnswer(-1); } ui.setQuestion(qm.getQuestion()); } } else if (currentStep == steps.answer) { currentStep = steps.question; votingOpen = true; tickTime = questionTime; ui.setQuestion(qm.getQuestion()); } else if (currentStep == steps.scores) { gameCanvas.enabled = true; scoreCanvas.enabled = false; currentStep = steps.question; votingOpen = true; tickTime = questionTime; foreach (playerObj p in players) { p.setAnswer(-1); } ui.setQuestion(qm.getQuestion()); } else { Debug.LogWarning("Step Error. Stepping to new question."); currentStep = steps.answer; } }
private static string WriteBestPath(Node[,] nodes, List<Node> enemies, Node us, Stack<Node> movementStack) { Node enemy1 = enemies.ElementAt(0); Node previousUs = movementStack.Count > 0 ? movementStack.Peek() : us; if (firstNode == null) { firstNode = us; squareCorner.Add(us); } string answer = ""; if (currentStep == steps.GetToBiggestFreeZone) { if (firstOurWall == '0') { firstOurWall = GetFreeDirection(us, nodes); } if (firstOurWall != 'V') { Console.Error.WriteLine("1-{0} Starting ourwall: {1} | position : {2} {3}", currentStep, firstOurWall, us.position.X, us.position.Y); answer = StraightLineToObstacle(us, nodes, firstOurWall); if (answer == "Found obstacle") { squareCorner.Add(us); currentStep = steps.GetToFreeZone; } } else { currentStep = steps.GetToStartingPosition; } } if (currentStep == steps.GetToFreeZone) { if (secondOurWall == '0') { secondOurWall = GetFreeDirection(us, nodes); } if (secondOurWall != 'V') { Console.Error.WriteLine("2-{0} secondWall: {1}", currentStep, secondOurWall); answer = StraightLineToObstacle(us, nodes, secondOurWall); if (answer == "Found obstacle") { squareCorner.Add(us); currentStep = steps.ThirdClose; } } else { currentStep = steps.GetToStartingPosition; } } if (currentStep == steps.ThirdClose) { Console.Error.WriteLine("3-{0}", currentStep); if (thirdOurWall == '0') { Console.Error.WriteLine("First wall: {0} | Second wall: {1}", firstOurWall, secondOurWall); thirdOurWall = GetThirdWall(firstOurWall, secondOurWall); } Point thirdSquarePosition = GetThirdSquarePosition(us, firstNode); answer = StraightLineToObstacle(us, nodes, thirdOurWall); Console.Error.WriteLine("Thirdclose answer: {0} thirdOurWall: {1} | thirdSquarePosition: {2} {3}", answer, thirdOurWall, thirdSquarePosition.X, thirdSquarePosition.Y); if (us.position == thirdSquarePosition) { squareCorner.Add(us); currentStep = steps.CloseSquare; } if (answer == "Found obstacle") { squareCorner.Add(us); currentStep = steps.CloseSquare; } } if (currentStep == steps.CloseSquare) { Console.Error.WriteLine("4-{0}", currentStep); if (fourthOurWall == '0') { fourthOurWall = GetFourthWall(firstOurWall, secondOurWall, thirdOurWall); } answer = StraightLineToObstacle(us, nodes, fourthOurWall); if (answer == "Found obstacle") { currentStep = steps.CloseSquareAfterObstacle; } if (us.position.X == firstNode.position.X && firstNode.position.Y == us.position.Y) { currentStep = steps.GetToBiggestFreeZone; resetWalls(); } } if (currentStep == steps.CloseSquareAfterObstacle) { var wasSquareClosedPreviously = WasSquareClosedPreviousTurn(nodes); answer = StraightLineToObstacle(us, nodes, firstOurWall); if (answer == "Found obstacle" || wasSquareClosedPreviously) { currentStep = steps.GetToBiggestFreeZone; resetWalls(); answer = WriteBestPath(nodes, enemies, us, movementStack); } } if (currentStep == steps.GetToStartingPosition) { answer = firstNode.position.X + " " + firstNode.position.Y; if ((Math.Abs(us.position.X - firstNode.position.X) == 1 || Math.Abs(us.position.Y - firstNode.position.Y) == 1) && !(Math.Abs(us.position.X - firstNode.position.X) == 1 && Math.Abs(us.position.Y - firstNode.position.Y) == 1)) { currentStep = steps.GetToBiggestFreeZone; resetWalls(); } } Console.Error.WriteLine(currentStep.ToString()); return answer; }