// Use this for initialization void Start() { // rb1 = bus1.GetComponent<Rigidbody> (); // rb2 = bus2.GetComponent<Rigidbody> (); busController1 = bus1.GetComponent <BusController> (); busController2 = bus2.GetComponent <BusController> (); }
// Start is called before the first frame update void Start() { pc = GameObject.Find("Player").GetComponent <PlayerController>(); bc = GameObject.Find("Bus").GetComponent <BusController>(); rigidBody = GetComponent <Rigidbody2D>(); characterAnimation = GetComponent <Animator>(); respawnPoint = transform.position; }
public void OnTapOrdinary(object sender, EventArgs args) { BusController.SetBusType("Ordinary"); BusController.SetBusFee("Ordinary"); this.Navigation.PushAsync(new SeatPlanPage()); //open seatplann for ordinary }
private void OnTapRegular(object sender, EventArgs e) { BusController.SetBusType("Regular"); BusController.SetBusFee("Regular"); this.Navigation.PushAsync(new SeatPlanPage()); //open seatplan for regular }
// Use this for initialization void Start() { bc = GameObject.Find("Bus").GetComponent <BusController>(); gn = GameObject.Find("Goofy").GetComponent <CharacterController>(); rigidBody = GetComponent <Rigidbody2D>(); playerAnimation = GetComponent <Animator>(); respawnPoint = transform.position; gameLevelManager = FindObjectOfType <LevelManager>(); }
private void OnTapDeluxe(object sender, EventArgs e) { BusController.SetBusType("Deluxe"); BusController.SetBusFee("Deluxe"); this.Navigation.PushAsync(new SeatPlanPage()); //open seatplan for deluxe }
public BusControllerTest() { _faker = new Faker(); _queueBus = new Mock <IQueueBus>(); _busController = new BusController(_queueBus.Object); _busModel = new BusModel { Message = _faker.Lorem.Paragraph() }; }
private void BindControls() { BusController busController = new BusController(); BusInfo busInfo = busController.SelectByBusID(this.cboBusCode.SelectedValue.ToString()); this.cboBusCode.SelectedValue = busInfo.BusID; this.txtBusNumber.Text = busInfo.BusNo; this.cboBusType.SelectedValue = busInfo.BusTypeID; this.lblTotalSeat.Text = Convert.ToString(busInfo.TotalSeats); }
public CommandSchedule(DateTime date, string name, byte command, Address address, byte[] data, BusController bus, ScheduleTypes type = ScheduleTypes.Once, int interval = 0) { _date = date; _name = name; _cmd = command; _address = address; _data = data; _bus = bus; _type = type; _interval = interval; }
public async void Clicked_Checkout(object sender, EventArgs e) { if (Quantity.Text == "" || Quantity.Text == " " || Quantity.Text == "0") { var autoseat = await DisplayAlert("Question?", "You didn't choose a seat.Continue?", "Yes", "No"); if (autoseat) { overlay.IsVisible = true; s1.IsEnabled = false; s2.IsEnabled = false; s3.IsEnabled = false; s4.IsEnabled = false; s5.IsEnabled = false; s6.IsEnabled = false; s7.IsEnabled = false; s8.IsEnabled = false; s9.IsEnabled = false; s10.IsEnabled = false; s11.IsEnabled = false; s12.IsEnabled = false; s13.IsEnabled = false; s14.IsEnabled = false; s15.IsEnabled = false; s16.IsEnabled = false; s17.IsEnabled = false; s18.IsEnabled = false; s19.IsEnabled = false; s20.IsEnabled = false; s21.IsEnabled = false; s22.IsEnabled = false; s23.IsEnabled = false; s24.IsEnabled = false; s25.IsEnabled = false; s26.IsEnabled = false; s27.IsEnabled = false; s28.IsEnabled = false; s29.IsEnabled = false; } } else { var check = await DisplayAlert("Question?", "Are you sure?", "Yes", "No"); if (check) { Controller.PaymentController.SetTotAmt((qty * BusController.GetBusFee())); Controller.PaymentController.SetTotQty(qty); await Navigation.PushAsync(new PaymentPage()); } } }
public async Task BusStopList_GetListByInvalidNumber_ReturnNull() { //Arrange int routeNumber = -1; var mock = new Mock <IBusInformationService>(); mock.Setup(x => x.GetBusStopList(routeNumber, 't')).ReturnsAsync((IEnumerable <string>)null); var controller = new BusController(mock.Object); //Act var result = await controller.BusStopList(routeNumber); //Assert Assert.IsNull(result.Model); }
private void BusReport_Load(object sender, EventArgs e) { BusController Controller = new BusController(); rpvBus.LocalReport.DataSources.Clear(); ReportDataSource rds = new ReportDataSource(); rds.Name = "BusDataSet_BusDataTable"; rds.Value = Controller.SelectBus(); this.rpvBus.LocalReport.DataSources.Add(rds); rpvBus.ZoomMode = ZoomMode.Percent; this.rpvBus.RefreshReport(); }
public async Task ActiveBuses_GetCountByInvalidNumber_ReturnNull() { //Arrange int routeNumber = -1; var mock = new Mock <IBusInformationService>(); mock.Setup(x => x.GetActiveBusesCount(routeNumber, 't')).ReturnsAsync((int?)null); var controller = new BusController(mock.Object); //Act var result = await controller.ActiveBuses(routeNumber); //Assert Assert.IsNull(result.Model); }
private void BindBusCode() { BusController busController = new BusController(); BusCollection busCollections = busController.SelectList(); BusInfo info = new BusInfo(); info.BusCode = " - Select One - "; info.BusID = null; busCollections.Insert(0, info); this.cboBusCode.DisplayMember = "BusCode"; this.cboBusCode.ValueMember = "BusID"; this.cboBusCode.DataSource = busCollections; }
private void BindBusNo() { BusController busController = new BusController(); BusCollection BusCollections = busController.SelectList(); BusInfo info = new BusInfo(); info.BusNo = " - Select One - "; info.BusID = null; BusCollections.Insert(0, info); this.cboBusNumber.DisplayMember = "BusNo"; this.cboBusNumber.ValueMember = "BusID"; this.cboBusNumber.DataSource = BusCollections; this.cboBusNumber.SelectedIndex = 0; }
public async Task BusStopList_GetListByExistingNumber_IsSuccess() { //Arrange int routeNumber = 2; var busStopes = Enumerable.Repeat("bus stop name", 6); var mock = new Mock <IBusInformationService>(); mock.Setup(x => x.GetBusStopList(routeNumber, 't')).ReturnsAsync(busStopes); var controller = new BusController(mock.Object); //Act var result = await controller.BusStopList(routeNumber); //Assert Assert.IsInstanceOf <IEnumerable <string> >(result.Model); CollectionAssert.AreEqual(busStopes, (IEnumerable <string>)result.Model); }
private void BindBus() { BusController busController = new BusController(); BusCollection busCollection = busController.SelectList(); BusInfo info = new BusInfo(); info.BusNo = " - Select One - "; info.BusID = null; busCollection.Insert(0, info); cboBusNo.DisplayMember = "BusNo"; cboBusNo.ValueMember = "BusID"; cboBusNo.DataSource = busCollection; cboBusNo.SelectedIndex = 0; }
public void Clicked_Seat4(object sender, EventArgs e) { tapCount3++; if (tapCount3 % 2 == 0) { s4.BackgroundColor = Color.FromHex("#52add4"); qty--; } else { s4.BackgroundColor = Color.FromHex("#63539e"); qty++; } Quantity.Text = "" + qty; TotAmt.Text = (qty * BusController.GetBusFee()).ToString(); }
public async Task RoutesList_GetAllRoutes_IsSuccess() { //Arrange var routes = new RoutesListModel() { Buses = Enumerable.Repeat(default(RouteDirectionsModel), 5) }; var mock = new Mock <IBusInformationService>(); mock.Setup(x => x.GetAllRoutes()).ReturnsAsync(routes); var controller = new BusController(mock.Object); //Act var result = await controller.RoutesList(); //Assert Assert.IsInstanceOf <IEnumerable <RouteDirectionsModel> >(result.Model); CollectionAssert.AreEqual(routes.Buses, (IEnumerable <RouteDirectionsModel>)result.Model); }
private void NewEditExit_EditClick(object sender, EventArgs e) { try { switch (NewEditExit.BtnEditText) { case "&Edit": this.EnableDisableControls(false); this.VisibleControls(true); this.BindComboBox(true); this.InitializeControls(); break; case "&Delete": if (this.cboBusCode.SelectedValue != null) { if (Globalizer.ShowMessage(MessageType.Question, "Are you sure want to delete?") == DialogResult.Yes) { BusController busController = new BusController(); busController.DeleteByBusID(this.cboBusCode.SelectedValue.ToString()); string log = "Form-Bus;Item-BusCode:" + this.cboBusCode.Text + ";action-Delete"; userAction.Log(log); this.BindComboBox(true); Globalizer.ShowMessage(MessageType.Information, "Deleted Successfully"); this.ResetControl(); } } break; } } catch (Exception ex) { Globalizer.ShowMessage(MessageType.Critical, ex.Message); } }
private void NewEditExit_NewClick(object sender, EventArgs e) { try { switch (NewEditExit.BtnNewText) { case "&New": this.EnableDisableControls(true); this.BindComboBox(false); this.InitializeControls(); this.txtBusCode.Focus(); break; case "&Save": if (this.CheckRequiredFields()) { BusController busController = new BusController(); BusInfo busInfo = new BusInfo(); busInfo.BusID = string.Empty; busInfo.BusCode = this.txtBusCode.Text.Trim(); busInfo.BusNo = this.txtBusNumber.Text.Trim(); busInfo.BusTypeID = this.cboBusType.SelectedValue.ToString(); busInfo.TotalSeats = Convert.ToInt32(this.lblTotalSeat.Text.Trim()); busController.Insert(busInfo); string log = "Form-Bus;Item-BusCode:" + this.txtBusCode.Text + ";action-Save"; userAction.Log(log); Globalizer.ShowMessage(MessageType.Information, "Saved Successfully"); this.ResetControl(); this.txtBusCode.Focus(); } break; case "&Update": if (this.CheckRequiredFields()) { BusController busController = new BusController(); BusInfo busInfo = new BusInfo(); busInfo.BusID = this.cboBusCode.SelectedValue.ToString(); busInfo.BusCode = this.cboBusCode.Text.Trim(); busInfo.BusNo = this.txtBusNumber.Text.Trim(); busInfo.BusTypeID = this.cboBusType.SelectedValue.ToString(); busInfo.TotalSeats = Convert.ToInt32(this.lblTotalSeat.Text.Trim()); busController.UpdateByBusID(busInfo); string log = "Form-Bus;Item-BusCode:" + this.cboBusCode.Text + ";action-Update"; userAction.Log(log); Globalizer.ShowMessage(MessageType.Information, "Updated Successfully"); this.ResetControl(); } break; } } catch (Exception ex) { Globalizer.ShowMessage(MessageType.Critical, ex.Message); } }
private void ConfigureBus(XElement busElement, XElement nodeElement) { if (busElement == null) throw new NodeConfigurationException("bus section not found"); var ports = new List<Port>(); foreach (var xport in busElement.Element("ports").Elements()) { var port = (Port)GetConfiguredObject(xport); if (port != null) ports.Add(port); else { Log.Warn(string.Format("port {0} failed configuration", xport)); } } var address = nodeElement != null && nodeElement.Element("address") != null ? Address.Parse(Convert.ToUInt32(nodeElement.Element("address").Value)) : Address.Empty; Bus = new BusController(address, ports.ToArray()); Log.Debug(string.Format("Configured bus of type {0}", Bus.GetType().Name)); }
private IList<Wire> GetWires(IEnumerable<XElement> elements, Node node, BusController bus) { var wires = new List<Wire>(); foreach (var xwire in elements) { var input = xwire.Attribute("input").Value; var pin = node.Pins.FirstOrDefault(p => p.Name == input); if (pin == null) throw new WireException("Input pin not found"); var index = Convert.ToByte(xwire.Attribute("index").Value); var address = xwire.Attribute("address") != null && !string.IsNullOrEmpty(xwire.Attribute("address").Value) ? Address.Parse(Convert.ToUInt32(xwire.Attribute("address").Value)) : Address.Empty; var useInputData = xwire.Attribute("useInputData") != null && !string.IsNullOrEmpty(xwire.Attribute("useInputData").Value) && Convert.ToBoolean(xwire.Attribute("useInputData").Value); var cmdText = xwire.Attribute("command").Value.ToUpperInvariant(); byte cmd = 0; #region parse command name switch (cmdText) { case "PING": cmd = NodeCommands.CMD_PING; break; case "RESET": cmd = NodeCommands.CMD_RESET; break; case "READ_CONFIG": cmd = NodeCommands.CMD_READ_CONFIG; break; case "START": cmd = NodeCommands.CMD_START; break; case "STOP": cmd = NodeCommands.CMD_STOP; break; //Pins case "CHANGE_DIGITAL": cmd = NodeCommands.CMD_CHANGE_DIGITAL; break; case "TOGGLE_DIGITAL": cmd = NodeCommands.CMD_TOGGLE_DIGITAL; break; case "TIMED_DIGITAL": cmd = NodeCommands.CMD_TIMED_DIGITAL; break; case "DELAY_DIGITAL": cmd = NodeCommands.CMD_DELAY_DIGITAL; break; case "PULSE_DIGITAL": cmd = NodeCommands.CMD_PULSE_DIGITAL; break; case "CYCLE_DIGITAL": cmd = NodeCommands.CMD_CYCLE_DIGITAL; break; case "CHANGE_ALL_DIGITAL": cmd = NodeCommands.CMD_CHANGE_ALL_DIGITAL; break; case "CHANGE_PWM": cmd = NodeCommands.CMD_CHANGE_PWM; break; case "CHANGE_PIN": cmd = NodeCommands.CMD_CHANGE_PIN; break; case "DELAY_TOGGLE_DIGITAL": cmd = NodeCommands.CMD_DELAY_TOGGLE_DIGITAL; break; case "DELTA_PWM": cmd = NodeCommands.CMD_DELTA_PWM; break; case "FADE_PWM": cmd = NodeCommands.CMD_FADE_PWM; break; case "ACTIVATE": cmd = NodeCommands.CMD_ACTIVATE; break; case "DEACTIVATE": cmd = NodeCommands.CMD_DEACTIVATE; break; case "EXECUTE_DEVICE_ACTION": cmd = NodeCommands.CMD_EXECUTE_DEVICE_ACTION; break; case "PUSH_SENSOR_READ": cmd = NodeCommands.CMD_READ_SENSOR; break; } #endregion var dataText = xwire.Attribute("data") != null ? xwire.Attribute("data").Value : string.Empty; var data = Csv.CsvToList<byte>(dataText).ToArray(); //var trgText = xwire.Attribute("trigger") != null ? xwire.Attribute("trigger").Value : string.Empty; //var trgs = Csv.CsvToList<string>(trgText).ToArray(); //var trigger = WireTriggers.None; //foreach (var trg in trgs) //{ // trigger |= trg != null && Enum.IsDefined(typeof (WireTriggers), trg) // ? (WireTriggers) Enum.Parse(typeof (WireTriggers), trg) // : WireTriggers.None; //} var wire = new Wire(pin) { Index = index, Command = cmd, Address = address, UseInputData = useInputData, Parameters = data }; //Add wire trigger event //TODO configurable on Activate/deactivate/change wire.OnWireTriggered += (sender, args) => { var w = (Wire)sender; var stack = new SimpleStack(w.Parameters); if (w.UseInputData) { stack.Push(args.Source.Value); } if (w.Address == Address.Empty || w.Address == bus.Address) node.Execute(w.Address, w.Command, stack.Data); else bus.SendImmediate(w.Command, w.Address, stack.Data); }; wires.Add(wire); } Log.Debug(string.Format("Configured {0} wires", wires.Count)); return wires; }
void Update() { if (!actionWindow.isOpen && !dialogWindow.isOpen) { if (Input.mouseScrollDelta.y != 0) { currentHand = SwapActiveHand(); SetHandColor(); //currentHand.GetComponentInChildren<Text>().text = "*"; } if (Input.GetMouseButtonDown(1)) { eventController.OnMouseClickEvent.Invoke(); mousePosRight = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector2 mousePos2D = new Vector2(mousePosRight.x, mousePosRight.y); RaycastHit2D[] hits = Physics2D.RaycastAll(mousePos2D, Vector2.zero); foreach (var hit in hits) { if (hit.collider.gameObject.tag == "table" && hit.collider.GetComponent <TableController>().isCraftTable) { bool removeTool = craftController.Craft_Table(hits, GetItemInHand(currentHand), CraftType.Cooking, CraftTable.Table); if (removeTool) { SetDefaultItem(currentHand); } return; } if (hit.collider.gameObject.tag == "microwave") { MicrowaveController microwave = hit.collider.GetComponent <MicrowaveController>(); craftController.Craft_Microwave(microwave, GetItemInHand(currentHand), CraftType.Cooking, CraftTable.Microwave); eventController.OnEnvChangeShapeEvent.Invoke(); return; } if (hit.collider.gameObject.tag == "oven") { MicrowaveController microwave = hit.collider.GetComponent <MicrowaveController>(); craftController.Craft_Microwave(microwave, GetItemInHand(currentHand), CraftType.Cooking, CraftTable.Oven); eventController.OnEnvChangeShapeEvent.Invoke(); return; } if (hit.collider.gameObject.tag == "printer") { PrinterController printerController = hit.collider.GetComponent <PrinterController>(); printerController.OnPrinterClick(); } if (hit.collider.gameObject.tag == "pc") { PCController pcController = hit.collider.GetComponent <PCController>(); pcController.OnPc_Disck(currentHand); } if (hit.collider.gameObject.tag == "tv") { TVController tvController = hit.collider.GetComponent <TVController>(); tvController.NextChanel(); } if (hit.collider.gameObject.name.Contains(Global.ITEM_SWITCH_PREFIX)) { ItemSwitchController itemSwitchController = hit.collider.GetComponent <ItemSwitchController>(); itemSwitchController.SwitchItem(GetItemInHand(currentHand), currentHand); } /* */ /* QUESTS */ /* */ if (hit.collider.gameObject.name.Contains("bus_spawn")) { Debug.Log("bus"); BusController bus = hit.collider.GetComponent <BusController>(); bus.GiveTicket(currentHand); return; } } eventController.OnRightButtonClickEvent.Invoke(hits, mousePos2D); } if (Input.GetMouseButtonDown(0)) { eventController.OnMouseClickEvent.Invoke(); mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector2 mousePos2D = new Vector2(mousePos.x, mousePos.y); RaycastHit2D[] hits = Physics2D.RaycastAll(mousePos2D, Vector2.zero); if (IsInActionRadius(mousePos, player.position, actioPlayerRadius)) { Item itemInHand = GetItemInHand(currentHand); itemInHand.itemUseData.use.Use_On_Env(hits, mousePos, currentHand, GetAnotherHand()); } foreach (var hit in hits) { if (hit.collider != null && IsInActionRadius(mousePos, player.position, actioPlayerRadius)) { // ели на полу айтем и в руках не чего нет if (hit.collider.name.Contains(Global.DROPED_ITEM_PREFIX) && IsEmpty(currentHand)) { GameObject itemGo = hit.collider.gameObject; ItemPickUp(itemGo); return; // приоритет что бы не взять айтем и не положить его потом на стол если он был уже на столе } if (hit.collider.gameObject.tag == "player") { Item item = currentHand.GetComponent <ItemCell>().item; item.itemUseData.use.Use_On_Player(statInit.stats, item); if (item.isDestroyOnPlayerUse) { SetDefaultItem(currentHand); } else { if (item.afterOnPlayerUseItem != null) { Item afterUseItemClone = Instantiate(item.afterOnPlayerUseItem); DressCell(currentHand, afterUseItemClone); } } } if (hit.collider.gameObject.tag == "tapWater") { TabWaterController tabWaterController = hit.collider.GetComponent <TabWaterController>(); Button btn_itemInHand = IsEmpty(currentHand) ? null : currentHand; tabWaterController.OnWaterTap_Click(btn_itemInHand); } if (hit.collider.gameObject.tag == "envObj") { BaseActionWindowConntroller baseAction = hit.collider.GetComponent <BaseActionWindowConntroller>(); baseAction.Open(hit.collider.gameObject); } if (hit.collider.gameObject.tag == "pc") { PCController pcController = hit.collider.GetComponent <PCController>(); Item itemInHand = IsEmpty(currentHand) ? null : GetItemInHand(currentHand); pcController.OnPc_ClicK(itemInHand, mousePos); } if (hit.collider.gameObject.tag == "tv") { TVController tVController = hit.collider.GetComponent <TVController>(); tVController.OnTvClick(); } if (hit.collider.gameObject.tag == "microwave" || hit.collider.gameObject.tag == "oven") { Item itemInHand = IsEmpty(currentHand) ? null : GetItemInHand(currentHand); MicrowaveController microwaveController = hit.collider.GetComponent <MicrowaveController>(); MicrowaveController.MicrowaveStatus status = microwaveController.OnMicrowaveClick(itemInHand, mousePos); if (status == MicrowaveController.MicrowaveStatus.PutItem) { SetDefaultItem(currentHand); } else if (status == MicrowaveController.MicrowaveStatus.TakeItem) { DressCell(currentHand, microwaveController.itemInside); microwaveController.itemInside = null; } eventController.OnEnvChangeShapeEvent.Invoke(); } if (hit.collider.gameObject.tag == "door") { Item itemInHand = GetItemInHand(currentHand); // использовать айтем как ключ //eventController.OnDoorEvent.Invoke(itemInHand, mousePos, hit.collider, hit.collider.GetComponent<DoorController>().isLocked); hit.collider.GetComponent <DoorController>().OnDoorClick(itemInHand, mousePos, hit.collider, hit.collider.GetComponent <DoorController>().isLocked); itemInHand.itemUseData.use.Use_To_Open(statInit.stats, itemInHand); } if (hit.collider.gameObject.tag == "case" || hit.collider.gameObject.tag == "printer") { CaseItem caseItem = hit.collider.GetComponent <CaseItem>(); Transform casePosition = hit.collider.transform; // важно соблюдать очередность, сначало открывается сундук потом панэль hit.collider.GetComponent <CaseController>().OnCaseCloseOpen(casePosition.position); eventController.OnStaticCaseItemEvent.Invoke(caseItem, casePosition); eventController.OnEnvChangeShapeEvent.Invoke(); } if (hit.collider.gameObject.tag == "table") { hit.collider.GetComponent <TableController>().OnTableClick(hit.transform.position, IsEmpty(currentHand) ? null : GetItemInHand(currentHand)); } /* */ /* QUESTS */ /* */ if (hit.collider.gameObject.name.Contains("bus_spawn")) { Debug.Log("bus"); BusController bus = hit.collider.GetComponent <BusController>(); bus.Activate(); return; } } } } } }
public HBusProcessor(BusController hbus) { _bus = hbus; _bus.CommandReceived += OnCommandReceived; _bus.AckReceived += OnAckReceived; _scheduler = Scheduler.GetScheduler(); _hbusEvents = new Dictionary<string, IList<Event>>(); //Event from ep source OnSourceEvent = (@event, point) => { if (@event.Channel != Channel && !string.IsNullOrEmpty(@event.Channel)) return; var address = !string.IsNullOrEmpty(@event.Address) ? Address.Parse(@event.Address) : Address.BroadcastAddress; var stack = new SimpleStack(); ////Create new page event list //if (!_hbusEvents.ContainsKey(@event.Subscriber)) // _hbusEvents.Add(@event.Subscriber, new List<Event>()); switch (@event.Name) { case "node-subscribe": _bus.SendCommand(NodeCommands.CMD_ADD_NODE_LISTENER, address); break; case "node-unsubscribe": _bus.SendCommand(NodeCommands.CMD_DELETE_NODE_LISTENER, address); break; case "pin-activate": stack.PushName(@event.Source); _bus.SendCommand(NodeCommands.CMD_ACTIVATE, address, stack.Data); break; case "pin-deactivate": stack.PushName(@event.Source); _bus.SendCommand(NodeCommands.CMD_DEACTIVATE, address, stack.Data); break; case "pin-subscribe": stack.PushName(@event.Source); _bus.SendCommand(NodeCommands.CMD_ADD_PIN_LISTENER, address, stack.Data); break; case "pin-unsubscribe": stack.PushName(@event.Source); _bus.SendCommand(NodeCommands.CMD_DELETE_PIN_LISTENER, address, stack.Data); break; case "device-subscribe": stack.PushName(@event.Source); _bus.SendCommand(NodeCommands.CMD_ADD_DEVICE_LISTENER, address, stack.Data); break; case "device-unsubscribe": stack.PushName(@event.Source); _bus.SendCommand(NodeCommands.CMD_DELETE_DEVICE_LISTENER, address, stack.Data); break; case "sensor-subscribe": //This is extracted only for explantion //@event.Data could be used as it is var interval = @event.Data[0]; var expires = (ushort) (@event.Data[2] << 8 + @event.Data[1]); stack.PushName(@event.Source); stack.Push(interval); stack.Push(expires); _bus.SendCommand(NodeCommands.CMD_ADD_SENSOR_LISTENER, address, stack.Data); break; case "sensor-unsubscribe": stack.PushName(@event.Source); _bus.SendCommand(NodeCommands.CMD_DELETE_SENSOR_LISTENER, address, stack.Data); break; case "sensor-read": stack.PushName(@event.Source); _bus.SendCommand(NodeCommands.CMD_READ_SENSOR, address, stack.Data); break; //TODO: other HBus commands default: if (@event.Name.IndexOf("device-") == 0) { //Send device action var devaction = new DeviceAction(@event.Source, @event.Name.Substring(7), @event.Data); _bus.SendCommand(NodeCommands.CMD_EXECUTE_DEVICE_ACTION, address, devaction.ToArray()); } break; } }; //Error from ep source OnSourceError = (exception, sender) => { Log.Error("Error from source endpoint", exception); }; //Close connection with ep source OnSourceClose = (sender) => { //Close HBus endpoint Stop(); Log.Debug("closed on source close"); }; }
public async void Done_Clicked(object a, EventArgs e) { Controller.PaymentController.SetTotAmt((int.Parse(qtyseats.Text) * BusController.GetBusFee())); Controller.PaymentController.SetTotQty(int.Parse(qtyseats.Text)); await Navigation.PushAsync(new PaymentPage()); }
public Node(INodeConfigurator configurator) { _configurator = configurator; //Bus controller _bus = _configurator.Bus; _bus.CommandReceived += OnCommandReceived; _bus.AckReceived += OnAckReceived; //Hardware Abstraction Layer _hal = _configurator.Hal; //Scheduler _scheduler = _configurator.Scheduler; //Private members _pinSubscribers = new Dictionary<string, Pin>(); _deviceSubscribers = new Dictionary<string, Device>(); _sensorSubscribers = new List<SensorSubscriber>(); _nodeSubscribers = new Dictionary<Address, byte>(); //Public configuration Status = new NodeStatusInfo { Mask = 0, NodeStatus = NodeStatusValues.Reset, BusStatus = _bus.Status, LastError = 0, TotalErrors = 0, Time = 0, LastActivatedInput = string.Empty, LastActivatedOutput = string.Empty }; //TODO: Add autostart property //if (AutoStart) { //Configure node //if (LoadConfiguration(false)) //{ // //Full reset node // Reset(true); //} //} //else //_bus.Open(); //Only bus start Log.Debug("Node created"); }
public SeatPlanPage() { InitializeComponent(); overlay.IsVisible = false; Price.Text = (BusController.GetBusFee()).ToString(); }
private static void Main(string[] args) { XmlConfigurator.Configure(); #if DEBUG //set log level to DEBUG var logLevel = Level.Debug; ((Hierarchy)LogManager.GetRepository()).Root.Level = logLevel; ((Hierarchy)LogManager.GetRepository()).RaiseConfigurationChanged(EventArgs.Empty); #endif Console.WriteLine("-----------------------------------------"); Console.WriteLine("HBus Console node version {0}", Assembly.GetExecutingAssembly().GetName().Version); #if ARTIK_DEMO_LOCAL Console.WriteLine("ARTIK DEMO with local node"); #endif #if ARTIK_DEMO_RASPBERRY Console.WriteLine("ARTIK DEMO with raspberry node"); #endif Console.WriteLine("-----------------------------------------"); //Startup parameters Console.WriteLine("Configuring node."); var defaultConfig = Convert.ToBoolean(ConfigurationManager.AppSettings["node.defaultConfiguration"]); var xconfig = ConfigurationManager.AppSettings["node.configurationFile"]; //Create configurator _configurator = new Nodes.Configuration.XmlConfigurator(xconfig); //Configure all global objects _configurator.Configure(defaultConfig); //Get the node _node = _configurator.Node; _bus = _configurator.Bus; #if DEBUG //Add handlers to bus _bus.OnMessageReceived += (source, message) => { Console.WriteLine("Received message from {0} to {1} = {2} ({3})", message.Source, message.Destination, message.Command, message.Flags); }; #endif //Configure remote sensors for demo porpouses #if ARTIK_DEMO_LOCAL || ARTIK_DEMO_RASPBERRY var addr7 = Address.Parse(7); _extSensors = new List<Sensor> { new Sensor { Name = "SN701", Address = addr7 }, //arduino node DHT11 temperature new Sensor { Name = "SN702", Address = addr7 }, //arduino node DHT11 humidity new Sensor { Name = "SN703", Address = addr7 } //arduino node photoresistor light }; #endif //Add handlers to sensor events _node.OnSensorRead += (arg1, arg2) => { Console.WriteLine("Sensor read from {0} : {1} = {2} @ {3}", arg1, arg2.Name, arg2.Value, arg2.Time); }; Console.WriteLine("Reset node."); //Full reset _node.Reset(true); Console.WriteLine("Start node."); //Start node _node.Start(); Console.WriteLine("Node {0} started", _node.Name); Console.WriteLine("Press i [enter] for info."); Console.WriteLine("Press x [enter] to exit."); #region local test section //Main loop while (true) { var w = Console.ReadLine(); Pin pin; Device device; switch (w) { case "0": _bus.SendCommand(NodeCommands.CMD_PING, Address.HostAddress); break; #if ARTIK_DEMO_LOCAL || ARTIK_DEMO_RASPBERRY #region input pins case "1": pin = _node.Pins[0]; pin.Activate(); break; case "2": pin = _node.Pins[1]; pin.Activate(); break; case "3": pin = _node.Pins[2]; pin.Activate(); break; case "4": pin = _node.Pins[3]; pin.Activate(); break; case "5": pin = _node.Pins[4]; pin.Activate(); break; case "6": pin = _node.Pins[5]; pin.Activate(); break; case "7": pin = _node.Pins[6]; pin.Activate(); break; case "8": pin = _node.Pins[7]; pin.Activate(); break; #endregion #region output pins case "q": pin = _node.Pins[8]; pin.Activate(); break; case "w": pin = _node.Pins[9]; pin.Activate(); break; case "e": pin = _node.Pins[10]; pin.Activate(); break; case "r": pin = _node.Pins[11]; pin.Activate(); break; #endregion #endif #region devices #if ARTIK_DEMO_LOCAL || ARTIK_DEMO_RASPBERRY case "t": device = _node.Devices[0]; device.ExecuteAction(new DeviceAction { Device = device.Name, Action = "open" }); break; case "y": device = _node.Devices[0]; device.ExecuteAction(new DeviceAction { Device = device.Name, Action = "close" }); break; case "u": device = _node.Devices[1]; device.ExecuteAction(new DeviceAction { Device = device.Name, Action = "open" }); break; case "i": device = _node.Devices[1]; device.ExecuteAction(new DeviceAction { Device = device.Name, Action = "close" }); break; #endif #endregion #region sensors #if ARTIK_DEMO_LOCAL || ARTIK_DEMO_RASPBERRY case "a":// local sensor readSensor(_node.Sensors[0]); break; case "s":// local sensor readSensor(_node.Sensors[1]); break; case "d"://remote sensor readSensor(_extSensors[0]); break; case "f"://remote sensor readSensor(_extSensors[1]); break; case "g"://remote sensor readSensor(_extSensors[2]); break; #endif #endregion case "h": ShowHelp(); break; case "x": Console.WriteLine("Closing node..."); _node.Close(); _node = null; Console.WriteLine("Bye."); return; } } }
public Node() { _configurator = null; //Bus controller _bus = null; //Hardware Abstraction Layer _hal = null; //Scheduler _scheduler = null; //Private members _pinSubscribers = new Dictionary<string, Pin>(); _deviceSubscribers = new Dictionary<string, Device>(); _sensorSubscribers = new List<SensorSubscriber>(); _nodeSubscribers = new Dictionary<Address, byte>(); //Public configuration Status = new NodeStatusInfo { Mask = 0, NodeStatus = NodeStatusValues.Unknown, BusStatus = BusStatus.Reset, LastError = 0, TotalErrors = 0, Time = 0, LastActivatedInput = string.Empty, LastActivatedOutput = string.Empty }; Log.Debug("Empty node created"); }
static void Main(string[] args) { //Log init XmlConfigurator.Configure(); Console.WriteLine("HBus.Server v." + Assembly.GetExecutingAssembly().GetName().Version); //TODO: configurator from db/xml #region HBus scheduler processor: schedule all sensors readings Console.WriteLine("..Configuring Scheduler processor"); var interval = Convert.ToInt32(ConfigurationManager.AppSettings["processor.scheduler.interval"]); var sproc = new SchedulerProcessor(new[] { //Read sensor 1 from console node new EventSchedule(DateTime.Now.AddSeconds(10), new Event() { Name = "sensor-read", Address = "2", Channel = "hbus", MessageType = "event", Source = "SN201", }, ScheduleTypes.Period, interval), //Read sensor 2 from console node new EventSchedule(DateTime.Now.AddSeconds(15), new Event() { Name = "sensor-read", Address = "2", Channel = "hbus", MessageType = "event", Source = "SN202", }, ScheduleTypes.Period, interval), //Read sensor 0 from remote Arduino node new EventSchedule(DateTime.Now.AddSeconds(20), new Event() { Name = "sensor-read", Address = "7", Channel = "hbus", MessageType = "event", Source = "SN701", }, ScheduleTypes.Period, interval), //Read sensor 1 from remote Arduino node new EventSchedule(DateTime.Now.AddSeconds(25), new Event() { Name = "sensor-read", Address = "7", Channel = "hbus", MessageType = "event", Source = "SN702", }, ScheduleTypes.Period, interval), //Read sensor 3 from remote Arduino node new EventSchedule(DateTime.Now.AddSeconds(30), new Event() { Name = "sensor-read", Address = "7", Channel = "hbus", MessageType = "event", Source = "SN703", }, ScheduleTypes.Period, interval), }); #endregion #region HBus commands processor Console.WriteLine("..Configuring HBus processor"); var hbHost = ConfigurationManager.AppSettings["processor.hbus.host"]; //HBus controller var bus = new BusController(Address.HostAddress, new Port[] { //new PortTcp(hbHost,5000, 5001, 0), new PortZMq("tcp://*:5555","tcp://127.0.0.1:5556", 0) }); var hbusproc = new HBusProcessor(bus); hbusproc.OnSourceEvent(new Event() { Name = "pin-subscribe", MessageType = "event", Channel = "hbus", Source = "LS201", Address = "2" }, null); #endregion #region Websocket processor Console.WriteLine("..Configuring websocket processor"); var wsproc = new WebsocketProcessor("ws://0.0.0.0:5050"); #endregion #region ThingSpeak processor Console.WriteLine("..Configuring ThingSpeak processor"); var tsKey = ConfigurationManager.AppSettings["processor.thingspeak.key"]; var tsproc = new ThingSpeakProcessor(tsKey, new[] { "SN303", "SN701" }); #endregion #region Artik processor Console.WriteLine("..Configuring Artik processor"); //Local console sensor var deviceTypeId1 = ConfigurationManager.AppSettings["processor.artik.device1.type.id"]; var deviceId1 = ConfigurationManager.AppSettings["processor.artik.device1.id"]; var deviceToken1 = ConfigurationManager.AppSettings["processor.artik.device1.token"]; var deviceName1 = ConfigurationManager.AppSettings["processor.artik.device1.name"]; var deviceSource1 = ConfigurationManager.AppSettings["processor.artik.device1.source"]; var deviceAddress1 = ConfigurationManager.AppSettings["processor.artik.device1.address"]; //Remote arduino sensor temperature var deviceTypeId2 = ConfigurationManager.AppSettings["processor.artik.device2.type.id"]; var deviceId2 = ConfigurationManager.AppSettings["processor.artik.device2.id"]; var deviceToken2 = ConfigurationManager.AppSettings["processor.artik.device2.token"]; var deviceName2 = ConfigurationManager.AppSettings["processor.artik.device2.name"]; var deviceSource2 = ConfigurationManager.AppSettings["processor.artik.device2.source"]; var deviceAddress2 = ConfigurationManager.AppSettings["processor.artik.device2.address"]; //Remote arduino sensor humidity var deviceTypeId3 = ConfigurationManager.AppSettings["processor.artik.device3.type.id"]; var deviceId3 = ConfigurationManager.AppSettings["processor.artik.device3.id"]; var deviceToken3 = ConfigurationManager.AppSettings["processor.artik.device3.token"]; var deviceName3 = ConfigurationManager.AppSettings["processor.artik.device3.name"]; var deviceSource3 = ConfigurationManager.AppSettings["processor.artik.device3.source"]; var deviceAddress3 = ConfigurationManager.AppSettings["processor.artik.device3.address"]; //Remote arduino sensor light var deviceTypeId4 = ConfigurationManager.AppSettings["processor.artik.device4.type.id"]; var deviceId4 = ConfigurationManager.AppSettings["processor.artik.device4.id"]; var deviceToken4 = ConfigurationManager.AppSettings["processor.artik.device4.token"]; var deviceName4 = ConfigurationManager.AppSettings["processor.artik.device4.name"]; var deviceSource4 = ConfigurationManager.AppSettings["processor.artik.device4.source"]; var deviceAddress4 = ConfigurationManager.AppSettings["processor.artik.device4.address"]; //Node console shutter device var deviceTypeId5 = ConfigurationManager.AppSettings["processor.artik.device5.type.id"]; var deviceId5 = ConfigurationManager.AppSettings["processor.artik.device5.id"]; var deviceToken5 = ConfigurationManager.AppSettings["processor.artik.device5.token"]; var deviceName5 = ConfigurationManager.AppSettings["processor.artik.device5.name"]; var deviceSource5 = ConfigurationManager.AppSettings["processor.artik.device5.source"]; var deviceAddress5 = ConfigurationManager.AppSettings["processor.artik.device5.address"]; //Node console output pin var deviceTypeId6 = ConfigurationManager.AppSettings["processor.artik.device6.type.id"]; var deviceId6 = ConfigurationManager.AppSettings["processor.artik.device6.id"]; var deviceToken6 = ConfigurationManager.AppSettings["processor.artik.device6.token"]; var deviceName6 = ConfigurationManager.AppSettings["processor.artik.device6.name"]; var deviceSource6 = ConfigurationManager.AppSettings["processor.artik.device6.source"]; var deviceAddress6 = ConfigurationManager.AppSettings["processor.artik.device6.address"]; var artikproc = new ArtikProcessor( new[] { new ArtikEvent(deviceId1, deviceTypeId1, deviceToken1, deviceName1, deviceSource1, deviceAddress1, "hbus"), new ArtikEvent(deviceId2, deviceTypeId2, deviceToken2, deviceName2, deviceSource2, deviceAddress2, "hbus"), new ArtikEvent(deviceId3, deviceTypeId3, deviceToken3, deviceName3, deviceSource3, deviceAddress3, "hbus"), new ArtikEvent(deviceId4, deviceTypeId4, deviceToken4, deviceName4, deviceSource4, deviceAddress4, "hbus"), new ArtikEvent(deviceId5, deviceTypeId5, deviceToken5, deviceName5, deviceSource5, deviceAddress5, "hbus"), new ArtikEvent(deviceId6, deviceTypeId6, deviceToken6, deviceName6, deviceSource6, deviceAddress6, "hbus"), } ); #endregion #region UsbUirt processor #if USE_USBUIRT /* 1500002D1FCA power 170000821ECA 1 150000231ECA 2 */ var ircmd = new IrCommandEvent { IrCode = "170000821ECA", //button 1 on remote Name = "pin-activate", MessageType = "event", Channel = "hbus", Source = "CS201", Address = "2" }; var irproc = new UsbUirtProcessor(new List<IrCommandEvent> { ircmd }); #endif #endregion Console.WriteLine("Build processors connections"); //Scheduler => HBus Console.WriteLine("..Connect scheduler to HBus"); sproc.AddSubscriber(hbusproc); //HBus => websocket Console.WriteLine("..Connect websocket to HBus"); hbusproc.AddSubscriber(wsproc); //websocket => HBus Console.WriteLine("..Connect HBus to websocket"); wsproc.AddSubscriber(hbusproc); //HBus => ThingsSpeak Console.WriteLine("..Connect ThingsSpeak to HBus"); hbusproc.AddSubscriber(tsproc); //HBus => Artik Cloud Console.WriteLine("..Connect Artik Cloud to HBus"); hbusproc.AddSubscriber(artikproc); //Artik Cloud => HBus Console.WriteLine("..Connect HBus to Artik Cloud "); artikproc.AddSubscriber(hbusproc); #if USE_USBUIRT //UsbUirt => HBus Console.WriteLine("..Connect UsbUirt to HBus"); irproc.AddSubscriber(hbusproc); #endif Console.WriteLine("Starting processors"); hbusproc.Start(); wsproc.Start(); tsproc.Start(); artikproc.Start(); #if USE_USBUIRT irproc.Start(); #endif Console.WriteLine("Press enter to stop"); Console.ReadLine(); Console.WriteLine("Stopping processors"); wsproc.Stop(); hbusproc.Stop(); #if USE_USBUIRT irproc.Stop(); #endif }
void Update() { if (dialogWindow.isOpen == false) { if (Input.mouseScrollDelta.y != 0 || Input.GetKeyDown(KeyCode.Space)) //switch hands { currentHand = SwapActiveHand(); SetHandColor(); } else if (Input.GetKeyDown(KeyCode.Q)) { actionPanel.OnDropClick(); } //else if (Input.GetKeyDown(KeyCode.Q)) //switch to left hand //{ // currentHand = left_hand_btn; // SetHandColor(); //} //else if (Input.GetKeyDown(KeyCode.E)) //switch to right hand //{ // currentHand = right_hand_btn; // SetHandColor(); //} else if (Input.GetKeyDown(KeyCode.Tab)) // open bag { if (isBagOpen == true) { CloseOpenContainer(bag_panel, ref isBagOpen); return; } if (IsEmpty(bag_btn) == true) { return; } Item bag = bag_btn.GetComponent <ItemCell>().item; CloseOpenContainer(bag_panel, ref isBagOpen); if (isBagOpen == true) { isBagOpenWithTab = true; ContainerContentInit(bag.innerItems, bag_panel); } } if (Input.GetMouseButtonDown(1)) { eventController.OnMouseClickEvent.Invoke(); mousePosRight = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector2 mousePos2D = new Vector2(mousePosRight.x, mousePosRight.y); RaycastHit2D[] hits = Physics2D.RaycastAll(mousePos2D, Vector2.zero); foreach (var hit in hits) { if (hit.collider.name.Contains(Global.DROPED_ITEM_PREFIX) && IsInActionRadius(hit.transform.position, player.position, actioPlayerRadius)) { Item itemInWorld = hit.collider.GetComponent <ItemCell>().item; if (itemInWorld.itemSubstitution.IsUsable(GetItemInHand(currentHand))) { itemInWorld.itemSubstitution.Substitute(hit.collider.gameObject); return; } } if (hit.collider.tag == "substitudeItem") { Item itemToDrop = hit.collider.GetComponent <SubstitudeCell>().item; actionPanel.SpawnItem(hit.transform.position, itemToDrop); Destroy(hit.collider.gameObject); return; } if (hit.collider.gameObject.tag == "table" && hit.collider.GetComponent <TableController>().isCraftTable) { bool removeTool = craftController.Craft_Table(hits, GetItemInHand(currentHand), CraftType.Cooking, CraftTable.Table); if (removeTool) { SetDefaultItem(currentHand); } return; } if (hit.collider.gameObject.tag == "microwave") { MicrowaveController microwave = hit.collider.GetComponent <MicrowaveController>(); craftController.Craft_Microwave(microwave, GetItemInHand(currentHand), CraftType.Cooking, CraftTable.Microwave); eventController.OnEnvChangeShapeEvent.Invoke(); return; } if (hit.collider.gameObject.tag == "oven") { MicrowaveController microwave = hit.collider.GetComponent <MicrowaveController>(); craftController.Craft_Microwave(microwave, GetItemInHand(currentHand), CraftType.Cooking, CraftTable.Oven); eventController.OnEnvChangeShapeEvent.Invoke(); return; } if (hit.collider.gameObject.tag == "printer") { PrinterController printerController = hit.collider.GetComponent <PrinterController>(); printerController.OnPrinterClick(); } if (hit.collider.gameObject.tag == "pc") { PCController pcController = hit.collider.GetComponent <PCController>(); pcController.OnPc_Disck(currentHand); } if (hit.collider.gameObject.tag == "tv") { TVController tvController = hit.collider.GetComponent <TVController>(); tvController.NextChanel(); } if (hit.collider.gameObject.name.Contains(Global.ITEM_SWITCH_PREFIX)) { ISwitchItem switchItem = hit.collider.GetComponent <ISwitchItem>(); switchItem.SwitchItem(GetItemInHand(currentHand), currentHand); //ItemSwitchController itemSwitchController = hit.collider.GetComponent<ItemSwitchController>(); //itemSwitchController.SwitchItem(GetItemInHand(currentHand), currentHand); } /* */ /* QUESTS */ /* */ if (hit.collider.gameObject.name.Contains("bus_spawn")) { Debug.Log("bus"); BusController bus = hit.collider.GetComponent <BusController>(); bus.GiveTicket(currentHand); return; } } eventController.OnRightButtonClickEvent.Invoke(hits, mousePos2D); } if (Input.GetMouseButtonDown(0) || ((isOptMouseInput = Input.GetKeyDown(KeyCode.E)) && terminalController.isOpen == false)) { eventController.OnMouseClickEvent.Invoke(); // не детектить нажатие пробела вовремя работы в терминале //isOptMouseInput = !terminalController.isOpen; if (isOptMouseInput == false) { mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); } else { mousePos = player.position + (playerMovement.GetTurnSide() / 2); } Vector2 mousePos2D = new Vector2(mousePos.x, mousePos.y); RaycastHit2D[] hits = Physics2D.RaycastAll(mousePos2D, Vector2.zero); //isSpacePressed = false; if (IsInActionRadius(mousePos, player.position, actioPlayerRadius)) { Item itemInHand = GetItemInHand(currentHand); itemInHand.itemUseData.use.Use_On_Env(hits, mousePos, currentHand, GetAnotherHand()); } foreach (var hit in hits) { if (hit.collider != null && IsInActionRadius(mousePos, player.position, actioPlayerRadius)) { // ели на полу айтем и в руках не чего нет if (hit.collider.name.Contains(Global.DROPED_ITEM_PREFIX) && IsEmpty(currentHand)) { GameObject itemGo = hit.collider.gameObject; ItemPickUp(itemGo); return; // приоритет что бы не взять айтем и не положить его потом на стол если он был уже на столе } /* клик по игроку */ if (hit.collider.gameObject.tag == "playerAction") { Item item = currentHand.GetComponent <ItemCell>().item; eventController.OnUseOnPlayerEvent.Invoke(item); item.itemUseData.use.Use_On_Player(null, item); if (item.isDestroyOnPlayerUse) { SetDefaultItem(currentHand); } else { if (item.afterOnPlayerUseItem != null) { Item afterUseItemClone = Instantiate(item.afterOnPlayerUseItem); DressCell(currentHand, afterUseItemClone); } } } if (hit.collider.tag == "substitudeItem") { BaseConection baseConection = hit.collider.GetComponent <BaseConection>(); if (baseConection != null) { PCController pcController = baseConection.FindPcInRadius(); if (pcController != null) { baseConection.ProcessConection(pcController); } return; } } if (hit.collider.gameObject.tag == "tapWater") { TabWaterController tabWaterController = hit.collider.GetComponent <TabWaterController>(); Button btn_itemInHand = IsEmpty(currentHand) ? null : currentHand; tabWaterController.OnWaterTap_Click(btn_itemInHand); } if (hit.collider.gameObject.tag == "envObj") { BaseActionWindowConntroller baseAction = hit.collider.GetComponent <BaseActionWindowConntroller>(); baseAction.Open(hit.collider.gameObject); } if (hit.collider.gameObject.tag == "pc") { PCController pcController = hit.collider.GetComponent <PCController>(); Item itemInHand = IsEmpty(currentHand) ? null : GetItemInHand(currentHand); pcController.OnPc_ClicK(itemInHand); } if (hit.collider.gameObject.tag == "tv") { TVController tVController = hit.collider.GetComponent <TVController>(); tVController.OnTvClick(); } if (hit.collider.gameObject.tag == "microwave" || hit.collider.gameObject.tag == "oven") { Item itemInHand = IsEmpty(currentHand) ? null : GetItemInHand(currentHand); MicrowaveController microwaveController = hit.collider.GetComponent <MicrowaveController>(); MicrowaveController.MicrowaveStatus status = microwaveController.OnMicrowaveClick(itemInHand, mousePos); if (status == MicrowaveController.MicrowaveStatus.PutItem) { SetDefaultItem(currentHand); } else if (status == MicrowaveController.MicrowaveStatus.TakeItem) { DressCell(currentHand, microwaveController.itemInside); microwaveController.itemInside = null; } eventController.OnEnvChangeShapeEvent.Invoke(); } if (hit.collider.gameObject.tag == "door") { Item itemInHand = GetItemInHand(currentHand); // использовать айтем как ключ //eventController.OnDoorEvent.Invoke(itemInHand, mousePos, hit.collider, hit.collider.GetComponent<DoorController>().isLocked); hit.collider.GetComponent <DoorController>().OnDoorClick(itemInHand, mousePos, hit.collider, hit.collider.GetComponent <DoorController>().isLocked); itemInHand.itemUseData.use.Use_To_Open(null, itemInHand); } if (hit.collider.gameObject.tag == "case" || hit.collider.gameObject.tag == "printer") { CaseItem caseItem = hit.collider.GetComponent <CaseItem>(); Transform casePosition = hit.collider.transform; // важно соблюдать очередность, сначало открывается сундук потом панэль hit.collider.GetComponent <CaseController>().OnCaseCloseOpen(casePosition.position); eventController.OnStaticCaseItemEvent.Invoke(caseItem, casePosition); eventController.OnEnvChangeShapeEvent.Invoke(); } if (hit.collider.gameObject.tag == "table") { hit.collider.GetComponent <TableController>().OnTableClick(hit.transform.position, IsEmpty(currentHand) ? null : GetItemInHand(currentHand)); } /* */ /* QUESTS */ /* */ if (hit.collider.gameObject.name.Contains("bus_spawn")) { Debug.Log("bus"); BusController bus = hit.collider.GetComponent <BusController>(); bus.Activate(); return; } } } } } }