private static void ReadConnectionInfos(XmlNode node, NewNodeConfiguration configurationNode) { configurationNode.ip = node.Attributes["ip"].Value; if (node.Attributes["port"] != null) { configurationNode.port = Convert.ToInt32(node.Attributes["port"].Value); } }
private static void SpawnScreenplane(Transform parent, NewNodeConfiguration 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; }
private static void ReadNodeConfigInformation() { XmlNode nodeConfig = xmlDocument.GetElementsByTagName("config")[0]; foreach (XmlNode node in nodeConfig.ChildNodes) { if (node.Name.Equals("slave") || node.Name.Equals("master")) { NewNodeConfiguration NewNodeConfiguration = new NewNodeConfiguration(); ReadConnectionInfos(node, NewNodeConfiguration); foreach (XmlNode childNode in node.ChildNodes) { switch (childNode.Name) { case "origin": ReadOrigin(childNode, NewNodeConfiguration); break; case "camera": ReadCamera(childNode, NewNodeConfiguration); break; case "screenplane": ReadScreenplane(childNode, NewNodeConfiguration); break; } } switch (node.Name) { case "master": master = NewNodeConfiguration; break; case "slave": slaves.Add(NewNodeConfiguration); break; } } } if (developmentMode || IsOwnIP(master.ip)) { own = master; } else { foreach (NewNodeConfiguration slave in slaves) { if (IsOwnIP(slave.ip)) { own = slave; //break; } } } 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!" : "") + ")"); } }
private static void ReadCamera(XmlNode node, NewNodeConfiguration configurationNode) { configurationNode.cameraRoation = ReadVector(node, "rotation"); configurationNode.cameraEye = node.Attributes["eye"].Value; }
private static void ReadOrigin(XmlNode node, NewNodeConfiguration configurationNode) { configurationNode.originPosition = ReadVector(node, "position"); }
private static void ReadScreenplane(XmlNode node, NewNodeConfiguration configurationNode) { configurationNode.screenplanePosition = ReadVector(node, "position"); configurationNode.screenplaneRotation = ReadVector(node, "rotation"); configurationNode.screenplaneScale = ReadVector(node, "scale"); }