Exemple #1
0
 private void Awake()
 {
     _instance = this;
     m_backend = new ConsoleBackend(consoleOptions.LogHandler, consoleOptions);
     m_gui     = new ConsoleGui(m_backend, consoleOptions);
     ConsoleGui.OnStateChanged += x => OnStateChanged(x);
 }
 public static void draw()
 {
     //Draw Command Window
     ConsoleGui.WriteLine("|| - Commands");
     ConsoleGui.Write("|| ");
     ConsoleGui.Write("|{0}Clear | ", clearSelected ? " *" : " ");
     ConsoleGui.Write("|{0}Exit |", exitSelected ? " *" : " ");
     ConsoleGui.WriteLine();
     ConsoleGui.Write("|{0}Enter |", enterSelected ? " *" : " ");
     ConsoleGui.Write("|{0}", inputString);
     ConsoleGui.WriteLine("\n|| ---------");
     //Draw Message Window
     ConsoleGui.WriteLine("------------");
     ConsoleGui.WriteLine("|| - Messages");
     if (messages.Count > MSG_COUNT)
     {
         //display last MSG_COUNT number of messages
         for (int i = messages.Count - 1; i >= messages.Count - MSG_COUNT; i--)
         {
             ConsoleGui.WriteLine("{0} - {1}", i, messages[i]);
         }
     }
     else
     {
         //display messages
         for (int i = messages.Count - 1; i >= 0; i--)
         {
             ConsoleGui.WriteLine("{0} - {1}", i, messages[i]);
         }
     }
     ConsoleGui.WriteLine("|| ---------");
 }
        private void Awake()
        {
            if (!_instance)
            {
                _instance = this;
            }
            else
            {
                Destroy(this.gameObject);
            }

            DontDestroyOnLoad(this.gameObject);
            var evsys = GameObject.FindObjectOfType <EventSystem>();

            if (!evsys)
            {
                Debug.LogError("UnityEvent System not found in scene, manually add it.");
                Debug.Break();
            }
            DestroyChildren(transform);
            GameObject prefab = Resources.Load <GameObject>("BeastConsole/ConsoleGui");

            m_consoleRoot = GameObject.Instantiate(prefab);
            m_consoleRoot.transform.SetParent(transform);

            m_backend = new ConsoleBackend();
            ConsoleGui gui = m_consoleRoot.GetComponentInChildren <ConsoleGui>();

            gui.Initialize(m_backend, consoleOptions);
        }
Exemple #4
0
        private static void RunGame(GameOptions options)
        {
            var levels = GenerateLevels(options.Seed, options.LevelCount);

            var gui = new ConsoleGui(new TextScreen());

            var playerController = options.PlayerController == null ?
                                   new ConsolePlayerController(gui) :
                                   BotLoader.LoadPlayerController(options.PlayerController);

            var engine = new Engine(options.PlayerName, playerController, levels.First(), new ConsoleRenderer(gui), new ConsoleEventReporter(gui));

            engine.GameLoop();
        }
Exemple #5
0
        static void Main(string[] args)
        {
            IGui gui = new ConsoleGui();
            //IMath mathCalculator = LoadMathCalculatorRigid();
            IMath mathCalculator = LoadMathCalculatorDecoupled();

            var value = gui.ReadInt("Give me an integer: ");

            bool isPrime = mathCalculator.IsPrime(value);

            gui.Write($"The number {value} is {(isPrime ? "" : "not ")}prime.");

            Console.Read();
        }
Exemple #6
0
        static void Main(string[] args)
        {
            IGui gui = new ConsoleGui();

            #region Caricamento dipendenze
            LoadMathCalculator();
            #endregion

            gui.Write("Messaggio scritto.");



            var value = gui.ReadInt("Immettere un numero intero.");
            gui.Write(value.ToString());
        }
Exemple #7
0
        static void Main(string[] args)
        {
            IGui gui  = new ConsoleGui();
            bool exit = false;

            while (!exit)
            {
                gui.ClearScreen();
                ILoanCalculator calculator = AskForLoanCalculator(gui);

                LoanApplication loanApp = new LoanApplication(gui, calculator);
                loanApp.Run();


                exit = gui.AskForExit();
            }

            Console.ReadKey();
        }
Exemple #8
0
        static void Main()
        {
            var sampleGenerator = new SampleGenerator(2, 6, 0.001);
            var randomFormula   = sampleGenerator.GetFormula();

            Console.WriteLine("Formula before making constants noisy: {0}", randomFormula);

            GenerateNoisyConstantsForNodeLeafes(randomFormula);
            Console.WriteLine("Formula after making constants noisy: {0}", randomFormula);

            Console.WriteLine("Press any key to start regression...");
            Console.ReadKey(true);

            var alg = new RegressionAlgorithm(randomFormula, sampleGenerator.InSamples, sampleGenerator.ExactResult);

            ConsoleGui.Run(alg, 5, "");

            Console.WriteLine("Result: {0}", alg.GetResult());
        }
    public static void Main(string[] args)
    {
        int count         = 0;
        int messagesAdded = 0;

        while (ConsoleGui.Alive)
        {
            ConsoleGui.input();
            ConsoleGui.draw();
            System.Threading.Thread.Sleep(50);
            ConsoleGui.clear();
            count++;
            if (count == 10)
            {
                ConsoleGui.messages.Add("Message " + messagesAdded);
                messagesAdded++;
                count = 0;
            }
        }
    }
Exemple #10
0
        static void Main(string[] args)
        {
            ConsoleGui.WriteGui();

            var apexProduct = ApexProduct.Unknown;
            var apexPath    = string.Empty;

            ConsoleGui.WriteLine("1. ApexSQL Log");
            ConsoleGui.WriteLine("2. ApexSQL Recover");

            ConsoleGui.WriteLine();
            ConsoleGui.Write("请输入产品序号:");

            var keyInfo = Console.ReadKey();

            ConsoleGui.WriteLine();
            ConsoleGui.Write("请输入产品路径:");

            switch (keyInfo.KeyChar)
            {
            case '1':
            {
                apexProduct = ApexProduct.ApexLog;
                apexPath    = Console.ReadLine();
            }
            break;

            case '2':
            {
                apexProduct = ApexProduct.ApexRecover;
                apexPath    = Console.ReadLine();
            }
            break;
            }

            ConsoleGui.WriteLine();

            if (apexProduct != ApexProduct.Unknown)
            {
                try
                {
                    var dirInfo = new DirectoryInfo(apexPath);
                    if (dirInfo.Exists)
                    {
                        if (apexProduct == ApexProduct.ApexLog || apexProduct == ApexProduct.ApexRecover)
                        {
                            var files = dirInfo.GetFiles("ApexSQL.Engine.Communication.dll", SearchOption.TopDirectoryOnly);
                            if (files != null && files.Any())
                            {
                                var filePath    = files.First().FullName;
                                var filePathBak = $"{filePath}.bak";

                                if (File.Exists(filePathBak))
                                {
                                    File.Delete(filePathBak);
                                }

                                files.First().MoveTo($"{filePath}.bak");
                                ReleasePatchFile(filePath);

                                ConsoleGui.Write("成功");
                            }
                        }
                    }
                }
                catch
                {
                    return;
                }
            }

            Console.ReadKey();
        }
 public static void Write(string format, params object[] args)
 {
     ConsoleGui.Write(String.Format(format, args));
 }
    public static void WriteLine(string format, params object[] args)
    {
        string s = String.Format(format, args);

        ConsoleGui.WriteLine(s);
    }
 public static void Main(string[] args) => ConsoleGui.Launch(args);