예제 #1
0
    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);
    }
예제 #3
0
 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();


            }
        }
예제 #5
0
 public void TimesAdd(float times, callback call)
 {
     //print("???? 单次计时  " + times);
     GetStopByTime(times);
     isDanciTimes2 = true;
     _call         = call;
 }
예제 #6
0
    // 因为音频播放是异步的,方便及时增加播放后的回调内容
    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;
                }
            }
        }
    }
예제 #7
0
 public void Start(long timeout, long repeat, Action callback)
 {
     cb = delegate(IntPtr h, int status) {
         callback();
     };
     Start(timeout, repeat, cb);
 }
예제 #8
0
 private void clearCallback()
 {
     cancelCallback = null;
     buyCallback    = null;
     sellCallback   = null;
     price          = 0;
 }
예제 #9
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);
        }
    }
예제 #10
0
        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>();
        }
예제 #11
0
    public void Add(int id, callback cb)
    {
        dict.Add(id, cb);
        string str = string.Format("监听 mainID:{0} ", id);

        Debug.Log(str);
    }
예제 #12
0
    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;
        }
    }
예제 #14
0
        public UVTimer(Loop loop)
            : base(loop, HandleType.UV_TIMER)
        {
            int r = uv_timer_init(loop.NativeHandle, NativeHandle);

            Ensure.Success(r);
            cb = OnTick;
        }
예제 #15
0
 public TimeEvent(TimeSpan _time, callback _funcCallBack)
 {
     this.time = _time;
     this.funcCB = _funcCallBack;
     this.dataCB = null;
     this.next = null;
     this.prev = null;
 }
예제 #16
0
 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);
     }
 }
예제 #17
0
파일: Timer.cs 프로젝트: Ajaygaikwad01/AIM
 public void Add(callback method, float insecond)
 {
     events.Add(new TimedEvent
     {
         Method        = method,
         TimeToExecute = Time.time + insecond
     });
 }
예제 #18
0
        public void Start(long timeout, long repeat, Action<Timer, int> callback)
        {
            cb = delegate (IntPtr h, int status) {
                callback(this, status);
            };

            Start(timeout, repeat, cb);
        }
예제 #19
0
 //连续间隔时间 返回
 public void ContinuouslyTimesAdd(float timeNums, float intervals, callback call)
 {
     _maxTimesNum = timeNums / intervals;
     _timeNums    = _maxTimesNum;
     _intervals   = intervals;
     //print("!!!!!!!!!!   "+ _timeNums);
     _call = call;
 }
예제 #20
0
 public TimeEvent(TimeSpan _time, callback _funcCallBack)
 {
     this.time   = _time;
     this.funcCB = _funcCallBack;
     this.dataCB = null;
     this.next   = null;
     this.prev   = null;
 }
예제 #21
0
 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); };
 }
예제 #22
0
 public void PlayAnimation(Sprite[] frameArr, float duration, callback onLoopEnd)
 {
     onFrame       = null;
     frameArray    = frameArr;
     animating     = true;
     currentFrame  = 0;
     this.duration = duration;
     timer         = framerate;
     cb            = onLoopEnd;
 }
예제 #23
0
 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();
 }
예제 #24
0
 internal void Start(long timeout, long repeat, callback callback)
 {
     if (Running)
     {
         Stop();
     }
     Running    = true;
     LongRepeat = repeat;
     uv_timer_start(handle, callback, timeout, repeat);
 }
예제 #25
0
 void EndJump()
 {
     t._gameTime = _fixedGameTime;
     SetSpeed(0);
     _canAcceptPlayerInput = true;
     if (_jumpCB != null)
     {
         _jumpCB();
         _jumpCB = null;
     }
 }
예제 #26
0
 public void setReload()
 {
     if (this.InvokeRequired)
     {
         callback d = new callback(loadContent);
         this.Invoke(d, new object[] { });
     }
     else
     {
         reload = true;
     }
 }
예제 #27
0
 public void GoToHomePlanet()
 {
     if (formMain.InvokeRequired)
     {
         callback inv = new callback(this.GoToHomePlanet);
         formMain.Invoke(inv, new object[] {  });
     }
     else
     {
         tabMaster.SelectedIndex = 2;
     }
 }
예제 #28
0
 public void FocusPassword()
 {
     if (formMain.InvokeRequired)
     {
         callback inv = new callback(this.FocusPassword);
         formMain.Invoke(inv, new object[] { });
     }
     else
     {
         txtPassword.Focus();
     }
 }
예제 #29
0
        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));
        }
예제 #30
0
 public void FocusUsername()
 {
     if (formMain.InvokeRequired)
     {
         callback inv = new callback(this.FocusUsername);
         formMain.Invoke(inv, new object[] { });
     }
     else
     {
         txtUsername.Focus();
     }
 }
예제 #31
0
 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);
         }
     }
 }
예제 #32
0
    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);
    }
예제 #33
0
 //删除一个类型的,一个指定回调
 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);
         }
     }
 }
예제 #34
0
    // 这个功能是有可复用性的,只是针对 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);
            }
        }
    }
예제 #35
0
        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);
        }
예제 #36
0
	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);
    }
예제 #37
0
 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);
 }
예제 #38
0
 public UVTimer(Loop loop)
     : base(loop, HandleType.UV_TIMER)
 {
     uv_timer_init(loop.NativeHandle, NativeHandle);
     cb = OnTick;
 }
예제 #39
0
	public ClientGetAsync(callback c)
	{
		this.Callback = c;
	}
예제 #40
0
 internal Listener(Loop loop, UvHandleType type)
     : base(loop, type)
 {
     DefaultBacklog = 128;
     listen_cb = listen_callback;
 }
예제 #41
0
 internal static extern int uv_write_win(IntPtr req, IntPtr handle, WindowsBufferStruct[] bufs, int bufcnt, callback callback);
예제 #42
0
 internal static extern int uv_write_unix(IntPtr req, IntPtr handle, UnixBufferStruct[] bufs, int bufcnt, callback callback);
예제 #43
0
파일: Com.cs 프로젝트: fabianmue/AS_GUI
 // class constructor
 public worker(string pn, byte[] wb, callback cb)
 {
     portName = pn;
     writeBuffer = wb;
     callBack = new callback(cb);
 }
예제 #44
0
 internal static extern int uv_listen(IntPtr stream, int backlog, callback callback);
예제 #45
0
 internal void Start(long timeout, long repeat, callback callback)
 {
     if (Running) {
         Stop();
     }
     Running = true;
     LongRepeat = repeat;
     uv_timer_start(handle, callback, timeout, repeat);
 }
예제 #46
0
 internal static extern int uv_timer_start(IntPtr timer, callback callback, long timeout, long repeat);
예제 #47
0
 internal static extern int uv_udp_send_win(IntPtr req, IntPtr handle, WindowsBufferStruct[] bufs, int bufcnt, sockaddr_in addr, callback callback);
예제 #48
0
 internal static extern int uv_udp_send_unix(IntPtr req, IntPtr handle, UnixBufferStruct[] bufs, int bufcnt, sockaddr_in addr, callback callback);
예제 #49
0
		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);
				}
			}
		}
예제 #50
0
파일: Tcp.cs 프로젝트: carlokok/LibuvSharp
 internal static extern int uv_tcp_connect6(IntPtr req, IntPtr handle, sockaddr_in6 addr, callback callback);
예제 #51
0
 internal static extern int uv_shutdown(IntPtr req, IntPtr handle, callback callback);
예제 #52
0
 public System.IAsyncResult Begincallback(callback callback, System.AsyncCallback callback1, object asyncState)
 {
     return this.BeginInvoke("callback", new object[] {
                 callback}, callback1, asyncState);
 }
예제 #53
0
 private static extern int pacifica_auth(callback cb);
예제 #54
0
파일: Pipe.cs 프로젝트: carlokok/LibuvSharp
 static extern void uv_pipe_connect(IntPtr req, IntPtr handle, string name, callback connect_cb);
예제 #55
0
 private void clearCallback()
 {
     cancelCallback = null;
     buyCallback = null;
     sellCallback = null;
     price = 0;
 }