public AppUpdateControl(IEnumerable<IAppVersion> appVersions, Action<IAppVersion> updateAction) { this.NewestVersion = appVersions.First(); InitializeComponent(); this.AppIconImage.ImageFailed += (sender, e) => { this.AppIconImage.Source = new BitmapImage(new Uri("/Assets/windows_phone.png", UriKind.RelativeOrAbsolute)); }; this.AppIconImage.Source = new BitmapImage(new Uri(HockeyClient.Current.AsInternal().ApiBaseVersion2 + "apps/" + NewestVersion.PublicIdentifier + ".png")); this.ReleaseNotesBrowser.Opacity = 0; this.ReleaseNotesBrowser.Navigated += (sender, e) => { (this.ReleaseNotesBrowser.Resources["fadeIn"] as Storyboard).Begin(); }; this.ReleaseNotesBrowser.NavigateToString(WebBrowserHelper.WrapContent(NewestVersion.Notes)); this.ReleaseNotesBrowser.Navigating += (sender, e) => { e.Cancel = true; WebBrowserTask browserTask = new WebBrowserTask(); browserTask.Uri = e.Uri; browserTask.Show(); }; this.InstallAETX.Click += (sender, e) => { WebBrowserTask webBrowserTask = new WebBrowserTask(); webBrowserTask.Uri = new Uri(HockeyClient.Current.AsInternal().ApiBaseVersion2 + "apps/" + NewestVersion.PublicIdentifier + ".aetx", UriKind.Absolute); webBrowserTask.Show(); }; this.InstallOverApi.Click += (sender, e) => { this.Overlay.Visibility = Visibility.Visible; updateAction.Invoke(NewestVersion); }; }
public void DisplayMessageUsingAction(Action<string> printMessageAction) { ConversionFunction = GetIdAsString; printMessageAction.Invoke(Name); printMessageAction.Invoke(Address); printMessageAction.Invoke(ConversionFunction.Invoke(Id)); }
/// <summary> /// Wraps code in a BeginTransaction and CommitTransaction /// </summary> /// <param name="action">The action.</param> public void WrapTransaction( Action action ) { if ( !_transactionInProgress ) { _transactionInProgress = true; using ( var dbContextTransaction = this.Database.BeginTransaction() ) { try { action.Invoke(); dbContextTransaction.Commit(); } catch ( Exception ex ) { dbContextTransaction.Rollback(); throw ( ex ); } finally { _transactionInProgress = false; } } } else { action.Invoke(); } }
public static void DownloadAsync(string url, Action<WebException, WebAlbum> callback) { var request = WebRequest.Create(new Uri(url)); _currentRequests.Add(request); request.BeginGetResponse(ar => { var currrentRequests = (List<WebRequest>)ar.AsyncState; try { using (var response = request.EndGetResponse(ar)) { var reader = XmlReader.Create(response.GetResponseStream()); callback.Invoke(null, GetAlbumDetails(reader)); } } catch (WebException ex) { callback.Invoke(ex, null); } catch (IOException ex) { //callback.Invoke(ex, null); //TODO: log web response fail (usually after abort) } finally { currrentRequests.Remove(request); } }, _currentRequests); }
public bool Display (string body, string cancelButtonTitle, string acceptButtonTitle = "", Action action = null, bool negativeAction = false) { AlertDialog.Builder alert = new AlertDialog.Builder (Forms.Context); alert.SetTitle ("Alert"); alert.SetMessage (body); alert.SetNeutralButton (cancelButtonTitle, (senderAlert, args) => { }); if (acceptButtonTitle != "") { if (!negativeAction) { alert.SetPositiveButton (acceptButtonTitle, (senderAlert, args) => { if (action != null) { action.Invoke (); } }); } else { alert.SetNegativeButton (acceptButtonTitle, (senderAlert, args) => { if (action != null) { action.Invoke (); } }); } } ((Activity)Forms.Context).RunOnUiThread (() => { alert.Show (); }); return true; }
public static async Task<string> GetRealVideoAddress(string url, Action<Error> onFail = null) { string address = string.Empty; DataLoader loader = new DataLoader(); await loader.LoadDataAsync(url, response => { RealVideoAddressData data = JsonSerializer.Deserialize<RealVideoAddressData>(response, true); if(data.Status.Equals("ok", StringComparison.OrdinalIgnoreCase)) { address = data.Info; } else { if(onFail != null) { onFail.Invoke(new Error() { Message = data.Info }); } } }, error => { if(onFail != null) { onFail.Invoke(error); } }); return address; }
public static JsonResult UploadFiles(this Controller controller, Action<UploadedFile> action) { if (controller.Request.IsAjaxRequest()) { try { action.Invoke(new UploadedFile( controller.Server.UrlDecode(controller.Request.Headers["x-file-name"]), controller.Request.InputStream )); return new JsonResult { Data = new { success = true } }; } catch (IOException ex) { return new JsonResult { Data = new { success = false, error = ex.Message } }; } } else { try { foreach (var key in controller.Request.Files.AllKeys) { var file = controller.Request.Files[key]; action.Invoke(new UploadedFile(file.FileName, file.InputStream)); } return new JsonResult { Data = new { success = true }, ContentType = "text/html" }; // IE fix } catch (IOException ex) { return new JsonResult { Data = new { success = false, error = ex.Message }, ContentType = "text/html" }; // IE fix } } }
public void DeleteFile(string fileName, Action<bool> completed = null) { try { string imagename = fileName.Replace (".pdf", ".jpeg").Replace (".mp4", ".jpeg"); var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); var directoryname = Path.Combine (documents, "Downloads"); if (Directory.Exists (directoryname)) { foreach (var file in Directory.GetFiles(directoryname)) { var item = file.Substring (file.LastIndexOf ("/") + 1, file.Length - 1 - file.LastIndexOf ("/")); if (item == fileName || item == imagename) { File.Delete (file); } } } //File.Delete (fileItem.FilePath.Replace("file://","")); //File.Delete (fileItem.ThumbPath.Replace("file://","")); completed.Invoke (true); } catch { completed.Invoke (false); throw; } }
/// <summary> /// perform an Action while using a shared lock on main thread. /// </summary> /// <param name="safeAction">Action to perform</param> public static void UsingShared(Action unsafeAction) { if (ThreadTracker.IsGameThread) unsafeAction.Invoke(); else using (Lock_MainThread.AcquireSharedUsing()) unsafeAction.Invoke(); }
void BuildFromDatasource(DataSourcePropertyAttribute dataSourcePropertyAttribute, Action<IEnumerable<string>, bool> itemsCalculated) { CompositeView compositeView = _propertyEditor.View; if (compositeView!=null) { compositeView.ObjectSpace.ObjectChanged += (sender, args) => { var comboBoxItems = GetComboBoxItems(dataSourcePropertyAttribute); itemsCalculated.Invoke(comboBoxItems,true); }; itemsCalculated.Invoke(GetComboBoxItems(dataSourcePropertyAttribute),false); } }
private void Grid_Loaded(object sender, RoutedEventArgs e) { try{ ImageSourceConverter isc = new ImageSourceConverter(); string strDir = @"C:\ProgramData\MyIPWebcamTimeLapse\MyIPWebcamTimeLapse\1.0.0.4\192.168.1.13\20130311\"; Action act = new Action(() => { try { foreach (string fil in System.IO.Directory.EnumerateFiles(strDir)) { if (!liss.ContainsKey(fil)) { ImageSource iss = isc.ConvertFromString(fil) as ImageSource; liss.Add(fil, iss); } } } catch (Exception ec) { string sdsldkfjsldkjf = ec.Message; } }); act.Invoke(); int i = 0; TimerCallback tc = new TimerCallback((a) => { act.Invoke(); try { SetImageCallback d = new SetImageCallback((ims,_i)=>{ image1.Source = ims; this.Title =_i+"."+ System.DateTime.Now.ToString("HH:mm:ss"); }); this.Dispatcher.Invoke(d,liss.Select(x => x.Value).ToArray()[i],i); } catch (Exception ex) { string s = ex.Message; } i++; if(i == liss.Count) i=1; }); System.Threading.Timer tim = new Timer(tc,null,0,50); } catch (Exception ec) { string sdsldkfjsldkjf = ec.Message; } }
/// <summary> /// Enqueues another action without considering the cancellation token. /// </summary> /// <param name="loop">The loop to extend.</param> /// <param name="action">The action to enqueue.</param> /// <param name="priority">The priority of the item.</param> public static void Enqueue(this IEventLoop loop, Action action, TaskPriority priority = TaskPriority.Normal) { if (loop != null) { loop.Enqueue(c => action.Invoke(), priority); } else { action.Invoke(); } }
public static void ThreadSafeInvoke(DispatcherPriority priority, Action action) { if (Application.Current.Dispatcher.CheckAccess()) { action.Invoke(); } else { Application.Current.Dispatcher.Invoke(priority, new Action(delegate() { action.Invoke(); })); } }
public void DeleteAllMedia(Action<bool> completed = null) { try { var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); var directoryname = Path.Combine (documents, "Downloads"); if (Directory.Exists (directoryname)) { foreach (var file in Directory.GetFiles(directoryname)) { File.Delete (file); } } completed.Invoke (true); } catch (Exception ex) { completed.Invoke (false); } }
internal static bool HandleError(JObject json, Action<int> error) { if (json == null) { error.Invoke(6); // Illegal Response return true; } if (json["error"] != null) { error.Invoke(json["error"].Value<int>(0)); return true; } return false; }
public static bool AckResponse <TEvent>(this CancellationToken token, Action <TEvent> handler, Action <Action <TEvent> > subscribe, Action <Action <TEvent> > unsubscribe, int msTimeout, System.Action initializer = null) { var q = new BlockingCollection <TEvent>(); Action <TEvent> add = item => q.TryAdd(item); subscribe(add); try { initializer?.Invoke(); TEvent eventResult; while (q.TryTake(out eventResult, msTimeout, token)) { handler?.Invoke(eventResult); if ((string)(object)eventResult == "ok") { return(true); } } return(false); } finally { unsubscribe(add); q.Dispose(); } }
void PlacePanel(CardPanel panel, System.Action onComplete = null) { bool hadMetadata = panel.TrySetupFromMetadata(); if (!hadMetadata) { float width = panel.GetReferenceRectTransform().rect.width; panel.SetPosition(Vector2.zero); /* if (panels.Count == 0) * { * panel.SetPosition(Vector2.zero); * } * else * { * panel.SetPosition(panels[panels.Count - 1].rectTransform.anchoredPosition + new Vector2(panels[panels.Count - 1].GetReferenceRectTransform().rect.width, 0) + new Vector2(width / 2f, 0)); * } */ //addPanelRect.anchoredPosition += new Vector2(width, 0); // Save position metadata, but don't create an undo item. The user didn't // do this. panel.SetUseMetadata(null); } onComplete?.Invoke(); }
public static IEnumerator nudgePlayer(LocomotionTracker locomotionTracker, System.Action nudgeCompleted = null) { float finishTime = Time.time + UnityEngine.Random.Range(0.2f, 0.4f); _ = Vector2.down; Vector2 direction; switch (UnityEngine.Random.Range(1, 5)) { case 1: direction = Vector2.up; break; case 2: direction = Vector2.left; break; case 3: direction = Vector2.right; break; default: direction = Vector2.down; break; } while (Time.time < finishTime && !locomotionTracker.gameObject.IsDestroyed()) { locomotionTracker.GetCurrentController().Steer(direction); yield return(null); } nudgeCompleted?.Invoke(); }
public static IEnumerator WaitForEventFromEngine <T>(string targetMessageType, T evt, System.Action OnIterationStart, Func <T, bool> OnSuccess) { // Hook up to web interface engine message reporting DCL.Interface.WebInterface.OnMessageFromEngine += OnFirstMessageFromEngine; lastMessageFromEngineType = ""; lastMessageFromEnginePayload = ""; yield return(new DCL.WaitUntil(() => { OnIterationStart?.Invoke(); if (!string.IsNullOrEmpty(lastMessageFromEnginePayload) && lastMessageFromEngineType == targetMessageType) { var messageObject = JsonUtility.FromJson <T>(lastMessageFromEnginePayload); if (OnSuccess != null) { return OnSuccess.Invoke(messageObject); } } return false; }, 2f)); }
// 资源回调 private void Handle_Completed(AssetOperationHandle obj) { TextAsset temp = _handle.AssetObject as TextAsset; if (temp != null) { try { SecurityParser sp = new SecurityParser(); sp.LoadXml(temp.text); _xml = sp.ToXml(); // 解析数据 if (_xml != null) { ParseData(); } } catch (Exception ex) { LogSystem.Log(ELogType.Error, $"Failed to parse xml {Location}. Exception : {ex.ToString()}"); } } // 注意:为了节省内存这里立即释放了资源 if (_assetRef != null) { _assetRef.Release(); _assetRef = null; } _userCallback?.Invoke(); }
private void ServerDisconnectHandler(object sender, string message) { Debug.Log(string.Format("ServerDisconnectHandler." + "Client was disconnected by {0} with reason:\n{1}", sender.ToString(), message)); if (connectionWaitingCoroutine != null) { Debug.Log("Stop connectionWaitingCoroutine"); StopCoroutine(connectionWaitingCoroutine); connectionWaitingCoroutine = null; } if (currentServerConnection != null) { currentClient = null; currentServerConnection = null; LostConnectionEvent?.Invoke(); } //if (checkConnectionCoroutine != null) //{ // Debug.Log("Stop checkConnectionCoroutine"); // StopCoroutine(checkConnectionCoroutine); // checkConnectionCoroutine = null; //} }
public static IEnumerator WaitForMessageFromEngine(string targetMessageType, string targetMessageJSONPayload, System.Action OnIterationStart, System.Action OnSuccess) { // Hook up to web interface engine message reporting DCL.Interface.WebInterface.OnMessageFromEngine += OnMessageFromEngine; lastMessageFromEngineType = ""; lastMessageFromEnginePayload = ""; bool awaitedConditionMet = false; yield return(new DCL.WaitUntil(() => { OnIterationStart?.Invoke(); if (lastMessageFromEngineType == targetMessageType && lastMessageFromEnginePayload == targetMessageJSONPayload) { DCL.Interface.WebInterface.OnMessageFromEngine -= OnMessageFromEngine; OnSuccess?.Invoke(); awaitedConditionMet = true; } return awaitedConditionMet; }, 2f)); }
private void SetFade(bool isIn, float duration, System.Action action) { canvasGroup.alpha = isIn ? 0 : 1; canvasGroup.DOFade(isIn ? 1 : 0, duration) .SetEase(fadeCurve) .OnComplete(() => action?.Invoke()); }
public ISessionFactory Build(Action<Configuration> additionalConfiguration = null) { ISessionFactory sessionFactory = GetFluentConfiguration().BuildSessionFactory(); if (additionalConfiguration != null) additionalConfiguration.Invoke(NHibernateConfiguration); return sessionFactory; }
public IEnumerable<IBe> Evolve(Action<IEnumerable<IBe>, int> perIteractionAction) { currentIteration = 0; while (currentIteration <= god.maximunIteration) { List<IBe> currentPopulation = new List<IBe>(); for (int i = 0; i < god.maximunOffspring; i++) { var operation = randomOperation.GetOperation(); switch (operation) { case Operations.Mutation: currentPopulation = currentPopulation.Concat(darwin.Mutate(god.GetSingle(population, i))).ToList(); break; case Operations.CrossOver: var couple = god.GetCouple(population, i); currentPopulation = currentPopulation.Concat(darwin.Conceive(couple.Item1, couple.Item2)).ToList(); break; } } population = population.Union(darwin.CalculateSolution(currentPopulation)).OrderBy(n => -n.Solution).Distinct(comparer).Take(god.maximunOffspring).ToList(); if (perIteractionAction != null) perIteractionAction.Invoke(population, currentIteration); currentIteration++; } return population; }
public void ReadTo(Action<SqlCeDataReader> readerAction) { try { using (var connection = new SqlCeConnection(ConnectionString)) { connection.Open(); using (var transaction = connection.BeginTransaction()) { using (var command = connection.CreateCommand()) { command.CommandText = _commandText; SetParametersToCommand(command); using (var reader = command.ExecuteReader()) { while (reader.Read()) { readerAction.Invoke(reader); } } } } } } catch (SqlCeLockTimeoutException ex) { Thread.Sleep(TimeSpan.FromMilliseconds(500)); ReadTo(readerAction); } catch (Exception ex) { LogOrSendMailToAdmin(ex); throw; } }
public LibraryDataGridSortingCommand(object source, Action<DataGridSortingEventArgs> afterAction = null) : base(source, args => { var lcv = CollectionViewSource.GetDefaultView(source) as ListCollectionView; if (lcv != null ) { if (args.Column.Header.ToString() == "No" && !args.Handled) { args.Handled = true; ListSortDirection direction = (args.Column.SortDirection != ListSortDirection.Ascending) ? ListSortDirection.Ascending : ListSortDirection.Descending; args.Column.SortDirection = direction; lcv.CustomSort = new LibararyNoNaturalComparer(direction); } else { lcv.CustomSort = null; } } if(afterAction != null) afterAction.Invoke(args); }) { }
public FakeAssembly(Action<FakeAssemblyConfigurator> closure) { var configurator = new FakeAssemblyConfigurator(this); closure.Invoke(configurator); }
public void Display (string body, string title, GoalsAvailable availableGoal, string cancelButtonTitle, string acceptButtonTitle = "", Action<GoalsAvailable, int> action = null) { EditText goalTextBox = new EditText (Forms.Context); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder (Forms.Context); alertDialogBuilder.SetTitle (title); alertDialogBuilder.SetMessage (body); alertDialogBuilder.SetView (goalTextBox); goalTextBox.InputType = Android.Text.InputTypes.NumberFlagSigned; var inputFilter = new Android.Text.InputFilterLengthFilter (7); var filters = new Android.Text.IInputFilter[1]; filters [0] = inputFilter; goalTextBox.SetFilters (filters); goalTextBox.InputType = Android.Text.InputTypes.ClassNumber; alertDialogBuilder.SetPositiveButton ("OK", (senderAlert, args) => { if(action != null) { int goalValue; int.TryParse(goalTextBox.Text, out goalValue); action.Invoke(availableGoal, goalValue); } } ); alertDialogBuilder.SetNeutralButton ("CANCEL", (senderAlert, args) => { } ); alertDialogBuilder.Show (); }
public void ActionLock(Action<List<TraceEvent>> action) { lock (this) { action.Invoke(events); } }
public FakeNancyModule(Action<FakeNancyModuleConfigurator> closure) { var configurator = new FakeNancyModuleConfigurator(this); closure.Invoke(configurator); }
public static void Dispatcher(this UIElement element, Action invokeAction) { if (element.Dispatcher.CheckAccess()) { invokeAction.Invoke(); } else element.Dispatcher.Invoke(invokeAction); }
public static void Measure(Action action) { var sw = Stopwatch.StartNew(); action.Invoke(); sw.Stop(); Console.WriteLine("Elapsed:" + sw.ElapsedMilliseconds); }
public static void BasicWorkflow(Action load, Action execute, Action finish, Action unload) { load.Invoke(); execute.Invoke(); finish.Invoke(); unload.Invoke(); }
public static void Dispatcher(this Application app, Action invokeAction) { if (app.Dispatcher.CheckAccess()) { invokeAction.Invoke(); } else app.Dispatcher.Invoke(invokeAction); }
public IContextualTabs AddTabSet(Action<ITabSetId> value) { var item = new TabSet(); value.Invoke(item); items.Add(item); return this; }
/// <summary> /// Initializes a new instance of the <see cref="ConfigurableResponseProcessor"/> class, /// with the procided configuration. /// </summary> /// <param name="action"></param> public ConfigurableResponseProcessor(Action<ConfigurableResponseProcessorConfigurator> action) { var configurator = new ConfigurableResponseProcessorConfigurator(this); action.Invoke(configurator); }
public void It(string description, Action callee) { Check.IsNotNull(description); Logger.Information("Enter It \"{0}\"", description); if (!this.bInitialized && this.beforeAll != null) { Logger.Information("Invoke BeforeAll()"); this.beforeAll.Invoke(); bInitialized = true; } if (null != beforeEach) { Logger.Information("Invoke BeforeEach()"); beforeEach.Invoke(); } if (null != callee) { Logger.Information("Invoke It.callee()"); callee.Invoke(); } if (null != afterEach) { Logger.Information("Invoke AfterEach()"); afterEach.Invoke(); } }
void LoadListFields(bool isFromListChange = false, System.Action continueWith = null) { if (!IsListSelected) { continueWith?.Invoke(); return; } var selectedSharepointServer = SelectedSharepointServer; var selectedList = SelectedList; // ReSharper disable ImplicitlyCapturedClosure _asyncWorker.Start(() => GetListFields(selectedSharepointServer, selectedList), columnList => // ReSharper restore ImplicitlyCapturedClosure { if (columnList != null) { var fieldMappings = columnList.Select(mapping => { var recordsetDisplayValue = DataListUtil.CreateRecordsetDisplayValue(selectedList.FullName.Replace(" ", "").Replace(".", ""), GetValidVariableName(mapping), "*"); var sharepointReadListTo = new SharepointReadListTo(DataListUtil.AddBracketsToValueIfNotExist(recordsetDisplayValue), mapping.Name, mapping.InternalName, mapping.Type.ToString()) { IsRequired = mapping.IsRequired }; return(sharepointReadListTo); }).ToList(); if (ReadListItems == null || ReadListItems.Count == 0 || isFromListChange) { ReadListItems = fieldMappings; } else { foreach (var sharepointReadListTo in fieldMappings) { var listTo = sharepointReadListTo; var readListTo = ReadListItems.FirstOrDefault(to => to.FieldName == listTo.FieldName); if (readListTo == null) { ReadListItems.Add(sharepointReadListTo); } } } ListItems = ReadListItems; } continueWith?.Invoke(); }); }
private IEnumerator DrawWeapon() { _drawWeapon?.Invoke(); float timeToFinish = 1.5f; AnimationUtility.GetCurrentAnimatorTime(_characterAnimator, 1); print(timeToFinish); yield return(new WaitForSeconds(timeToFinish)); }
public virtual void RequestOpen() { if (!IsOpenedOrOpening()) { OnOpen?.Invoke(); } sidebarManager.RequestOpen(this); }
private IEnumerator SendRequestWithActionImpl(System.Action action) { yield return(new WaitUntil(() => authorization.IsValid() && url.IsValid())); yield return(SendRequest(url, authorization)); action?.Invoke(); }
public void ChangeGun(string gunName) { if (CurrentGunName != gunName) { CurrentGunName = gunName; OnGunChange?.Invoke(); } }
private void OnPrintCompleted(DialogCommaType commaType, System.Action callback) { ShowComma(commaType); PlayEmojiAnimation(StopHash); callback?.Invoke(); textTyper.PrintCompleted.RemoveAllListeners(); textTyper.CharacterPrinted.RemoveAllListeners(); }
public void ResetObject() { if (LOG_MESSAGES) { Debug.Log($"RECEIVE: ResetObject"); } OnResetObject?.Invoke(); }
protected IEnumerator WaitFor(float Time, System.Action before = null, System.Action after = null) { before?.Invoke(); yield return(new WaitForSeconds(Time)); after?.Invoke(); }
private void OnHealthChanged(float value) { if (value <= 0f) { //EnemyDeath enemyDied?.Invoke(); } }
protected virtual void OnTransferSuccess() { if (!isConnectionStabilised) { isConnectionStabilised = true; ConnectionStabilised?.Invoke(); } }
public void Complete() { if (!isCompleted) { action?.Invoke(); isCompleted = true; } }
/// <summary> /// 相机推进:模型dotween位移 /// </summary> /// <param name="obj">tween目标位置</param> /// <param name="tarPos">tween目标位置</param> /// <param name="delayTime">tween时间</param> /// <param name="Complete">tween完成回调函数</param> /// <param name="isWorld">是否世界坐标</param> public static void DoTweenModel(GameObject obj, Vector3 tarPos, float delayTime, System.Action Complete, bool isWorld) { if (isWorld) { obj.transform.DOMove(tarPos, delayTime).onComplete = () => { Complete?.Invoke(); }; } else { obj.transform.DOLocalMove(tarPos, delayTime).onComplete = () => { Complete?.Invoke(); }; } }
public void ResetBuilderCameraZoom() { if (LOG_MESSAGES) { Debug.Log($"RECEIVE: ResetBuilderCameraZoom"); } OnResetCameraZoom?.Invoke(); }
private void StartFade(float toValue, float duration, System.Action onComplete = null) { StopFade(); _fadeTweener = DOTween .To(() => SkeletonAnimation.skeleton.A, value => SkeletonAnimation.skeleton.A = value, toValue, duration) .OnComplete(() => onComplete?.Invoke()) .Play(); }
private void UpdateVisualizerLevelUp(System.Action _callback) { progressVisual?.UpdateLevelUp(CurrentLevel.Level / (float)levels.Length, _callback); if (progressVisual == null) { _callback?.Invoke(); } }
public IEnumerator LoadDataForDefinitions(Type[] definitionTypesToLoad, System.Action onComplete = null) { if (!loadedDefinitions) { ICoroutine coroutine = CoroutineRunner.Start(loadData(definitionTypesToLoad), this, "LoadData"); while (!coroutine.Completed && !coroutine.Cancelled) { yield return(null); } loadedDefinitions = true; onComplete?.Invoke(); } else { onComplete?.Invoke(); } }
void PreviewBlendshapeField(string label, int buttonIndex, SerializedProperty blendShapeIndex, System.Action onSetActive = null) { if (_eyelidBlendshapeNames == null) { return; } bool setActive = false; GUILayout.BeginHorizontal(); { //Dropdown EditorGUI.BeginChangeCheck(); blendShapeIndex.intValue = EditorGUILayout.Popup(label, blendShapeIndex.intValue + 1, _eyelidBlendshapeNames) - 1; if (EditorGUI.EndChangeCheck()) { SetActiveProperty(null); setActive = true; } //Preview bool isActiveProperty = IsActiveProperty(blendShapeIndex); GUI.backgroundColor = isActiveProperty ? _activeButtonColor : Color.white; if (GUILayout.Button(isActiveProperty ? "Return" : "Preview", EditorStyles.miniButton, GUILayout.MaxWidth(PreviewButtonWidth)) || setActive) { if (isActiveProperty) { SetActiveProperty(null); } else { onSetActive?.Invoke(); SetActiveProperty(blendShapeIndex); //Record RecordBlendShape(blendShapeIndex.intValue); //Other onSetActive?.Invoke(); } } GUI.backgroundColor = Color.white; } GUILayout.EndHorizontal(); }
public override void Setup() { base.Setup(); openSaveFolder.onClick.AddListener(OpenSaveFolder); #if USE_STEAMWORKS openSteamWorkshop.onClick.AddListener(() => openWorkshop?.Invoke()); openSteamWorkshopSecondary.onClick.AddListener(() => openWorkshop?.Invoke()); #else openSteamWorkshop.gameObject.SetActive(false); openSteamWorkshopSecondary.gameObject.SetActive(false); #endif AddCategory(null); AddCategory(SAVED); AddCategory(WORKSHOP); AddCategory(AUTOSAVES); SetCategoryEnabled(SAVED, showMyGamesToggle.isOn); #if USE_STEAMWORKS SetCategoryEnabled(WORKSHOP, showWorkshopGamesToggle.isOn); SetCategoryLoading(WORKSHOP, true); #else SetCategoryEnabled(WORKSHOP, false); showWorkshopGamesToggle.gameObject.SetActive(false); #endif SetCategoryEnabled(AUTOSAVES, showAutosavesToggle.isOn); searchField.onValueChanged.AddListener((searchString) => SetSearchString(searchString)); searchClear.onClick.AddListener(() => searchField.text = ""); showWorkshopGamesToggle.onValueChanged.AddListener( (on) => SetCategoryEnabled(WORKSHOP, showWorkshopGamesToggle.isOn)); showMyGamesToggle.onValueChanged.AddListener( (on) => SetCategoryEnabled(SAVED, showMyGamesToggle.isOn)); showAutosavesToggle.onValueChanged.AddListener( (on) => SetCategoryEnabled(AUTOSAVES, showAutosavesToggle.isOn)); SetOpenEvent(CreateThumbnails); templateSelectorMenu.Setup(); templateSelectorMenu.Close(); gameDetail = Instantiate(gameDetailPrefab).GetComponent <GameDetail>(); UpdateSort(); }
public void Open() { gameObject.SetActive(true); Show(); Populate(); onOpen?.Invoke(); darkBackground.SetActive(true); cardManager.DisablePointerState(); }
private void PlayEnd(System.Action callback = null) { _finishRef++; if (_finishRef >= ItemCount + _playTimeRef) { _isPlaying = false; callback?.Invoke(); } }
private IEnumerator CorLoadByWWWurl(RawImage rawImage, string url, [CanBeNull] System.Action callback) { WWW www = new WWW(url); yield return(new WaitUntil(() => www.isDone)); rawImage.texture = www.texture; callback?.Invoke(); }
public void Fill() { this.gameObject.GetComponent <Renderer>().material.color = SavingColor; print("Rengi degisti"); //to do process bar ++ OnPainted += LevelManager.Instance.OnBlockPainted; OnPainted?.Invoke(); gameObject.GetComponent <Collider>().enabled = false; }