Example #1
0
        public bool Proceed(string text)
        {
            Stack <char> queue = new Stack <char>();

            foreach (var ch in text)
            {
                OpenClose open  = _openClose.FirstOrDefault(x => x.Open == ch);
                OpenClose close = _openClose.FirstOrDefault(x => x.Close == ch);
                if (open == null && close == null)
                {
                    return(false);
                }
                if (open != null)
                {
                    queue.Push(open.Open);
                }
                else
                {
                    if (queue.Any() == false)
                    {
                        return(false);
                    }
                    char poped = queue.Pop();
                    if (poped != close.Open)
                    {
                        return(false);
                    }
                }
            }
            return(queue.Any() == false);
        }
Example #2
0
        public override void Update(GameTime gameTime)
        {
            i++;
            var transform = entity.GetComponent <Transform>();

            if (i % 500 == 0)
            {
                Console.Log(openState);
            }

            switch (openState)
            {
            case OpenClose.Open:
                // do nothing, the panel is open
                // allow for item selection?
                if (GameStateManager.State == GameStates.Playing)
                {
                    openState = OpenClose.Closing;
                }
                break;

            case OpenClose.Closed:
                // do nothing, the panel is closed
                if (GameStateManager.State == GameStates.ItemSelection)
                {
                    openState = OpenClose.Opening;
                }
                break;

            case OpenClose.Opening:
                // lerp to open position

                transform.position = Vector2.Lerp(start, goal, t);
                t += deltaT;

                if (t >= 1f)
                {
                    openState = OpenClose.Open;
                    t         = 0;
                }
                break;

            case OpenClose.Closing:
                // lerp to closed position

                transform.position = Vector2.Lerp(goal, start, t);
                t += deltaT;

                if (t >= 1f)
                {
                    openState = OpenClose.Closed;
                    t         = 0;
                }
                break;
            }
        }
Example #3
0
 public Office(Guid id, string director, Address address, string openFrom, string openTo, OpenClose isOpen, PhoneNumber phoneNumber,
               IDomainEventPublisher domainEventPublisher) : base(id, domainEventPublisher)
 {
     Director    = director;
     Address     = address;
     OpenFrom    = openFrom;
     OpenTo      = openTo;
     IsOpen      = isOpen;
     PhoneNumber = phoneNumber;
 }
Example #4
0
    protected override void OnTCEnable()
    {
        m_forceTarget = target as TCForce;

        if (m_forceTarget != null)
        {
            m_forces = new List <TCForce>(m_forceTarget.GetComponents <TCForce>());
        }
        m_primeForce = m_forces[0];
        m_forces.RemoveAt(0);

        m_openClose      = GetOpenClose();
        m_forceGenerator = new TCNoiseForceGenerator(m_forceTarget);
    }
Example #5
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        OpenClose script = (OpenClose)target;

        GUILayout.Space(5);

        if (GUILayout.Button("Open"))
        {
            script.Open();
        }
        if (GUILayout.Button("Close"))
        {
            script.Close();
        }
    }
    protected override void OnTCEnable()
    {
        m_tabGroup = GetOpenClose();

        foreach (var system in Targets)
        {
            if (m_drawers.ContainsKey(system))
            {
                continue;
            }

            var emitter = system.Emitter as ParticleEmitter;

            if (emitter != null)
            {
                m_drawers[system] = new TCWireframeDrawer(emitter.GetEmitterShapeData().emitMesh);
            }
        }
    }
Example #7
0
        public override string ToString()
        {
            string ret = Time.ToString() + ",";

            ret += TransactionCode.ToString() + ",";
            ret += TransactionSubcode.ToString() + ",";
            ret += TransID.ToString() + ",";
            ret += (Symbol != null ? Symbol.ToString() : "") + ",";
            ret += (BuySell != null ? BuySell.ToString() : "") + ",";
            ret += (OpenClose != null ? OpenClose.ToString() : "") + ",";
            ret += Quantity.ToString() + ",";
            ret += ExpireDate.ToString() + ",";
            ret += Strike.ToString() + ",";
            ret += (InsType != null ? InsType.ToString() : "") + ",";
            ret += Price.ToString() + ",";
            ret += Fees.ToString() + ",";
            ret += Amount.ToString() + ",";
            ret += Description.ToString() + ",";
            ret += AccountRef.ToString();
            return(ret);
        }
Example #8
0
 public Door(bool isVertical, bool isLocked, bool isOpen, bool special) : base()
 {
     name        = "Door";
     description = "Hmm, this is a door";
     if (isVertical)
     {
         symbolOpened = "_";
         symbolClosed = "|";
     }
     else
     {
         symbolOpened = "|";
         symbolClosed = "_";
     }
     if (isOpen)
     {
         symbol = symbolOpened;
     }
     else
     {
         symbol = symbolClosed;
     }
     this.isLocked  = isLocked;
     this.isOpen    = isOpen;
     isInteractible = true;
     if (special)
     {
         interactions.Add(new FakeInspect(this));
         isSpecial = true;
     }
     else
     {
         OpenClose openClose = new OpenClose(this);
         openClose.registerObserver(this);
         interactions.Add(openClose);
         isSpecial = false;
     }
 }
 private void Fileter(OpenClose isOpen)
 {
     var orders = this.OrderTasks.Where(P => P.IsSelected == true);
     foreach (OrderTask order in orders)
     {
         if (order.IsOpen == isOpen)
         {
             order.IsSelected = true;
         }
         else
         {
             order.IsSelected = false;
         }
     }
 }
Example #10
0
        void Vlakno()
        {
            // main work thread
            while (MaBezet)
            {
                try
                {
                    COM         = new SerialPort(textBox1.Text); // get user defined COM port name
                    COM.NewLine = "\r\n";                        // define string of end of line (\r and \n)
                    try
                    {
                        COM.Open();      // try to open serial port
                    }
                    catch (Exception ex) // problem with opening serial port
                    {
                        MessageBox.Show("Problém s otevřením sériového portu. " + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    }
                    if (FileName.Text == "")
                    {
                        OpenFiles();                      // open output log files
                    }
                    else
                    {
                        OpenFiles(FileName.Text);
                    }

                    while (MaBezet)
                    {
                        try
                        {
                            string Radek = COM.ReadLine();
                            if (!LogOnly.Checked)
                            {
                                //Ramce.Add(new Ramec(Radek));
                                listBox1.Invoke((MethodInvoker) delegate() // insert arrived data to GUI from thread
                                {
                                    FilterInsert(Radek);
                                });
                            }
                            else
                            {
                                if (SouborRaw != null) // is file avaliable for writing?
                                {
                                    DateTime now = DateTime.Now;
                                    // log all arrived CAN Bus data to file xxxRaw
                                    Radek = now.ToShortDateString() + " " + now.ToLongTimeString() + "\t" + Radek.Replace(" ", "\t");
                                    SouborRaw.WriteLine(Radek);
                                }
                            }
                        }
                        catch (TimeoutException ex) // no ne line, wait for next time
                        { }
                        catch (Exception ex)        // another exception
                        { }
                    }
                }
                catch (ThreadAbortException) // end of thread
                { }
                //catch ()
                catch (Exception ex)                                      // other error
                {
                    string Err = ex.Message + "\r\n\r\n" + ex.StackTrace; // show message with StackTrace
                }
            }
            OpenClose.Invoke((MethodInvoker) delegate() // change state of button
            {
                OpenClose.Text = "Open";
            });
            if ((COM != null) || COM.IsOpen)
            {
                COM.Close();                              // if is serial port open, than close it
            }
            if (SouborRaw != null)
            {
                SouborRaw.Flush();
                SouborRaw.Close(); // if is file used, than close it
            }
            if (SouborFiltered != null)
            {
                SouborFiltered.Flush();
                SouborFiltered.Close(); // if is file used, than close it
                MaBezet = false;
            }
        }
Example #11
0
 /// <summary>
 /// Закрыть/открыть объект
 /// </summary>
 public void OpenClose_ExitPanel()
 {
     OpenClose.ShowHide_GameObject(exitPanel);
 }
Example #12
0
        private static void TestOpenClose()
        {
            OpenClose principle = new OpenClose();

            principle.Test();
        }
Example #13
0
 internal void Update(Order order)
 {
     this._ExchangeCode = order.ExchangeCode;
     this._OrderId = order.Id;
     this._Code = order.Code;
     this._Phase = order.Phase;
     this._OrderStatus = order.Status;
     this._IsBuy = order.BuySell;
     this._IsOPen = order.OpenClose;
     this._Lot = order.Lot;
     this._ContractSize = order.Transaction.ContractSize;
     this._OrderType = order.Transaction.OrderType;
     this._OrderTypeString = order.Type;
     this._SetPrice = order.SetPrice;
     this._SubmitDateTime = order.Transaction.SubmitTime;
     this._ExpireTime = order.Transaction.SubmitTime;
     this._Account = order.Transaction.Account;
     this._Transaction = order.Transaction;
     this._Instrument = order.Transaction.Instrument;
     this._HitCount = order.HitCount;
     this._BestPrice = order.BestPrice;
     this._BestTime = order.BestTime;
     this.ChangeStatus(this._OrderStatus);
 }