public void shouldJoinTwoNames()
        {
            var sut = new SimpleFunctions();

            string fullName = sut.JoinToNames("Shibu", "Thannikkunnath");

            Assert.That(fullName,Is.EqualTo("Shibu Thannikkunnath"));
        }
        public void ShouldJoinTwoNamesNotEqualto()
        {
            var sut = new SimpleFunctions();

            string fullName = sut.JoinToNames("Shibu", "Thannikkunnath");

            Assert.That(fullName, Is.Not.EqualTo("SHIBU THANNIKKUNNATH"));
        }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (rndItems.items.Count != 0)
        {
            float temp = 0f;
            foreach (ItemRarity itemRarity in rndItems.items)
            {
                temp += manager.GetOverAllChance(manager.GetItemsDb(itemRarity));
            }
            foreach (ItemRarity itemRarity in rndItems.items)
            {
                float chance = manager.GetOverAllChance(manager.GetItemsDb(itemRarity));
                EditorGUILayout.TextArea(itemRarity.ToString() + " chance: " + SimpleFunctions.CountPercent(chance, temp) + "% (" + chance + ")");
            }
            EditorGUILayout.TextArea("Overall chance: " + temp);
        }
    }
    public void SetupCorridor(Direction4D direction, byte length, System.Random rand)
    {
        GameObject cor = new GameObject();

        Corridor corridor = cor.AddComponent <Corridor>();

        Vector2 startCorner = Vector2.zero;
        Vector2 endCorner   = Vector2.zero;

        int offsetW = SimpleFunctions.Min(width, prevRoom.width);
        int offsetH = SimpleFunctions.Min(height, prevRoom.height);

        int tempX = rand.Next(2, offsetW);
        int tempY = rand.Next(1, offsetH);

        switch (direction)
        {
        case Direction4D.Up:
            startCorner = new Vector2(start.x + tempX, end.y);
            endCorner   = new Vector2(startCorner.x, startCorner.y + length);
            break;

        case Direction4D.Down:
            startCorner = new Vector2(start.x + tempX, start.y);
            endCorner   = new Vector2(startCorner.x, startCorner.y - length);
            break;

        case Direction4D.Right:
            startCorner = new Vector2(end.x, start.y + tempY);
            endCorner   = new Vector2(startCorner.x + length, startCorner.y);
            break;

        case Direction4D.Left:
            startCorner = new Vector2(start.x, start.y + tempY);
            endCorner   = new Vector2(startCorner.x - length, startCorner.y);
            break;
        }

        corridor.Setup(startCorner, endCorner, this, prevRoom, direction);
    }
Exemple #5
0
        public void SortearTabelaCampeonato_IsValid()
        {
            Assert.Throws <ArgumentException>(
                delegate
            {
                SimpleFunctions.SortearTabelaCampeonato(_competidores);
            });

            Assert.Throws <ArgumentException>(
                delegate
            {
                _competidores.Add("Marcelo");
                SimpleFunctions.SortearTabelaCampeonato(_competidores);
            });

            Assert.Throws <ArgumentException>(
                delegate
            {
                _competidores.Add("Estevão");
                SimpleFunctions.SortearTabelaCampeonato(_competidores);
            });
        }
Exemple #6
0
    private static bool CreateShopToRight(Room room, GameObject shop)
    {
        Vector3    position    = new Vector3(room.end.x - 5, room.end.y - 4, 0);
        Vector3    endposition = new Vector3(position.x + 4, position.y + 4);
        GameObject s           = room.CreateEnvironmentObject(shop, position);

        foreach (GameObject d in room.Doors)
        {
            if (SimpleFunctions.Check_Superimpose(position, endposition, d.transform.position, d.transform.position, 2))
            {
                GameObject.Destroy(s);
                return(false);
            }
        }

        Transform[] shopsEnv = s.GetComponentsInChildren <Transform>();
        foreach (Transform t in shopsEnv)
        {
            room.EnvironmentTiles.Add(new EnvironmentTile(t.gameObject, room));
        }

        return(true);
    }
 bool Check_All_Superimpose(Vector2 startpos, Vector2 endpos, List <Room> exceptions)
 {
     foreach (Room temproom in Map.roomObjs)
     {
         bool ok = true;
         foreach (Room r in exceptions)
         {
             if (temproom == r)
             {
                 ok = false;
                 break;
             }
         }
         if (ok)
         {
             if (SimpleFunctions.Check_Superimpose(temproom.start, temproom.end, startpos, endpos, 2) == true || transform.position.x <= 0 || transform.position.y <= 0)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        /// <summary>
        /// Should be dynamic object with properties name and value
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public void SetValuesDynamic(dynamic list)
        {
            try
            {
                List <string> Names = new List <string>();
                List <ToPlot> data  = new List <ToPlot>();
                foreach (dynamic q in list)
                {
                    var v = new ToPlot {
                        Name = q.name, Value = q.value
                    };
                    data.Add(v);
                    Names.Add(q.name);
                }
                AssignPlateType(Names);

                double[,] dataToPlot = new double[PT.NumRows, PT.NumCols];
                var    cleanedData = from x in data where SimpleFunctions.IsARealNumber(x.Value) & x.Value != 0 select x;
                double max         = cleanedData.Max((x) => x.Value);
                double min         = cleanedData.Min((x) => x.Value);
                foreach (var d in cleanedData)
                {
                    int index = -1;
                    if (PT.CellNameToInts.TryGetValue(d.Name, out index))
                    {
                        int row = PT.RowColArray[index, 0];
                        int col = PT.RowColArray[index, 1];
                        dataToPlot[row, col] = d.Value;
                    }
                }
                this.SetMatrixForPlotting(dataToPlot, PT.RowNames, PT.ColNames);
            }
            catch (Exception thrown)
            {
                Console.WriteLine("Could not Make Plot\n" + thrown.Message);
            }
        }
        public void SetValue(GrowthCurveDoubleValueGetter dataFunction)
        {
            if (pcurPlateType != PlateType.None)
            {
                double[,] dataToPlot = new double[PT.NumRows, PT.NumCols];
                var data        = from x in curGCC select new { Name = x.DataSetName, Value = SafeGet(dataFunction, x) };
                var cleanedData = (from x in data where SimpleFunctions.IsARealNumber(x.Value) & x.Value != 0 select x).ToList();

                double max = cleanedData.Max((x) => x.Value);
                double min = cleanedData.Min((x) => x.Value);

                foreach (var d in cleanedData)
                {
                    int index = -1;
                    if (PT.CellNameToInts.TryGetValue(d.Name, out index))
                    {
                        int row = PT.RowColArray[index, 0];
                        int col = PT.RowColArray[index, 1];
                        dataToPlot[row, col] = d.Value;
                    }
                }
                this.SetMatrixForPlotting(dataToPlot, PT.RowNames, PT.ColNames);
            }
        }
Exemple #10
0
 public static void Rollback(this SimpleFunctions simpleFunctions, string reason)
 {
     simpleFunctions.LastEvent = reason;
 }
Exemple #11
0
        static void Main()
        {
            long key = 1, value = 1, output = 0;

            // This is a simple in-memory sample of FASTER using value types

            // Create device for FASTER log
            var path = Path.GetTempPath() + "HelloWorld/";
            var log  = Devices.CreateLogDevice(Path.GetTempPath() + "hlog.log");

            // Create store instance
            var store = new FasterKV <long, long>(
                size: 1L << 20, // 1M cache lines of 64 bytes each = 64MB hash table
                    logSettings: new LogSettings {
                LogDevice = log
                    }                                            // specify log settings (e.g., size of log in memory)
                );

            // Create functions for callbacks; we use a standard in-built function in this sample
            // although you can write your own by extending FunctionsBase or implementing IFunctions
            // In this in-built function, read-modify-writes will perform value merges via summation
            var funcs = new SimpleFunctions <long, long>((a, b) => a + b);

            // Each logical sequence of calls to FASTER is associated
            // with a FASTER session. No concurrency allowed within
            // a single session
            var session = store.NewSession(funcs);

            // (1) Upsert and read back upserted value
            session.Upsert(ref key, ref value);

            // In this sample, reads are served back from memory and return synchronously
            // Reads from disk will return PENDING status; see StoreCustomTypes example for details
            var status = session.Read(ref key, ref output);

            if (status == Status.OK && output == value)
            {
                Console.WriteLine("(1) Success!");
            }
            else
            {
                Console.WriteLine("(1) Error!");
            }

            /// (2) Delete key, read to verify deletion
            session.Delete(ref key);

            status = session.Read(ref key, ref output);
            if (status == Status.NOTFOUND)
            {
                Console.WriteLine("(2) Success!");
            }
            else
            {
                Console.WriteLine("(2) Error!");
            }

            // (3) Perform two read-modify-writes (summation), verify result
            key = 2;
            long input1 = 25, input2 = 27;

            session.RMW(ref key, ref input1);
            session.RMW(ref key, ref input2);

            status = session.Read(ref key, ref output);

            if (status == Status.OK && output == input1 + input2)
            {
                Console.WriteLine("(3) Success!");
            }
            else
            {
                Console.WriteLine("(3) Error!");
            }

            // End session
            session.Dispose();

            // (4) Perform TryAdd using RMW
            using (var tryAddSession = store.NewSession(new TryAddFunctions <long, long>()))
            {
                key = 3; input1 = 30; input2 = 31;

                // First TryAdd - success; status should be NOTFOUND (does not already exist)
                status = tryAddSession.RMW(ref key, ref input1);

                // Second TryAdd - failure; status should be OK (already exists)
                var status2 = tryAddSession.RMW(ref key, ref input2);

                // Read, result should be input1 (first TryAdd)
                var status3 = session.Read(ref key, ref output);

                if (status == Status.NOTFOUND && status2 == Status.OK && status3 == Status.OK && output == input1)
                {
                    Console.WriteLine("(4) Success!");
                }
                else
                {
                    Console.WriteLine("(3) Error!");
                }
            }

            // Dispose store
            store.Dispose();

            // Close devices
            log.Dispose();

            // Delete the created files
            try { new DirectoryInfo(path).Delete(true); } catch { }

            Console.WriteLine("Press <ENTER> to end");
            Console.ReadLine();
        }
        private static Boolean TrySimpleParse(String normalizedExpression, out String strExpression, out SimpleFunctions function)
        {
            function      = SimpleFunctions.None;
            strExpression = normalizedExpression;

            /***************************************************
            * NOTE: now it has 2 classified conditions:
            * 1. sub != origin
            * 2. sub == orgin
            ***************************************************/

            // 1.sub != origin
            var subExpression = Helper.GetSubExpression(strExpression);

            if (subExpression != strExpression)
            {
                return(true);
            }

            // 2. sub == origin

            /***************************************************
            * NOTE: now it has 3 potential conditions:
            * 1. started with number
            * 2. started with left bracket --- [Impossible]
            * 3. start with string which is function name
            *
            * so, actually it has 2 classified conditions:
            * 1. started with number: will return true to continue with search
            * 2. started with char: to get the function name & parameter
            ***************************************************/

            // 2.1 started with number
            if (Regex.IsMatch(strExpression, @"^[0-9]")) // should never started with +/-, since it's normalized
            {
                return(true);
            }

            // 2.2 started with char
            var match = Regex.Match(strExpression, @"[([{]");

            if (!match.Success || match.Index == 0)
            {
                throw new Exception(String.Format("TrySimpleParse Expression: {0}", strExpression));
            }

            // get the simple function name
            var expression1  = strExpression.Substring(0, match.Index).ToUpper();
            var functionName = Enum.GetNames(typeof(SimpleFunctions)).FirstOrDefault(p => p.ToUpper() == expression1);

            if (functionName == null)// not a simple function
            {
                return(false);
            }

            function      = (SimpleFunctions)Enum.Parse(typeof(SimpleFunctions), functionName);
            strExpression = strExpression.Substring(functionName.Length + 1, strExpression.Length - functionName.Length - 2);
            return(true);
        }
Exemple #13
0
        static void DiskSample()
        {
            Console.WriteLine("\nDisk Sample:\n");

            long key = 1, value = 1, output = 0;

            // Create FasterKV config based on specified base directory path.
            using var config = new FasterKVSettings <long, long>("./database")
                  {
                      TryRecoverLatest = true
                  };
            Console.WriteLine($"FasterKV config:\n{config}\n");

            // Create store using specified config
            using var store = new FasterKV <long, long>(config);

            // Create functions for callbacks; we use a standard in-built function in this sample.
            // You can write your own by extending this or FunctionsBase.
            // In this in-built function, read-modify-writes will perform value merges via summation.
            var funcs = new SimpleFunctions <long, long>((a, b) => a + b);

            // Each logical sequence of calls to FASTER is associated with a FASTER session.
            // No concurrency allowed within a single session
            using var session = store.NewSession(funcs);

            if (store.RecoveredVersion == 1) // did not recover
            {
                Console.WriteLine("Clean start; upserting key-value pair");

                // (1) Upsert and read back upserted value
                session.Upsert(ref key, ref value);

                // Take checkpoint so data is persisted for recovery
                Console.WriteLine("Taking full checkpoint");
                store.TryInitiateFullCheckpoint(out _, CheckpointType.Snapshot);
                store.CompleteCheckpointAsync().AsTask().GetAwaiter().GetResult();
            }
            else
            {
                Console.WriteLine($"Recovered store to version {store.RecoveredVersion}");
            }

            // Reads are served back from memory and return synchronously
            var status = session.Read(ref key, ref output);

            if (status.Found && output == value)
            {
                Console.WriteLine("(1) Success!");
            }
            else
            {
                Console.WriteLine("(1) Error!");
            }

            // (2) Force flush record to disk and evict from memory, so that next read is served from disk
            store.Log.FlushAndEvict(true);

            // Reads from disk will return PENDING status, result available via either asynchronous IFunctions callback
            // or on this thread via CompletePendingWithOutputs, shown below
            status = session.Read(ref key, ref output);
            if (status.IsPending)
            {
                session.CompletePendingWithOutputs(out var iter, true);
                while (iter.Next())
                {
                    if (iter.Current.Status.Found && iter.Current.Output == value)
                    {
                        Console.WriteLine("(2) Success!");
                    }
                    else
                    {
                        Console.WriteLine("(2) Error!");
                    }
                }
                iter.Dispose();
            }
            else
            {
                Console.WriteLine("(2) Error!");
            }

            /// (3) Delete key, read to verify deletion
            session.Delete(ref key);

            status = session.Read(ref key, ref output);
            if (status.Found)
            {
                Console.WriteLine("(3) Error!");
            }
            else
            {
                Console.WriteLine("(3) Success!");
            }

            // (4) Perform two read-modify-writes (summation), verify result
            key = 2;
            long input1 = 25, input2 = 27;

            session.RMW(ref key, ref input1);
            session.RMW(ref key, ref input2);

            status = session.Read(ref key, ref output);

            if (status.Found && output == input1 + input2)
            {
                Console.WriteLine("(4) Success!");
            }
            else
            {
                Console.WriteLine("(4) Error!");
            }


            // (5) Perform TryAdd using RMW and custom IFunctions
            using var tryAddSession = store.NewSession(new TryAddFunctions <long, long>());
            key = 3; input1 = 30; input2 = 31;

            // First TryAdd - success; status should be NOTFOUND (does not already exist)
            status = tryAddSession.RMW(ref key, ref input1);

            // Second TryAdd - failure; status should be OK (already exists)
            var status2 = tryAddSession.RMW(ref key, ref input2);

            // Read, result should be input1 (first TryAdd)
            var status3 = session.Read(ref key, ref output);

            if (!status.Found && status2.Found && status3.Found && output == input1)
            {
                Console.WriteLine("(5) Success!");
            }
            else
            {
                Console.WriteLine("(5) Error!");
            }
        }
 public SimpleFunctionTests()
 {
     sut = new SimpleFunctions();
 }
Exemple #15
0
 public void FibonnaciIsNotEmpty()
 {
     Assert.IsNotEmpty(SimpleFunctions.Fibonacci(1));
 }
Exemple #16
0
 protected void btnPower_Click(object sender, EventArgs e)
 {
     lblResult.Text = SimpleFunctions.Power(Convert.ToInt32(txtFirst.Text), Convert.ToInt32(txtSecond.Text)).ToString();
 }
Exemple #17
0
 private void btn_print_screen_Click(object sender, EventArgs e)
 {
     SimpleFunctions.PrintScreen(Screen.AllScreens, @"C:\Users\marcelosr\Desktop\printscreen.png", ImageFormat.Png);
 }
Exemple #18
0
        private static Boolean TrySimpleParse(String normalizedExpression, out String strExpression, out SimpleFunctions function)
        {
            function      = SimpleFunctions.None;
            strExpression = String.Copy(normalizedExpression);
            if (Regex.IsMatch(strExpression, @"^[0-9]"))
            {
                return(true);
            }

            var subExpression = Helpers.GetSubExpression(strExpression);

            if (subExpression != strExpression)
            {
                return(true);
            }

            var match = Regex.Match(strExpression, @"[([{]");

            if (!match.Success)
            {
                return(false);
            }

            if (match.Index == 0)
            {
                return(true);
            }

            var expression1  = strExpression.Substring(0, match.Index).ToUpper();
            var functionName = Enum.GetNames(typeof(SimpleFunctions)).FirstOrDefault(p => p.ToUpper() == expression1);

            if (functionName == null)
            {
                return(false);
            }

            function      = (SimpleFunctions)Enum.Parse(typeof(SimpleFunctions), functionName);
            strExpression = strExpression.Substring(functionName.Length + 1, strExpression.Length - functionName.Length - 2);
            return(true);
        }
Exemple #19
0
        static void InMemorySample()
        {
            Console.WriteLine("In-Memory Sample:\n");

            long key = 1, value = 1, output = 0;

            // Create a default config (null path indicates in-memory only)
            // Uses default config parameters. Update config fields to tune parameters.
            using var config = new FasterKVSettings <long, long>(null);
            Console.WriteLine($"FasterKV config:\n{config}\n");

            using var store = new FasterKV <long, long>(config);

            // Create functions for callbacks; we use a standard in-built function in this sample.
            // You can write your own by extending this or FunctionsBase.
            // In this in-built function, read-modify-writes will perform value merges via summation.
            var funcs = new SimpleFunctions <long, long>((a, b) => a + b);

            // Each logical sequence of calls to FASTER is associated with a FASTER session.
            // No concurrency allowed within a single session
            using var session = store.NewSession(funcs);

            // (1) Upsert and read back upserted value
            session.Upsert(ref key, ref value);

            // Reads are served back from memory and return synchronously
            var status = session.Read(ref key, ref output);

            if (status.Found && output == value)
            {
                Console.WriteLine("(1) Success!");
            }
            else
            {
                Console.WriteLine("(1) Error!");
            }

            /// (2) Delete key, read to verify deletion
            session.Delete(ref key);

            status = session.Read(ref key, ref output);
            if (status.Found)
            {
                Console.WriteLine("(2) Error!");
            }
            else
            {
                Console.WriteLine("(2) Success!");
            }

            // (4) Perform two read-modify-writes (summation), verify result
            key = 2;
            long input1 = 25, input2 = 27;

            session.RMW(ref key, ref input1);
            session.RMW(ref key, ref input2);

            status = session.Read(ref key, ref output);

            if (status.Found && output == input1 + input2)
            {
                Console.WriteLine("(3) Success!");
            }
            else
            {
                Console.WriteLine("(3) Error!");
            }


            // (5) Perform TryAdd using RMW and custom IFunctions
            using var tryAddSession = store.NewSession(new TryAddFunctions <long, long>());
            key = 3; input1 = 30; input2 = 31;

            // First TryAdd - success; status should be NotFound (does not already exist)
            status = tryAddSession.RMW(ref key, ref input1);

            // Second TryAdd - failure; status should be Found (already exists)
            var status2 = tryAddSession.RMW(ref key, ref input2);

            // Read, result should be input1 (first TryAdd)
            var status3 = session.Read(ref key, ref output);

            if (status.NotFound && status2.Found && status3.Found && output == input1)
            {
                Console.WriteLine("(4) Success!");
            }
            else
            {
                Console.WriteLine("(4) Error!");
            }
        }
Exemple #20
0
        private static void ExibirInformacoesAtivos()
        {
            try
            {
                do
                {
                    var opcaoEscolhida = ObterOpcaoEscolhida();

                    StringBuilder saidaConsole = new StringBuilder();

                    switch (opcaoEscolhida)
                    {
                    case '1':
                        foreach (var ativo in ativos)
                        {
                            saidaConsole.AppendLine($"{ativo.dividendYield}%");
                        }
                        break;

                    case '2':
                        foreach (var ativo in ativos)
                        {
                            saidaConsole.AppendLine($"{((Fii)ativo).valorPatrimonial}");
                        }
                        break;

                    case '3':
                        foreach (var ativo in ativos)
                        {
                            saidaConsole.AppendLine($"{ativo.proventos[0].valorPago}");
                        }
                        break;

                    case '4':
                        foreach (var ativo in ativos)
                        {
                            saidaConsole.AppendLine($"{ativo.proventos[0].dataCom.ToString("MMMM")}");
                        }
                        break;

                    case '5':
                        foreach (var ativo in ativos)
                        {
                            saidaConsole.AppendLine($"{ativo.proventos[0].dataPagamento.ToString("MMMM")}");
                        }
                        break;

                    case '6':
                        foreach (var ativo in ativos)
                        {
                            saidaConsole.AppendLine($"{ativo.proventos[0].dataCom.ToString("dd/MM/yyyy")}");
                        }
                        break;

                    case '7':
                        foreach (var ativo in ativos)
                        {
                            saidaConsole.AppendLine($"{ativo.proventos[0].dataPagamento.ToString("dd/MM/yyyy")}");
                        }
                        break;

                    case '9':
                        Environment.Exit(0);
                        return;

                    default:
                        saidaConsole.AppendLine("Opção inválida!");
                        break;
                    }

                    Console.Write(saidaConsole);
                    SimpleFunctions.SetToClipboard(saidaConsole.ToString());
                } while (true);

                // Até melhorar o que tenho hoje
                //Console.WriteLine($"{acao.ticker.PadRight(6)} {acao.valorAtual.ToString().PadLeft(8)} {acao.dividendYield.ToString().PadLeft(8)}%");
            }
            catch (FormatException)
            {
                Console.WriteLine("Opção inválida!");
            }
            catch (Exception)
            {
                Console.WriteLine("Opção inválida para Ações!");
            }
            finally
            {
                ExibirInformacoesAtivos();
            }
        }
    // Start is called before the first frame update
    void LateUpdate()
    {
        if (Time.timeScale != 0)
        {
            if (Player.instance != null)
            {
                if (bigMap)
                {
                    sightMousePos = Player.instance.sightCamera.ScreenToWorldPoint(Input.mousePosition);

                    if (teleport != null)
                    {
                        Vector2 worldMousePos = cam.ScreenToWorldPoint(Input.mousePosition);
                        foreach (Room r in Map.roomObjs)
                        {
                            if (SimpleFunctions.Check_Superimpose(worldMousePos, r.start, r.end))
                            {
                                if (r.hereWasPlayer)
                                {
                                    r.HighLight(true);
                                    if (Input.GetButton("Fire1"))
                                    {
                                        teleport.TeleportTo(r);
                                        TurnOffBigMap(false);
                                    }
                                    break;
                                }
                            }
                            else
                            {
                                r.HighLight(false);
                            }
                        }
                    }

                    Vector3 v = transform.position;

                    if (sightMousePos.x < Player.instance.transform.position.x - 4)
                    {
                        v.x -= sightMousePos.normalized.x;
                    }
                    else if (sightMousePos.x > Player.instance.transform.position.x + 4)
                    {
                        v.x += sightMousePos.normalized.x;
                    }

                    if (sightMousePos.y < Player.instance.transform.position.y - 3)
                    {
                        v.y -= sightMousePos.normalized.y;
                    }
                    else if (sightMousePos.y > Player.instance.transform.position.y + 3)
                    {
                        v.y += sightMousePos.normalized.y;
                    }

                    v.x = Mathf.Clamp(v.x, Map.lowestVector.x, Map.highestVector.x);
                    v.y = Mathf.Clamp(v.y, Map.lowestVector.y, Map.highestVector.y);

                    transform.position = Vector3.MoveTowards(transform.position, v, 1f);
                }
            }
        }
    }
Exemple #22
0
 public static SimpleFunctions Clear(this SimpleFunctions eventHolder)
 {
     eventHolder.LastEvent = string.Empty;
     return(eventHolder);
 }
Exemple #23
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        for (int i = 0; i <= manager.phaseMax; i++)
        {
            GuiLine(Color.black, 8);
            GUILayout.Label("PHASE № " + i);
            float overallChance = manager.CalculateOverallChances(i);

            EditorGUILayout.TextArea("Overall: " + overallChance.ToString());

            float chance = manager.nothing.chance[i];
            EditorGUILayout.TextArea("Nothing chance: " + SimpleFunctions.CountPercent(chance, overallChance) + "% (" + chance + ")");


            chance = manager.ammoItems.chance[i];
            EditorGUILayout.TextArea("Ammo: " + SimpleFunctions.CountPercent(chance, overallChance) + "% (" + chance + ")");

            chance = manager.healItems.chance[i];
            EditorGUILayout.TextArea("Heal: " + SimpleFunctions.CountPercent(chance, overallChance) + " % (" + chance + ")");


            chance = manager.common_boostItems.chance[i];
            EditorGUILayout.TextArea("Common Boosts: " + SimpleFunctions.CountPercent(chance, overallChance) + " % (" + chance + ")");
            chance = manager.rare_BoostItems.chance[i];
            EditorGUILayout.TextArea("Rare Boosts: " + SimpleFunctions.CountPercent(chance, overallChance) + " % (" + chance + ")");


            chance = manager.common_ModificatorItems.chance[i];
            EditorGUILayout.TextArea("Common Mods: " + SimpleFunctions.CountPercent(chance, overallChance) + " % (" + chance + ")");
            chance = manager.rare_ModificatorItems.chance[i];
            EditorGUILayout.TextArea("Rare Mods: " + SimpleFunctions.CountPercent(chance, overallChance) + " % (" + chance + ")");


            chance = manager.common_Items.chance[i];
            EditorGUILayout.TextArea("Common items: " + SimpleFunctions.CountPercent(chance, overallChance) + "% (" + chance + ")");
            chance = manager.rare_Items.chance[i];
            EditorGUILayout.TextArea("Rare items: " + SimpleFunctions.CountPercent(chance, overallChance) + "% (" + chance + ")");
            chance = manager.legendary_Items.chance[i];
            EditorGUILayout.TextArea("Legendary items: " + SimpleFunctions.CountPercent(chance, overallChance) + "% (" + chance + ")");


            chance = manager.common_Weapons.chance[i];
            EditorGUILayout.TextArea("Common weapons: " + SimpleFunctions.CountPercent(chance, overallChance) + "% (" + chance + ")");

            chance = manager.rare_Weapons.chance[i];
            EditorGUILayout.TextArea("Rare weapons: " + SimpleFunctions.CountPercent(chance, overallChance) + "% (" + chance + ")");

            chance = manager.legendary_Weapons.chance[i];
            EditorGUILayout.TextArea("Legendary weapons: " + SimpleFunctions.CountPercent(chance, overallChance) + "% (" + chance + ")");


            GuiLine(4);
            float[] weapChances = manager.GetChances(ItemRarity.weapons, i);
            EditorGUILayout.TextArea("Weapons: " + SimpleFunctions.CountPercent(weapChances[0], overallChance) + "% (" + weapChances[0] + ")");

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.TextArea("Com: " + SimpleFunctions.CountPercent(weapChances[1], weapChances[0]).ToString("F" + 1) + "%(" + weapChances[1] + ")");
            EditorGUILayout.TextArea("Rare: " + SimpleFunctions.CountPercent(weapChances[2], weapChances[0]).ToString("F" + 1) + "%(" + weapChances[2] + ")");
            EditorGUILayout.TextArea("Legend: " + SimpleFunctions.CountPercent(weapChances[3], weapChances[0]).ToString("F" + 1) + "%(" + weapChances[3] + ")");
            EditorGUILayout.EndHorizontal();

            GuiLine(4);
            float[] useItemsChances = manager.GetChances(ItemRarity.useItems, i);
            EditorGUILayout.TextArea("UseItems: " + SimpleFunctions.CountPercent(useItemsChances[0], overallChance) + "% (" + useItemsChances[0] + ")");

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.TextArea("Com: " + SimpleFunctions.CountPercent(useItemsChances[1], useItemsChances[0]).ToString("F" + 1) + "%(" + useItemsChances[1] + ")");
            EditorGUILayout.TextArea("Rare: " + SimpleFunctions.CountPercent(useItemsChances[2], useItemsChances[0]).ToString("F" + 1) + "%(" + useItemsChances[2] + ")");
            EditorGUILayout.TextArea("UltraRare: " + SimpleFunctions.CountPercent(useItemsChances[3], useItemsChances[0]).ToString("F" + 1) + " %(" + useItemsChances[3] + ")");
            EditorGUILayout.EndHorizontal();

            GuiLine(4);
            float[] otherChances = manager.GetChances(ItemRarity.other, i);
            EditorGUILayout.TextArea("Other: " + SimpleFunctions.CountPercent(otherChances[0], overallChance) + "% (" + otherChances[0] + ")");

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.TextArea("Heal: " + SimpleFunctions.CountPercent(otherChances[1], otherChances[0]).ToString("F" + 1) + "%(" + otherChances[1] + ")");
            EditorGUILayout.TextArea("Ammo: " + SimpleFunctions.CountPercent(otherChances[2], otherChances[0]).ToString("F" + 1) + "%(" + otherChances[2] + ")");
            EditorGUILayout.TextArea("Boost: " + SimpleFunctions.CountPercent(otherChances[3], otherChances[0]).ToString("F" + 1) + " %(" + otherChances[3] + ")");
            EditorGUILayout.TextArea("Mods: " + SimpleFunctions.CountPercent(otherChances[4], otherChances[0]).ToString("F" + 1) + " %(" + otherChances[4] + ")");
            EditorGUILayout.EndHorizontal();
        }
    }
Exemple #24
0
 public static SimpleFunctions Done(this SimpleFunctions eventHolder)
 {
     eventHolder.LastEvent = "Done";
     return(eventHolder);
 }
Exemple #25
0
 protected void btnRoot_Click(object sender, EventArgs e)
 {
     lblResult.Text = SimpleFunctions.Root(Convert.ToDouble(txtFirst.Text), Convert.ToDouble(txtSecond.Text)).ToString();
 }
Exemple #26
0
 public SimpleUnit(String strExpression, SimpleFunctions simpleFunction) : base(strExpression)
 {
     this._function = simpleFunction;
 }
Exemple #27
0
    private void CreateTeleport(Room room)
    {
        Vector2 tmp = Vector2.zero;
        bool    ok  = false;

        List <Vector2> tiles = new List <Vector2>();

        foreach (Wall wall in room.smartGrid.UpWalls)
        {
            if (wall.gameObject.transform.position.x > room.start.x + 2)
            {
                tmp = wall.gameObject.transform.position;
                Wall checkDoor1 = room.GetWallAtPosition(new Vector3(tmp.x + 2, tmp.y));
                Wall checkDoor2 = room.GetWallAtPosition(new Vector3(tmp.x - 2, tmp.y));

                if (checkDoor1 != null && checkDoor2 != null)
                {
                    Wall w1 = room.GetWallAtPosition(new Vector3(tmp.x + 1, tmp.y));
                    Wall w2 = room.GetWallAtPosition(new Vector3(tmp.x - 1, tmp.y));

                    if (w1 != null && w2 != null)
                    {
                        tiles.Add(w1.gameObject.transform.position);
                        tiles.Add(w2.gameObject.transform.position);
                        tiles.Add(wall.gameObject.transform.position);
                        ok = true;
                        break;
                    }
                }
            }
        }
        if (ok)
        {
            Vector2 lowest  = tiles[0];
            Vector2 highest = tiles[0];

            foreach (Vector2 v in tiles)
            {
                lowest = SimpleFunctions.LowestVector(lowest, v);
            }
            foreach (Vector2 v in tiles)
            {
                highest = SimpleFunctions.HighestVector(highest, v);
            }
            List <Wall> walls = room.smartGrid.GetWallsRange(lowest, highest);
            for (int i = 0; i < walls.Count; i++)
            {
                room.smartGrid.RemoveWall(walls[i]);
            }

            List <Vector2> rect = SimpleFunctions.GetRectangle(lowest, highest);

            foreach (Vector2 r in rect)
            {
                room.CreateTile(r, FloorType.outside);
            }

            room.smartGrid.CreateWallAroundTiles(rect.ToArray());

            GameObject tel = room.CreateEnvironmentObject(teleport.gameObject, tmp);
            room.teleport = tel.GetComponent <Teleport>();
            room.SetMiniMapIcon(icons.teleportIcon, tmp);
        }
    }
Exemple #28
0
 private void btn_decripta_Click(object sender, EventArgs e)
 {
     SimpleFunctions.DecryptFile(txt_arquivo_entrada.Text, txt_arquivo_destino.Text, SaltKey);
 }