コード例 #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
ファイル: Calculator.cs プロジェクト: TPeterW/NightView-Calc
        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;
        }
コード例 #4
0
 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
ファイル: unit.cs プロジェクト: DavidGoedicke/CrowedControl
 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
ファイル: Calculator.cs プロジェクト: TPeterW/NightView-Calc
 public Calculator()
 {
     currentNum  = "0";
     lastNum     = 0;
     lastEntered = sign.none;
     doCalc      = false;
     overwrite   = false;
 }
コード例 #9
0
ファイル: Calculator.cs プロジェクト: TPeterW/NightView-Calc
        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
ファイル: gate.cs プロジェクト: DavidGoedicke/CrowedControl
 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
ファイル: Sign.cs プロジェクト: HelenSPR/OptimBaseProf
        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
ファイル: Sign.cs プロジェクト: HelenSPR/OptimBaseProf
        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
ファイル: TicTacToeGame.cs プロジェクト: AmarianaH/PLs
 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
ファイル: Program.cs プロジェクト: stalskaper/leetcode_tasks
        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));
            }
        }
コード例 #29
0
    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 "+";
        }