protected override void Action()
        {
            List <BaseValue> internalVariableList = logicObject.logicManager.data.internalValueList;
            string           tempFormula          = formula;

            for (int i = 0; i < internalVariableList.Count; i++)
            {
                string valueStr = logicObject.logicManager.GetInternalValue(internalVariableList[i].name).ToString();
                string temp     = tempFormula.Replace("{" + internalVariableList[i].name + "}", valueStr);
                if (!temp.Equals(tempFormula))
                {
                    tempFormula = temp;
                }
            }
            try
            {
                //Debug.Log("Formula:" + tempFormula);
                object c = CalculateTool.CalculateExpression(tempFormula);//1+12+3
                logicObject.logicManager.SetInternalValue(resultValueName, c);
            }
            catch (System.Exception e)
            {
                // Debug.LogError(e);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            var n = (long)int.MaxValue;
            var time = new TimeSpan(0, 0, 30);
            var tool = new CalculateTool(time);
            var maxPrimeNumber = tool.FindMaxPrime(n);

            Console.WriteLine("[0..{1}] range in find max prime number {0} by {2} sek elapsed!", maxPrimeNumber, n, time.Seconds);

            Console.ReadKey();
        }