public virtual void ApplyPositionTransform(PositionTransform transform) { foreach (Vertex v in vertices) { v.p = transform(v.p); } }
/// <summary> /// 位移变化触发器 /// </summary> /// <param name="self"></param> void OnCameraPositionTransform(PositionTransform self) { if (OnPoschanged != null) { m_TransformMixer.ManualUpdate(); OnPoschanged(transform.position); } }
public override void ApplyPositionTransform(PositionTransform transform) { base.ApplyPositionTransform(transform); foreach (SurfaceComponentGeometry surfaceComponent in surfaceComponents.Values) { surfaceComponent.ApplyPositionTransform(transform); } }
public static async Task <string> GetCity() { var accessStatus = await Geolocator.RequestAccessAsync(); BasicGeoposition baspos = new BasicGeoposition(); switch (accessStatus) { case GeolocationAccessStatus.Allowed: { Geolocator geolocator = new Geolocator { DesiredAccuracyInMeters = 0 }; Geoposition pos = await geolocator.GetGeopositionAsync(); Geopoint myLocation = pos.Coordinate.Point; baspos = myLocation.Position; baspos = PositionTransform.Transfrom(baspos); const string MovieSearch_Api = "http://restapi.amap.com/v3/geocode/regeo?key=a3a90de8b27f31e0054c34e61e0e3d9f&location={0}&extensions=base "; HttpClient httpclient = new HttpClient(); HttpResponseMessage response = new HttpResponseMessage(); string result = null; string Location = Convert.ToString(baspos.Longitude) + "," + Convert.ToString(baspos.Latitude); string Api = MovieSearch_Api.Replace("{0}", Location); response = await httpclient.GetAsync(Api); result = await response.Content.ReadAsStringAsync(); return(result); } case GeolocationAccessStatus.Denied: { var dialog = new MessageDialog("已拒绝程序对位置的访问权,请至设置-隐私-位置中打开本程序的位置访问权限", "异常提示"); dialog.Commands.Add(new UICommand("确定", cmd => { })); var a = await dialog.ShowAsync(); bool result = await Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-location")); return("0"); } case GeolocationAccessStatus.Unspecified: { var dialog = new MessageDialog("未指明程序对位置的访问权,请至设置-隐私-位置中打开本程序的位置访问权限", "异常提示"); dialog.Commands.Add(new UICommand("确定", cmd => { })); var a = await dialog.ShowAsync(); bool result = await Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-location")); return("1"); } } return("2"); }
static int set_OnValueChanged(IntPtr L) { try { PositionTransform obj = (PositionTransform)ToLua.CheckObject(L, 1, typeof(PositionTransform)); EventObject arg0 = null; if (LuaDLL.lua_isuserdata(L, 2) != 0) { arg0 = (EventObject)ToLua.ToObject(L, 2); } else { return(LuaDLL.luaL_throw(L, "The event 'PositionTransform.OnValueChanged' can only appear on the left hand side of += or -= when used outside of the type 'PositionTransform'")); } if (arg0.op == EventOp.Add) { PositionTransform.OnValueChangedDelegate ev = (PositionTransform.OnValueChangedDelegate)DelegateFactory.CreateDelegate(typeof(PositionTransform.OnValueChangedDelegate), arg0.func); obj.OnValueChanged += ev; } else if (arg0.op == EventOp.Sub) { PositionTransform.OnValueChangedDelegate ev = (PositionTransform.OnValueChangedDelegate)LuaMisc.GetEventHandler(obj, typeof(PositionTransform), "OnValueChanged"); Delegate[] ds = ev.GetInvocationList(); LuaState state = LuaState.Get(L); for (int i = 0; i < ds.Length; i++) { ev = (PositionTransform.OnValueChangedDelegate)ds[i]; LuaDelegate ld = ev.Target as LuaDelegate; if (ld != null && ld.func == arg0.func) { obj.OnValueChanged -= ev; state.DelayDispose(ld.func); break; } } arg0.func.Dispose(); } return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 根据tag获取位置变换器 /// </summary> public PositionTransform GetPositionTransform(string tag) { PositionTransform[] tlist = GetComponents <PositionTransform>(); int len = tlist.Length; for (int i = 0; i < len; i++) { PositionTransform curr = tlist[i]; if (curr.tag == tag) { return(curr); } } return(null); }
static int set_Value(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); PositionTransform obj = (PositionTransform)o; UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); obj.Value = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Value on a nil value" : e.Message)); } }
static int get_Value(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); PositionTransform obj = (PositionTransform)o; UnityEngine.Vector3 ret = obj.Value; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Value on a nil value" : e.Message)); } }
static int get_OwnerTransformMixer(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); PositionTransform obj = (PositionTransform)o; TransformMixer ret = obj.OwnerTransformMixer; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index OwnerTransformMixer on a nil value" : e.Message)); } }
static int get_tag(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); PositionTransform obj = (PositionTransform)o; string ret = obj.tag; LuaDLL.lua_pushstring(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index tag on a nil value" : e.Message)); } }
static int set_tag(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); PositionTransform obj = (PositionTransform)o; string arg0 = ToLua.CheckString(L, 2); obj.tag = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index tag on a nil value" : e.Message)); } }
public void load(BinaryReader reader) { this.header = this.ReadHeader(reader); if (this.header.magicByte != 0x04) { Debug.LogError("Unable to parse TCK File - wrong header!"); return; } PositionTransform chunk = new PositionTransform(); for (var i = 0; i < this.header.countOfPositionBlocks; i++) { chunk.position = ReadVector3(reader); transforms.Add(chunk); } }
/// <summary> /// 震动 /// </summary> public Tweener Shake(ShakeCurve curve, float duration) { PositionTransform pt = gameObject.AddComponent <PositionTransform>();//新增一个位置变换组件 //震动发生时,取宿主的旋转量,震动过程中不随宿主旋转而改变震动方向 Quaternion mainRotation = m_TransformMixer.MainRotationTransform.Value; float t = 0; return(DOTween.To( () => t, x => { t = x; pt.Value = mainRotation * new Vector3(curve.ShakeX.Evaluate(t), curve.ShakeY.Evaluate(t), curve.ShakeZ.Evaluate(t)); }, 1f, duration ) .SetAutoKill(true) .SetRecyclable(false) .SetEase(Ease.OutExpo) .OnKill(() => GameObject.Destroy(pt))); }
/// <summary> /// 注册位置变换器 /// </summary> internal void _RegTransform(PositionTransform t) { m_PositionTransforms.Add(t); m_PositionTransformChanged = true; }
//相机位置变化 void OnCameraPosChanged(PositionTransform self) { EagleEyeMap.SetVisualFieldChanged(); }
private async Task FirstStep() { var accessStatus = await Geolocator.RequestAccessAsync(); BasicGeoposition baspos = new BasicGeoposition(); switch (accessStatus) { case GeolocationAccessStatus.Allowed: { Geolocator geolocator = new Geolocator { DesiredAccuracyInMeters = 0 }; Geoposition pos = await geolocator.GetGeopositionAsync(); myLocation = pos.Coordinate.Point; baspos = myLocation.Position; baspos = PositionTransform.Transfrom(baspos); myLocation = new Geopoint(baspos); UIElement marker = PointMeMarker(); MyMap.Children.Add(marker); MapControl.SetLocation(marker, myLocation); MyMap.Center = myLocation; MyMap.LandmarksVisible = true; break; } case GeolocationAccessStatus.Denied: { var dialog = new MessageDialog("已拒绝程序对位置的访问权,请至设置-隐私-位置中打开本程序的位置访问权限", "异常提示"); dialog.Commands.Add(new UICommand("确定", cmd => { })); var a = await dialog.ShowAsync(); bool result = await Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-location")); return; } case GeolocationAccessStatus.Unspecified: { var dialog = new MessageDialog("未指明程序对位置的访问权,请至设置-隐私-位置中打开本程序的位置访问权限", "异常提示"); dialog.Commands.Add(new UICommand("确定", cmd => { })); var a = await dialog.ShowAsync(); bool result = await Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-location")); return; } } string position = baspos.Longitude + "," + baspos.Latitude; string json = null; try { json = await Httprequest.HttpRequest.GetPositionSearchRequest(position, SerchRange); } catch (HttpRequestException) { var dialog = new MessageDialog("周边检索异常(未能成功发送请求)", "异常提示"); dialog.Commands.Add(new UICommand("确定", cmd => { })); var a = await dialog.ShowAsync(); } if (!string.IsNullOrWhiteSpace(json)) { POIResult = JsonConvert.DeserializeObject <Rootobject1>(json); viewmodel.poiresult = POIResult.pois; foreach (Pois i in POIResult.pois) { Geopoint geo = LocationToGeoPoint(i.location); MapIcon mapIcon1 = new MapIcon(); mapIcon1.Location = geo; mapIcon1.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIcon1.Title = i.name; MyMap.MapElements.Add(mapIcon1); } } }
/// <summary> /// 反注册一个位置变换器 /// </summary> internal void _UnregTransform(PositionTransform t) { m_PositionTransforms.Remove(t); m_PositionTransformChanged = true; }
void OnEnable() { model = target as PositionTransform; }