Skip to content
Snippets Groups Projects
CommunicationEvents.cs 5.81 KiB
Newer Older
  • Learn to ignore specific revisions
  • using System.Collections.Generic;
    
    using System.Diagnostics;
    
    using UnityEngine;
    using UnityEngine.Events;
    
    public static class CommunicationEvents
    {
    
    ki7077's avatar
    ki7077 committed
        public static UnityEvent<RaycastHit[]> TriggerEvent = new();
    
        public static UnityEvent<RaycastHit[]> TriggerModFireEvent = new();
    
        public static UnityEvent<int> ToolModeChangedEvent = new();
        public static UnityEvent<Fact> AddFactEvent = new();
        public static UnityEvent<Fact> RemoveFactEvent = new();
    
    Richard Marcus's avatar
    Richard Marcus committed
    
    
        public static UnityEvent<REST_JSON_API.ScrollApplicationCheckingError[]> ScrollApplicationCheckingErrorEvent = new();
    
    MaZiFAU's avatar
    MaZiFAU committed
        public static UnityEvent PushoutFactFailEvent = new();
    
    Richard Marcus's avatar
    Richard Marcus committed
    
    
        public static UnityEvent gameSucceededEvent = new();
        public static UnityEvent gameNotSucceededEvent = new();
        public static UnityEvent NewAssignmentEvent = new();
    
        public static UnityEvent StartT0Event = new();
    
    MaZiFAU's avatar
    MaZiFAU committed
        public static UnityEvent<string> ScrollFactHintEvent = new();
    
        public static UnityEvent<string, FactWrapper.FactMaterials> AnimateExistingFactEvent = new();
        public static UnityEvent<Fact, FactWrapper.FactMaterials> AnimateExistingAsSolutionEvent = new();
    
        public static UnityEvent<Fact> AnimateNonExistingFactEvent = new();
        public static UnityEvent<List<string>> HintAvailableEvent = new();
    
    MaZiFAU's avatar
    MaZiFAU committed
    
    
    John Schihada's avatar
    John Schihada committed
    
        //------------------------------------------------------------------------------------
        //-------------------------------Global Variables-------------------------------------
    
        public static bool ServerAutoStart = true;
    
        public static bool ServerRunning = true;
    
    MaZiFAU's avatar
    MaZiFAU committed
    
    
        //CHANGE HERE PORT OF SERVER
        public static string ServerPortDefault = "8085"; //used for Local
    
    
        public static string ServerAddressLocalhost = "http://localhost"; //Without Port               //Kann das weg?
        public static string ServerAddressLocal = "http://localhost:8085"; // "http://localhost:8085"  //Kann das weg?
    
    Stefan Richter's avatar
    Stefan Richter committed
        public static string ServerAdress = "http://localhost:8085"; //need "http://" //used by dispalyScrolls.cs //http://10.231.4.95:8085"; //IMPORTANT for MAINMENU
    
        public static Process process_mmt_frameIT_server;
    
    
        public static int ToolID_new;
        public static int ToolID_selected;//Script
    
    MaZiFAU's avatar
    MaZiFAU committed
    
    
        /*
         * will be loaded from other config file
         */
    
    MaZiFAU's avatar
    MaZiFAU committed
        public static string lastIP = "";
        public static string newIP = "";
        public static string IPslot1 = "- if you can read this";
        public static string IPslot2 = "- NetworkConfig";
        public static string IPslot3 = "- not loaded";
    
        public static string IPslot4 = "- GO TO -> 'Options'";
        public static string IPslot5 = "-   -> 'Reset Options'";
        public static string selecIP = "-   -> PRESS: 'Reset Configurations'";//"GO TO -> 'Options'\n-> 'Reset Options'\nPRESS: \n'Reset Configurations'";
    
        public static int[] ServerRunningA = new int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //other, lastIP, newIP, IP1, IP2, IP3, selecIP, IP4, IP5,...} //0: offline, 1: Checking, 2: online, 3: NoNetworkAddress;
        public static bool[] ServerRunningA_test = new bool[10] { false, false, false, false, false, false, false, false, false, false }; //other, lastIP, newIP, IP1, IP2, IP3, selecIP, IP4, IP5,...}
    
        public static double IPcheckGeneration = 0;
        public static int CheckNetLoop = 1;
    
        public static int[] CheckServerA = new int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // 1 => CommunicationEvents.lastIP, 2 => CommunicationEvents.newIP,3 => CommunicationEvents.IPslot1, 4 => CommunicationEvents.IPslot2,
                                                                                        // 5 => CommunicationEvents.IPslot3, 6 => CommunicationEvents.selecIP, 7 => CommunicationEvents.IPslot4, 8 => CommunicationEvents.IPslot5,
    
        public static bool autoOSrecognition = true;
    
        public static OperationSystem Opsys = OperationSystem.Windows; //Scripts
    
        public enum OperationSystem
        {
    
    MaZiFAU's avatar
    MaZiFAU committed
            Windows = 0,
            Android = 1,
    
        public static bool CursorVisDefault = true; //Script.
    
    
        public static bool GadgetCanBeUsed = false;
    
        // Configs
        public static bool VerboseURI = false;
    
        public static string debug_path = "hey";
    
    
        public static string CreateHierarchiePath(List<Directories> hierarchie, string prefix = "", string postfix = "")
        {
            foreach (var dir in hierarchie)
                prefix = System.IO.Path.Combine(prefix, dir.ToString());
    
            return System.IO.Path.Combine(prefix, postfix);
        }
    
    
        // TODO! avoid tree traversel with name
    
        public static string CreatePathToFile(out bool file_exists, string name, string format = null, List<Directories> hierarchie = null, bool use_install_folder = false)
    
            if (!string.IsNullOrEmpty(format))
    
                switch (format)
                {
                    case "JSON":
                        ending = ".JSON";
                        break;
                    default:
                        break;
                }
    
    
            string path = Opsys switch
    
                OperationSystem.Android => Application.persistentDataPath,
                OperationSystem.Windows or _ => use_install_folder ? Application.dataPath : Application.persistentDataPath,
            };
    
            string Target_StreamToDataPath_UnityEditor = "UnityEditor";
            if (Application.isEditor && use_install_folder) { path = Path.Combine(Application.persistentDataPath, Target_StreamToDataPath_UnityEditor); }
    
    
            if (hierarchie != null)
            {
                path = CreateHierarchiePath(hierarchie, path);
                System.IO.Directory.CreateDirectory(path);
    
            path = System.IO.Path.Combine(path, name + ending);
            file_exists = System.IO.File.Exists(path);
    
    
            return path;