Example #1
0
        /// <summary>
        /// Rita en checkbox, ifylld om uppgiften är OK.
        /// </summary>
        /// <param name="text">Texten<see cref="int"/>.</param>
        /// <returns>Värde att utvärdera<see cref="int"/>.</returns>
        private static int DoCheckBox(int text)
        {
            ConsoleGUI gui = new ConsoleGUI();

            gui.PrintAt(NiceDebug.StartX - 4, NiceDebug.StartY - 1, text == 0 ? "[ ]" : "[X]");
            return(text);
        }
Example #2
0
        private static int DoCheckBox(int v)
        {
            var gui = new ConsoleGUI();

            gui.PrintAt(NiceDebug.StartX - 4, NiceDebug.StartY - 1, v == 0 ? "[ ]" : "[X]");
            return(v);
        }
Example #3
0
 void IModule.OnGUI()
 {
     ConsoleGUI.Lable($"[{nameof(NetworkManager)}] State : {States}");
     ConsoleGUI.Lable($"[{nameof(NetworkManager)}] IP Host : {_host}");
     ConsoleGUI.Lable($"[{nameof(NetworkManager)}] IP Port : {_port}");
     ConsoleGUI.Lable($"[{nameof(NetworkManager)}] IP Type : {_family}");
 }
Example #4
0
    //----------------------------------------------------------
    // Unity callbacks
    //----------------------------------------------------------
    void Awake()
    {
        mInstance  = this;
        awakeFrame = Time.frameCount;

        chatHistoryBuffer  = 40;
        outerBuffer        = 50;
        chatPanelPosX      = Screen.width - chatPanelWidth - outerBuffer;
        chatPanelPosY      = Screen.height - chatPanelHeight - outerBuffer;
        userListPanelWidth = chatPanelWidth * 3 / 10;
        chatWindowRect     = new Rect(chatPanelPosX, chatPanelPosY, chatPanelWidth, chatPanelHeight);

        teleGui            = this.gameObject.AddComponent <TeleportGUI>();
        consoleGui         = this.gameObject.AddComponent <ConsoleGUI>();
        customizeAvatarGui = this.gameObject.AddComponent <CustomizeAvatarGUI>();
        userListMgr        = this.gameObject.AddComponent <HTMLUserListManager>();
        replayGUI          = this.gameObject.AddComponent <ReplayGUI>();
        devGUI             = this.gameObject.AddComponent <DevGUI>();
        DevGUIEnabled      = false;

        // Load  dynamic console input TextField textures.
        consoleBGStretchable = Resources.Load("Textures/UnityNativeGUI/TextWindow_Middle") as Texture2D;
        consoleBGEndCap      = Resources.Load("Textures/UnityNativeGUI/TextWindow_EndCap") as Texture2D;

        // Load presenter tool textures
        presentToolResizeButton = new VirCustomButton(Resources.Load("Textures/UnityNativeGUI/PresentTool_Resize") as Texture2D, 0, 0, 1.2f, "Resize");
        presentToolCloseButton  = new VirCustomButton(Resources.Load("Textures/UnityNativeGUI/Button_ChatMin_Active") as Texture2D, 0, 0, 1.2f, "Minimize");

        consoleBackgroundTex = Resources.Load("Textures/UnityNativeGUI/ConsoleBackground") as Texture2D;


        // Set up viewport buttons
        productViewportResizeButton = new VirCustomButton(Resources.Load("Textures/UnityNativeGUI/PresentTool_Resize") as Texture2D, 0, 0, 1.2f, "Resize");
        productViewportCloseButton  = new VirCustomButton(Resources.Load("Textures/UnityNativeGUI/Button_ChatMin_Active") as Texture2D, 0, 0, 1.2f, "Minimize");


        // Presenter tool defaults to off.
        allowPresenterTool = false;

        // Resize viewport if necessary
        if (!Screen.fullScreen && Screen.height >= (Screen.currentResolution.height - 40))
        {
            Screen.SetResolution((int)(0.85 * Screen.width), (int)(0.85 * Screen.height), Screen.fullScreen);
        }

        // Omnibox
        obTLCorner = Resources.Load("Textures/UnityNativeGUI/omnibox/top_left_corner") as Texture2D;
        obTEdge    = Resources.Load("Textures/UnityNativeGUI/omnibox/top_edge") as Texture2D;
        obLEdge    = Resources.Load("Textures/UnityNativeGUI/omnibox/left_edge") as Texture2D;
        obFill     = Resources.Load("Textures/UnityNativeGUI/omnibox/fill") as Texture2D;

        // Fadeout texture
        whiteTex = Resources.Load("Textures/white") as Texture2D;

        // Turn off all native gui for assembly
        if (GameManager.Inst.ServerConfig == "Assembly" || GameManager.Inst.ServerConfig == "MDONS")
        {
            GameGUI.Inst.Visible = false;
        }
    }
Example #5
0
        public void SearchMedicine()
        {
            ConsoleGUI.Render("Wyszukiwanie leku");
            var searchString   = ConsoleGUI.PromptRender("Podaj frazę do wyszukania: ").Trim();
            var foundMedicines = medicineDb.Where(x => x.MedicineName.ToLower().Contains(searchString.ToLower()));

            if (foundMedicines.Any())
            {
                List <string> render = new List <string>();
                render.Add("Znaleziono: ");
                foreach (var found in foundMedicines)
                {
                    render.Add($"ID: {found.Id}");
                    render.Add($"Nazwa: {found.MedicineProducer} {found.MedicineName}");
                    render.Add($"Cena: {found.MedicinePrice}");
                    render.Add($"Ilość: {found.MedicineQuantity}{found.MedicineQuantityType}");
                }
                ConsoleGUI.Render(render);
                ConsoleGUI.PromptRender("Dowolny przycisk powróci do MENU");
            }
            else
            {
                ConsoleGUI.ErrorRender("Nie znaleziono produktów o nazwie " + searchString, true);
                ConsoleGUI.PromptRender("Dowolny przycisk powróci do MENU");
            }
        }
Example #6
0
        public void DeleteUser()
        {
            ShowUsers(false);

            string userInput = ConsoleGUI.PromptRender("Podaj ID użytkownika, którego chcesz usunąć: ");

            if (int.TryParse(userInput, out int input))
            {
                if (currentUser.Id == input)
                {
                    ConsoleGUI.ErrorRender("Nie możesz usunąć sam siebie", true);
                    return;
                }

                User user = GetUser(input);
                if (user != null)
                {
                    users.Remove(user);
                    Flush();
                }
                else
                {
                    ConsoleGUI.ErrorRender("Nie ma takiego użytkownika", true);
                    return;
                }
            }
        }
Example #7
0
        public void AddUser()
        {
            var    userName    = ConsoleGUI.PromptRender("Imie uzytkownika: ").Replace(",", "").Trim();
            var    userSurname = ConsoleGUI.PromptRender("Nazwisko uzytkownika: ").Replace(",", "").Trim();
            string userNickname;

            while (true)
            {
                userNickname = ConsoleGUI.PromptRender("Nick: ").Replace(",", "").Trim();
                if (users.Any(x => x.UserNickname.Equals(userNickname)))
                {
                    ConsoleGUI.ErrorRender("Ta nazwa użytkownika jest już zajęta, spróbuj inną");
                }
                else
                {
                    break;
                }
                continue;
            }
            var userPassword = ConsoleGUI.PromptRender("Hasło użytkownika: ").Replace(",", "").Trim();

            int id = users.Max(x => x.Id) + 1;

            users.Add(new User(id, userName, userNickname, userSurname, userPassword));

            Flush();
        }
Example #8
0
    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogError("only one instance is allowed to exist");
        }
        instance = this;

        if (m_handleLog)
        {
            Application.logMessageReceived += PrintDebug;
        }
        //Application.RegisterLogCallback(new Application.LogCallback(this.PrintDebug));

        lines    = new CircularBuffer <string>(linesOfHistory, true);
        commands = new CircularBuffer <string>(commandHistory, true);
        SceneManager.sceneLoaded += SceneManager_sceneLoaded;
        RegisterCommand("help", this, "Help");
        RegisterCommand("list", this, "List");
        RegisterCommand("listComponents", this, "ListComponents");
        RegisterCommand("printTree", this, "PrintTree");
        RegisterCommand("select", this, "Select");
        RegisterParser(typeof(int), new ParserCallback(parseInt));
        RegisterParser(typeof(float), new ParserCallback(parseFloat));
        RegisterParser(typeof(string), new ParserCallback(parseString));

        consoleGUI = GetComponent <ConsoleGUI>();

        //UnityEngine.Profiling.Profiler.logFile = Path.Combine(Application.streamingAssetsPath, "profiling"); //Also supports passing "myLog.raw"
        //UnityEngine.Profiling.Profiler.enableBinaryLog = true;
        //UnityEngine.Profiling.Profiler.enabled = true;
    }
Example #9
0
        static void Main(string[] args)
        {
            ConsoleGUI gui = new ConsoleGUI();

            PlugInLoader plugIn    = new PlugInLoader();
            var          exercises = plugIn.LoadAvailableExercises().OrderBy(x => x.VersionNumber);

            foreach (var exercise in exercises)
            {
                gui.WriteMessage($"##### {exercise.VersionNumber} - {exercise.Description} #####", Color.Yellow);
                exercise.Run(gui);
                Console.ReadKey();
            }

            //VatExerciseMain vat = new VatExerciseMain();
            //vat.Run(null);

            //VatExercise.VatExerciseClasses vatClasses = new VatExercise.VatExerciseClasses();
            //vatClasses.Run(gui);

            //StarWars.StarWarsMain starWars = new StarWars.StarWarsMain();
            //starWars.Run(gui);

            //StarWars2_Delegates.StarWarsMain starWarsDelegates = new StarWars2_Delegates.StarWarsMain();

            //starWarsDelegates.Run(gui);

            //StarWars3_Events.StarWarsMain starWarsDelegates = new StarWars3_Events.StarWarsMain();
            //starWarsDelegates.Run(gui);

            Filters.FiltersMain filters = new Filters.FiltersMain();
            filters.Run(gui);

            //Console.ReadKey();
        }
Example #10
0
        void IModule.OnGUI()
        {
            string mainSceneName = _mainScene == null ? string.Empty : _mainScene.Location;

            ConsoleGUI.Lable($"[{nameof(SceneManager)}] Main scene : {mainSceneName}");
            ConsoleGUI.Lable($"[{nameof(SceneManager)}] Addition scene count : {_additionScenes.Count}");
        }
Example #11
0
        void IModule.OnGUI()
        {
            int totalCount = AssetSystem.GetLoaderCount();

            ConsoleGUI.Lable($"[{nameof(ResourceManager)}] Virtual simulation : {AssetSystem.SimulationOnEditor}");
            ConsoleGUI.Lable($"[{nameof(ResourceManager)}] Loader count : {totalCount}");
        }
Example #12
0
 // Use this for initialization
 void Start()
 {
     consoles         = this.transform.GetComponentsInChildren <Console>();
     consoleGUIObject = transform.FindChild("ConsoleGUI").gameObject;
     consoleGUIObject.gameObject.SetActive(false);
     cG  = consoleGUIObject.GetComponentInChildren <ConsoleGUI> ();
     cGT = consoleGUIObject.GetComponentInChildren <ConsoleGUITime> ();
 }
Example #13
0
 static async Task Main(string[] args)
 {
     var gui = new ConsoleGUI()
     {
         TargetUpdateTime = 100
     };
     var sim = new LifeSimulation();
     await gui.Start(sim);
 }
Example #14
0
        public static void Browse(ref MedicineDb mainDb)
        {
            int currentId = 1;

            while (true)
            {
                var medicine = mainDb.GetMedicineById(currentId);
                if (medicine == null)
                {
                    ConsoleGUI.Render("Brak leku o ID " + currentId + " w bazie danych");
                }
                else
                {
                    RenderView(medicine);
                }
                Navigation choice = MenuChoice();
                if (choice != Navigation.Exit)
                {
                    if (choice == Navigation.Next)
                    {
                        currentId++;
                        continue;
                    }

                    if (choice == Navigation.Previous)
                    {
                        if (currentId != 1)
                        {
                            currentId--;
                        }
                        continue;
                    }

                    if (choice == Navigation.ByID)
                    {
                        var z = ConsoleGUI.PromptRender("ID: ");
                        if (int.TryParse(z, out int s))
                        {
                            currentId = s;
                        }
                        else
                        {
                            ConsoleGUI.ErrorRender("ID: " + z + " nie jest poprawne", true);
                        }
                    }

                    if (choice == Navigation.Incorrect)
                    {
                        continue;
                    }
                }
                else
                {
                    break;
                }
            }
        }
Example #15
0
 static async System.Threading.Tasks.Task Main(string[] args)
 {
     var input = new TextInput();
     var gui   = new ConsoleGUI()
     {
         Input = input
     };
     var sim = new MySimulation(gui, input);
     await gui.Start(sim);
 }
Example #16
0
        public static void DebugThis(string text)
        {
            var gui = new ConsoleGUI();

            if (text.Length > MaxLength)
            {
                text = text.Substring(0, MaxLength);
            }
            gui.PrintAt(StartX, StartY++, text);
        }
Example #17
0
 public MySimulation(ConsoleGUI gui, TextInput input)
 {
     actualTime    = DateTime.Now;
     currentDay    = actualTime;
     simulationDay = 1;
     logForBakeryRelatedUpdates.Log("Welcome to this made up bakery!");
     logForBakeryRelatedUpdates.Log("Select which command to run by typing a number from the list of commands");
     commandDisplay.Lines = writer.CommandWriter();
     this.gui             = gui;
     this.input           = input;
 }
Example #18
0
        public TPSPlugin(Logger logger, int periodInSeconds)
        {
            this.logger          = logger;
            this.periodInSeconds = periodInSeconds;
            this.gui             = logger as ConsoleGUI;

            if (gui != null)
            {
                this.graph = new Graph();
                gui.SetChannelGraph(Channel, graph);
            }
        }
Example #19
0
    private void Awake()
    {
        _ins = this;
        CommandRegister._ins.Register(typeof(CommandBase).Assembly);

        InitView();
        input  = _inputField;
        output = _logCat;

        submitAction = new ConsoleSubmitAction();
        escapeAction = new ConsoleCloseAction();
    }
Example #20
0
        static async Task Main(string[] args)
        {
            var gui = new ConsoleGUI(35, 149)
            {
                TargetUpdateTime = 100
            };
            TextInput input = new TextInput();

            gui.Input = input;
            var sim = new MySimulation((TextInput)gui.Input);
            await gui.Start(sim);
        }
Example #21
0
        public RAMPlugin(Logger logger, int periodInSeconds)
        {
            this.logger          = logger;
            this.periodInSeconds = periodInSeconds;
            this.gui             = logger as ConsoleGUI;

            if (gui != null)
            {
                this.graph      = new Graph();
                graph.formatter = FormatMemoryAmount;
                gui.SetChannelGraph(Channel, graph);
            }
        }
Example #22
0
        public MySimulation(ConsoleGUI gui, TextInput input)
        {
            log.Log("Welcome to car repair workshop simulator.");
            log.Log("Press 1 as many times as you want to in oder to simulate a new vehicle being repaired.");
            log.Log("Press 2 to exit simulation.");


            gui.TargetUpdateTime = 700;
            wsg.GenerateEmpoyees(ws);
            wsg.GenerateStock(ws);
            this.gui   = gui;
            this.input = input;
        }
Example #23
0
        public void ShowUsers(bool wait = true)
        {
            List <string> toRender = new List <string>();

            foreach (var user in users)
            {
                toRender.Add("\tID:" + user.Id + "\tImię:" + user.Name + "\tNazwisko: " + user.Subname + "\tNick: " + user.UserNickname);
            }

            ConsoleGUI.Render(toRender);
            if (wait)
            {
                ConsoleGUI.PromptRender("Dowolny przycisk opuści ten widok");
            }
        }
Example #24
0
        /// <summary>
        /// Interprets a given <see cref="Sentence"/>. Initiates game model manipulation.
        /// </summary>
        /// <param name="sentence">The <see cref="Sentence"/> to interpret.</param>
        public static void Interpret(Sentence sentence)
        {
            if (sentence == null)
            {
                throw new ArgumentNullException(nameof(sentence));
            }
            // iterate through each top level node in sentence
            for (int i = 0; i < sentence.Length; i++)
            {
                // Conjunction
                if (sentence[i] is ConjunctionNode)
                {
                    continue;
                }

                // Command
                else if (sentence[i] is CommandNode command)
                {
                    command.Delegate();
                }

                // Verb
                else if (sentence[i] is VerbNode verb)
                {
                    foreach (VerbUsage syntax in verb.Usages)
                    {
                    }
                    // new verb logic here: check each word against all syntaxes in syntaxList, if end of a syntax is reached, it is potentially correct, if a word does not
                    // match, throw syntax out. Once all syntaxes have been checked: if there are no potentialy correct syntaxes, use the current word in the error message.
                    // Otherwise, go with the longest potentially correct syntax. Only go with an empty syntax if all other syntaxes were thrown out on the first check,
                    // and throw all pending syntaxes out if the end of the sentence is reached (unless the end of the syntax is reached at the same time).
                }

                // Unknown
                else if (sentence[i] is UnknownNode)
                {
                    ConsoleGUI.Print("I don't understand the word \"" + sentence[i].OrigWord + ".\"");
                    return;
                }

                // anything else
                else
                {
                    ConsoleGUI.Print("You lost me at \"" + sentence[i].OrigWord + ".\"");
                    return;
                }
            }
        }
Example #25
0
        public void RemoveMedicine()
        {
            var z = ConsoleGUI.PromptRender("Podaj ID leku do usunięcia z bazy danych");

            if (int.TryParse(z, out int i))
            {
                if (!DeleteMedicine(i))
                {
                    ConsoleGUI.ErrorRender("Nie udało się usunąć leku o ID " + i + " z bazy", true);
                }
            }
            else
            {
                ConsoleGUI.ErrorRender("Podano niepoprawne ID " + z, true);
            }
        }
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            //Setting up employees
            Dietitian       theDietitian       = new Dietitian("Mrs Lind", Employee.Positions.Dietitian);
            PersonalTrainer thePersonalTrainer = new PersonalTrainer("Arnold Schwarzenegger", Employee.Positions.PersonalTrainer);
            //Setting up clinic
            NutritionClinic theClinic = new NutritionClinic("Mayonaise Foundation", theDietitian, thePersonalTrainer);

            var input = new TextInput();
            var gui   = new ConsoleGUI()
            {
                Input = input
            };
            var sim = new MySimulation(input, theClinic);
            await gui.Start(sim);
        }
Example #27
0
 public static void Log(object obj)
 {
     if (obj is Type)
     {
         Log((Type)obj);
     }
     else
     {
         Log log = new Log(obj);
         if (ConsoleGUI.GUI == null)
         {
             ConsoleGUI.ShowWindow();
         }
         ConsoleGUI.GUI.AddLog(log);
     }
 }
Example #28
0
        /// <summary>
        /// Run the game.
        /// </summary>
        /// <param name="args"></param>
        public static void Run(string[] args)
        {
            ConsoleGUI.Setup();
            Glossary glossary = Load.BuildGlossary();

            while (true)
            {
                Sentence sentence = Sentence.Parse(ConsoleGUI.GetPlayerInput(), glossary, out string errorMessage);
                if (errorMessage != null)
                {
                    ConsoleGUI.Print(errorMessage);
                }
                else
                {
                    Sentence.Interpret(sentence);
                }
            }
        }
Example #29
0
        private static Navigation MenuChoice()
        {
            var choice = ConsoleGUI.PromptRender("n - Następny, p - Poprzedni, s - Skocz do ID, w - Wyjście").Trim();

            switch (choice)
            {
            case "n":
                return(Navigation.Next);

            case "p":
                return(Navigation.Previous);

            case "s":
                return(Navigation.ByID);

            case "w":
                return(Navigation.Exit);

            default:
                return(Navigation.Incorrect);
            }
        }
Example #30
0
        private static void RenderView(Medicine medicine)
        {
            List <string> toRender = new List <string>();

            toRender.Add("Id w bazie: " + medicine.Id);
            toRender.Add("Nazwa leku: \"" + medicine.MedicineName + "\"");
            toRender.Add("Producent: " + medicine.MedicineProducer);
            toRender.Add("Ilość leku: " + medicine.MedicineQuantity + " " + medicine.MedicineQuantityType);
            toRender.Add("Cena normalna: " + medicine.MedicinePrice);

            if (medicine.MedicineRefundPossible)
            {
                toRender.Add("Refundacja tego leku jest możliwa i wynosi " + medicine.MedicineRefundPercentage + "%");
                toRender.Add("Cena po refundacji: " + medicine.MedicinePriceWithRefund);
            }
            else
            {
                toRender.Add("Refundacja tego leku nie jest możliwa");
            }

            ConsoleGUI.Render(toRender);
        }