示例#1
0
    void OnMousDownRight_()
    {
        RaycastHit hit;

        if (getClickPos(out hit))
        {
            if (dt == drawType.barrier)
            {
            }
            else if (dt == drawType.wall)
            {
            }
            else if (dt == drawType.sign)
            {
                if (clickCount == 0)
                {
                    targetSign = hit.transform.GetComponent <sign>();
                    if (targetSign != null && targetSign.moveable)
                    {
                        clickCount = 10;
                    }
                }
                else if (clickCount == 10)
                {
                    targetSign = null;
                    clickCount = 0;
                }
            }
        }
    }
示例#2
0
        private String plus()
        {
            // Ignore the last dot is exists
            if (charAt(currentNum, currentNum.Length - 1) == '.')
            {
                currentNum = currentNum.Substring(0, currentNum.Length - 1);
            }


            if (!Char.IsDigit(charAt(currentNum, 0)))
            {
                lastEntered = sign.plus;
                currentNum  = "+";
            }
            else if (doCalc)
            {
                doCalculation();
                doCalc      = true;
                lastNum     = Double.Parse(currentNum);
                lastEntered = sign.plus;
                currentNum  = "+";
            }
            else
            {
                lastNum     = Double.Parse(currentNum);
                lastEntered = sign.plus;
                currentNum  = "+";
                doCalc      = true;
            }

            return(currentNum);
        }
示例#3
0
        /**
         * Konštruktor triedy
         */
        public Math_handle(Output_handle ouput_handle)
        {
            this.output_handle = ouput_handle;
            matho = new Matho();

            actual_sign = sign.none;
        }
 public string Firmar(ref authTokenType token, string texto, string alias, SignatureModeType tipodefirma)
 {
     LunaXml.xmCryptoService client = new xmCryptoService();
     try
     {
         sign textoafirmar = new sign();
         textoafirmar.AuthToken = token;
         textoafirmar.SignatureModeSpecified = true;
         textoafirmar.DataToSign             = Convert.ToBase64String(Encoding.UTF8.GetBytes(texto));
         textoafirmar.SignatureMode          = tipodefirma;
         textoafirmar.SigningKeyAlias        = alias;
         signResponse respuesta = client.sign(textoafirmar);
         token = respuesta.AuthToken;
         if (respuesta.Result.ResultMajor != null && respuesta.Result.ResultMajor == "urn:oasis:names:tc:dss:resultmajor:Success")
         {
             return(respuesta.Signature);
         }
         else
         {
             Log.Error((respuesta.Result.ResultMessage != null ? respuesta.Result.ResultMessage.Value : ""));
             return(null);
         }
     }
     catch (Exception ex)
     {
         Log.Error("Error al intentar firmar: " + ex);
         return(null);
     }
     finally
     {
         client.Dispose();
     }
 }
示例#5
0
 void eraseFromMemory(sign s)
 {
     if (visitedSigns.Contains(s))
     {
         visitedSigns.Remove(s);
     }
 }
示例#6
0
        static string ReceiveCoordinates(sign currentSign)
        {
            Console.Write("\n  Enter coordinates of your move. {0}: ", currentSign);
            string rawCoordinates = Console.ReadLine();

            return(rawCoordinates);
        }
示例#7
0
        public SignIntValueChoosingModel(IRepository repository, int idorder, int idsign)
        {
            this._Repository = repository;

            this.Sign      = _Repository.Signs.First(s => s.idsign == idsign);
            this.Order     = _Repository.Orders.First(o => o.idorder == idorder);
            this.OrderSign = _Repository.OrdersSigns.SingleOrDefault(os => os.idsign == idsign && os.idorder == idorder);
        }
示例#8
0
 public Calculator()
 {
     currentNum  = "0";
     lastNum     = 0;
     lastEntered = sign.none;
     doCalc      = false;
     overwrite   = false;
 }
示例#9
0
        private string allClear()
        {
            currentNum  = "0";
            doCalc      = false;
            lastEntered = sign.none;

            return(currentNum);
        }
示例#10
0
 public Calculator()
 {
     currentNum = "0";
     lastNum = 0;
     lastEntered = sign.none;
     doCalc = false;
     overwrite = false;
 }
示例#11
0
 /**
  * Funkcia spracuvajúca vyčistenie displeja
  */
 public void C_proceed()
 {
     result       = 0;
     actual_sign  = sign.none;
     result_state = false;
     output_handle.clear_display();
     output_handle.clear_log();
 }
示例#12
0
 void Start()
 {
     //rate = 1.0f;
     mySign = gameObject.AddComponent <sign>() as sign;
     mySign.setDirection(-transform.forward * transform.lossyScale.magnitude);
     mySign.setTargets(gateTarget);
     mySign.moveable = false;
 }
示例#13
0
 /**
  * Funkcia spracuvajúca y-tú mocninu
  */
 public void pow_y_proceed()
 {
     try
     {
         update_result_in_log();     // Ak sa vyskytol error, už sa o neho postaral operation result
         output_handle.print_log(" ^ ");
         actual_sign = sign.pow_y;
     }
     catch { }
 }
示例#14
0
 static void ChangeCurrentSign()
 {
     if (currentSign == sign.X)
     {
         currentSign = sign.O;
     }
     else
     {
         currentSign = sign.X;
     }
 }
示例#15
0
        public bool UpdateSign(sign instance)
        {
            sign cache = dbContext.signs.Where(s => s.idsign == instance.idsign).FirstOrDefault();

            if (cache != null)
            {
                dbContext.SubmitChanges();
                return(true);
            }

            return(false);
        }
示例#16
0
        public SignIntValueChoosingModelDataSet(IRepository repository, ds_order dataset, int idsign)
        {
            this._Repository = repository;

            this.Sign = _Repository.Signs.First(s => s.idsign == idsign);

            this.datasetOrder = dataset;

            this.Order1 = (ds_order.ordersRow)dataset.orders.Rows[0];

            this.OrderSign1 = ((DataTable)dataset.docsign).AsEnumerable().FirstOrDefault(docs => docs.Field <int>("idsign") == idsign) as ds_order.docsignRow;
        }
示例#17
0
        public bool RemoveSign(int idsign)
        {
            sign instance = dbContext.signs.FirstOrDefault(s => s.idsign == idsign);

            if (instance != null)
            {
                dbContext.signs.DeleteOnSubmit(instance);
                dbContext.SubmitChanges();
                return(true);
            }

            return(false);
        }
示例#18
0
 /**
  * Funkcia spracuvajúca odčítanie
  */
 public void sub_proceed()
 {
     // Ak je display prázdny, znak mínus patrí ku číslu, neberie sa ako znak pre operáciu odčítať
     if (output_handle.is_display_empty() == true)
     {
         output_handle.print_on_display("-");
     }
     else
     {
         update_result_in_log();
         output_handle.print_log(" - ");
         actual_sign = sign.sub;
     }
 }
示例#19
0
        /**
         * Funkcia spracuvajúca výpis výsledku na displej
         */
        public void eq_proceed()
        {
            try
            {
                result = operation_result();
                output_handle.clear_log();
                output_handle.clear_display();
                output_handle.print_on_display(result.ToString());
            }
            catch { }

            result       = 0;
            actual_sign  = sign.none;
            result_state = true;
        }
示例#20
0
 /**
  * Funckia, ktorá aktualizuje reťazec vo vedľajšom displeji
  */
 private void update_result_in_log()
 {
     try
     {
         result = operation_result();
         output_handle.clear_log();
         output_handle.print_log(result.ToString());
         output_handle.clear_display();
     }
     catch
     {
         result       = 0;
         actual_sign  = sign.none;
         result_state = true;
     }
 }
示例#21
0
 public char Move(int row, int colomn, sign player)
 {
     if (row >= 0 && row < 3 && colomn >= 0 && colomn < 3)
     {
         if (mat[row, colomn].Equals('-'))
         {
             if (player.Equals(sign.X))
             {
                 return('X');
             }
             if (player.Equals(sign.O))
             {
                 return('O');
             }
         }
         else
         {
             return('m');
         }
     }
     return('-');
 }
示例#22
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            sign  signs   = new sign();
            MSign objsign = new MSign();

            //下班进行考勤设置
            if (DateTime.Compare(Convert.ToDateTime(DateTime.Now.ToString("hh:mm:ss")), Convert.ToDateTime(down)) >= 0)
            {
                objsign.Datetime     = DateTime.Now;
                objsign.EmployeeName = Session["loginName"].ToString();
                objsign.Late         = false;
                objsign.Quit         = false;
                signs.InsertIntoSign(objsign);
            }
            else
            {
                objsign.Datetime     = DateTime.Now;
                objsign.EmployeeName = Session["loginName"].ToString();
                objsign.Late         = false;
                objsign.Quit         = true;
                signs.InsertIntoSign(objsign);
            }
            this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('签退成功!');</script>");
        }
示例#23
0
 /**
  * Funkcia spracuvajúca delenie
  */
 public void div_proceed()
 {
     update_result_in_log();
     output_handle.print_log(" / ");
     actual_sign = sign.div;
 }
示例#24
0
 /**
  * Funkcia spracuvajúca sčítanie
  */
 public void add_proceed()
 {
     update_result_in_log();
     output_handle.print_log(" + ");
     actual_sign = sign.add;
 }
示例#25
0
        public string Equals()
        {
            switch(LastSign)
            {
                case sign.none:
                    storedValue = CurrentOnScreen;
                    break;
                case sign.plus:
                    storedValue = storedValue + CurrentOnScreen;
                    break;
                case sign.minus:
                    storedValue = storedValue - CurrentOnScreen;
                    break;
                case sign.multi:
                    storedValue = storedValue * CurrentOnScreen;
                    break;
                case sign.div:
                    storedValue = storedValue / CurrentOnScreen;
                    break;
            }

            LastSign = sign.none;
            CurrentOnScreen = storedValue;

            return storedValue.ToString();
        }
示例#26
0
        public string Sub(out string processText)
        {
            if (LastSign == sign.none)
            {
                storedValue = CurrentOnScreen;

                processText = storedValue.ToString();

                LastSign = sign.minus;
                return "-";
            }
            else
            {
                switch (LastSign)
                {
                    case sign.plus:
                        storedValue = storedValue + CurrentOnScreen;
                        break;
                    case sign.minus:
                        storedValue = storedValue - CurrentOnScreen;
                        break;
                    case sign.multi:
                        storedValue = storedValue * CurrentOnScreen;
                        break;
                    case sign.div:
                        storedValue = storedValue / CurrentOnScreen;
                        break;
                }
            }
            CurrentOnScreen = 0;
            processText = storedValue.ToString();
            LastSign = sign.minus;

            return "-";
        }
示例#27
0
 /**
  * Funkcia spracuvajúca druhú mocninu
  */
 public void pow_2_proceed()
 {
     actual_sign = sign.pow_2;
     eq_proceed();
 }
示例#28
0
        public static int MyAtoi(string str)
        {
            startPosition  = -1;
            finishPosition = -1;
            bool nonWhiteSpaceAppeared = false;
            bool trailingNullsAppeared = false;
            int  result  = 0;
            int  counter = 0;
            sign sign    = sign.unassigned;

            while (counter < str.Length)
            {
                if (str[counter] == ' ')
                {
                    if (nonWhiteSpaceAppeared)
                    {
                        finishPosition = counter - 1;
                        break;
                    }
                    counter++;
                }
                else if (signChars.Contains(str[counter]))
                {
                    if (startPosition > -1)
                    {
                        finishPosition = counter - 1;
                        break;
                    }
                    else if (trailingNullsAppeared)
                    {
                        return(0);
                    }
                    nonWhiteSpaceAppeared = true;
                    if (sign != sign.unassigned)
                    {
                        return(0);
                    }
                    else
                    {
                        sign = str[counter] == '+' ? sign.positive : sign.negative;
                    }
                    counter++;
                    continue;
                }
                else if (charToDigit.ContainsKey(str[counter]))
                {
                    nonWhiteSpaceAppeared = true;
                    if (str[counter] != '0' && startPosition == -1)
                    {
                        startPosition = counter;
                    }
                    else
                    {
                        trailingNullsAppeared = true;
                    }
                    counter++;
                    continue;
                }
                else
                {
                    if (startPosition > -1)
                    {
                        finishPosition = counter - 1;
                    }
                    break;
                }
            }
            if (startPosition == -1)
            {
                return(0);
            }
            if (finishPosition == -1)
            {
                finishPosition = str.Length - 1;
            }
            char[] parsebleArray = str.Substring(startPosition, finishPosition - startPosition + 1).ToCharArray();
            counter = parsebleArray.Length;
            if (parsebleArray.Length < 10)
            {
                do
                {
                    if (!char.IsNumber(parsebleArray[counter - 1]))
                    {
                        break;
                    }
                    result += myPow(10, parsebleArray.Count() - counter) * (charToDigit[parsebleArray[counter - 1]]);
                    counter--;
                } while (counter > 0);
                return(sign == sign.negative ? (-1) * result : result);
            }
            else
            {
                return(parseMax(parsebleArray, sign != sign.negative));
            }
        }
    public bool CheckIfValid(string data)
    {
        int  prantesisCount     = 0;
        int  bracketCount       = 0;
        int  acoladCount        = 0;
        sign lastSignOpened     = new sign();
        bool hasEncounteredSign = false;

        char[] dataInCharArray = data.ToCharArray();
        for (int i = 0; i < dataInCharArray.Length; i++)
        {
            switch (dataInCharArray[i])
            {
            case '{':
                if (!hasEncounteredSign)
                {
                    hasEncounteredSign = true;
                }
                lastSignOpened = sign.ACOLAD;
                acoladCount++;
                break;

            case '}':
                acoladCount--;
                if (hasEncounteredSign)
                {
                    if (lastSignOpened != sign.ACOLAD)
                    {
                        if (acoladCount > 0)
                        {
                            return(false);
                        }
                    }
                }

                break;

            case '(':
                prantesisCount++;
                if (!hasEncounteredSign)
                {
                    hasEncounteredSign = true;
                }
                lastSignOpened = sign.PRANTESIS;
                break;

            case ')':
                prantesisCount--;
                if (hasEncounteredSign)
                {
                    if (lastSignOpened != sign.PRANTESIS)
                    {
                        if (prantesisCount > 0)
                        {
                            return(false);
                        }
                    }
                }
                break;

            case '[':
                bracketCount++;
                if (!hasEncounteredSign)
                {
                    hasEncounteredSign = true;
                }
                lastSignOpened = sign.BRACKET;
                break;

            case ']':
                bracketCount--;
                if (hasEncounteredSign)
                {
                    if (lastSignOpened != sign.BRACKET)
                    {
                        if (bracketCount > 0)
                        {
                            return(false);
                        }
                    }
                }

                break;
            }
        }
        if (prantesisCount != 0 || bracketCount != 0 || acoladCount != 0)
        {
            print($"P:{prantesisCount},B:{bracketCount},A:{acoladCount}");
            return(false);
        }
        else
        {
            return(true);
        }
    }
示例#30
0
 /**
  * Funkcia spracuvajúca násobenie
  */
 public void mul_proceed()
 {
     update_result_in_log();
     output_handle.print_log(" x ");
     actual_sign = sign.mul;
 }
示例#31
0
 public void Initialise()
 {
     storedValue = 0;
     CurrentOnScreen = 0;
     LastSign = sign.none;
 }
示例#32
0
        private string allClear()
        {
            currentNum = "0";
            doCalc = false;
            lastEntered = sign.none;

            return currentNum;
        }
示例#33
0
 /**
  * Funkcia spracuvajúca faktoriál
  */
 public void fac_proceed()
 {
     actual_sign = sign.fac;
     eq_proceed();
 }
示例#34
0
        private String plus()
        {
            // Ignore the last dot is exists
            if (charAt(currentNum, currentNum.Length - 1) == '.')
                currentNum = currentNum.Substring(0, currentNum.Length - 1);

            if (!Char.IsDigit(charAt(currentNum, 0)))
            {
                lastEntered = sign.plus;
                currentNum = "+";
            }
            else if (doCalc)
            {
                doCalculation();
                doCalc = true;
                lastNum = Double.Parse(currentNum);
                lastEntered = sign.plus;
                currentNum = "+";
            }
            else
            {
                lastNum = Double.Parse(currentNum);
                lastEntered = sign.plus;
                currentNum = "+";
                doCalc = true;
            }

            return currentNum;
        }
示例#35
0
 /**
  * Funkcia spracuvajúca druhú odmocninu
  */
 public void sqr_proceed()
 {
     actual_sign = sign.sqr;
     eq_proceed();
 }
示例#36
0
 /**
  * Funkcia spracuvajúca tretiu odmocninu
  */
 public void root_3_proceed()
 {
     actual_sign = sign.root_3;
     eq_proceed();
 }
示例#37
0
        public string Add(out string processText)
        {
            if (LastSign == sign.none)
            {
                // store currently on-screen value and don't do anything

                storedValue = CurrentOnScreen;

                processText = storedValue.ToString();

                LastSign = sign.plus;
                return "+";
            }
            else
            {
                switch (LastSign)
                {
                    case sign.plus:
                        storedValue = storedValue + CurrentOnScreen;
                        break;
                    case sign.minus:
                        storedValue = storedValue - CurrentOnScreen;
                        break;
                    case sign.multi:
                        storedValue = storedValue * CurrentOnScreen;
                        break;
                    case sign.div:
                        storedValue = storedValue / CurrentOnScreen;
                        break;
                }
            }
            CurrentOnScreen = 0;
            processText = storedValue.ToString();
            LastSign = sign.plus;

            return "+";
        }