private void Awake() { Instance = this; stateMachine = new StateMachine(); menuState = new MenuState(this, stateMachine); gameState = new GameState(this, stateMachine); waitingState = new WaitingState(this, stateMachine); defeatState = new DefeatState(this, stateMachine); stateMachine.Initialize(waitingState); startPositions = new List <Vector3>(8); for (int i = 0; i < startPositions.Capacity; i++) { startPositions.Add(Vector3.zero); } calculateTransoftm = new CalculateTransoftms(); calculateTransoftm.CreateTempTransform().SetParent(tempTransforms); CalculateStartPositions(); lastRandom = UnityEngine.Random.Range(0, 4); GameObject temp = new GameObject(); newPlacedTransform = temp.GetComponent <Transform>(); GameObject temp1 = new GameObject(); newFallingTransform = temp1.GetComponent <Transform>(); newPlacedTransform.SetParent(tempTransforms); newFallingTransform.SetParent(tempTransforms); }
public Lobby(string name) { Points = new Dictionary <Team, int>(); Info = new LobbyInfo(name); State = new WaitingState(this); State.Initialize(); }
void Awake() { _spawner = GetComponentInParent <Spawner>(); _customerEvents = GetComponent <CustomerEvents>(); var waitingState = new WaitingState(this, _customerEvents); var buyingState = new BuyingState(_buyTime, this, _customerEvents); var finishedState = new FinishedState(this, _customerEvents, _spawner, point); var deadState = new DeadState(this, _spawner); _stateMachine = new StateMachine(); At(waitingState, buyingState, IsCustomerCanBuy()); At(buyingState, waitingState, NotIsCustomerCanBuy()); At(waitingState, deadState, IsDead()); At(buyingState, deadState, IsDead()); At(buyingState, finishedState, IsFinishedBuying()); _stateMachine.SetState(waitingState); void At(IState from, IState to, Func <bool> condition) => _stateMachine.AddTransition(from, to, condition); Func <bool> IsCustomerCanBuy() => () => _canBuy; Func <bool> NotIsCustomerCanBuy() => () => !_canBuy; Func <bool> IsFinishedBuying() => () => _finishedBuying; Func <bool> IsDead() => () => _isDead; }
private void StopWaitingForCalibration() { // Reset runInBackground to its original value when the waiting is over. Application.runInBackground = _originalRunInBackgroundState; _waitingState = WaitingState.NotWaiting; }
public Lobby(LobbyInfo info) { Points = new Dictionary <Team, int>(); Info = info; State = new WaitingState(this); State.Initialize(); }
public Printer() { PaperOffState = new PaperOffState(this); PowerOffState = new PowerOffState(this); PrintState = new PrintState(this); WaitingState = new WaitingState(this); _state = WaitingState; }
private void StopWaitingForCalibration() { // Reset runInBackground to its original value when the waiting is over. Application.runInBackground = _originalRunInBackgroundState; _waitingState = WaitingState.NotWaiting; AutoFade.LoadLevel("Level 1", 1, 1, Color.black); }
public Automat(int numberOfApartments) { NumberOfApartments = numberOfApartments; WaitingState = new WaitingState(this); GotApplicationState = new GotApplicationState(this); ApartmentRentedState = new ApartmentRentedState(this); FullyRentedState = new FullyRentedState(this); state = WaitingState; }
private void StartWaitingForCalibration() { _originalRunInBackgroundState = Application.runInBackground; // Set runInBackground to true to be able to wait for calibration to finish. Application.runInBackground = true; print("Waiting for calibration to start"); _waitingState = WaitingState.WaitingForCalibrationToStart; }
public AutomatServer() { NumberOfApartments = 9; WaitingState = new WaitingState(this); GotApplicationState = new GotApplicationState(this); ApartmentRentedState = new ApartmentRentedState(this); FullyRentedState = new FullyRentedState(this); state = WaitingState; thread = new Thread(Run); thread.Start(); }
void Update() { if (timeCounter - startingTime > counter && counter < timeCalibrationStarts) { textCountdown.GetComponent <UnityEngine.UI.Text> ().text = (timeCalibrationStarts - counter - 1).ToString(); counter++; } timeCounter += Time.deltaTime; if (timeCounter > this.timeCalibrationStarts && didStartCalibration == false) { didStartCalibration = true; textGO.GetComponent <UnityEngine.UI.Text> ().text = ""; Destroy(textGOSkip); Destroy(textCountdown); StartWaitingForCalibration(); _host.LaunchRecalibration(); textGO.GetComponent <UnityEngine.UI.Text> ().text = "If you see this screen, Tobii EyeX could not be found.\n\nIt is recommended to install Tobii EyeX, otherwise you cannot play the game proberly.\n\nPress E to continue or Space to get back into the menu central."; print("doing"); } if (_waitingState == WaitingState.WaitingForCalibrationToStart && _host.EyeTrackingDeviceStatus == EyeXDeviceStatus.Pending) { print("Waiting for calibration to finish"); _waitingState = WaitingState.WaitingForCalibrationToFinish; } else if (_waitingState == WaitingState.WaitingForCalibrationToFinish && _host.EyeTrackingDeviceStatus == EyeXDeviceStatus.Tracking) { print("Calibration finished. Bring back focus to application"); WindowHelpers.ShowCurrentWindow(); StopWaitingForCalibration(); } if (Input.GetKeyDown(KeyCode.E)) { AutoFade.LoadLevel("Level 1", 1, 1, Color.black); } if (timeCounter > this.timeCalibrationStarts && Input.GetKeyDown(KeyCode.Space)) { AutoFade.LoadLevel("Central", 1, 1, Color.black); } }
/// <summary> /// 更改当前的等待状态 /// </summary> /// <param name="newState">新的状态</param> private void changeWaitingState(WaitingState newState) { if (newState == WaitingState.NotWaiting) { string s; if (reversiGame.CurrentPiece == ReversiPiece.Black) { s = "请下黑子"; } else if (reversiGame.CurrentPiece == ReversiPiece.White) { s = "请下白子"; } else { s = "请下棋"; } stateControl.CurrentStateText = s; IsUserTurn = true; } else if (newState == WaitingState.WaitingMovePieceConfirmed) { timer.Interval = new TimeSpan(0, 0, 0, 0, PlayerMoveTime); timer.Start(); } else if (newState == WaitingState.WaitingMovePieceCompleted) { if (!stateControl.IsVeryBusy) { stateControl.CurrentStateText = "计算机思考中..."; } timer.Interval = new TimeSpan(0, 0, 0, 0, AIMoveTime / 2); timer.Start(); } else if (newState == WaitingState.StillWaitingMovePieceCompleted) { stateControl.IsVeryBusy = true; DoEvents(); timer.Interval = new TimeSpan(0, 0, 0, 0, AIWaitTime); timer.Start(); } else if (newState == WaitingState.WaitingRegretPieceCompleted) { stateControl.CurrentStateText = "悔棋中, 请稍等..."; DoEvents(); timer.Interval = new TimeSpan(0, 0, 0, 0, RegretTime); timer.Start(); } waitingState = newState; }
private AbstractState CreateAbstractState(Shipping m_Parent) { AbstractState _ret = null; switch (m_Parent.ShippingState2.GetValueOrDefault(GetDefaultValue(m_Parent))) { case ShippingState2.Cancelation: _ret = new CancelationState(this); break; case ShippingState2.Canceled: _ret = new CanceledState(this); break; case ShippingState2.Completed: _ret = new CompletedState(this); break; case ShippingState2.Confirmed: _ret = new ConfirmedState(this); break; case ShippingState2.Creation: _ret = new CreationState(this); break; case ShippingState2.Delayed: _ret = new DelayedState(this); break; case ShippingState2.LackOfData: _ret = new LackOfDataState(this); break; case ShippingState2.Left: _ret = new LeftState(this); break; case ShippingState2.Started: _ret = new StartedState(this); break; case ShippingState2.Waiting: _ret = new WaitingState(this); break; } return(_ret); }
private void Update() { if (_waitingState == WaitingState.WaitingForCalibrationToStart && _host.EyeTrackingDeviceStatus == EyeXDeviceStatus.Pending) { print("Waiting for calibration to finish"); _waitingState = WaitingState.WaitingForCalibrationToFinish; } else if (_waitingState == WaitingState.WaitingForCalibrationToFinish && _host.EyeTrackingDeviceStatus == EyeXDeviceStatus.Tracking) { print("Calibration finished. Bring back focus to application"); WindowHelpers.ShowCurrentWindow(); StopWaitingForCalibration(); } }
private void WriteMifare_Click(object sender, System.EventArgs e) { if (string.IsNullOrWhiteSpace(TxtMsg.Text)) { Android.Support.V7.App.AlertDialog.Builder msg = new Android.Support.V7.App.AlertDialog.Builder(this); msg.SetTitle("Empty Message!!!"); msg.SetMessage("Please Enter Message To Write..."); msg.SetPositiveButton("OK", (s, a) => { }); msg.SetCancelable(true); msg.Create().Show(); return; } Openwait(); TxtState.Text = "Mifare - Waiting For Tag"; Terminal.WriteLine($"Set Mifare Writing Data > {TxtMsg.Text}"); State = WaitingState.Write_Mifare; }
public void Initialize(InputSystem input, Board board, Worker.Colour colour) { _input = input; _board = board; _workers = new List <Worker>(); _colour = colour; _god = new BaseGod(); _stateMachine = new StateMachine(); _stateMachine.Initialize(input, board); WaitingState waitingState = new WaitingState(); _stateMachine.RegisterState(waitingState); PlacingState placingState = new PlacingState(); _stateMachine.RegisterState(placingState); SelectingState selectingState = new SelectingState(); _stateMachine.RegisterState(selectingState); MovingState movingState = new MovingState(); _stateMachine.RegisterState(movingState); BuildingState buildingState = new BuildingState(); _stateMachine.RegisterState(buildingState); WaitingOnConfirmationState waitingOnConfirmationState = new WaitingOnConfirmationState(); _stateMachine.RegisterState(waitingOnConfirmationState); DoneTurnState doneTurnState = new DoneTurnState(); _stateMachine.RegisterState(doneTurnState); _stateMachine.SetState((int)StateId.Waiting); }
public void RemoveClient(Client client) { Clients.Remove(client); Info.Clients.Remove(client.Info); client.Lobby = null; Broadcast(client.Info.Name + " left the lobby."); // Check if we have to destroy Lobby if (Clients.Count == 0) { Server.Singleton.LobbyList.Remove(this); return; // Stop } // Set state to Waiting State if not already in if (State.Name.Equals(WaitingState.DefaultName)) { return; } Broadcast("The game is over, waiting for players to join."); State = new WaitingState(this); }
public void Start() { var currentRound = _context.CurrentFinding.CurrentRound; IState evaluatedState = null; if (currentRound == -1) { evaluatedState = new EndedState(_context, _brainstormingModel); } else if (currentRound == 0) { evaluatedState = new WaitingState(_logger, _brainstormingDalService, _context, _brainstormingModel); } else if (currentRound > 0) { evaluatedState = new RunningState(_logger, _brainstormingDalService, _context, _brainstormingModel); } if (currentRound < -1 || evaluatedState == null) { throw new ArgumentException("Invalid round or state not registered"); } ChangeState(evaluatedState); }
private static void CheckMessageQueue() { while (serverRequestQueue.Count > 0) { System.Threading.Thread nThread = new Thread(new ThreadStart(BlinkLed)); blinkOn = true; nThread.Start(); IState currentState = cr.State; cr.State = WaitingState.Instance(); try { String request = serverRequestQueue.Dequeue(); cr.DataConnector.SendWaitingMessage("Ýþleminiz yapýlýyor..."); if (!DisplayAdapter.Cashier.Inactive) { DisplayAdapter.Cashier.Show("ARKA OFÝS\nÝÞLEMÝ YAPILIYOR..."); } int success = cr.DataConnector.ProcessRequest(request); if (success == 0)//Data.dll is not responsible for request { String failResponse = String.Empty; success = -1; try { ProcessServerRequest(request); success = 1; } catch (PowerFailureException pfe) { try { Recover.RecoverPowerFailure(pfe); } catch { }; Error err = new Error(pfe); failResponse = err.Message.Replace('\n', '·'); } catch (LimitExceededOrZRequiredException le) { cr.Log.Warning(le); failResponse = PosMessage.LOGO_DEPARTMENT_CHANGE_Z_REPORT_REQUIRED.Replace('\n', '·'); } catch (Exception ex) { Error err = new Error(ex); failResponse = err.Message.Replace('\n', '·'); } try { //1 : success, -1 fail if (success == 1) { cr.DataConnector.SendMessage(true, "ÝÞLEM BAÞARIYLA TAMAMLANMIÞTIR."); cr.Log.Success("Office request \"{0}\" completed", request.TrimEnd('0', '\n', '\r')); } else { cr.DataConnector.SendMessage(false, failResponse); cr.Log.Error("Office request \"{0}\" failed: {1}", request.TrimEnd('0', '\n', '\r'), failResponse); } } catch { } } if (!DisplayAdapter.Instance().Inactive) { if (success == -1) { DisplayAdapter.Cashier.Show("ARKA OFÝS ÝÞLEMÝ\nBAÞARISIZ OLDU!.."); } else { DisplayAdapter.Cashier.Show("ARKA OFÝS ÝÞLEMÝ\nBAÞARIYLA TAMAMLANDI"); } } } finally { if (!(cr.State is ElectronicJournalError)) { if (cr.State is States.Login) { currentState = States.Login.Instance(); } else { cr.State = States.Start.Instance(); } if (!(currentState is WaitingState)) { cr.State = currentState; } } } } blinkOn = false; }
public LevelLifeCycleTransitionManager(IntroState introState, IncomingWaveState incomingWaveState, WaitingState waitingState, DivingWaveState divingWaveState, LevelEndState levelEndState) { AddState(introState) .AllowTransition(waitingState, _ => true) .Build(); AddState(incomingWaveState) .AllowTransition(waitingState, _ => true) .Build(); AddState(divingWaveState) .AllowTransition(waitingState, _ => true) .Build(); AddState(waitingState) .AllowTransition(levelEndState, context => context.LevelEndAchieved) .AllowTransition(incomingWaveState, context => context.HasWavesToIncome) .AllowTransition(divingWaveState, context => true) .Build(); }
public Controller() { this.waitingState = new WaitingState(this.mon.maxWaitTime, this.time); this.readyState = new ReadyState(this.isPlayerControlled, this.time, this.mon); }
void NewTagDetected(NFC.TagInfo?info) { ClearItems(); var item = new List <IListItem>(); item.Add(new StatusHeaderListItem("Waiting For Tag...")); //item.Add(new DataItem("hi", "text")); var lst = FindViewById <Android.Widget.ListView>(Resource.Id.lstview); lst.Adapter = new ListViewAdapter(this, item); UpdateStatus("New Tag Detected!"); Terminal.WriteLine("New Tag Detected!"); if (info == null) { Terminal.WriteLine("Tag Info Returned Null"); UpdateStatus("Tag Info Returned Null!"); return; } Terminal.WriteLine("------------------------------------------------------------"); string Tech = " | "; foreach (var tec in info.Value.TechList) { Tech += tec.Replace("android.nfc.tech.", "") + " | "; } Terminal.WriteLine("TechList > " + Tech); AddHeader(new HeaderListItem("Tag Info")); AddItem(new DataItem("Serial Number", info.Value.UID())); AddItem(new DataItem("Tech List", Tech)); foreach (var tec in info.Value.TechList) { switch (tec) { case NFC.Tech_IsoDep: if (info.Value.IsoDep == null) { return; } Terminal.WriteLine("\n"); Terminal.WriteLine($"Tag Tec = [{tec.Replace("android.nfc.tech.", "")}]"); AddHeader(new HeaderListItem($"Tech = [{tec.Replace("android.nfc.tech.", "")}]")); AddItem(new DataItem("Max Transcive Length", $"{info.Value.IsoDep.MaxTransceiveLength} bytes")); AddItem(new DataItem("Timeout", $"{info.Value.IsoDep.Timeout} ms")); break; case NFC.Tech_MifareClassic: if (info.Value.MifareClassic == null) { return; } Terminal.WriteLine("\n"); Terminal.WriteLine($"Tag Tec = [{tec.Replace("android.nfc.tech.", "")}]"); AddHeader(new HeaderListItem($"Tech = [{tec.Replace("android.nfc.tech.", "")}]")); AddItem(new DataItem("Type", $"{info.Value.MifareClassic.Type}")); AddItem(new DataItem("Size", $"{info.Value.MifareClassic.Size} bytes")); AddItem(new DataItem("Block Count", $"{info.Value.MifareClassic.BlockCount} blocks")); AddItem(new DataItem("Sector Count", $"{info.Value.MifareClassic.SectorCount} sectors")); AddItem(new DataItem("Max Transcive Length", $"{info.Value.MifareClassic.MaxTransceiveLength} bytes")); AddItem(new DataItem("Timeout", $"{info.Value.MifareClassic.Timeout} ms")); info.Value.MifareClassic.Connect(); var res = NFC.MifareClassic_AuthenticateSectorWithKeyA(info.Value.MifareClassic, 1, null); Terminal.WriteLine($"Auth > {res}"); if (State == WaitingState.Write_Mifare) { if (res == NFC.NFCMessage.NFC_AUTH_OK) { Terminal.WriteLine($"Writing Mifare > {TxtMsg.Text}"); NFC.MifareClassic_WriteBlock(info.Value.MifareClassic, info.Value.MifareClassic.SectorToBlock(1), Encoding.UTF8.GetBytes(TxtMsg.Text)); Android.Support.V7.App.AlertDialog.Builder msg = new Android.Support.V7.App.AlertDialog.Builder(this); msg.SetTitle("Success!!!"); msg.SetMessage("Tag Written Successfully..."); msg.SetPositiveButton("OK", (s, a) => { }); msg.SetCancelable(true); msg.Create().Show(); TxtState.Text = "Written Mifare"; } else { Android.Support.V7.App.AlertDialog.Builder msg = new Android.Support.V7.App.AlertDialog.Builder(this); msg.SetTitle("Error!!!"); msg.SetMessage("Failed To Write Tag..."); msg.SetPositiveButton("OK", (s, a) => { }); msg.SetCancelable(true); msg.Create().Show(); TxtState.Text = "Failed Write Mifare"; } } if (State == WaitingState.None) { if (res == NFC.NFCMessage.NFC_AUTH_OK) { var rm = NFC.MifareClassic_ReadBlock(info.Value.MifareClassic, info.Value.MifareClassic.SectorToBlock(1)); Terminal.WriteLine($"Reading Mifare > {Encoding.UTF8.GetString(rm)}"); AddItem(new DataItem("Reading", Encoding.UTF8.GetString(rm))); } } info.Value.MifareClassic.Close(); break; case NFC.Tech_MifareUltralight: if (info.Value.MifareUltralight == null) { return; } Terminal.WriteLine("\n"); Terminal.WriteLine($"Tag Tec = [{tec.Replace("android.nfc.tech.", "")}]"); AddHeader(new HeaderListItem($"Tech = [{tec.Replace("android.nfc.tech.", "")}]")); AddItem(new DataItem("Type", $"{info.Value.MifareUltralight.Type}")); AddItem(new DataItem("Max Transcive Length", $"{info.Value.MifareUltralight.MaxTransceiveLength} bytes")); AddItem(new DataItem("Timeout", $"{info.Value.MifareUltralight.Timeout} ms")); break; case NFC.Tech_Ndef: if (info.Value.Ndef == null) { return; } Terminal.WriteLine("\n"); Terminal.WriteLine($"Tag Tec = [{tec.Replace("android.nfc.tech.", "")}]"); AddHeader(new HeaderListItem($"Tech = [{tec.Replace("android.nfc.tech.", "")}]")); AddItem(new DataItem("Type", $"{info.Value.Ndef.Type}")); AddItem(new DataItem("Writable", $"{info.Value.Ndef.IsWritable}")); AddItem(new DataItem("Can Make Read-Only", $"{info.Value.Ndef.CanMakeReadOnly()}")); AddItem(new DataItem("Max Size", $"{info.Value.Ndef.MaxSize} bytes")); AddHeader(new HeaderListItem($"Ndef Message...")); info.Value.Ndef.Connect(); if (State == WaitingState.Write_Ndef) { Terminal.WriteLine($"Writing Ndef > {TxtMsg.Text}"); NdefRecord record = NdefRecord.CreateMime("text/plain", Encoding.ASCII.GetBytes(TxtMsg.Text)); //NdefRecord record = NdefRecord.CreateTextRecord("", "SomeTxt"); NdefMessage message = new NdefMessage(new NdefRecord[] { record }); NFC.Ndef_WriteMessage(info.Value.Ndef, message); Android.Support.V7.App.AlertDialog.Builder msg = new Android.Support.V7.App.AlertDialog.Builder(this); msg.SetTitle("Success!!!"); msg.SetMessage("Tag Written Successfully..."); msg.SetPositiveButton("OK", (s, a) => { }); msg.SetCancelable(true); msg.Create().Show(); TxtState.Text = "Written Ndef"; } if (State == WaitingState.None) { int i = 0; foreach (var msg in NFC.Ndef_ReadMessage(info.Value.Ndef).GetRecords()) { Terminal.WriteLine($"Reading Ndef Msg [{i}] > {Encoding.ASCII.GetString(msg.GetPayload())}"); AddItem(new DataItem($"Record [{i}] - [UFT-8] [{ msg.ToMimeType()}]", $"{Encoding.UTF8.GetString(msg.GetPayload())}")); i++; } } info.Value.Ndef.Close(); break; case NFC.Tech_NdefFormatable: if (info.Value.NdefFormatable == null) { return; } Terminal.WriteLine("\n"); Terminal.WriteLine($"Tag Tec = [{tec.Replace("android.nfc.tech.", "")}]"); AddHeader(new HeaderListItem($"Tech = [{tec.Replace("android.nfc.tech.", "")}]")); if (State == WaitingState.Format_Ndef) { var res1 = NFC.NdefFormatable_FormatTag(info.Value.NdefFormatable.Tag); Terminal.WriteLine($"Ndef Format > {res1}"); if (res1 == NFC.NFCMessage.NFC_TAG_FORMATED) { Android.Support.V7.App.AlertDialog.Builder msg = new Android.Support.V7.App.AlertDialog.Builder(this); msg.SetTitle("Success!!!"); msg.SetMessage("Tag Formatted Successfully..."); msg.SetPositiveButton("OK", (s, a) => { }); msg.SetCancelable(true); msg.Create().Show(); TxtState.Text = "Formated Ndef"; } else { Android.Support.V7.App.AlertDialog.Builder msg = new Android.Support.V7.App.AlertDialog.Builder(this); msg.SetTitle("Error!!!"); msg.SetMessage("Failed To Format Tag..."); msg.SetPositiveButton("OK", (s, a) => { }); msg.SetCancelable(true); msg.Create().Show(); TxtState.Text = "Failed Format Ndef"; } } if (State == WaitingState.None) { } break; case NFC.Tech_NfcA: if (info.Value.NfcA == null) { return; } Terminal.WriteLine("\n"); Terminal.WriteLine($"Tag Tec = [{tec.Replace("android.nfc.tech.", "")}]"); info.Value.NfcA.Connect(); AddHeader(new HeaderListItem($"Tech = [{tec.Replace("android.nfc.tech.", "")}]")); AddItem(new DataItem("Max Transcive Length", $"{info.Value.NfcA.MaxTransceiveLength} bytes")); AddItem(new DataItem("Timeout", $"{info.Value.NfcA.Timeout} ms")); AddItem(new DataItem("Sak", $"{info.Value.NfcA.Sak}")); AddItem(new DataItem("Atqa", $"{Encoding.ASCII.GetString(info.Value.NfcA.GetAtqa())}")); info.Value.NfcA.Close(); break; case NFC.Tech_NfcB: if (info.Value.NfcB == null) { return; } Terminal.WriteLine("\n"); Terminal.WriteLine($"Tag Tec = [{tec.Replace("android.nfc.tech.", "")}]"); info.Value.NfcB.Connect(); AddHeader(new HeaderListItem($"Tech = [{tec.Replace("android.nfc.tech.", "")}]")); AddItem(new DataItem("Max Transcive Length", $"{info.Value.NfcB.MaxTransceiveLength} bytes")); AddItem(new DataItem("Application Data", $"{Encoding.ASCII.GetString(info.Value.NfcB.GetApplicationData())}")); AddItem(new DataItem("Protocol Info", $"{Encoding.ASCII.GetString(info.Value.NfcB.GetProtocolInfo())}")); info.Value.NfcB.Close(); break; case NFC.Tech_NfcBarcode: if (info.Value.NfcBarcode == null) { return; } Terminal.WriteLine("\n"); Terminal.WriteLine($"Tag Tec = [{tec.Replace("android.nfc.tech.", "")}]"); info.Value.NfcBarcode.Connect(); AddHeader(new HeaderListItem($"Tech = [{tec.Replace("android.nfc.tech.", "")}]")); AddItem(new DataItem("Type", $"{info.Value.NfcBarcode.Type}")); AddItem(new DataItem("Barcode", $"{Encoding.ASCII.GetString(info.Value.NfcBarcode.GetBarcode())}")); info.Value.NfcBarcode.Close(); break; case NFC.Tech_NfcF: if (info.Value.NfcF == null) { return; } Terminal.WriteLine("\n"); Terminal.WriteLine($"Tag Tec = [{tec.Replace("android.nfc.tech.", "")}]"); info.Value.NfcF.Connect(); AddHeader(new HeaderListItem($"Tech = [{tec.Replace("android.nfc.tech.", "")}]")); AddItem(new DataItem("Manufacturer", $"{Encoding.ASCII.GetString(info.Value.NfcF.GetManufacturer())}")); AddItem(new DataItem("System Code", $"{Encoding.ASCII.GetString(info.Value.NfcF.GetSystemCode())}")); AddItem(new DataItem("Max Transcive Length", $"{info.Value.NfcF.MaxTransceiveLength} bytes")); AddItem(new DataItem("Timeout", $"{info.Value.NfcF.Timeout} ms")); info.Value.NfcF.Close(); break; case NFC.Tech_NfcV: Terminal.WriteLine("\n"); if (info.Value.NfcV == null) { return; } info.Value.NfcV.Connect(); AddHeader(new HeaderListItem($"Tech = [{tec.Replace("android.nfc.tech.", "")}]")); AddItem(new DataItem("Dsf Id", $"{info.Value.NfcV.DsfId}")); AddItem(new DataItem("Response Flags", $"{info.Value.NfcV.ResponseFlags}")); AddItem(new DataItem("Max Transcive Length", $"{info.Value.NfcV.MaxTransceiveLength} bytes")); info.Value.NfcV.Close(); break; } } if (TxtState.Text.Contains("Waiting")) { Android.Support.V7.App.AlertDialog.Builder msg = new Android.Support.V7.App.AlertDialog.Builder(this); if (State == WaitingState.Format_Ndef) { msg.SetTitle("Failed To Format Tag!!!"); msg.SetMessage("Tag You Tapped Dosen't Supports 'NdefFormatable' Technology..."); msg.SetPositiveButton("OK", (s, a) => { }); msg.SetCancelable(true); msg.Create().Show(); TxtState.Text = "Failed To Format"; } else if (State == WaitingState.Write_Mifare) { msg.SetTitle("Failed To Write Tag!!!"); msg.SetMessage("Tag You Tapped Dosen't Supports 'MifareClassic' Technology..."); msg.SetPositiveButton("OK", (s, a) => { }); msg.SetCancelable(true); msg.Create().Show(); TxtState.Text = "Failed To Write"; } else if (State == WaitingState.Write_Ndef) { msg.SetTitle("Failed To Write Tag!!!"); msg.SetMessage("Tag You Tapped Dosen't Supports 'Ndef' Technology..."); msg.SetPositiveButton("OK", (s, a) => { }); msg.SetCancelable(true); msg.Create().Show(); TxtState.Text = "Failed To Write"; } } else { TxtMsg.Text = ""; } State = WaitingState.None; Terminal.WriteLine("------------------------------------------------------------"); }
private void MakeStateManager() { RoutineState routine = new RoutineState(player, gameObject); routine.AddTransition(Transition.PlayerLearning, StateID.InteractiveStateID); InteractiveState interactive = new InteractiveState(player, gameObject); interactive.AddTransition(Transition.SetPlayerTask, StateID.WaitingStateID); WaitingState waiting = new WaitingState(player, gameObject); waiting.AddTransition(Transition.PlayerTaskComplete, StateID.EndStateID); EndState end = new EndState(player, gameObject); end.AddTransition(Transition.AllDone, StateID.RoutineStateID); manager = new NPCStateManager(); manager.AddState(routine); manager.AddState(interactive); manager.AddState(waiting); manager.AddState(end); }