コード例 #1
0
        private void TxtInStock_ButtonClick(object sender, EventArgs e)
        {
            try
            {
                if (this._product == null)
                {
                    return;
                }

                if (int.TryParse(this.txtInStock.Text, out int inStock))
                {
                    // Validar cantidad
                    if (inStock <= 0)
                    {
                        throw new Exception("La cantidad debe ser mayor a cero.");
                    }

                    // Validar cantidad disponible.
                    if (this.Filter.WarehouseID != null && inStock > this._product.AvailableQuantity)
                    {
                        throw new Exception("La cantidad no puede ser mayor a la cantidad disponible del producto");
                    }

                    this.txtInStock.Clear();
                    OnPush?.Invoke(inStock, this._product);
                }
            }
            catch (Exception ex)
            {
                ex.ShowDialog(MessageBoxIcon.Warning);
            }
        }
コード例 #2
0
    public new T Pop()
    {
        T item = base.Pop();

        OnPush?.Invoke();
        return(item);
    }
コード例 #3
0
    public void GetRepulsed(Vector3 force, ForceMode forceMode = ForceMode.VelocityChange)
    {
        if (!IsActive)
        {
            return;
        }

        OnPush?.Invoke(force);

        switch (forceMode)
        {
        case ForceMode.Acceleration:
            _rb.AddForce(force, ForceMode.Acceleration);
            break;

        case ForceMode.VelocityChange:
            _rb.AddForce(force, ForceMode.VelocityChange);
            break;

        case ForceMode.Impulse:
            _rb.AddForce(force, ForceMode.Impulse);
            break;

        case ForceMode.Force:
            _rb.AddForce(force, ForceMode.Force);
            break;
        }
    }
コード例 #4
0
 // Pool an item
 public void Push(T obj)
 {
     if (obj == null)
     {
         return;
     }
     OnPush?.Invoke(obj);
     _pool.Push(obj);
 }
コード例 #5
0
 void Manual()
 {
     maxIndex        = 1;
     nowIndex        = 0;
     titleUi.text    = "そうさほうほう\nかわずたん\u3000\u3000\u3000\u3000\u3000\u3000\u3000ジョイコン\n<sprite=7>\u3000…いどう\u3000\u3000\u3000\u3000\u3000\u3000 かたむける・ふる\n<sprite=4>\u3000…ジャンプ、決定\u3000\u3000 ZRでほせい\n<sprite=3>\u3000…キャンセル";
     onSelecteds[0]  = SetButtonPush(StartPlacement);
     onSelecteds[0] += SetButtonPush(() => nowIndex = 1);
     onCancel        = StartPlacement;
     onCancel       += () => nowIndex = 1;
     cursor.gameObject.SetActive(false);
 }
コード例 #6
0
        public Button(
            Canvas canvas,

            OnPush onPushDelegate,

            Texture defaultTexture,
            Texture highlighedTexture,
            Texture pushedTexture) : base(canvas, defaultTexture, highlighedTexture, pushedTexture)
        {
            m_OnPushDelegate = onPushDelegate;
        }
コード例 #7
0
 void VideoOption()
 {
     cursor.gameObject.SetActive(true);
     maxIndex       = 2;
     nowIndex       = 0;
     addIndex       = 1;
     titleUi.text   = "がめんせってい\nフルスクリーン\u3000< " + ScreenIsFull() + " >\nかいぞうど < " + ScreenSizeString() + " >";
     onSelecteds[0] = SetFullScreen();
     onSelecteds[1] = SetScreenSize();
     onCancel       = Option;
     onCancel      += () => nowIndex = 0;
 }
コード例 #8
0
 void Option()
 {
     cursor.gameObject.SetActive(true);
     titleUi.text   = "オプション\nがめんせってい\nおんりょうせってい";
     maxIndex       = 2;
     nowIndex       = 0;
     addIndex       = 1;
     onSelecteds[0] = SetButtonPush(VideoOption);
     onSelecteds[1] = SetButtonPush(BgmOption);
     onCancel       = StartPlacement;
     onCancel      += () => nowIndex = 2;
 }
コード例 #9
0
        public override void Write(CustomFileWriter writer)
        {
            bool HasBranchFilter()
            => OnPushBranchIncludes != null ||
            OnPushBranchExcludes != null ||
            OnPushBranchRegexIncludes != null ||
            OnPushBranchRegexExcludes != null ||
            OnPushPathIncludes != null ||
            OnPushPathExcludes != null;

            bool HasPathFilter()
            => OnPushPathIncludes != null ||
            OnPushPathExcludes != null;

            if (OnPush != null ||
                HasBranchFilter() ||
                HasPathFilter())
            {
                using (writer.WriteBlock("gitPush"))
                {
                    if (OnPush != null)
                    {
                        writer.WriteLine($"enabled = {OnPush.ToString().ToLowerInvariant()}");
                    }

                    if (HasBranchFilter())
                    {
                        using (writer.WriteBlock("branchFilter"))
                        {
                            new[]
                            {
                                OnPushBranchIncludes?.Select(x => $"+{x.DoubleQuote()}"),
                                OnPushBranchExcludes?.Select(x => $"-{x.DoubleQuote()}"),
                                OnPushBranchRegexIncludes?.Select(x => $"+Regex({x.DoubleQuote()})"),
                                OnPushBranchRegexExcludes?.Select(x => $"-Regex({x.DoubleQuote()})")
                            }.WhereNotNull().SelectMany(x => x).ForEach(x => writer.WriteLine(x));
                        }
                    }

                    if (HasPathFilter())
                    {
                        using (writer.WriteBlock("pathFilter"))
                        {
                            new[]
                            {
                                OnPushPathIncludes?.Select(x => $"+{x.DoubleQuote()}"),
                                OnPushPathExcludes?.Select(x => $"-{x.DoubleQuote()}")
                            }.WhereNotNull().SelectMany(x => x).ForEach(x => writer.WriteLine(x));
                        }
                    }
                }
            }
        }
コード例 #10
0
 void StartPlacement()
 {
     cursor.gameObject.SetActive(true);
     maxIndex       = 4;
     addIndex       = 0;
     titleUi.text   = "スタート\nそうさほうほう\nオプション\nおわる";
     onSelecteds    = new OnSelected[maxIndex];
     onSelecteds[0] = SetButtonPush(StartRocketScene);
     onSelecteds[1] = SetButtonPush(Manual);
     onSelecteds[2] = SetButtonPush(Option);
     onSelecteds[3] = SetButtonPush(Quit);
     onCancel       = null;
 }
コード例 #11
0
 public bool enPool(T obj)
 {
     if (obj != null)
     {
         OnPush.Invoke(obj);
         avaliableItems.Enqueue(obj);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #12
0
 void BgmOption()
 {
     cursor.gameObject.SetActive(true);
     maxIndex = 4;
     nowIndex = 0;
     addIndex = 1;
     audioMixer.GetFloat("MasterVol", out masterVol);
     audioMixer.GetFloat("BGMVol", out bgmVol);
     audioMixer.GetFloat("SEVol", out seVol);
     titleUi.text   = "おんりょうせってい … <sprite=7>でへんこう\n全体 < " + (masterVol + 80) + " >\nBGM < " + (bgmVol + 80) + " >\nこうかおん < " + (seVol + 80) + " >\n元にもどす";
     onSelecteds[0] = SetMaster();
     onSelecteds[1] = SetBGM();
     onSelecteds[2] = SetSE();
     onSelecteds[3] = SetDefault();
     onCancel       = Option;
     onCancel      += () => nowIndex = 1;
 }
コード例 #13
0
        public override async Task <PushResponse> Push(
            IAsyncStreamReader <Rumor> requestStream,
            ServerCallContext context)
        {
            var rumors = new List <Rumor>();

            while (!context.CancellationToken.IsCancellationRequested &&
                   await requestStream.MoveNext(context.CancellationToken))
            {
                var rumor = requestStream.Current;
                rumors.Add(rumor);
            }

            OnPush?.Invoke(this, new PushRumorEventArgs
            {
                Rumors = rumors,
            });

            return(new PushResponse());
        }
コード例 #14
0
        public override void DidPush()
        {
            if (OnPush != null)
            {
                OnPush.Invoke();
            }

            if (m_components != null)
            {
                foreach (var c in m_components)
                {
                    c.DidPush(this.m_dataObject);
                }
            }

            //Populate();

            //DidShow();

            //base.DidPush();
        }
コード例 #15
0
        private bool Populate(T blueprint, int count, Transform transform = null)
        {
            parent = this.parent;
            T startObj = CreateObject(blueprint);

            if (startObj == null)
            {
                throw new Exception();
            }

            avaliableItems.Enqueue(startObj);
            OnPush.Invoke(startObj);

            for (int i = 1; i < count; i++)
            {
                startObj = CreateObject(blueprint);
                avaliableItems.Enqueue(startObj);
                OnPush.Invoke(startObj);
            }
            return(true);
        }
コード例 #16
0
 public virtual void Push(T item)
 {
     stack.Push(item);
     OnPush?.Invoke(item);
 }
コード例 #17
0
ファイル: Physics.cs プロジェクト: deblob/GaLi
 public void Push(PointF direction, PointF?source) => OnPush?.Invoke(direction, source);
コード例 #18
0
    public new void Push(T item)
    {
        base.Push(item);

        OnPush?.Invoke();
    }
コード例 #19
0
ファイル: Webhook.cs プロジェクト: tomko80/RGB-GO
 protected virtual void OnPushEvent(WebhookEventArgs e)
 {
     OnPush?.Invoke(this, e);
 }
コード例 #20
0
ファイル: NiwradMenu.cs プロジェクト: louis030195/niwrad
 public new void Push(T item)
 {
     OnPush?.Invoke(item);
     base.Push(item);
 }
コード例 #21
0
 public ObjectPool(Creator creator, OnPush onPush = null, OnPop onPop = null)
 {
     this.creator = creator;
     this.onPop   = onPop;
     this.onPush  = onPush;
 }