/// <summary> /// 设置 UI 节点活动性 /// </summary> /// <param name="eType"></param> 枚举量作为判断方式的依据 void SetActive(ENTERACT_TYPE eType = ENTERACT_TYPE.NULL) { GlobalHub gi = GlobalHub.Instance; switch (eType) { case ENTERACT_TYPE.CLR_EXC: selfText.text = gi.UiTexts["colorEnteract"].GetValue(); // "交换颜色" bool enteractAwake = (gi.p_enteract != null && gi.p_playerMaterial != null && gi.p_enteract.Point != (int)gi.PlayerColorType); gameObject.SetActive(enteractAwake); break; case ENTERACT_TYPE.CLR_SPR: selfText.text = gi.UiTexts["colorSource"].GetValue(); // "触碰色彩源" enteractAwake = (gi.p_enteract != null && gi.p_playerMaterial != null && gi.p_enteract.Point != (int)COLOR_TYPE.NULL); gameObject.SetActive(enteractAwake); break; case ENTERACT_TYPE.TLK: selfText.text = gi.UiTexts["talk"].GetValue(); // "对话" enteractAwake = gi.p_enteract != null; gameObject.SetActive(enteractAwake); break; default: gameObject.SetActive(false); break; } }
private async void FindMe_OnClick(object sender, RoutedEventArgs e) { try { var geolocator = new Geolocator(); var geoposition = await geolocator.GetGeopositionAsync(); if (geoposition != null) { _bikeMap.SetView(new Location(geoposition.Coordinate.Latitude, geoposition.Coordinate.Longitude), 18); MapLayer.SetPosition(_selfpushpin, new Location(geoposition.Coordinate.Point.Position.Latitude, geoposition.Coordinate.Point.Position.Longitude)); _bikeMap.Children.Remove(_selfpushpin); _bikeMap.Children.Add(_selfpushpin); GlobalHub.ScrollToSection(MapSection); } } catch (Exception) { _bikeMap.SetView(new Location(51.5072, 0.1275), 15); GlobalHub.ScrollToSection(MapSection); } }