Esempio n. 1
0
 private static void readConnectionInfos(XmlNode node, ConfigurationNode configurationNode)
 {
     configurationNode.ip = node.Attributes["ip"].Value;
     if (node.Attributes["port"] != null)
     {
         configurationNode.port = Convert.ToInt32(node.Attributes["port"].Value);
     }
 }
Esempio n. 2
0
        private static void SpawnScreenplane(Transform parent, ConfigurationNode configurationNode)
        {
            GameObject screenPlane = new GameObject(configurationNode.ip);

            screenPlane.transform.parent        = parent;
            screenPlane.transform.localScale    = configurationNode.screenplaneScale;
            screenPlane.transform.eulerAngles   = configurationNode.screenplaneRotation;
            screenPlane.transform.localPosition = configurationNode.screenplanePosition;
            configurationNode.screenPlane       = screenPlane.transform;
        }
Esempio n. 3
0
        private static void readNodeInformation()
        {
            XmlNode node_Config = xmlDocument.GetElementsByTagName("config")[0];

            foreach (XmlNode node in node_Config.ChildNodes)
            {
                if (node.Name.Equals("slave") || node.Name.Equals("master"))
                {
                    ConfigurationNode configurationNode = new ConfigurationNode();
                    readConnectionInfos(node, configurationNode);

                    foreach (XmlNode childNode in node.ChildNodes)
                    {
                        switch (childNode.Name)
                        {
                        case "origin":
                            readOrigin(childNode, configurationNode);
                            break;

                        case "camera":
                            readCamera(childNode, configurationNode);
                            break;

                        case "screenplane":
                            readScreenplane(childNode, configurationNode);
                            break;
                        }
                    }

                    switch (node.Name)
                    {
                    case "master":
                        master = configurationNode;
                        break;

                    case "slave":
                        slaves.Add(configurationNode);
                        break;
                    }
                }
            }

            if (developmentMode || isOwnIP(master.ip))
            {
                own = master;
            }
            else
            {
                foreach (ConfigurationNode slave in slaves)
                {
                    if (isOwnIP(slave.ip))
                    {
                        own = slave;
                    }
                }
            }

            if (own == null)
            {
                throw new Exception("Own configuration node could not be found.");
            }
            else
            {
                Debug.Log("Config loaded (" + (master != null ? "1" : "0") + " master, " + slaves.Count + " slaves, own type: " + (isMaster() ? "master" : "slave") + (developmentMode ? ", Development mode!" : "") + ")");
            }
        }
Esempio n. 4
0
 private static void readCamera(XmlNode node, ConfigurationNode configurationNode)
 {
     configurationNode.cameraRoation = readVector(node, "rotation");
     configurationNode.cameraEye     = node.Attributes["eye"].Value;
 }
Esempio n. 5
0
 private static void readOrigin(XmlNode node, ConfigurationNode configurationNode)
 {
     configurationNode.originPosition = readVector(node, "position");
 }
Esempio n. 6
0
 private static void readScreenplane(XmlNode node, ConfigurationNode configurationNode)
 {
     configurationNode.screenplanePosition = readVector(node, "position");
     configurationNode.screenplaneRotation = readVector(node, "rotation");
     configurationNode.screenplaneScale    = readVector(node, "scale");
 }