public IEnumerator HasBeenClickedConditionalPass() { Asset kitten = new Asset("CP [Kitten]", new Vector3(0, 0), new Character("Kitten", "Meow")); Cutscene dummyScene = new Cutscene( (kitten, null), Resources.Load <Texture>("Images/BG/Trees")); assets[0].getState().setNextScene(dummyScene); PointandClick currentScene = new PointandClick(assets); currentScene.show(); SceneNavigator.Instance.setCurrentScene(currentScene); yield return(new WaitForSeconds(1f)); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); AssetViewer aViewer = GameObject .FindWithTag("EventSystem") .GetComponent <AssetViewer>(); Asset asset = aViewer.getSceneAssetFrom(aPanel.transform.GetChild(0).gameObject); asset.getState().Click(asset); Assert.IsTrue(asset.getState().isClicked()); HasBeenClicked clickedConditional = new HasBeenClicked(asset); Assert.IsTrue(clickedConditional.isMet()); }
public IEnumerator OnePass() { Cutscene nextScene = new Cutscene((passKitten, null), backgrounds[0]); Asset asset = new Asset(assetName, assetPosition, new PaCElement(nextScene)); PointandClick currentScene = new PointandClick(new List <Asset> { asset }, backgrounds[1]); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); GameObject eventSystem = GameObject.FindWithTag("EventSystem"); SceneNavigator sNavi = eventSystem.GetComponent <SceneNavigator>(); AssetViewer aViewer = eventSystem.GetComponent <AssetViewer>(); currentScene.show(); sNavi.setCurrentScene(currentScene); sNavi.addConditions(asset, new List <Conditional> { new HasBeenClicked(asset) }); yield return(new WaitForSeconds(1f)); Asset sceneAsset = aViewer.getSceneAssetFrom(aPanel.transform.GetChild(0).gameObject); sceneAsset.getState().Click(sceneAsset); yield return(new WaitForSeconds(3f)); Assert.AreEqual(nextScene, sNavi.getCurrentScene()); }
public PointandClick(List <Asset> assets, Texture background = null) { bgViewer = BackgroundViewer.Instance; aViewer = AssetViewer.Instance; _assets = assets; _background = background; }
public IEnumerator OneFail() { Asset failKitten = new Asset("CP [Kitten]", new Vector3(0, 0), new Character("Kitten", "We're missing an important item.")); Cutscene nextScene = new Cutscene((passKitten, null), backgrounds[0]); Cutscene errorScene = new Cutscene((failKitten, null), backgrounds[1]); Asset asset = new Asset(assetName, assetPosition, new PaCElement(nextScene)); PointandClick currentScene = new PointandClick(new List <Asset> { asset }, backgrounds[1]); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); GameObject eventSystem = GameObject.FindWithTag("EventSystem"); SceneNavigator sNavi = eventSystem.GetComponent <SceneNavigator>(); AssetViewer aViewer = eventSystem.GetComponent <AssetViewer>(); DialogueViewer dlViewer = eventSystem.GetComponent <DialogueViewer>(); currentScene.show(); sNavi.setCurrentScene(currentScene); HasBeenClicked clickedCondition = new HasBeenClicked(asset); List <Conditional> conditionals = new List <Conditional> { clickedCondition }; sNavi.addConditions(asset, conditionals); sNavi.addErrorScene(asset, clickedCondition, errorScene); yield return(new WaitForSeconds(1f)); sNavi.changeSceneIfSatisfied(aViewer.getSceneAssetFrom(aPanel.transform.GetChild(0).gameObject)); yield return(new WaitForSeconds(3f)); Assert.AreEqual(errorScene, sNavi.getCurrentScene()); Asset navButton = dlViewer.getNavButton(); navButton.getState().Click(navButton); Assert.AreEqual(currentScene, sNavi.getCurrentScene()); yield return(new WaitForSeconds(3f)); }
private void infoButton_Click(object sender, EventArgs e) { FileStream stream = new FileStream(bundlePath, FileMode.Open, FileAccess.ReadWrite); int start = (int)(bundle.bundleHeader6.GetFileDataOffset() + bundle.bundleInf6.dirInf[bundleContents.SelectedIndex].offset); int length = (int)bundle.bundleInf6.dirInf[bundleContents.SelectedIndex].decompressedSize; byte[] data; using (BinaryReader reader = new BinaryReader(stream)) { reader.BaseStream.Position = start; data = reader.ReadBytes(length); } MemoryStream partition = new MemoryStream(data); AssetViewer av = new AssetViewer(partition, Path.GetDirectoryName(stream.Name), Path.GetFileName(stream.Name)); av.ShowDialog(); }
public void CloseProject(Boolean showStartPage = false) { if (StudioCore.Instance.HasProject) { StudioCore.Instance.Project.CacheManager.Dispose(); } // Close all windows AssetViewer.Clear(); StudioCore.Instance.Project = null; if (showStartPage) { StartPage.Instance.Show(dockPanel); } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Unity content (*.unity3d;*.assets)|*.unity3d;*.assets|Bundle file (*.unity3d)|*.unity3d|Assets file (*.assets)|*.assets|All types (*.*)|*.*"; if (ofd.ShowDialog() == DialogResult.OK) { //try //{ //todo, use using FileStream stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.ReadWrite); AssetsFileReader tempReader = new AssetsFileReader(stream); //todo .assets sanity check if (tempReader.ReadStringLength(7) != "UnityFS") { tempReader.Position = 0; AssetViewer av = new AssetViewer(stream, Path.GetDirectoryName(stream.Name), Path.GetFileName(stream.Name)); av.ShowDialog(); } else { tempReader.Position = 0; BundleLoader bl = new BundleLoader(stream); bl.ShowDialog(); if (bl.loaded) { bundleContents.Enabled = true; exportButton.Enabled = true; importButton.Enabled = true; infoButton.Enabled = true; foreach (AssetsBundleDirectoryInfo06 di in bl.bundle.bundleInf6.dirInf) { bundleContents.Items.Add(di.name); } bundleContents.SelectedIndex = 0; bundlePath = bl.bundleFilename; fileName.Text = Path.GetFileName(bundlePath); bundle = bl.bundle; } } tempReader = null; //} catch (Exception ex) //{ // MessageBox.Show("Unable to open the file!\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); //} } }
public IEnumerator HasBeenClickedConditionalFail() { PointandClick currentScene = new PointandClick(assets); currentScene.show(); yield return(new WaitForSeconds(1f)); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); AssetViewer aViewer = GameObject .FindWithTag("EventSystem") .GetComponent <AssetViewer>(); Asset asset = aViewer.getSceneAssetFrom(aPanel.transform.GetChild(0).gameObject); Assert.IsFalse(asset.getState().isClicked()); HasBeenClicked clickedConditional = new HasBeenClicked(asset); Assert.IsFalse(clickedConditional.isMet()); }
public IEnumerator AssetDims() { AssetViewer aViewer = GameObject .FindWithTag("EventSystem") .GetComponent <AssetViewer>(); Asset desiredAsset = assets[0]; aViewer.placeInScene(desiredAsset); yield return(new WaitForSeconds(1f)); GameObject asset = GameObject.FindWithTag("Kitten"); Image assetImage = asset.GetComponent <Image>(); Assert.AreEqual(Color.white, assetImage.color); aViewer.Darken(asset); Assert.AreEqual(Color.grey, assetImage.color); }
void Awake() { aViewer = AssetViewer.Instance; DialoguePanel = GameObject.FindWithTag("DialoguePanel"); SpeakerName = GameObject .FindWithTag("SpeakerNameText") .GetComponent <TextMeshProUGUI>(); DialogueText = GameObject .FindWithTag("DialogueText") .GetComponent <TextMeshProUGUI>(); navButtonObject = GameObject.FindWithTag("NavButton"); navButton = new Asset( navButtonObject.name, navButtonObject.transform.position, new Button()); navButton.setPrefab(navButtonObject); aViewer.trackCoreAsset(navButton); DialoguePanel.SetActive(false); }
public IEnumerator RemovesAssetFromScene() { AssetViewer aViewer = GameObject .FindWithTag("EventSystem") .GetComponent <AssetViewer>(); Asset desiredAsset = assets[0]; aViewer.placeInScene(desiredAsset); yield return(new WaitForSeconds(1f)); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); int numAssets = aPanel.transform.childCount; Assert.AreEqual(1, numAssets); aViewer.clearSceneAssets(); yield return(new WaitForSeconds(1f)); numAssets = aPanel.transform.childCount; Assert.AreEqual(0, numAssets); }
public IEnumerator MoveToSmoothDamp() { AssetViewer aViewer = GameObject .FindWithTag("EventSystem") .GetComponent <AssetViewer>(); Scene[] scenes = { new PointandClick(assets), new Cutscene((cat, null)) }; foreach (Scene scene in scenes) { scene.show(); yield return(new WaitForSeconds(1f)); var prefab = GameObject .FindWithTag("AssetsPanel") .transform .GetChild(0); Vector2 origPos = prefab.transform.position; Vector2 targetPos = new Vector3(300, 25); aViewer.MoveTo(prefab.gameObject, targetPos, 5f, MovementTypes.FastMiddle); yield return(new WaitUntil(() => !aViewer.getIsMoving())); Vector2 newPos = prefab.transform.position; Assert.AreNotEqual(origPos, newPos); int prefabDistance = Mathf.RoundToInt(Vector2.Distance(newPos, targetPos)); Assert.AreEqual(0, prefabDistance); Asset asset = aViewer.getSceneAssetFrom(prefab.gameObject); asset.setPosition(origPos); scene.hide(); } }
public IEnumerator MovementInterrupt() { AssetViewer aViewer = GameObject .FindWithTag("EventSystem") .GetComponent <AssetViewer>(); Scene scene = new Cutscene((cat, null)); scene.show(); yield return(new WaitForSeconds(1f)); var prefab = GameObject .FindWithTag("AssetsPanel") .transform .GetChild(0); Vector3 targetPos = new Vector3(-90, 0, 0); aViewer.MoveTo(prefab.gameObject, targetPos, 50f, MovementTypes.FastMiddle); yield return(new WaitUntil(() => !aViewer.getIsMoving())); Assert.IsTrue(Vector3.Distance(prefab.position, targetPos) < .1f); yield return(new WaitForSeconds(1f)); }
private void Start() { if (instance != null) { Destroy(gameObject); return; } instance = this; genericPrefabs = new Dictionary <UIElementType, GameObject>(); genericPrefabs.Add(UIElementType.Button, buttonPrefab); genericPrefabs.Add(UIElementType.Dropdown, dropdownPrefab); genericPrefabs.Add(UIElementType.Empty, emptyPrefab); genericPrefabs.Add(UIElementType.Image, imagePrefab); genericPrefabs.Add(UIElementType.Input, inputPrefab); genericPrefabs.Add(UIElementType.Panel, panelPrefab); genericPrefabs.Add(UIElementType.Text, textPrefab); GameObject addonViewerObj = Create(addonViewerPrefab); addonViewer = addonViewerObj.GetComponent <AddonViewer>(); GameObject assetBrowserObj = Create(assetBrowserPrefab); assetBrowser = assetBrowserObj.GetComponent <AssetBrowser>(); GameObject debugPanelObj = Create(debugPanelPrefab); debugPanel = debugPanelObj.GetComponent <DebugPanel>(); GameObject assetViewerObj = Create(assetViewerPrefab); assetViewer = assetViewerObj.GetComponent <AssetViewer>(); addonViewer.Close(); assetBrowser.Close(); assetViewer.Close(); }
public IEnumerator PlacesAsset() { AssetViewer aViewer = GameObject .FindWithTag("EventSystem") .GetComponent <AssetViewer>(); Asset desiredAsset = assets[0]; aViewer.placeInScene(desiredAsset); yield return(new WaitForSeconds(1f)); var asset = GameObject .FindWithTag("AssetsPanel") .transform .GetChild(0); Assert.AreEqual(desiredAsset.getPrefab().name, asset.name); Vector3 position = asset.position; Vector3 desiredPosition = desiredAsset.getPosition(); Assert.AreEqual(Math.Floor(desiredPosition.x), Math.Floor(position.x)); Assert.AreEqual(Math.Floor(desiredPosition.y), Math.Floor(position.y)); }
static void OpenTool() { AssetViewer window = GetWindow <AssetViewer>(false, "Asset Viewer", true); window.minSize = new Vector2(900f, 600f); }
public IEnumerator OnePassOneFail() { Asset e1kitten = new Asset("CP [Kitten]", new Vector3(0, 0), new Character("Kitten", "I should not be here.")); Asset e2kitten = new Asset("CP [Kitten]", new Vector3(50, 0), new Character("Kitten", "Oops!")); List <Cutscene> errorScenes = new List <Cutscene> { new Cutscene((e1kitten, null), backgrounds[1]), new Cutscene((e2kitten, null), backgrounds[1]) }; Asset passingAsset = new Asset( assetName, assetPosition, new PaCElement(null)); Asset placeholderAsset = new Asset( assetName, new Vector3(275, 147), new PaCElement(null)); List <Asset> assets = new List <Asset>() { passingAsset, placeholderAsset }; PointandClick currentScene = new PointandClick(assets, backgrounds[1]); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); GameObject eventSystem = GameObject.FindWithTag("EventSystem"); SceneNavigator sNavi = eventSystem.GetComponent <SceneNavigator>(); AssetViewer aViewer = eventSystem.GetComponent <AssetViewer>(); DialogueViewer dlViewer = eventSystem.GetComponent <DialogueViewer>(); currentScene.show(); sNavi.setCurrentScene(currentScene); HasBeenClicked passingCondition = new HasBeenClicked(passingAsset); HasBeenClicked failingCondition = new HasBeenClicked(placeholderAsset); List <Conditional> conditionals = new List <Conditional> { passingCondition, failingCondition }; sNavi.addConditions(passingAsset, conditionals); sNavi.addErrorScene(passingAsset, passingCondition, errorScenes[0]); sNavi.addErrorScene(passingAsset, failingCondition, errorScenes[1]); yield return(new WaitForSeconds(1f)); Asset sceneAsset = aViewer.getSceneAssetFrom(aPanel.transform.GetChild(0).gameObject); sceneAsset.getState().Click(sceneAsset); yield return(new WaitForSeconds(3f)); Assert.AreEqual(errorScenes[1], sNavi.getCurrentScene()); Asset navButton = dlViewer.getNavButton(); navButton.getState().Click(navButton); Assert.AreEqual(currentScene, sNavi.getCurrentScene()); yield return(new WaitForSeconds(3f)); }
private void Awake() { AssetViewer.Instance = this; this.InitCamera(); this.MainObject = new GameObject("MainObject"); }
public override void HoverEnter(Asset asset) { aViewer = AssetViewer.Instance; aViewer.Darken(asset.getPrefab()); }
public override void HoverExit(Asset asset) { aViewer = AssetViewer.Instance; aViewer.Lighten(asset.getPrefab()); }
void Start() { aViewer = AssetViewer.Instance; }
public void LoadURL() { AssetViewer instance = AssetViewer.GetInstance(); instance.LoadObject(this.UsePATH); }
private void AttachTreeViewEventHandlers() { treeView.BeforeLabelEdit += (@s, e) => { if (e.Node.Parent == null) { e.CancelEdit = true; } if (e.Node.Tag is int) { e.CancelEdit = true; } }; treeView.AfterLabelEdit += (@s, e) => { if (e.Node.Tag is AssetBase) { if (e.Label == null) { return; } if (String.IsNullOrWhiteSpace(e.Label)) { e.Node.EndEdit(false); } StudioCore.Instance.Project.RenameAsset(e.Node.Text, e.Label); } }; treeView.AfterSelect += (@s, e) => { if (e.Node.Tag is AssetBase) { var asset = e.Node.Tag as AssetBase; StudioCore.Instance.RequestUpdate(UpdateScope.Preview, PreviewWindow.UPDATE_TARGET, new [] { e.Node.Tag, 0 }); if (AssetViewer.GetInstance(asset) != null) { StudioCore.Instance.RequestUpdate(UpdateScope.AssetViewer, asset.ID, -1); } } if (e.Node.Tag is int && e.Node.Parent.Tag is AssetBase) { var asset = e.Node.Parent.Tag as AssetBase; var index = (Int32)e.Node.Tag; StudioCore.Instance.RequestUpdate(UpdateScope.Preview, PreviewWindow.UPDATE_TARGET, new[] { e.Node.Parent.Tag, index }); if (AssetViewer.GetInstance(asset) != null) { StudioCore.Instance.RequestUpdate(UpdateScope.AssetViewer, asset.ID, index); } } }; treeView.DoubleClick += (@s, e) => { if (treeView.SelectedNode == null) { return; } var asset = treeView.SelectedNode.Tag as AssetBase; if (asset != null && asset.Error == null) { StudioCore.Instance.ViewAsset(asset); } }; }
/// <summary> /// Opens the specified asset in the asset viewer. /// </summary> /// <param name="asset"></param> public void ViewAsset(AssetBase asset) { var viewer = AssetViewer.GetInstance(asset); MainForm.Instance.PushDockableWindow(viewer, DockState.Document); }