public void AddTask(CommonSettings.VoidCallBack task) { lock (todoList) { todoList.Enqueue(task); } }
public void Lose(CommonSettings.VoidCallBack callback = null) { if (callback != null) { callback(); } }
/// <summary> /// 显示游戏动画 /// </summary> /// <param name="viewAction">动画描述</param> /// <param name="CallBack">播放完毕的回调</param> private void ShowViewAction(GameViewAction viewAction, CommonSettings.VoidCallBack CallBack) { this.SetAllCardsUnSelective(); CallBack(); }
static public void PlayEffect(string path, CommonSettings.VoidCallBack callback = null) { if (Configer.Instance.HighQualityAudio) { path = path.Replace("audios", "audios_source"); } else { path = path.Replace("audios_source", "audios"); } if (Configer.Instance.ResourceRootMenu != "") { path = Configer.Instance.ResourceRootMenu + path; } path = path.Replace("\\", "/"); int channel = CurrentChannel; EffectPool[channel].Source = new Uri(path, UriKind.Relative); AudioTag tag = EffectPool[channel].Tag as AudioTag; tag.callback = callback; EffectPool[channel].Play(); CurrentChannel++; if (CurrentChannel >= EFFECT_POOL_SIZE) { CurrentChannel = 0; } }
public void cameraScrollTo(double x, double y, CommonSettings.VoidCallBack callback) { double left = Canvas.GetLeft(field); double top = Canvas.GetTop(field); double toMoveX = x - (double)CommonSettings.SCREEN_WIDTH * 0.5f; double toMoveY = y - (double)CommonSettings.SCREEN_HEIGHT * 0.5f; double animationTime = 300; if (Math.Abs(left - LimitLeft(-toMoveX) + Math.Abs(top - LimitTop(-toMoveY))) < 150) { animationTime = 150; } Storyboard storyboard = new Storyboard(); bool IsAnimation = false; if ((left + toMoveX) != 0) { DoubleAnimation animationX = new DoubleAnimation() { From = left, To = LimitLeft(-toMoveX), Duration = new Duration(TimeSpan.FromMilliseconds(animationTime)) }; Storyboard.SetTarget(animationX, field); Storyboard.SetTargetProperty(animationX, new PropertyPath("(Canvas.Left)")); storyboard.Children.Add(animationX); IsAnimation = true; } if ((top + toMoveY) != 0) { DoubleAnimation animationY = new DoubleAnimation() { From = top, To = LimitTop(-toMoveY), Duration = new Duration(TimeSpan.FromMilliseconds(animationTime)) }; Storyboard.SetTarget(animationY, field); Storyboard.SetTargetProperty(animationY, new PropertyPath("(Canvas.Top)")); storyboard.Children.Add(animationY); IsAnimation = true; } if (IsAnimation) { storyboard.Begin(); storyboard.Completed += (ss, e) => { callback(); }; } else { callback(); } }
public void cameraMoveTo(double moveToX, double moveToY, CommonSettings.VoidCallBack callback) { cameraScrollTo(moveToX, moveToY, () => { if (callback != null) { callback(); } }); }
public void displaySkill(UIHost uihost, CommonSettings.VoidCallBack callback) { if (OLBattleGlobalSetting.Instance.battleData.currentSkill.actionType == "SKILL") { uihost.battleFieldContainer.field.ShowOLSkillAnimation(callback); } else { callback(); } }
public void Win(CommonSettings.VoidCallBack callback = null) { string uuid = OLBattleGlobalSetting.Instance.channel; BattleNetManager.Instance.CommitBattleResult(uuid, Me.Name, _opponent.Name, "", (ret, isTimeout) => { if (callback != null) { callback(); } } ); }
//public void Show(List<ImageSource> images, CommonSettings.VoidCallBack callback) public void Show(List <string> imagesUrls, CommonSettings.VoidCallBack callback) { downloadedImage = 0; progressBar.Value = 0; progressText.Text = "0%"; if (checkTimer == null) { this.InitCheckTimer(); } if (baseUrl == "") { baseUrl = GetURL(); } Callback = callback; if (imagesUrls == null || imagesUrls.Count == 0) { Finish(); } else { //先去掉已经缓存的图片 List <string> tobeRemovedImages = new List <string>(); foreach (var url in imagesUrls) { if (cachedKey.ContainsKey(url)) { tobeRemovedImages.Add(url); } } foreach (var img in tobeRemovedImages) { imagesUrls.Remove(img); } if (imagesUrls.Count == 0) { //this.Dispatcher.BeginInvoke(() => { Finish(); }); Finish(); return; } suggestTip.Show(); tobedownload = imagesUrls; totalDownloadedNumber = tobedownload.Count; this.Visibility = Visibility.Visible; StartDownload(); } }
public void Init(string name, ImageSource pic, string description, CommonSettings.VoidCallBack callback) { if (pic != null) { head.mainTexture = pic.Source; } else { NGUITools.SetActive(head.gameObject, false); } Callback = callback; info.text = name;// +":" + description; NGUITools.SetActive(this.gameObject, true); }
void Update() { CommonSettings.VoidCallBack task = null; lock (todoList) { if (todoList.Count > 0) { task = todoList.Dequeue(); } } if (task != null) { task(); } }
private void ShowDialogOld(string role, string info, CommonSettings.VoidCallBack callback) { this.Focus(); this.Head.Source = RoleManager.GetRole(role).Head; this.Text.Text = info; string roleName = RoleManager.GetRole(role).Name; if (roleName == "小虾米") { roleName = RuntimeData.Instance.maleName; this.Head.Source = RuntimeData.Instance.Team[0].Head; } else if (role == "铃兰") { roleName = RuntimeData.Instance.femaleName; } this.RoleName.Text = roleName + ":"; this.Visibility = System.Windows.Visibility.Visible; this.oldCallback = callback; }
public void ScrollIntoView(CommonSettings.VoidCallBack callback) { this.ParentBattleField.battleFieldContainer.cameraScrollTo(this.CanvasLeft, this.CanvasTop, callback); }
public void initCamera(CommonSettings.VoidCallBack callback) { Spirit role = field.Spirits[0]; cameraMoveTo(role.CanvasLeft, role.CanvasTop, callback); }
public void BeginInvoke(CommonSettings.VoidCallBack callback) { uiHost.AddTask(callback); }
static public void PlayRandomEffect(string[] paths, CommonSettings.VoidCallBack callback = null) { PlayEffect(ResourceManager.Get(paths[Tools.GetRandomInt(0, paths.Length) % paths.Length]), callback); }