// Start is called before the first frame update void Start() { //Add box collider so touches are caught. if (GetComponent <BoxCollider>() == null) { BoxCollider collider = gameObject.AddComponent <BoxCollider>(); collider.size = new Vector3(collider.size.x, collider.size.y, 0.01f); } //Get Sprite Info spriteRend = GetComponent <SpriteRenderer>(); initialColor = spriteRend.color; //Get Hotspot Script hotspot = GetComponent <IHotspot>(); //Create hotspot glow if it's enabled from HotspotController. HotspotController hotspotController = this.gameObject.GetComponentInParent <HotspotController>(); if (hotspotController != null && hotspotController.hotspotEffects == HotspotController.HotspotEffects.Glow) { this.gameObject.AddComponent <CreateHotspotGlow>().SetValue(hotspotController.hotspotGlowSettings); } }
public void Remove(IHotspot h) { lock (_hotspots) { _hotspots.Remove(h); } InvokeChangedListeners(); }
public void ChildHotspotOpened(IHotspot childHotspot, OnClickAction childClickAction) { for (int i = 0; i < transform.childCount; i++) { var hotspot = transform.GetChild(i).GetComponent <IHotspot>(); if (hotspot == childHotspot) { continue; } if (hotspot != null) { switch (childClickAction) { case OnClickAction.Disable: hotspot.DisableInteractivity(); break; case OnClickAction.Delete: case OnClickAction.Hide: transform.GetChild(i).gameObject.SetActive(false); break; } } } }
public void Add(IHotspot h) { lock (_hotspots) { _hotspots.Add(h); } InvokeChangedListeners(); }
public SuccessViewModel(IHotspot hotspot) { _hotspot = hotspot; this.CurrentSSID = this.SSID = _hotspot.SSID; this.CurrentPresharedKey = this.PresharedKey = _hotspot.PresharedKey; var dirty = this.WhenAny(x => x.SSID, x => x.PresharedKey, x => x.CurrentSSID, x => x.CurrentPresharedKey, (ssid, psk, cssid, cpsk) => ssid.Value != cssid.Value || psk.Value != cpsk.Value); var valid = this.WhenAny(x => x.SSID, x => x.PresharedKey, (name, key) => IsSSIDValid(name.Value) && IsPresharedKeyValid(key.Value)); var canAcceptChanges = Observable.CombineLatest(dirty, valid, (isDirty, isValid) => isDirty && isValid); canAcceptChanges.ToProperty(this, x => x.IsModified, out _modified); AcceptChanges = ReactiveCommand.CreateAsyncTask( canAcceptChanges, _ => Task.Run(() => { _hotspot.Stop(); _hotspot.SSID = this.SSID; _hotspot.PresharedKey = this.PresharedKey; this.CurrentSSID = this.SSID; this.CurrentPresharedKey = this.PresharedKey; _hotspot.Start(); })); }
public IActionResult AddHotspot(HotspotAddVM hotspot) { var success = true; var message = "Pointer was successfully added!"; IHotspot hotspotToAdd = null; try { double pitch = double.Parse(hotspot.Pitch); double yaw = double.Parse(hotspot.Yaw); if (hotspot.HotspotType == "info") { hotspotToAdd = new InfoHotspot { Description = hotspot.Description, Footer = hotspot.Footer, Pitch = pitch, Yaw = yaw, Subtitle = hotspot.Subtitle, Title = hotspot.Title, URL = hotspot.HasURL ? hotspot.URL : null }; } else if (hotspot.HotspotType == "scene") { if (!hotspot.HasNextSceneId) { throw new Exception("Pointer should have scene!"); } hotspotToAdd = new SceneHotspot { Description = hotspot.Description, Footer = hotspot.Footer, Pitch = pitch, Yaw = yaw, Subtitle = hotspot.Subtitle, Title = hotspot.Title, SceneId = hotspot.NextSceneId }; } var scene = Loader.Scenes.FirstOrDefault(x => x.Name == hotspot.CurrentSceneId); if (scene != null) { scene.Hotspots.Add(hotspotToAdd); Loader.UpdateScenes(); } else { throw new Exception($"Scene isn't found with name '{hotspot.CurrentSceneId}'!"); } } catch (Exception ex) { success = false; message = ex.Message; } return(new ObjectResult(new { success, message })); }
private void Start() { hotspot = GetComponent <IHotspot>(); if (hotspot == null) { Debug.LogError("No Hotspot Component attached to PlaySoundOnHotspotActivate Object " + name + "."); } }
void Start() { spriteRenderer = GetComponent <SpriteRenderer>(); textMeshPro = GetComponent <TextMeshPro>(); if (hotspot == null) { hotspot = transform.parent.GetComponent <IHotspot>(); } }
public StatusViewModel(IHotspot hotspot) { _hotspot = hotspot; this.WhenAnyValue(x => x._hotspot.SSID).ToProperty(this, x => x.SSID, out _ssid); this.WhenAnyValue(x => x._hotspot.PresharedKey).ToProperty(this, x => x.PresharedKey, out _presharedKey); this.WhenAny(x => x._hotspot.ConnectedDeviceCount, count => string.Format(StatusTextFormat, count.Value)) .ToProperty(this, x => x.Status, out _status); }
private void Initialize() { _hotspot = new Hotspot(); if (!_hotspot.IsSupported) { MessageBox.Show(this, $"Wireless hotspots are not supported by your system or network card.", "Not supported", MessageBoxButtons.OK, MessageBoxIcon.Error); Load += (s, e) => Close(); } _hotspot.StatusChanged += (s, e) => UpdateStatus(); _hotspot.ClientsConnectedChanged += (s, e) => UpdateClientCount(); hotspotNameTbx.Text = _hotspot.SsidName; hotspotPasswordTbx.Text = _hotspot.Password; UpdateStatus(); }
public MainViewModel(IHotspot hotspot) { _hotspot = hotspot; this.WhenAnyValue(x => x._hotspot.SSID).ToProperty(this, x => x.SSID, out _ssid); this.WhenAnyValue(x => x._hotspot.PresharedKey).ToProperty(this, x => x.PresharedKey, out _presharedKey); this.WhenAny( x => x._hotspot.Authentication, x => x._hotspot.PresharedKey, x => x._hotspot.SSID, (authAlgo, psk, ssid) => { var qrString = string.Format(QrCodeContentFormat, authAlgo.Value, psk.Value, ssid.Value); var encoder = new QRCodeEncoder(); var bitmap = encoder.Encode(qrString); return(Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions())); }).ToProperty(this, x => x.QRCode, out _qrCode); }
public bool Contains(IHotspot h) { lock (_hotspots) { return(_hotspots.Contains(h)); } }
public void Init(IHotspot hotspot) { this.hotspot = hotspot; }
public SplashViewModel(IHotspot hotspot) { _hotspot = hotspot; }