Beispiel #1
0
        protected IEnumerator UF_MotionEuler(
            Transform target,
            Vector3 vfrom,
            Vector3 vto,
            float duration,
            bool ingoreTimeScale,
            bool spaceWorld,
            DelegateVoid eventFinish)
        {
            float progress = 0;
            float tickBuff = 0;

            while (progress < 1)
            {
                float delta = ingoreTimeScale ? GTime.RunDeltaTime : GTime.UnscaleDeltaTime;
                tickBuff += delta;
                progress  = Mathf.Clamp01(tickBuff / duration);
                Vector3 current = progress * vto + (1 - progress) * vfrom;
                if (spaceWorld)
                {
                    target.eulerAngles = current;
                }
                else
                {
                    target.localEulerAngles = current;
                }
                yield return(null);
            }

            GHelper.UF_SafeCallDelegate(eventFinish);
        }
Beispiel #2
0
 public static void ForEach <P>(this LinkedList <P> list, DelegateVoid <P> apply)
 {
     foreach (var el in list)
     {
         apply(el);
     }
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            //DelegateStringVoid a = new DelegateStringVoid(M1);
            DelegateStringVoid a = M1;

            //a.AddMethod(GemIFil);
            a += GemIFil;
            //a.Invoke("*");
            if (a != null)
            {
                a("*");
            }



            return;

            // Direkte
            M1("*");
            // Inddirekte
            a.Invoke("*");

            DelegateVoid b = new DelegateVoid(Console.Beep);

            Console.Beep();
            b.Invoke();

            DelegateIntIntInt c = new DelegateIntIntInt(Plus);

            Console.WriteLine(Plus(10, 10));
            Console.WriteLine(c.Invoke(10, 10));
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            // Direkte kald
            Test1();

            // Inddirekte
            DelegateVoid d1 = new DelegateVoid(Test1);

            d1.Invoke();
            Kør(d1);

            DelegateVoid d2 = HentDelegate();

            d2.Invoke();


            //DelegateIntIntInt d3 = new DelegateIntIntInt(LægSammen);
            DelegateIntIntInt d3 = LægSammen;

            // Direkte
            Console.WriteLine(LægSammen(1, 1));
            // Inddirekte
            //Console.WriteLine(d3.Invoke(1, 1));
            Console.WriteLine(d3(1, 1));


            DelegateIntIntInt minRegner = FindTilfældigRegneArt();

            Console.WriteLine(minRegner.Invoke(5, 5));
        }
Beispiel #5
0
            public void CallDelegate()
            {
                Status = 123;
                DelegateVoid d = Target;

                d();
            }
 private void delegatedVoid(JiraServer server, DelegateVoid rest, DelegateVoid classic) {
     if (restServers.Contains(server.GUID)) {
         rest(server);
     } else {
         classic(server);
     }
 }
Beispiel #7
0
            public void CallDelegateStatic()
            {
                StatusStatic = 1230;
                DelegateVoid d = TargetStatic;

                d();
            }
Beispiel #8
0
        public int UF_AddSpeedTransPostion(
            UnityEngine.Object target,
            Vector3 vfrom,
            UnityEngine.Object toObject,
            float speed,
            bool ingoreTimeScale,
            float heightOffset,
            bool spaceWorld,
            Vector2 offset,
            bool focusAngle,
            DelegateVoid eventFinish
            )
        {
            int       id           = 0;
            Transform transform    = UF_ObjectToTransform(target);
            Transform tarTransform = UF_ObjectToTransform(toObject);

            if (transform != null)
            {
                if (speed <= 0)
                {
                    throw new System.Exception("speed can not less than 0");
                }
                float dis      = Vector3.Distance(tarTransform.position, transform.position);
                float duration = dis / speed;
                id = FrameHandle.UF_AddCoroutine(UF_MotionTransPosition(transform, vfrom, tarTransform, duration, ingoreTimeScale, heightOffset, spaceWorld, offset, focusAngle, eventFinish));
            }
            return(id);
        }
Beispiel #9
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                var ih     = new IpHelper(NetHelper.LocalPublicIp, true);
                var userIp = ih.IpAddress;

                var d      = new DelegateVoid(this.PostGuestBook);
                var result = this.Invoke(d, new[] { _stringBuilder.ToString(), userIp, txtQQ.Text.Trim() });

                if ((bool)result)
                {
                    DialogResult = DialogResult.OK;
                    Close();
                }
                else
                {
                    DialogResult = DialogResult.No;
                    MsgBox.ShowMessage("发送反馈失败,请检查网络设置!\nSend Failed!");
                }
            }
            catch (Exception exx)
            {
                DialogResult = DialogResult.No;
                MsgBox.ShowMessage(exx.Message);
            }
        }
Beispiel #10
0
        void CreateButton()
        {
            int x = 0;
            int y = 0;

            do
            {
                x = (MyClass.random.Next(0, 4));
                y = (MyClass.random.Next(0, 4));
            } while (massSquare[x, y] != null);

            Button button = new Button();

            button.FontFamily = new FontFamily("Arial Black");
            button.FontSize   = 50;
            button.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
            //button.FontFamily = new FontFamily("TimesNewRoman");
            grid.Children.Add(button);
            Grid.SetColumn(button, x * 2 + 2);
            Grid.SetRow(button, y * 2 + 4);
            Square square = new Square(x, y, button);

            massSquare[x, y] = square;
            square.destroy  += DeleteButton;
            newMoveEvent    += square.ResetAddStatus;
        }
Beispiel #11
0
        protected void InvokeVoid(DelegateVoid action)
        {
            _error  = null;
            _thread = new System.Threading.Thread((System.Threading.ThreadStart) delegate {
                try {
                    action();
                } catch (ThreadAbortException) {
                    return;
                } catch (NotSupportedException) {
                    _error = "Method not supported by the Selenium .Net web driver";
                } catch (System.Exception ex) {
                    _error = ex.GetType().Name + ": " + ex.Message;
                }
            });
            _thread.Start();
            bool succeed = _thread.Join(_timeout + 1000);

            this.CheckCanceled();
            if (!succeed)
            {
                throw new ApplicationException(GetErrorPrefix(action.Method.Name) + "\nTimed out running command after " + _timeout + " milliseconds");
            }
            if (_error != null)
            {
                throw new ApplicationException(GetErrorPrefix(action.Method.Name) + "\n" + _error);
            }
        }
Beispiel #12
0
        public static int CallDelegateVoid2()
        {
            status = 0;
            DelegateVoid d = DelegateVoidTarget2;

            d();
            return(status);
        }
Beispiel #13
0
    /// <summary>
    ///  添加监听,只对view中InitUI()里的UI有效
    /// </summary>
    protected override void AddListener()
    {
        PayLineViewPresenters view = this.View as PayLineViewPresenters;

        MainMenuController mainMenuController = UIMgr.Instance.GetView(EViewID.MainMenu) as MainMenuController;

        changeLineCountListener += mainMenuController.UpdateTotalBet;
    }
Beispiel #14
0
 /// <summary>
 /// 设置目的地,角色直线运动到目的地
 /// </summary>
 public void UF_MoveTo(Vector3 point, DelegateVoid eventDestinationFinish)
 {
     if (!isActive)
     {
         return;
     }
     //SetStay();
     UF_AddPathPoint(point, eventDestinationFinish);
 }
Beispiel #15
0
 public static void UF_CallMethod(DelegateVoid method)
 {
     if (method != null)
     {
         lock (s_CallMethod) {
             s_CallMethod.Add(method);
         }
     }
 }
Beispiel #16
0
        private void UF_InvokePathPointFinish()
        {
            //完成移动
            DelegateVoid tmp = m_EventPathFinish;

            m_EventPathFinish = null;

            GHelper.UF_SafeCallDelegate(tmp);
        }
Beispiel #17
0
        public static int ReassignDelegateVoid()
        {
            status = 0;
            DelegateVoid d = DelegateVoidTarget1;

            d();
            d = DelegateVoidTarget2;
            d();
            return(status);
        }
Beispiel #18
0
        public static void Main(string[] args)
        {
            LambdaDelegateAnonymous lda = new LambdaDelegateAnonymous();

            DelegateVoid dv = new DelegateVoid(lda.Test);

            dv();

            Console.WriteLine("Hello World!");
        }
Beispiel #19
0
 /// <summary>
 /// 初始化
 /// </summary>
 private void InitPre(EViewID viewID, int viewInstID, GameObject view)
 {
     this.Model = CreateModel();
     this.View  = CreateView(view);
     this.createViewFinishListener += this.InitPost;
     this.dlgOpenListener          += this.AddListener;
     this.dlgCloseListener         += this.RemoveListener;
     this.SetViewID(viewID);
     this.SetViewInstID(viewInstID);
 }
Beispiel #20
0
 public static void UF_SafeCallDelegate(DelegateVoid method)
 {
     try{
         if (method != null)
         {
             method();
         }
     }
     catch (System.Exception e) {
         Debugger.UF_Exception(e);
     }
 }
Beispiel #21
0
 protected void SafeRunPrintError(DelegateVoid func)
 {
     try
     {
         func();
     }
     catch (Exception ex)
     {
         Log("SafeRunPrintError", ex);
         Response.ContentType = "text/html";
         Response.Output.Write("Exception: " + ex.Message);
     }
 }
Beispiel #22
0
        public void UF_SetStay()
        {
            isMoving  = false;
            isJumping = false;
            isRushing = false;
            m_ListPathPoints.Clear();
            m_EventPathFinish = null;
            m_MoveForward     = Vector3.zero;
            //Y轴归零
            Vector3 pos = m_Avatar.position; pos.y = 0;

            m_Avatar.position = pos;
        }
Beispiel #23
0
        /// <summary>
        ///     下载完毕
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        private void downloader_Completed(object sender, EventArgs arg)
        {
            try
            {
                if (CloudProxyData.CloudProxyList.Count > 0)
                {
                    lock (ProxyData.ProxyList)
                    {
                        List <ProxyServer> list =
                            ProxyData.ProxyList.Union(CloudProxyData.CloudProxyList).Distinct().ToList();
                        List <ProxyServer> listUni = (from row in list
                                                      select new ProxyServer {
                            proxy = row.proxy, port = row.port
                        })
                                                     .Distinct().ToList();

                        ProxyData.ProxyList.Clear();
                        foreach (ProxyServer proxy in listUni)
                        {
                            ProxyServer model = list.FirstOrDefault(p => p.proxy == proxy.proxy && p.port == proxy.port);
                            ProxyData.Set(model);
                        }
                    }
                }
                if (ProxyData.TotalNum == 0)
                {
                    Config.MainForm.SetStatusText(Config.LocalLanguage.Messages.NetworkIsbusyPleaseTryAgainLater);
                }
                else
                {
                    DelegateVoid dv = BindData;
                    Invoke(dv);
                    DelegateUpdateLabelInfo();
                    Config.MainForm.SetToolTipText(string.Format(Config.LocalLanguage.Messages.NumOfProxiesDownloaded,
                                                                 ProxyData.TotalNum));
                    dv = ReadDataOk;
                    Invoke(dv);
                    Config.MainForm.SetStatusText(string.Format(Config.LocalLanguage.Messages.NumOfProxiesDownloaded,
                                                                ProxyData.TotalNum));
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteException(ex);
            }
            finally
            {
                DelegateVoid dv = ReadDataOk;
                Invoke(dv);
            }
        }
Beispiel #24
0
 /// <summary>
 /// 添加路径点
 /// </summary>
 /// <param name="point">Point.</param>
 public void UF_AddPathPoint(Vector3 point, DelegateVoid eventPathFinish)
 {
     if (!isActive)
     {
         return;
     }
     if (m_ListPathPoints.Count == 0 && m_Avatar != null)
     {
         m_DirectionPoint = m_Avatar.position;
     }
     m_ListPathPoints.Add(point);
     m_EventPathFinish = eventPathFinish;
     isTurning         = true;
     isMoving          = true;
 }
Beispiel #25
0
 //设置一个计时器,时钟倒计时
 public void UF_SetAsTimer(long timestamp, string _format, DelegateVoid _callback)
 {
     m_IsOver         = false;
     m_IsPause        = false;
     m_ISide          = -1;
     clockTimestamp   = timestamp;
     m_IsNormal       = true;
     format           = _format;
     m_TickBuffer     = System.Environment.TickCount;
     m_RunBuffer      = 0;
     m_EventClockOver = _callback;
     m_DateTime       = GTime.UF_TimestampToDateTime(clockTimestamp, m_IsNormal);
     m_TickOverflow   = 0;
     UF_UpdateText();
 }
    /// <summary>
    ///  添加监听,只对view中InitUI()里的UI有效
    /// </summary>
    protected override void AddListener()
    {
        UIEventListen.Get(ViewSub.btnRaiseBet).onClick += RaiseBet;
        UIEventListen.Get(ViewSub.btnLowerBet).onClick += LowerBet;
        UIEventListen.Get(ViewSub.btnAddLine).onClick  += AddLine;
        UIEventListen.Get(ViewSub.btnSubLine).onClick  += SubLine;

        UIEventListen.Get(ViewSub.btnPayTable).onClick += ShowPayTable;
        UIEventListen.Get(ViewSub.objPayTable).onClick += ClosePayTable;

        UIEventListen.Get(ViewSub.btnSpin).onClick   += Spin;
        UIEventListen.Get(ViewSub.btnMaxBet).onClick += SpinMaxBet;

        changeLineCountListener += UpdateTotalBet;
    }
Beispiel #27
0
        protected IEnumerator UF_MotionTransPosition(
            Transform target,
            Vector3 vfrom,
            Transform toObj,
            float duration,
            bool ingoreTimeScale,
            float heightOffset,
            bool spaceWorld,
            Vector3 offset,
            bool focusAngle,
            DelegateVoid eventFinish)
        {
            float progress = 0;
            float tickBuff = 0;

            while (progress < 1)
            {
                float delta = ingoreTimeScale ? GTime.RunDeltaTime : GTime.UnscaleDeltaTime;
                tickBuff += delta;
                progress  = Mathf.Clamp01(tickBuff / duration);
                Vector3 current       = progress * (toObj.position + offset) + (1 - progress) * vfrom;
                Vector3 currentOffset = new Vector3(0, heightOffset * Mathf.Sin(Mathf.PI * progress), 0);
                Vector3 lastPositon   = default(Vector3);
                if (spaceWorld)
                {
                    lastPositon     = target.position;
                    target.position = current + currentOffset;
                    if (focusAngle)
                    {
                        target.eulerAngles = MathX.UF_EulerAngle(lastPositon, target.position);
                    }
                }
                else
                {
                    lastPositon          = target.localPosition;
                    target.localPosition = current + currentOffset;
                    if (focusAngle)
                    {
                        target.localEulerAngles = MathX.UF_EulerAngle(lastPositon, target.position);
                    }
                }
                yield return(null);
            }

            GHelper.UF_SafeCallDelegate(eventFinish);
        }
Beispiel #28
0
        public static void GenarateMenu()
        {
            DelegateVoid myDelegate1 = GenarateMenuInfo;
            DelegateVoid myDelegate2 = GenarateCustomerMenu;

            while (true)
            {
                if (Program.CurrentLoggedIn != null)
                {
                    myDelegate2();
                }
                else
                {
                    myDelegate1();
                }
            }
        }
Beispiel #29
0
        public int UF_AddScale(
            Transform target,
            Vector3 vfrom,
            Vector3 vto,
            float duration,
            bool ingoreTimeScale,
            DelegateVoid eventFinish)
        {
            int       id        = 0;
            Transform transform = UF_ObjectToTransform(target);

            if (transform != null)
            {
                id = FrameHandle.UF_AddCoroutine(UF_MotionScale(transform, vfrom, vto, duration, ingoreTimeScale, eventFinish));
            }
            return(id);
        }
Beispiel #30
0
 private void UpdateScoreScreen()
 {
     if (lblErrors.InvokeRequired)
     {
         var d = new DelegateVoid(UpdateScoreScreen);
         this.BeginInvoke(d, null);
     }
     else
     {
         lblGood.Text   = $"{_pointSucess}";
         lblErrors.Text = $"{_pointError}";
         if (_gamesRun > 0)
         {
             lblAverageTime.Text = (_pressTimesum / _gamesRun).ToString();
         }
     }
 }
Beispiel #31
0
	public static void Foo (DelegateVoid input)
	{
		throw new ApplicationException ("wrong overload");
	}