public override void play(String clipName, callback method = null) { if (audioPlayers.Count <= 0 || clips.Count <= 0) { return; } float maxTime = -1; AudioSource player = _center; // specific clip data. switch 的传入判断值必须在运行时就已经是既定值,即 const 不能作为判断对象。 switch (clipName) { case PlayerAudioData.SWITCH_OBSTACLE_CLIP: player = _switch; break; default: break; } AudioPlayObj obj = new AudioPlayObj(selectClip(clipName), this, player, maxTime); AudioPlayCtrl.getInstance().addEffectObj(obj); if (method != null) { AudioPlayCtrl.getInstance().addCallbackToEffectClip(clipName, method); } }
public dot add_dot(float total_time, float duration, callback cb_each, callback when_end) { dot d = new dot(total_time, duration, cb_each, when_end); dots.Add(d.guid, d); return(d); }
public void longRunning(callback obj) { for (int i = 0; i <= 1000; i++) { obj(i); } }
public void loadContent() { if (this.listClass.InvokeRequired) { callback d = new callback(loadContent); this.Invoke(d, new object[] { }); } else { classList = UtilityDB.getClasses(); lblUser.Text = lblUser.Text.ToUpper(); fillTicketID(); fillListClass(); if (listClass.Items.Count > 0) { listClass.SetSelected(0, true); fillListName(); } if (comboName.Items.Count > 0) { comboName.SelectedIndex = 0; } lblUser.Text = lblUser.Text.ToUpper(); } }
public void TimesAdd(float times, callback call) { //print("???? 单次计时 " + times); GetStopByTime(times); isDanciTimes2 = true; _call = call; }
// 因为音频播放是异步的,方便及时增加播放后的回调内容 public void addCallbackToEffectClip(System.String clipName = "", callback method = null) { if (method == null) { ProjectUtils.Warn("addCallbackToEffectClip Lost method"); return; } ; // 适配,当 audio 刚刚加入队列时, _effectClipObj 并未被赋值 if (!clipName.Trim().Equals("")) { // 避免同名对象进入而使得 callback 没有成功绑定 for (int i = _effectClipPlayList.Count - 1; i >= 0; i--) { AudioPlayObj obj = _effectClipPlayList[i]; if (obj.clip.name == clipName) { obj.handle += method; return; } } } }
public void Start(long timeout, long repeat, Action callback) { cb = delegate(IntPtr h, int status) { callback(); }; Start(timeout, repeat, cb); }
private void clearCallback() { cancelCallback = null; buyCallback = null; sellCallback = null; price = 0; }
// 添加背景音乐播放 public override void play(System.String clipName, callback method = null) { if (audioPlayers.Count <= 0 || clips.Count <= 0) { return; } float maxTime = -1; AudioSource player = _atom; switch (clipName) { case "": player.clip = null; return; } AudioPlayObj obj = new AudioPlayObj(selectClip(clipName), this, player, maxTime); AudioPlayCtrl.getInstance().addBackgroundObj(obj); if (method != null) { AudioPlayCtrl.getInstance().addCallbackToBackgroundClip(clipName, method); } }
public Question(JObject jo, callback _cb) { InitializeComponent(); cb = _cb; JToken question = jo["spins_data"]["spins"][0]["questions"][0]["question"]; type = jo["spins_data"]["spins"][0]["type"].Value <string>(); string _text = question["text"].Value <string>(); category = question["category"].Value <string>(); id = question["id"].Value <string>(); questionBox.Text = _text; categoryBox.Text = category; spinTypeBox.Text = type; List <JToken> answers = question["answers"].ToList(); for (int i = 0; i < answers.Count(); ++i) { answerList.Items.Add(answers[i].Value <string>()); } answerList.SelectedIndex = question["correct_answer"].Value <int>(); }
public void Add(int id, callback cb) { dict.Add(id, cb); string str = string.Format("监听 mainID:{0} ", id); Debug.Log(str); }
public hourglass add_hourglass(float total_time, callback cb) { hourglass hg = new hourglass(total_time, cb); hourglasses.Add(hg.guid, hg); return(hg); }
public void init(Camera gameCamera, float time, float size, Type type = Type.Horiz, callback cb = null, MethodType method = MethodType.ByMath) { if (isReady) { _type = type; _method = method; _time = time; _camera = gameCamera.gameObject.transform.parent.transform; //gameCamera.transform; _size = size; _oriPos = _camera.localPosition; //_oriPos.x = GameManager.screenCenter.x; //_oriPos.y = GameManager.screenCenter.y; _isInit = true; isReady = false; _value = 1.0f; _prevTime = Time.realtimeSinceStartup; _nowTime = Time.realtimeSinceStartup; _endTime = Time.realtimeSinceStartup + time; _callback = cb; } }
public UVTimer(Loop loop) : base(loop, HandleType.UV_TIMER) { int r = uv_timer_init(loop.NativeHandle, NativeHandle); Ensure.Success(r); cb = OnTick; }
public TimeEvent(TimeSpan _time, callback _funcCallBack) { this.time = _time; this.funcCB = _funcCallBack; this.dataCB = null; this.next = null; this.prev = null; }
public void SetEvent( string _path, callback _callback ) { Transform t = transform.Find (_path); if(t!=null){ ifcButton btn = t.gameObject.GetComponent<ifcButton>(); if( btn!=null ) btn.ifcEvento = (_callback); } }
public void Add(callback method, float insecond) { events.Add(new TimedEvent { Method = method, TimeToExecute = Time.time + insecond }); }
public void Start(long timeout, long repeat, Action<Timer, int> callback) { cb = delegate (IntPtr h, int status) { callback(this, status); }; Start(timeout, repeat, cb); }
//连续间隔时间 返回 public void ContinuouslyTimesAdd(float timeNums, float intervals, callback call) { _maxTimesNum = timeNums / intervals; _timeNums = _maxTimesNum; _intervals = intervals; //print("!!!!!!!!!! "+ _timeNums); _call = call; }
public TimeEvent(TimeSpan _time, callback _funcCallBack) { this.time = _time; this.funcCB = _funcCallBack; this.dataCB = null; this.next = null; this.prev = null; }
public callback setToggle(callback toggle) { EventTrigger evt = GetComponent<EventTrigger>(); EventTrigger.Entry ent = new EventTrigger.Entry(); ent.eventID = EventTriggerType.PointerClick; ent.callback.AddListener((data) => { toggle(); }); evt.triggers.Add(ent); return () => { evt.triggers.Remove(ent); }; }
public void PlayAnimation(Sprite[] frameArr, float duration, callback onLoopEnd) { onFrame = null; frameArray = frameArr; animating = true; currentFrame = 0; this.duration = duration; timer = framerate; cb = onLoopEnd; }
public dot(float target, float duration, callback cb_each, callback when_end) { this.target = target; this.reach_total = 0; this.reach = 0; this.duration = duration; this.cb_each = cb_each; this.when_end = when_end; this.guid = System.Guid.NewGuid(); }
internal void Start(long timeout, long repeat, callback callback) { if (Running) { Stop(); } Running = true; LongRepeat = repeat; uv_timer_start(handle, callback, timeout, repeat); }
void EndJump() { t._gameTime = _fixedGameTime; SetSpeed(0); _canAcceptPlayerInput = true; if (_jumpCB != null) { _jumpCB(); _jumpCB = null; } }
public void setReload() { if (this.InvokeRequired) { callback d = new callback(loadContent); this.Invoke(d, new object[] { }); } else { reload = true; } }
public void GoToHomePlanet() { if (formMain.InvokeRequired) { callback inv = new callback(this.GoToHomePlanet); formMain.Invoke(inv, new object[] { }); } else { tabMaster.SelectedIndex = 2; } }
public void FocusPassword() { if (formMain.InvokeRequired) { callback inv = new callback(this.FocusPassword); formMain.Invoke(inv, new object[] { }); } else { txtPassword.Focus(); } }
void setLine(Point p0, Point p1, callback builder) { int w = p1.X - p0.X; int h = p1.Y - p0.Y; int x = Math.Min(p0.X, p1.X); int y = Math.Min(p0.Y, p1.Y); int x2 = Math.Max(p0.X, p1.X); int y2 = Math.Max(p0.Y, p1.Y); x = Math.Max(x, 0); y = Math.Max(y, 0); x2 = Math.Min(x2, xMax); y2 = Math.Min(y2, yMax); int aw = Math.Abs(w); int ah = Math.Abs(h); bool b = (w * h < 0); if (aw > ah) { if (b) { for (int i = 0; i <= aw; i++) { builder(x + i, y2 - ah * i / aw); } } else { for (int i = 0; i <= aw; i++) { builder(x + i, y + ah * i / aw); } } } else { if (b) { for (int i = 0; i <= ah; i++) { builder(x2 - aw * i / ah, y + i); } } else { for (int i = 0; i <= ah; i++) { builder(x + aw * i / ah, y + i); } } } onVoxelUpdated(new Rectangle(x, y, aw + 1, ah + 1)); }
public void FocusUsername() { if (formMain.InvokeRequired) { callback inv = new callback(this.FocusUsername); formMain.Invoke(inv, new object[] { }); } else { txtUsername.Focus(); } }
public void removeCallback(string notificationName, callback method_in) { // Если событие есть if (callback_storage.ContainsKey(notificationName)) { // Если у этого события есть такой же метод if (((ArrayList)callback_storage[notificationName]).Contains(method_in)) { // Удаляем этот метод ((ArrayList)callback_storage[notificationName]).Remove(method_in); } } }
private void HitTheGround() { int numSpiders = Random.Range(1, 3); for (int i = 0; i < numSpiders; i++) { Vector3 spawnPos = transform.position + Random.onUnitSphere; spawnPos.y = 0.5f; // TODO: Use gravity instead Instantiate(spiderMinionPrefab, spawnPos, Quaternion.identity); } nextPositionAction = null; Invoke("ClimbToCeiling", 2f); }
//删除一个类型的,一个指定回调 public static void removeListener(string type, callback fn) { if (dict.ContainsKey(type)) { List <EventCallback> list = dict[type] as List <EventCallback>; //StarEngine.Debuger.LogTrace("````````````````````````````删除了侦听:" + type); list.RemoveAll(x => x.cb == fn); if (list.Count <= 0) { dict.Remove(type); } } }
// 这个功能是有可复用性的,只是针对 playeAudioCtrl 并不有效 public virtual void play(String clipName, callback method = null) { if (audioPlayers.Count > 0 && clips.Count > 0) { AudioPlayObj obj = new AudioPlayObj(selectClip(clipName), this, audioPlayers[0], 3.5f); AudioPlayCtrl.getInstance().addEffectObj(obj); if (method != null) { AudioPlayCtrl.getInstance().addCallbackToEffectClip(clipName, method); } } }
public Producer(ProducerConfig config, callback ack) { this.config = config; this.ack = ack; this.client = new Client(config.BootstrapServers); this.bufferPool = new BufferPool(config.BufferMemoryBytes); this.networkCts = new CancellationTokenSource(); this.networkTask = StartNetworkTask(networkCts.Token); this.finalizeTaskCts = new CancellationTokenSource(); this.finalizeTask = StartBufferFinalizeTask(finalizeTaskCts.Token); }
public void select(string itemName, int price, bool canSell, callback cancelCallback = null, callback buyCallback = null, callback sellCallback = null) { this.price = price; itemNameText.text = itemName; itemPriceText.text = "$" + price; if (canSell) { sellButton.SetActive(true); } else { sellButton.SetActive(false); } this.cancelCallback = cancelCallback; this.buyCallback = buyCallback; this.sellCallback = sellCallback; holder.SetActive(true); }
private void searchMEM(){ string query = textBoxQuery.Text.Trim().ToLower(); string[] patterns = query.Split(' '); this.resultList = new List<MusikFile>(); foreach (string str in list) { bool found = true; foreach (string pattern in patterns) { if (!str.Contains(pattern)) { found = false; } } if (found) { try { this.resultList.Add(new MusikFile(str)); } catch (Exception) { } } } lock (locker) { this.searching = false; } callback endSearchDelegate = new callback(endSearch); this.Invoke(endSearchDelegate); }
public UVTimer(Loop loop) : base(loop, HandleType.UV_TIMER) { uv_timer_init(loop.NativeHandle, NativeHandle); cb = OnTick; }
public ClientGetAsync(callback c) { this.Callback = c; }
internal Listener(Loop loop, UvHandleType type) : base(loop, type) { DefaultBacklog = 128; listen_cb = listen_callback; }
internal static extern int uv_write_win(IntPtr req, IntPtr handle, WindowsBufferStruct[] bufs, int bufcnt, callback callback);
internal static extern int uv_write_unix(IntPtr req, IntPtr handle, UnixBufferStruct[] bufs, int bufcnt, callback callback);
// class constructor public worker(string pn, byte[] wb, callback cb) { portName = pn; writeBuffer = wb; callBack = new callback(cb); }
internal static extern int uv_listen(IntPtr stream, int backlog, callback callback);
internal void Start(long timeout, long repeat, callback callback) { if (Running) { Stop(); } Running = true; LongRepeat = repeat; uv_timer_start(handle, callback, timeout, repeat); }
internal static extern int uv_timer_start(IntPtr timer, callback callback, long timeout, long repeat);
internal static extern int uv_udp_send_win(IntPtr req, IntPtr handle, WindowsBufferStruct[] bufs, int bufcnt, sockaddr_in addr, callback callback);
internal static extern int uv_udp_send_unix(IntPtr req, IntPtr handle, UnixBufferStruct[] bufs, int bufcnt, sockaddr_in addr, callback callback);
internal static string ToString(int size, callback func) { IntPtr ptr = IntPtr.Zero; try { ptr = Marshal.AllocHGlobal(size); IntPtr sizePointer = (IntPtr)size; int r = func(ptr, ref sizePointer); Ensure.Success(r); return Marshal.PtrToStringAuto(ptr, sizePointer.ToInt32()); } finally { if (ptr != IntPtr.Zero) { Marshal.FreeHGlobal(ptr); } } }
internal static extern int uv_tcp_connect6(IntPtr req, IntPtr handle, sockaddr_in6 addr, callback callback);
internal static extern int uv_shutdown(IntPtr req, IntPtr handle, callback callback);
public System.IAsyncResult Begincallback(callback callback, System.AsyncCallback callback1, object asyncState) { return this.BeginInvoke("callback", new object[] { callback}, callback1, asyncState); }
private static extern int pacifica_auth(callback cb);
static extern void uv_pipe_connect(IntPtr req, IntPtr handle, string name, callback connect_cb);
private void clearCallback() { cancelCallback = null; buyCallback = null; sellCallback = null; price = 0; }