Newer
Older
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Events;
public static class CommunicationEvents
{
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();
public static UnityEvent gameSucceededEvent = new();
public static UnityEvent gameNotSucceededEvent = new();
public static UnityEvent StartT0Event = new();
Björn Eßwein
committed
/** <summary>Inform ui that it should animate the given fact with the given material.</summary> */
public static UnityEvent<string, FactWrapper.FactMaterials> AnimateExistingFactEvent = new();
Björn Eßwein
committed
/** <summary>Start firework and invoke AnimateExistingFactEvent.</summary> */
public static UnityEvent<Fact, FactWrapper.FactMaterials> AnimateExistingAsSolutionEvent = new();
Björn Eßwein
committed
/** <summary>Show a missing fact for a short time as hint for the user.</summary> */
public static UnityEvent<Fact> AnimateNonExistingFactEvent = new();
//------------------------------------------------------------------------------------
//-------------------------------Global Variables-------------------------------------
Marco Zimmer
committed
// TODO! move to GlobalStatic/Behaviour
public static bool ServerAutoStart = true;
public static bool ServerRunning = true;
//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?
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* Put all of the data about a Server into one class
*/
class KnownServer
{
public string IP;
public ServerStatus currentStatus = ServerStatus.offline;
public bool statusKnown = false;
public enum ServerStatus
{
offline,
online,
checking,
NoNetworkAddress
}
public void UpdateStatus()
{
}
}
//List of Known Servers
public enum KnownServers
{
last,
newIP,
slot1,
slot2,
slot3,
slot4,
slot5,
selecIP
}
//Enum.GetNames(typeof(KnownServers)).Length; //Number of known Server slots, to be able to add more later
/*
* will be loaded from other config file
*/
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";
Stefan Richter
committed
public static string IPslot4 = "- GO TO -> 'Options'";
public static string IPslot5 = "- -> 'Reset Options'";
public static string selecIP = "- -> PRESS: 'Reset Configurations'";
Stefan Richter
committed
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;
Stefan Richter
committed
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
{
iOS =2,
WindowsStoreApps = 3,
public static bool CursorVisDefault = true; //Script.
public static bool CursorVisLastUsedIngame = true; //Script.
Stefan Richter
committed
public static bool GadgetCanBeUsed = false;
Marco Zimmer
committed
// Configs
public static bool VerboseURI = false;
Marco Zimmer
committed
public enum Directories
{
Marco Zimmer
committed
Stages,
Marco Zimmer
committed
SaveGames,
Marco Zimmer
committed
ValidationSets,
Marco Zimmer
committed
FactStateMachines,
}
public static string CreateHierarchiePath(List<Directories> hierarchie, string prefix = "", string postfix = "")
{
foreach (var dir in hierarchie)
prefix = Path.Combine(prefix, dir.ToString());
Marco Zimmer
committed
Marco Zimmer
committed
}
public static string Get_DataPath()
{
Stefan Richter
committed
bool use_replacementfolder = false;
Stefan Richter
committed
return use_replacementfolder ? Path.Combine(Application.persistentDataPath, "DataPath_writeable") : Path.Combine(Application.dataPath, "StreamingAssets", "StreamToDataPath_withHandler");
OperationSystem.Android => Path.Combine(Application.persistentDataPath, "DataPath_writeable"),
OperationSystem.Windows or _ => Application.dataPath,
};
}
// 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)
Marco Zimmer
committed
string ending = "";
if (!string.IsNullOrEmpty(format))
switch (format)
{
case "JSON":
ending = ".JSON";
break;
default:
break;
}
string path = use_install_folder
? Get_DataPath()
: Application.persistentDataPath;
if (hierarchie != null)
{
path = CreateHierarchiePath(hierarchie, path);
path = Path.Combine(path, name + ending);
file_exists = File.Exists(path);