/* * private void FindWayToRoute() * { * if (temp != null) * RouteSetWP.RemoveRoute(temp); * * Road from = ExtractRoadFrom(WorldMap.GetTile(Position)); * WayPoint fromWP = from.WPContainer.GetClosestWP(Position); * * if (Vector3.Dot(Position + transform.right, transform.InverseTransformPoint(fromWP.Position)) < 0) * fromWP = from.WPContainer.GetClosestWPExcept(Position, fromWP); * * temp = new RouteWP(RouteCreator.CreatePathToRouteWP(prev, route, route_forward), true); * * if (temp == null) { Abort("Path does not exist"); return; } * * if (!route.Contains(temp[temp.Count - 1])) * { * Debug.Log("<color=red>WTF temp route does not lead to main route</color>\nTrying to recalculate..."); * * temp = new RouteWP(RouteCreator.CreatePathToRouteWP(fromWP, route, route_forward), true); * * if (!route.Contains(temp[temp.Count - 1])) * Debug.Log("<color=red>RECALCULATION FAILED</color>"); * } * * RouteSetWP.AddRoute(temp, false); * * on_main_route = false; * current_WP = 0; * * if (sphereCurr == null) * throw new System.NullReferenceException("sphereCurr"); * * sphereCurr.SetPosition(fromWP.Position); * * temp.HighLight(true, Color.red); * } */ private void FindWayToRoute() { List <WayPoint> newTemp = RouteCreator.CreatePathWP(current, route_forward ? route.endWP : route.startWP, false); if (newTemp == null) { Abort("Path does not exist"); return; } if (temp != null) { RouteSet.RemoveRoute(temp); } temp = new Route(newTemp, true); RouteSet.AddRoute(temp, false); on_main_route = false; current_WP = 0; sphereCurr.SetPosition(current.Position); Road curr = ExtractRoadFrom(WorldMap.GetTile(Position)); tempRoad = GetBack.GetWayToClosest(curr, mainRoad); for (int i = 0; i < tempRoad.Count; i++) { tempRoad[i].SetColor(RoadColor.Red); } //enabled = false; }
//»ñÈ¡ÉùÒô×ÊÔ´ private void Get(string abName, string assetName, GetBack cb) { string key = abName + "." + assetName; if (sounds[key] == null) { ResManager.LoadAudioClip(abName, assetName, (obj) => { if (obj == null) { Debug.Log("PlayBackSound fail"); cb(null, key); return; } else { sounds.Add(key, obj); cb(obj as AudioClip, key); return; } }); } else { cb(sounds[key] as AudioClip, key); return; } }
//获取声音资源 private void Get(string abName, string assetName, GetBack cb) { string key = abName + "." + assetName; if (sounds[key] == null) //表中没有,ab中实例化 { ResManager.LoadAudioClip(abName, assetName, delegate(Object[] objs) //这里的委托参数是lua传过来的 { if (objs == null || objs[0] == null) { Debug.Log("PlaySound fail"); cb(null, key); return; } else { sounds.Add(key, objs[0]); cb(objs[0] as AudioClip, key); return; } } ); } else { cb(sounds[key] as AudioClip, key); } }
//获取声音资源 private void Get(string assetName, GetBack cb) { string key = assetName; if (sounds[key] == null) { if (requestLoadMap[key] != null) { return; } requestLoadMap.Add(key, 1); ResManager.LoadAudioClip("Audio/" + assetName, (objs) => { if (objs == null) { Debug.Log("获取背景声音资源 失败:" + "|" + assetName); cb(null, key); requestLoadMap.Remove(key); return; } else { sounds.Add(key, objs); cb(objs as AudioClip, key); return; } }); } else { cb(sounds[key] as AudioClip, key); return; } }
// IAppDatabase database; public ListViewModel() { Products = new ObservableCollection <ProductViewModel>(); DownloadProducts(); AddProduct = new Command(() => { Products.Add(new ProductViewModel("inny")); }); this.AddPageCommand = new Command(() => { App.Navigation.PushAsync(new AddPage(this)); }); SaveProduct = new Command(() => { if (ProductToAdd != null) { var productModel = new ProductModel { ID = ProductToAdd.Id, Name = ProductToAdd.Text, IsChecked = ProductToAdd.IsChecked }; ProductToAdd.Id = App.Database.SaveItem(productModel); Products.Add(ProductToAdd); } GetBack.Execute(new object()); }); GetBack = new Command(() => { App.Navigation.PopAsync(); }); }
//µÃµ½ÓÎϷƬ¶Î private void Get(string abName, string assetName, GetBack gb) { string _key = GetClipNewName(abName, assetName); if (!sounds.ContainsKey(_key)) { ResManager.LoadAudioClip(abName, assetName, objs => { if (objs.Length == 0 || objs[0] == null) { Debug.Log("PlayBackSound fail"); if (gb != null) { gb(null, _key); } return; } else { sounds.Add(_key, objs[0] as AudioClip); if (gb != null) { gb(objs[0] as AudioClip, _key); } return; } }); } else { if (gb != null) { gb(sounds[_key], _key); } } }
///获取声音资源 private void Get(string clipName, GetBack cb) { string key = clipName; if (!m_sounds.ContainsKey(key)) { LoadAudioSource(clipName, (obj) => { if (obj == null) { Debugger.LogDebug("PlayBackSound fail"); cb(null, key); return; } else { if (!m_sounds.ContainsKey(key)) { m_sounds.Add(key, obj); cb(obj as AudioClip, key); return; } else { cb(m_sounds[key] as AudioClip, key); return; } } }); } else { cb(m_sounds[key] as AudioClip, key); return; } }