public PozyxModule() { positiningIsValid = false; clientUnity = UnityEngine.GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); ips_tag_frames = new ServerMessages.IPSDroneTag(); // Notifications from pozyxsource clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_POSITIONING_STARTED, onIPSStarted)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_POSITIONING_STOPPED, onIPSStopped)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)NotificationType.QUITTING, onIPSQuitting)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_LOCALTAG_CONNECTED, onIPSConnected)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_DISCOVERED, onIPSDiscovered)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_AUTOCALIBRATED, onIPSAutocalibrated)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_UPDATED_SETTINGS, onIPSUpdated)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_DATA_ANCHOR, onIPSAnchorData)); // anchor data clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_DATA_ANCHORS_LIST, onIPSAnchorList)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_NOTENOUGH_TAGSFOUND, onIPSNotenoughTags)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_NOTENOUGH_ANCHORSFOUND, onIPSNotenoughAnchors)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_LAST_REQUEST_HAS_FAILED, onIPSLastRequestFailed)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_ANCHORS_MANUAL_CONFIG_ACCEPTED, onIPSManualConfigAccepted)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_ANCHORS_TOBE_AUTOCALIBRATED_ACCEPTED, onIPSAnchorsToBeAutocalibratedAccepted)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_DRONETAGS_LIST, onDroneTagsList)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_DRONETAGS, onDroneLastTagData)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_DRONETAGS_MANUAL_CONFIG_ACCEPTED, onConfirmedManualConfig)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_GET_DRONEFILTER_NOTIFICATION, onGetDroneFilter)); }
public void buttonPressed() { ClientUnity clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); byte i = 0; //If the button clicked is the same as the one that has the script, the iris parameter is sent to the drone foreach (Transform item in irisScreen.transform) { if (this.name.Equals(item.name)) { irisButtonToGiveValues.transform.GetChild(0).GetComponent <Text>().text = this.transform.GetChild(0).GetComponent <Text>().text; if (!isInPlanning) { clientUnity.client.sendCommand((byte)Modules.RCAM_MODULE, (byte)RCamCommandType.RCAM_SET_CONFIG, (byte)RCamConfigParameter.RCAM_CONFIG_IRIS, i); } else { //This is in planning, which assigns the waypoint this iris aperture ChangePointType.pointSelected.GetComponent <PathPoint>().Rc.irisAperture = i; } irisScreen.SetActive(false); } i++; if (item.name.Equals("F20")) { //In order to fit them on the screen, I had to remove one i++; } } }
public void setConflictingMaps(MapMetadata Server, MapMetadata Local, GameObject Panel, ClientUnity client) { server = Server; local = Local; panel = Panel; clientUnity = client; }
public AtreyuModule() { clientUnity = UnityEngine.GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.ATREYU_NOTIFICATIONS_MODULE, (byte)AtreyuNotificationType.ATREYU_VERSION_NOTIFICATION, onVersionRcv)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.ATREYU_NOTIFICATIONS_MODULE, (byte)AtreyuNotificationType.ATREYU_UPDATE_PACKAGE_PATHNAME_NOTIFICATION, onUpdatePath)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.ATREYU_NOTIFICATIONS_MODULE, (byte)AtreyuNotificationType.ATREYU_SYSTEM_STATE_CHANGE_NOTIFICATION, onSystemStateChange)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.ATREYU_NOTIFICATIONS_MODULE, (byte)AtreyuNotificationType.ATREYU_CANNOT_CHANGE_STATE_NOTIFICATION, onSystemStateCannotChange)); }
void Start() { GameObject finder = GameObject.Find("ClientUnity"); if (finder) { clientUnity = finder.GetComponent <ClientUnity>(); } }
public GimbalMultiplexerModule() { clientUnity = UnityEngine.GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); // Notifications from pozyxsource clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.GIMBAL_MULTIPLEXER_NOTIFICATIONS_MODULE, (byte)GimbalMultiplexerNotificationType.GIMBAL_GOTO_ANGLE_NOTIFICATION, onGimbalGotoAngle)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.GIMBAL_MULTIPLEXER_NOTIFICATIONS_MODULE, (byte)GimbalMultiplexerNotificationType.GIMBAL_ANGLE_CHANGED_NOTIFICATION, onGimbalAngleChanged)); //clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_DATA, onIPSData)); // dron data }
void Awake() { //Adds listener on the start, just in case a change is produced because any change on the slider, even if it is by code will call inmediately the listener. clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); pitchContainer.transform.GetChild(1).GetComponent <Slider>().onValueChanged.AddListener(PitchValueChanged); rollContainer.transform.GetChild(1).GetComponent <Slider>().onValueChanged.AddListener(RollValueChanged); yawContainer.transform.GetChild(1).GetComponent <Slider>().onValueChanged.AddListener(YawValueChanged); speedContainer.transform.GetChild(1).GetComponent <Slider>().onValueChanged.AddListener(SpeedValueChanged); }
// Use this for initialization void Start() { Application.runInBackground = true; clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); //doneText.fontSize = Screen.width / 80; //doneButtonText.fontSize = Screen.width / 65; //doneText.text = "Press done\nto proceed"; }
public FPVModule() { stopWatch = new Stopwatch(); clientUnity = UnityEngine.GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.FPV_NOTIFICATIONS_MODULE, (byte)FPVNotificationType.FPV_RESOLUTION_NOTIFICATION, onResolutionMessage)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.FPV_NOTIFICATIONS_MODULE, (byte)FPVNotificationType.FPV_IMAGE_JPEG_NOTIFICATION, onImageMessage)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.FPV_NOTIFICATIONS_MODULE, (byte)FPVNotificationType.FPV_LAST_NOTIFICATION, onLastNotification)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.FPV_NOTIFICATIONS_MODULE, (byte)FPVNotificationType.FPV_STREAMING_STARTED, onFPVStart)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.FPV_NOTIFICATIONS_MODULE, (byte)FPVNotificationType.FPV_STREAMING_STOPPED, onFPVStop)); }
void Awake() { // Logos size //airtLogo.sizeDelta = new Vector2(Screen.width/3.0f, Screen.height/6.0f); //partnerLogos.sizeDelta = new Vector2(Screen.width - 50.0f, Screen.height / 8.0f); Application.runInBackground = true; clientUnity = clientUnityGO.GetComponent <ClientUnity>(); tex.sprite = Sprite.Create(new Texture2D(640, 480), new Rect(0, 0, 640, 480), new Vector2(0.5f, 0.5f)); }
void Start() { clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); //queue = new QueueSync<PCLMsg>(10); //string filePath = ""; //for (int i = 1; i < 72; i++) //{ // filePath = resourcesPath + fileName + i + ".bytes"; // if (File.Exists(filePath)) // { // FileStream fs = new FileStream(filePath, FileMode.Open); // BinaryReader br = new BinaryReader(fs); // UnityEngine.Debug.Log(br.ReadByte()); // UnityEngine.Debug.Log(br.ReadByte()); // UnityEngine.Debug.Log(br.ReadByte()); // UnityEngine.Debug.Log(br.ReadInt32()); // } // else // UnityEngine.Debug.Log("Invalid Path: " + filePath); // //} //TextAsset[] files = Resources.LoadAll<TextAsset>("Mapping"); //First step of the shader createBaseTriangle(); NUMCLOUDFILES = FileManager.GetNumFiles(FileManager.persistentMappingDataPath); //UnityEngine.Debug.Log("NUMCLOUDFILES: " + NUMCLOUDFILES.ToString("##.##")); //for (int i = 1; i < NUMCLOUDFILES; i++) //{ // //(fileName + i); // allBytes = loadMsgFromFile(fileName + i); // // if (allBytes != null) // { // byte[] hdr = new byte[(int)PCLMsgOffsets.HEADER_SIZE]; // Buffer.BlockCopy(allBytes, 0, hdr, 0, hdr.Length); // // PCLMsg pcl = new PCLMsg(hdr); // // byte[] data = new byte[allBytes.Length - hdr.Length]; // Buffer.BlockCopy(allBytes, hdr.Length, data, 0, allBytes.Length - hdr.Length); // // pcl.fillMesh(data); // queue.Enqueue(pcl); // // UnityEngine.Debug.Log("cloud " + i); // } //} }
public DroneModule() { cameraOffset = new Vector3(-1, -1, -1); clientUnity = UnityEngine.GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); // Notifications from pozyxsource clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.DRONE_NOTIFICATIONS_MODULE, (byte)DroneNotificationType.DRONE_GIMBAL_POSE_NOTIFICATION, onGimbalPose)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.DRONE_NOTIFICATIONS_MODULE, (byte)DroneNotificationType.DRONE_ZCAMERA_OFFSET_NOTIFICATION, onDroneCamOffset)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.DRONE_NOTIFICATIONS_MODULE, (byte)DroneNotificationType.DRONE_POSITION_POSE_NOTIFICATION, onIPSData)); //clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.POSITIONING_NOTIFICATIONS_MODULE, (byte)PositioningNotificationType.IPS_DATA, onIPSData)); // dron data }
// Use this for initialization void Start() { launchButtonGO = this.gameObject; buttonWidth = launchButtonGO.GetComponent <RectTransform>().sizeDelta.x; launchButtonGO.GetComponent <Image>().color = new Vector4(1.0f, 1.0f, 1.0f, 0.4f); launchButtonGO.transform.GetChild(0).GetComponent <Text>().color = new Vector4(1.0f, 1.0f, 1.0f, 0.4f); fillButton = transform.GetChild(1).GetComponent <RectTransform>(); clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); //launchButtonGO.GetComponent<Button>() }
void Start() { clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); //At the beggining we load the map if (MissionManager.loadMap) { LoadMap(Application.persistentDataPath + "/PersistentData/Missions/" + MissionManager.guid + ".json.metadata"); } ownPath = Path.Instance; }
public StandardModule() { clientUnity = UnityEngine.GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.STD_NOTIFICATIONS_MODULE, (byte)NotificationType.ACK, onStdAck)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.STD_NOTIFICATIONS_MODULE, (byte)NotificationType.HEART_BEAT, onStdHearbeat)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.STD_NOTIFICATIONS_MODULE, (byte)NotificationType.STARTED, onStdStarted)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.STD_NOTIFICATIONS_MODULE, (byte)NotificationType.STOPPED, onStdStopped)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.STD_NOTIFICATIONS_MODULE, (byte)NotificationType.QUITTING, onStdQuitting)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.STD_NOTIFICATIONS_MODULE, (byte)NotificationType.POWERING_OFF, onStdPoweringoff)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.STD_NOTIFICATIONS_MODULE, (byte)NotificationType.UNKNOWN_COMMAND, onStdUnknowncommand)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.STD_NOTIFICATIONS_MODULE, (byte)NotificationType.UNDEFINED_MODULE, onStdUndefinedmodule)); }
void Awake() { // Logos size //airtLogo.sizeDelta = new Vector2(Screen.width/3.0f, Screen.height/6.0f); //partnerLogos.sizeDelta = new Vector2(Screen.width - 50.0f, Screen.height / 8.0f); Application.runInBackground = true; clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); if (fpvRender) { //we create a sprite on the first time always to have the resolution that the camera has and to have the texture clean fpvRender.sprite = Sprite.Create(new Texture2D(640, 480), new Rect(0, 0, 640, 480), new Vector2(0.5f, 0.5f)); } }
public LibraryModule() { clientUnity = UnityEngine.GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_LIBRARIAN_NOTIFICATIONS_MODULE, (byte)PlanLibrarianNotificationType.PLAN_LIB_LIBRARY_PATH_NOTIFICATION, onPathReceivedMessage)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_LIBRARIAN_NOTIFICATIONS_MODULE, (byte)PlanLibrarianNotificationType.PLAN_LIB_NUMBER_PLANS_IN_DDBB_NOTIFICATION, onNumberOfPlansReceived)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_LIBRARIAN_NOTIFICATIONS_MODULE, (byte)PlanLibrarianNotificationType.PLAN_LIB_BASE_NAME_NOTIFICATION, onPlanNameReceived)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_LIBRARIAN_NOTIFICATIONS_MODULE, (byte)PlanLibrarianNotificationType.PLAN_LIB_METADATA_NOTIFICATION, onMetadataReceived)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_LIBRARIAN_NOTIFICATIONS_MODULE, (byte)PlanLibrarianNotificationType.PLAN_LIB_THUMBNAIL_NOTIFICATION, onThumbnailReceived)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_LIBRARIAN_NOTIFICATIONS_MODULE, (byte)PlanLibrarianNotificationType.PLAN_LIB_MISSION_NOTIFICATION, onMissionReceived)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_LIBRARIAN_NOTIFICATIONS_MODULE, (byte)PlanLibrarianNotificationType.PLAN_LIB_MAP_NOTIFICATION, onMapReceived)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_LIBRARIAN_NOTIFICATIONS_MODULE, (byte)PlanLibrarianNotificationType.PLAN_LIB_FILE_NOT_FOUND_NOTIFICATION, onFileNotFoundException)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_LIBRARIAN_NOTIFICATIONS_MODULE, (byte)PlanLibrarianNotificationType.PLAN_LIB_MISSION_INDEX_NOT_FOUND_NOTIFICATION, onMissionIndexNotFoundException)); }
// ----- METHODS ----- void Awake() { // Create the file browser and name it GameObject fileBrowserObject = this.gameObject; fileBrowserObject.transform.localScale = fileBrowserObject.transform.localScale * 0.75f; fileBrowserObject.name = "FileBrowser"; // Set the mode to save or load FileBrowser fileBrowserScript = fileBrowserObject.GetComponent <FileBrowser>(); fileBrowserScript.SetupFileBrowser(ViewMode.Landscape); fileBrowserScript.OpenFilePanel(this, "LoadFileUsingPath", _fileExtension); clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); }
void Start() { clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); //first we get the mode and start a coroutine to get the mode clientUnity.client.SendCommand((byte)Modules.RCAM_MODULE, (byte)RCamCommandType.RCAM_GET_MODE); StartCoroutine(lookForChangeInMode()); for (int i = 0; i < param.Length; i++) { //here we send each configuration request to the drone clientUnity.client.sendCommand((byte)Modules.RCAM_MODULE, (byte)RCamCommandType.RCAM_GET_CONFIG, (byte)param[i]); paramDict.Add((byte)param[i], 0); } //And start a coroutine to get them StartCoroutine(lookForChangeInConfig()); }
public OSModule(string dataPath, string fileName) { clientUnity = UnityEngine.GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.OS_NOTIFICATIONS_MODULE, (byte)OSNotificationType.OS_FILE_CREATED_NOTIFICATION, onFileCreated)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.OS_NOTIFICATIONS_MODULE, (byte)OSNotificationType.OS_FILE_CHUNK_WRITTEN_NOTIFICATION, onChunkWrite)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.OS_NOTIFICATIONS_MODULE, (byte)OSNotificationType.OS_FILE_CONTENT_NOTIFICATION, onContentReceived)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.OS_NOTIFICATIONS_MODULE, (byte)OSNotificationType.OS_FILE_ERROR_NOTIFICATION, onFileError)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.OS_NOTIFICATIONS_MODULE, (byte)OSNotificationType.OS_SYSTEM_INFO_NOTIFICATION, onSystemInfo)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.OS_NOTIFICATIONS_MODULE, (byte)OSNotificationType.OS_AVAILABLE_DISKSPACE_NOTIFICATION, onAvailableDiskspace)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.OS_NOTIFICATIONS_MODULE, (byte)OSNotificationType.OS_FILE_SIZE_NOTIFICATION, onFileSizeReceived)); this.dataPathUpdate = dataPath; this.fileNameUpdate = fileName; }
// Use this for initialization void Start() { //Boolean to put the text waiting for positioning firstPositionTry = true; //State machine to know at which scene we are GeneralSceneManager.sceneState = GeneralSceneManager.SceneState.Calibration; anchorCubeParent.transform.GetChild(0).GetComponent <MeshRenderer>().material.DisableKeyword("_EMISSION"); //Find the clientunity that is in every scene and comunicates with the drone clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); //Initialize transformation matrix Matrix4x4 id = Matrix4x4.identity; id.m00 = id.m11 = id.m22 = 1000; MissionManager.invMatrix = Matrix4x4.Inverse(id); }
/* * public void BuildImportedSceneAndReturn() * { * BuildImportedScene(); * if (!System.IO.Directory.Exists(Application.persistentDataPath + "/PersistentData/Thumbnails")) * System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/PersistentData/Thumbnails"); * //calibrationPanel.SetActive(false); * * //SceneManager.LoadScene("PlanSelection"); * //canvas.GetComponent<Canvas>().enabled = false; * * } * * public void BuildAlignedScene() * { * if (importedModel) * BuildImportedSceneAndReturn(); * else { * BuildEmptyScene(); * * //calibrationPanel.SetActive(false); * // * //planSelection.SetActive(true); * //planSelection.transform.parent.GetComponent<PlanSelectionManager>().enabled = true; * } * } */ //I think this function is no longer used public void goToCalibrateBox() { importedModel = false; if (!float.TryParse(widthInput.text, out width)) { UnityEngine.Debug.Log("Width is not a numeric value"); } if (!float.TryParse(heightInput.text, out height)) { UnityEngine.Debug.Log("Height is not a numeric value"); } if (!float.TryParse(depthInput.text, out depth)) { UnityEngine.Debug.Log("Depth is not a numeric value"); } MissionManager.modelBoundingBox = new Vector3(width, height, depth); MissionManager.fileSize = 2; UnityEngine.Debug.Log("Creating empty scene"); if (mapName == "") { inputMapName.text = mapName = "DefaultCube"; } if (mapLocation == "") { mapLocation = "Default Location"; } clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); createEmptyScene.SetActive(false); previewScene.SetActive(false); modificationTextGui.text = modificationText; boundingBoxGui.text = modelBoundingBox.x.ToString("0.00") + "x" + modelBoundingBox.y.ToString("0.00") + "x" + modelBoundingBox.z.ToString("0.00"); mapSizeGui.text = fileSize + "KB"; inputMapName.text = mapName; inputMapLocation.text = mapLocation; //planSelection.SetActive(true); //mapInfo.transform.parent.GetComponent<MissionManager>().enabled = false; //mapInfo.transform.parent.GetComponent<MissionManager>().enabled = true; mapInfo.SetActive(true); //planSelection.transform.parent.GetComponent<PlanSelectionManager>().enabled = true; //GameObject.Find("Background").GetComponent<BackgroundClicks>().enabled = false; //GameObject.Find("Background").GetComponent<BackgroundClicks>().enabled = true; }
private void Start() { float width = background.sizeDelta.x; clientUnity = UnityEngine.GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); warningPanel.sizeDelta = new Vector2(Screen.width / 3, Screen.height / 3); //Position of the warning panel o nthe general scene where there is a canvas scaler okButton.anchoredPosition = new Vector2(-warningPanel.sizeDelta.x / 6, warningPanel.sizeDelta.y / 5); throbber.anchoredPosition = new Vector2(warningPanel.sizeDelta.x / 2, warningPanel.sizeDelta.y / 5); warningPanel.GetChild(0).GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width, Screen.height); OkLandedButton.anchoredPosition = new Vector2(-warningPanel.sizeDelta.x / 6, warningPanel.sizeDelta.y / 5); cancelButton.anchoredPosition = new Vector2(warningPanel.sizeDelta.x / 6, warningPanel.sizeDelta.y / 5); firstText.GetComponent <RectTransform>().anchoredPosition = new Vector2(0.0f, warningPanel.sizeDelta.y / 8); secondText.GetComponent <RectTransform>().anchoredPosition = new Vector2(0.0f, warningPanel.sizeDelta.y / 8); if (GeneralSceneManager.sceneState == GeneralSceneManager.SceneState.General) { return; } //Else okButton.anchoredPosition = new Vector2(-warningPanel.sizeDelta.x / 2, warningPanel.sizeDelta.y / 6); throbber.anchoredPosition = new Vector2(warningPanel.sizeDelta.x / 2, warningPanel.sizeDelta.y / 5); warningPanel.GetChild(0).GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width, Screen.height); OkLandedButton.anchoredPosition = new Vector2(-warningPanel.sizeDelta.x / 6, warningPanel.sizeDelta.y / 5); cancelButton.anchoredPosition = new Vector2(warningPanel.sizeDelta.x / 2, warningPanel.sizeDelta.y / 6); firstText.GetComponent <RectTransform>().anchoredPosition = new Vector2(0.0f, warningPanel.sizeDelta.y / 3); secondText.GetComponent <RectTransform>().anchoredPosition = new Vector2(0.0f, warningPanel.sizeDelta.y / 3); okButton.sizeDelta = new Vector2(warningPanel.sizeDelta.x / 2, warningPanel.sizeDelta.y / 4); OkLandedButton.sizeDelta = new Vector2(warningPanel.sizeDelta.x / 2, warningPanel.sizeDelta.y / 4); cancelButton.sizeDelta = new Vector2(warningPanel.sizeDelta.x / 2, warningPanel.sizeDelta.y / 4); okButton.GetChild(0).GetComponent <Text>().fontSize = (int)(warningPanel.sizeDelta.x / 15); OkLandedButton.GetChild(0).GetComponent <Text>().fontSize = (int)(warningPanel.sizeDelta.x / 15); cancelButton.GetChild(0).GetComponent <Text>().fontSize = (int)(warningPanel.sizeDelta.x / 15); throbber.sizeDelta = new Vector2(warningPanel.sizeDelta.x / 6, warningPanel.sizeDelta.y / 6); firstText.GetComponent <RectTransform>().sizeDelta = new Vector2(warningPanel.sizeDelta.x, warningPanel.sizeDelta.y / 3); firstText.GetComponent <Text>().fontSize = (int)(warningPanel.sizeDelta.x / 10); secondText.GetComponent <Text>().fontSize = (int)(warningPanel.sizeDelta.x / 10); secondText.GetComponent <RectTransform>().sizeDelta = new Vector2(warningPanel.sizeDelta.x, warningPanel.sizeDelta.y / 3); //warningPanel.sizeDelta = new Vector2(Screen.width, Screen.height); }
public MissionExecutorModule() { clientUnity = UnityEngine.GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_REGISTRATION_MATRIX_CHANGED_NOTIFICATION, onRegistrationMatrixChanged)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_PLAN_LOADING_NOTIFICATION, onPlanExecPlanLoading)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_PLAN_LOADED_NOTIFICATION, onPlanExecPlanLoaded)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_PREFLIGHT_TESTING_NOTIFICATION, onPreflightTestStart)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_FCS_NOT_RESPONDING_NOTIFICATION, onPlanExecNotResponding)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_PREFLIGHT_TESTS_FAILED_NOTIFICATION, onPreflightFailed)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_ERROR_LOADING_PLAN_NOTIFICATION, onErrorLoadingPlan)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_READY_TO_FLIGHT_NOTIFICATION, onReadyToFlight)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_FLIGHT_PLAN_COMPLETED_NOTIFICATION, onPlanCompleted)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_FIRST_WAYPOINT_IS_TOO_FAR_NOTIFICATION, onFirstWaypointIsTooFar)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_FLYING_TO_NEXT_WP_NOTIFICATION, onFlyingToNextWp)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_CURRENT_FLIGHT_PLAN_NOTIFICATION, onCurrentPlanReceived)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_LAUNCHED_NOTIFICATION, onPlanLaunched)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_REACHED_WAYPOINT_NOTIFICATION, onReachedWp)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)PlanExecutorNotificationType.PLAN_EXEC_LANDING_NOTIFICATION, onLanding)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.PLAN_EXECUTOR_NOTIFICATIONS_MODULE, (byte)NotificationType.INVALID_STATUS, onInvalidStatus)); }
/// <summary> /// When the app is paused, we unsubcribe in order no to receive any petition from an inactive app /// </summary> /// <param name="pauseStatus"></param> void OnApplicationPause(bool pauseStatus) { if (firstLoad) { firstLoad = false; return; } ClientUnity clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); //UnityEngine.Debug.Log(pauseStatus); string currentScene = SceneManager.GetActiveScene().name; if (pauseStatus) // Application is paused, unsuscribe depending on the scene; { StateChangeSubscription(currentScene, false); } else // Application resume, suscribe depending on the scene { StateChangeSubscription(currentScene, true); } }
public MapperModule() { clientUnity = UnityEngine.GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); //clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_STARTED_MAPPING_NOTIFICATION, pointCloudStarted)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_MAP_READY_NOTIFICATION, onMappingReady)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_ERROR_SAVING_DDBB_NOTIFICATION, errorSavingDDBB)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_IDLE_NOTIFICATION, idle)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_ALL_POINT_CLOUDS_DELETED_NOTIFICATION, allPointCloudsDeleted)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_DELETED_POINTCLOUD_NOTIFICATION, PointCloudDeleted)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_CURRENT_GUID_NOTIFICATION, currentGUID)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_NUMBER_POINTCLOUDS_IN_MAP_NOTIFICATION, numberOfPointClouds)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_LIST_POINTCLOUD_IDS_NOTIFICATION, listOfPointCloudsGUID)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_MAP_READY_NOTIFICATION, mapReadyNotification)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_STARTED_MAPPING_NOTIFICATION, mapStartedNotification)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_PAUSE_MAPPING_NOTIFICATION, mapPausedNotification)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_IDLE_NOTIFICATION, mapIdleNotification)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_DONE_MAPPING_NOTIFICATION, mapDoneNotification)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_DONE_MAPPING_NOTIFICATION, pointCloudStopped)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)MapperNotificationType.MAPPER_POINTCLOUD_NOTIFICATION, onPclData)); clientUnity.mhandlers.Add(new MsgHandler((byte)Modules.MAPPER_NOTIFICATIONS_MODULE, (byte)NotificationType.INVALID_STATUS, onInvalidStatus)); }
void PlanButton(string id) { //This is the button clicked when we select an old plan //UnityEngine.Debug.Log(id); MissionManager.planIndex = int.Parse(id); MissionManager.loadMap = true; ClientUnity clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); //If the map doesn't exist, we download it if (!File.Exists(Application.persistentDataPath + "/PersistentData/Maps/" + MissionManager.guid + ".dae.map") && !File.Exists(Application.persistentDataPath + "/PersistentData/Maps/" + MissionManager.guid + ".dpl.map")) { if (clientUnity == null || clientUnity.client == null || !clientUnity.client.isConnected) { //UnityEngine.Debug.Log("Please connect to the drone to download this map"); // ## TODO: Mostrar mensaje al usuario StartCoroutine(FadePanel()); } else { downloadingMapPanel.SetActive(true); downloadingMapPanel.transform.GetChild(0).GetComponent <Text>().text = "Downloading Map"; PlanSelectionManager.askedForMaps = true; clientUnity.client.sendTwoPartCommand((byte)Modules.PLAN_LIBRARIAN_MODULE, (byte)PlanLibrarianCommandType.PLAN_LIB_REQUEST_MAP, MissionManager.guid + "\0"); // ##TODO Add the downloadign map that already exist and load it here } return; } if (GeneralSceneManager.appState == GeneralSceneManager.ApplicationState.Planning) { GameObject.Find("UIManager").GetComponent <UIManager>().LoadCustomScene("Planning"); //SceneManager.LoadScene("Planning"); } else if (GeneralSceneManager.appState == GeneralSceneManager.ApplicationState.Recording) { GameObject.Find("UIManager").GetComponent <UIManager>().LoadCustomScene("ModelAlignment"); //SceneManager.LoadScene("ModelAlignment"); } }
void Awake() { clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); int buttonSize = Screen.height / 15; int buttonOffset = buttonSize / 4; if (topInfoPanel) { // Posicion y tamaño del info panel topInfoPanel.anchoredPosition = new Vector2(0, -Screen.height / 20); topInfoPanel.sizeDelta = new Vector2(Screen.width / 2.0f, Screen.height / 20.0f); //topInfoPanel.sizeDelta = new Vector2(Screen.width - (2 * buttonSize) - (4 * buttonOffset), Screen.height / 8); //Posicion y tamaño de las imagenes del info panel float infoImageSize = topInfoPanel.sizeDelta.x / 5; readyImageRect.anchoredPosition = new Vector2(0 * infoImageSize, 0); calibrationImageRect.anchoredPosition = new Vector2(1 * infoImageSize, 0); mappingImageRect.anchoredPosition = new Vector2(2 * infoImageSize, 0); planningImageRect.anchoredPosition = new Vector2(3 * infoImageSize, 0); recordingImageRect.anchoredPosition = new Vector2(4 * infoImageSize, 0); readyImageRect.sizeDelta = new Vector2(infoImageSize, 0); calibrationImageRect.sizeDelta = new Vector2(infoImageSize, 0); mappingImageRect.sizeDelta = new Vector2(infoImageSize, 0); planningImageRect.sizeDelta = new Vector2(infoImageSize, 0); recordingImageRect.sizeDelta = new Vector2(infoImageSize, 0); readyImage = readyImageRect.GetChild(0).GetComponent <Image>(); GameObject prefabCopy = Instantiate(middleBar); prefabCopy.GetComponent <RectTransform>().sizeDelta = new Vector2(50, topInfoPanel.sizeDelta.y * 0.9f); float newBarWidth = prefabCopy.GetComponent <RectTransform>().sizeDelta.y * 9 / 92; prefabCopy.GetComponent <RectTransform>().anchoredPosition = new Vector2(infoImageSize * 1 - newBarWidth / 2, 0); Instantiate(prefabCopy, topInfoPanel.transform); prefabCopy.GetComponent <RectTransform>().anchoredPosition = new Vector2(infoImageSize * 2 - newBarWidth / 2, 0); Instantiate(prefabCopy, topInfoPanel.transform); prefabCopy.GetComponent <RectTransform>().anchoredPosition = new Vector2(infoImageSize * 3 - newBarWidth / 2, 0); Instantiate(prefabCopy, topInfoPanel.transform); prefabCopy.GetComponent <RectTransform>().anchoredPosition = new Vector2(infoImageSize * 4 - newBarWidth / 2, 0); Instantiate(prefabCopy, topInfoPanel.transform); Destroy(prefabCopy); // Posicion y tamaño del HomeButton //homeButton.anchoredPosition = new Vector2(-buttonSize - buttonOffset, 0); if (homeButton) { homeButton.anchoredPosition = new Vector2(buttonSize + buttonOffset, topInfoPanel.anchoredPosition.y); homeButton.sizeDelta = new Vector2(buttonSize, buttonSize); } } if (bottombar) { bottombar.anchoredPosition = new Vector2(0, Screen.height / 8); bottombar.sizeDelta = new Vector2(-Screen.width / 15, Screen.height / 175); } if (bottomPanel) { float bottomButtonSize = Screen.height / 20.0f; float bottomButtonOffset = bottomButtonSize / 4; bottomPanel.anchoredPosition = new Vector2(0, Screen.height / 25.0f); bottomPanel.sizeDelta = new Vector2(Screen.width / 2.0f, bottomButtonSize); settingsButton.anchoredPosition = new Vector2(2 * bottomButtonSize + 3 * bottomButtonOffset, 0); settingsButton.sizeDelta = new Vector2(bottomButtonSize, bottomButtonSize); if (aboutButton) { aboutButton.anchoredPosition = new Vector2(1 * bottomButtonSize + 1 * bottomButtonOffset, 0); aboutButton.sizeDelta = new Vector2(bottomButtonSize, bottomButtonSize); } } if (loadPanel && SceneManager.GetActiveScene().name != "General") { loadPanel.transform.GetChild(0).GetComponent <RectTransform>().anchoredPosition = new Vector2(0, Screen.height / 7); loadPanel.transform.GetChild(0).GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width / 1.5f, Screen.height / 3); loadPanel.transform.GetChild(1).GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -Screen.height / 7); loadPanel.transform.GetChild(1).GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.height / 8, Screen.height / 8); loadPanel.transform.GetChild(0).GetComponent <Text>().fontSize = (int)(Screen.width * 0.05f); } }
void Awake() { GeneralSceneManager.sceneState = GeneralSceneManager.SceneState.TagsConfiguration; // Client for send and receive messages clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); // UI Settings variables int width = Screen.width; int height = Screen.height; // Panel to detect clicks size GetComponent <RectTransform>().sizeDelta = new Vector2(width * 0.6f, height * 0.7f); // Tags panel settings panelSize = new Vector2(width * 0.3f, height * 0.5f); tagsConfigurationPanel.anchoredPosition = new Vector2(width * 0.6f, -height * 0.225f); tagsConfigurationPanel.sizeDelta = panelSize; // First panel (list with anchors, labels and tags settings) lookingForTags.anchoredPosition = new Vector2(width / 8, -height / 4); searchTags.anchoredPosition = new Vector2(width / 8, -height / 4); tagsFound.anchoredPosition = new Vector2(width / 3, -height / 6); tagsThrobber.anchoredPosition = new Vector2(0.0f, -height / 10f); tagsRect.anchoredPosition = new Vector2(0.0f, -height / 12); lookingForTags.sizeDelta = new Vector2(width / 6, height / 6); searchTags.sizeDelta = new Vector2(width / 6, height / 4); tagsFound.sizeDelta = new Vector2(width / 2, height / 6); tagsThrobber.sizeDelta = new Vector2(width / 20, width / 20); tagsRect.sizeDelta = new Vector2(width / 2, height / 2); lookingForTags.GetComponent <Text>().fontSize = (int)(width * 0.020f); searchTags.GetComponent <Text>().fontSize = (int)(width * 0.015f); tagsFound.GetComponent <Text>().fontSize = (int)(width * 0.035f); tagsText.GetComponent <Text>().fontSize = (int)(width * 0.02f); // First panel buttons settings discoverAnchorsButton.anchoredPosition = new Vector2(width / 8, -height / 2f); configButton.anchoredPosition = new Vector2(width / 8, -height / 1.5f); skipEverythingButton.anchoredPosition = new Vector2(width / 8, -height / 1.5f); discoverAnchorsButton.sizeDelta = new Vector2(width / 6, height / 12); skipEverythingButton.sizeDelta = new Vector2(width / 6, height / 12); configButton.sizeDelta = new Vector2(width / 6, height / 12); discoverAnchorsButton.GetChild(0).GetComponent <Text>().fontSize = (int)(width * 0.02f); skipEverythingButton.GetChild(0).GetComponent <Text>().fontSize = (int)(width * 0.02f); configButton.GetChild(0).GetComponent <Text>().fontSize = (int)(width * 0.02f); // Confirm config button listener confirmButton.GetComponent <Button>().onClick.AddListener(ConfirmTagConfiguration); nextConfigButton.GetComponent <Button>().onClick.AddListener(NextConfiguration); backConfigButton.GetComponent <Button>().onClick.AddListener(BackConfiguration); // Confirm button and his label/throbber size confirmButton.sizeDelta = new Vector2(panelSize.x * 0.4f, panelSize.y / 10); nextConfigButton.sizeDelta = new Vector2(panelSize.x * 0.4f, panelSize.y / 10); backConfigButton.sizeDelta = new Vector2(panelSize.x * 0.4f, panelSize.y / 10); sendingDataThrobber.sizeDelta = new Vector2(panelSize.x * 0.2f, panelSize.x * 0.2f); sendingDataText.sizeDelta = new Vector2(panelSize.x * 0.25f, panelSize.y / 10); // Confirm button and his label/throbber position confirmButton.anchoredPosition = new Vector2(panelSize.x * 0.55f, -panelSize.y * 1.1f); nextConfigButton.anchoredPosition = new Vector2(panelSize.x * 0.55f, -panelSize.y * 1.1f); backConfigButton.anchoredPosition = new Vector2(panelSize.x * 0.05f, -panelSize.y * 1.1f); sendingDataThrobber.anchoredPosition = new Vector2(panelSize.x * 0.6f, -panelSize.y * 1.1f); sendingDataText.anchoredPosition = new Vector2(panelSize.x * 0.85f, -panelSize.y * 1.1f); confirmButton.GetChild(0).GetComponent <Text>().fontSize = (int)(width * 0.02f); nextConfigButton.GetChild(0).GetComponent <Text>().fontSize = (int)(width * 0.02f); backConfigButton.GetChild(0).GetComponent <Text>().fontSize = (int)(width * 0.02f); sendingDataText.GetComponent <Text>().fontSize = (int)(width * 0.02f); }
void Awake() { GeneralSceneManager.sceneState = GeneralSceneManager.SceneState.Recording; topInfoPanel.transform.GetChild(0).GetChild(0).GetComponent <Image>().color = new Color(1, 1, 1, 0.4f); topInfoPanel.transform.GetChild(1).GetChild(0).GetComponent <Image>().color = new Color(1, 1, 1, 0.4f); topInfoPanel.transform.GetChild(2).GetChild(0).GetComponent <Image>().color = new Color(1, 1, 1, 0.4f); topInfoPanel.transform.GetChild(3).GetChild(0).GetComponent <Image>().color = new Color(1, 1, 1, 0.4f); modelLoadingPanel = GameObject.Find("ModelLoadingPanel"); modelLoadingPanel.transform.GetChild(0).GetComponent <RectTransform>().anchoredPosition = new Vector2(0, Screen.height / 7); modelLoadingPanel.transform.GetChild(0).GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width / 1.5f, Screen.height / 3); modelLoadingPanel.transform.GetChild(1).GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -Screen.height / 7); modelLoadingPanel.transform.GetChild(1).GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.height / 8, Screen.height / 8); modelLoadingPanel.transform.GetChild(0).GetComponent <Text>().fontSize = (int)(Screen.width * 0.05f); StartCoroutine(WaitForModel()); fpvRender.sizeDelta = new Vector2(Screen.width / 4, Screen.height / 3); warningAccept.sizeDelta = new Vector2(Screen.width / 6, Screen.height / 10); warningCancel.sizeDelta = new Vector2(Screen.width / 6, Screen.height / 10); warningTakeOff.sizeDelta = new Vector2(Screen.width / 6, Screen.height / 10); warningAccept.anchoredPosition = new Vector2(Screen.width / 8, 0); warningCancel.anchoredPosition = new Vector2(-Screen.width / 8, 0); WarningPanel.anchoredPosition = new Vector2(0, Screen.height / 4); WarningPanel.sizeDelta = new Vector2(WarningPanel.sizeDelta.x, 3 * Screen.height / 4); warningTitle.fontSize = Screen.height / 16; warningTitle.GetComponent <RectTransform>().anchoredPosition = new Vector2(warningTitle.GetComponent <RectTransform>().anchoredPosition.x, Screen.height / 12); warningText.fontSize = Screen.height / 28; warningText.rectTransform.sizeDelta = new Vector2(warningText.rectTransform.sizeDelta.x, Screen.height / 4); warningText.rectTransform.anchoredPosition = new Vector2(warningText.rectTransform.anchoredPosition.x, -2 * Screen.height / 12); warningRecStartPanel.anchoredPosition = new Vector2(0, Screen.height / 4); warningRecStartPanel.sizeDelta = new Vector2(WarningPanel.sizeDelta.x, 3 * Screen.height / 6); warningRecStartTitle.fontSize = Screen.height / 16; warningRecStartTitle.GetComponent <RectTransform>().anchoredPosition = new Vector2(warningTitle.GetComponent <RectTransform>().anchoredPosition.x, Screen.height / 12); warningRecStartText.fontSize = Screen.height / 28; warningRecStartText.rectTransform.sizeDelta = new Vector2(warningText.rectTransform.sizeDelta.x, Screen.height / 4); warningRecStartText.rectTransform.anchoredPosition = new Vector2(warningText.rectTransform.anchoredPosition.x, -2 * Screen.height / 12); playPauseImage = playButton.GetComponent <Image>(); playPauseRect = playButton.GetComponent <RectTransform>(); playPauseRect.sizeDelta = new Vector2(Screen.height / 16, Screen.height / 16); backRect.sizeDelta = new Vector2(Screen.height / 16, Screen.height / 16); playPauseRect.anchoredPosition = new Vector2(Screen.width / 20, 0); backRect.anchoredPosition = new Vector2(-Screen.width / 20, 0); recordingPanel.GetComponent <RectTransform>().anchoredPosition = new Vector2(Screen.width / 20, 2 * Screen.height / 8); clientUnity = GameObject.Find("ClientUnity").GetComponent <ClientUnity>(); droneHasFinishedPanel.gameObject.SetActive(false); droneHasFinishedPanel.sizeDelta = new Vector2(droneHasFinishedPanel.sizeDelta.x, Screen.height / 16); droneHasFinishedPanel.anchoredPosition = new Vector2(0, 2 * Screen.height / 8); droneHasFinishedText.GetComponent <Text>().fontSize = Screen.width / 60; droneHasFinishedButton.sizeDelta = new Vector2(Screen.width / 8, Screen.height / 16); //Create Path path = Path.Instance; string jsonString = File.ReadAllText(Application.persistentDataPath + "/PersistentData/Missions/" + MissionManager.guid + ".json.mission"); Map map = JsonUtility.FromJson <Map>(jsonString); //UnityEngine.Debug.Log("Guid: " + MissionManager.guid); //UnityEngine.Debug.Log("PlanIndex: " + MissionManager.planIndex); //UnityEngine.Debug.Log("PathsCount: " + map.Paths.Count); Path anotherPath = map.Paths[MissionManager.planIndex]; //We get the matrix that will transform from unity to pozyx to send it registrationMatrix = new RegistrationMatrix(); for (int i = 0; i < 16; i++) { registrationMatrix.elems[i] = map.unityToAnchors[i]; UnityEngine.Debug.Log(registrationMatrix.elems[i]); } registrationMatrix.rowMajor = 0; //path.setPath(anotherPath); //If the drone isn't in recording state if (!isRecState) { //We enter recording state, which will send the matrix and the plan clientUnity.client.SendCommand((byte)Modules.ATREYU_MODULE, (byte)AtreyuCommandType.ATREYU_ENTER_RECORDING_STATE); //clientUnity.client.sendCommand((byte)Modules.POSITIONING_MODULE, (byte)PositioningCommandType.IPS_SYSTEM); } else { //else we start to look at the drone travel FlyButtonStateMachine.state = FlyButtonStateMachine.buttonState.ACTIVATED; isRecState = false; } //for (int i = 0; i < path.Count(); i++) //{ // GameObject auxPoint = Instantiate(point, path.GetPoint(i).PointPosition, Quaternion.Euler(0, 0, 0), parent.transform); // path.GetPoint(i).PointTransf = auxPoint.transform; // auxPoint.SetActive(true); // auxPoint.AddComponent<PathPoint>().createPathPointWithPoint(path.GetPoint(i), 0,0); // waypoints.Add(auxPoint); //} //topCam.gameObject.GetComponent<PostRenderFront>().enabled = true; //lineMat.SetPass(0); ////WarningPanel.gameObject.SetActive(false); //for (int i = 0; i < path.Count() - 1; i++) //{ // CatmullRomSpline.DisplayCatmullRomSpline2(path, i, ref path.middlePointsTop, topCam.orthographicSize / 2.0f, true, topCam); //} ////modelMaterial.SetFloat("_Discard", 0); // waypoints.Sort((IComparer<GameObject>)new SortPointsByID()); // indexWaypoints = 0; // indexMiddlePoints = 0; // TotalindexMiddlePoints = 0; // drone.transform.position = waypoints[0].transform.position; // actualWaypoint = waypoints[0].transform.position; // nextWaypoint = path.middlePointsTop[0]; // if (waypoints[0].GetComponent<PathPoint>().Poi != null) // { // drone.transform.LookAt(waypoints[0].GetComponent<PathPoint>().Poi); // } // else // { // drone.transform.rotation = Quaternion.Euler(0, 0, 0); // // } //recordingPanel.SetActive(true); }