protected override void OnButtonUp() { if (targetBuilder.CurrentFrameQuality == ImageTargetBuilder.FrameQuality.FRAME_QUALITY_HIGH) { StartBuildingTarget(); } else if (targetBuilder.CurrentFrameQuality == ImageTargetBuilder.FrameQuality.FRAME_QUALITY_MEDIUM) { notification.ShowNotification("The visible object in the scene is medium quality. \nDo you wish to use it as reference anyway? \nWe recommend the use of an object \nwith higher contrast as reference \n(such as a detailed magazine cover).", true); } else { notification.ShowNotification("The visible object in the scene is low quality. \nPlease make sure your camera's field of view contains \na highly contrasted object \n(such as a detailed magazine cover).", false); } }
protected override void OnButtonUp() { var craftIO = UserDefinedTargetEventHandler_preview.model.gameObject.GetComponent <CraftSavingScript>(); var filePath = SavedFilesBrowser.SavedFilesPath + "/" + DateTime.Now.ToString("yyyyMMddHHmmss") + "." + SavedFilesBrowser.FileExtension; craftIO.SaveCraft(filePath); fileBrowser.ReInitializeFilesList(); notification.HideButtons(); notification.ShowNotification("\n\n\nFile saved under : \n" + filePath, false, 0.45f, FontStyle.Bold); }
public bool LoadCraft(string newFilePath) { var textureManager = TextureBrowser.GetFirstInstance(); if (newFilePath != FilePath) { FilePath = newFilePath; } Debug.Log(FilePath); CraftState craft = null; try { craft = CraftState.DeserializeState(FilePath); } catch { notification.ShowNotification("Unable to load the geometry. \nThe file might be corrupted."); return(false); } for (int i = 0; i < transform.childCount; i++) { Destroy(transform.GetChild(i).gameObject); } transform.localScale = new Vector3(craft.CraftScale, craft.CraftScale, craft.CraftScale); renderer.material.color = ColorHexConverter.HexToRGB(craft.RootColor); if (craft.RootTexture == 0) { renderer.material.mainTexture = null; } else { renderer.material.mainTexture = textureManager.GetTextureByIndex(craft.RootTexture); } AddSpawnEffect(gameObject); for (int i = 0; i < craft.ChildrenColors.Length; i++) { var child = Instantiate(Resources.Load(childCubePrefabName), transform.position, transform.rotation) as GameObject; child.renderer.material = new Material(sourceMaterial); child.transform.parent = transform; child.transform.localScale = new Vector3(1, 1, 1); child.transform.localPosition = new Vector3(craft.ChildrenLocalPosX[i], craft.ChildrenLocalPosY[i], craft.ChildrenLocalPosZ[i]); child.renderer.material.color = ColorHexConverter.HexToRGB(craft.ChildrenColors[i]); if (craft.ChildrensTextures[i] == 0) { child.renderer.material.mainTexture = null; } else { child.renderer.material.mainTexture = textureManager.GetTextureByIndex(craft.ChildrensTextures[i]); } AddSpawnEffect(child); } return(true); }
protected override void OnButtonUp() { var craftIO = UserDefinedTargetEventHandler_preview.model.gameObject.GetComponent <CraftSavingScript>(); if (craftIO.FilePath == null || craftIO.FilePath.Trim() == "") { var filePath = SavedFilesBrowser.SavedFilesPath + "/" + DateTime.Now.ToString("yyyyMMddHHmmss") + "." + SavedFilesBrowser.FileExtension; craftIO.SaveCraft(filePath); fileBrowser.ReInitializeFilesList(); if (!loadButton.activeSelf) { loadButton.SetActive(true); } notification.ShowNotification("\n\n\nFile saved under : \n" + filePath, false, 0.45f, FontStyle.Bold); } else { notification.ShowNotification("\nOverride current file : \n'" + Path.GetFileNameWithoutExtension(craftIO.FilePath) + "' ?", false, 1, FontStyle.Normal, true); } }