Пример #1
0
        public void Init(DialogReceiverInterface e, SceneDataControl scene, int areaIndex)
        {
            sceneRef           = scene;
            calledAreaIndexRef = areaIndex;

            string backgroundPath =
                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                    GameRources.GetInstance().selectedSceneIndex].getPreviewBackground();

            backgroundPreviewTex = AssetsController.getImage(backgroundPath).texture;

            activeAreaTex   = (Texture2D)Resources.Load("Editor/ActiveArea", typeof(Texture2D));
            exitTex         = (Texture2D)Resources.Load("Editor/ExitArea", typeof(Texture2D));
            selectedAreaTex = (Texture2D)Resources.Load("Editor/SelectedArea", typeof(Texture2D));
            float bgwidth = backgroundPreviewTex.width * (600f / backgroundPreviewTex.height);

            imageBackgroundRect = new Rect(0f, 0f, bgwidth, 600);

            x      = sceneRef.getActiveAreasList().getActiveAreasList()[areaIndex].getX();
            y      = sceneRef.getActiveAreasList().getActiveAreasList()[areaIndex].getY();
            width  = sceneRef.getActiveAreasList().getActiveAreasList()[areaIndex].getWidth();
            heigth = sceneRef.getActiveAreasList().getActiveAreasList()[areaIndex].getHeight();

            base.Init(e, bgwidth, 600);
        }
Пример #2
0
        public ScenesWindowActiveAreas(Rect aStartPos, GUIContent aContent, GUIStyle aStyle,
                                       params GUILayoutOption[] aOptions)
            : base(aStartPos, aContent, aStyle, aOptions)
        {
            clearImg     = (Texture2D)Resources.Load("EAdventureData/img/icons/deleteContent", typeof(Texture2D));
            addTexture   = (Texture2D)Resources.Load("EAdventureData/img/icons/addNode", typeof(Texture2D));
            moveUp       = (Texture2D)Resources.Load("EAdventureData/img/icons/moveNodeUp", typeof(Texture2D));
            moveDown     = (Texture2D)Resources.Load("EAdventureData/img/icons/moveNodeDown", typeof(Texture2D));
            duplicateImg = (Texture2D)Resources.Load("EAdventureData/img/icons/duplicateNode", typeof(Texture2D));

            if (GameRources.GetInstance().selectedSceneIndex >= 0)
            {
                backgroundPath =
                    Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                        GameRources.GetInstance().selectedSceneIndex].getPreviewBackground();
            }
            if (backgroundPath != null && !backgroundPath.Equals(""))
            {
                backgroundPreviewTex = AssetsController.getImage(backgroundPath).texture;
            }

            conditionTex = (Texture2D)Resources.Load("EAdventureData/img/icons/no-conditions-24x24", typeof(Texture2D));

            selectedAreaSkin = (GUISkin)Resources.Load("Editor/EditorLeftMenuItemSkinConcreteOptions", typeof(GUISkin));
            noBackgroundSkin = (GUISkin)Resources.Load("Editor/EditorNoBackgroundSkin", typeof(GUISkin));


            selectedArea   = -1;
            selectedAction = -1;
        }
 public static string[] CategoryFolders()
 {
     string[] folders = new string[AssetsConstants.CATEGORIES_COUNT];
     for (int i = 0; i < AssetsConstants.CATEGORIES_COUNT; i++)
     {
         folders[i] = AssetsController.getCategoryFolder(i);
     }
     return(folders);
 }
 void OnSlidesceneChanged(string val)
 {
     slidesPath = val;
     Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[
         GameRources.GetInstance().selectedCutsceneIndex].setPathToSlides(val);
     slidesPathPreview =
         Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[
             GameRources.GetInstance().selectedCutsceneIndex].getPreviewImage();
     slidesPreview = AssetsController.getImage(slidesPathPreview).texture;
 }
Пример #5
0
 public void addPlayer()
 {
     if (sceneDataControl.isForcedPlayerLayer())
     {
         playerImagePath = Controller.getInstance().getPlayerImagePath();
         ElementContainer ec = new ElementContainer(null, 0, AssetsController.getImage(this.playerImagePath));
         int layer           = insertInOrder(ec, true);
         reassignLayerAllReferencesDataControl(layer);
         sceneDataControl.setPlayerLayer(layer);
     }
 }
Пример #6
0
 private void OnBackgroundChange(string val)
 {
     backgroundPath = val;
     Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
         GameRources.GetInstance().selectedBookIndex].setPreviewImage(val);
     if (backgroundPath != null && !backgroundPath.Equals(""))
     {
         backgroundPreview =
             AssetsController.getImage(backgroundPath).texture;
     }
 }
 void OnImageChanged(string val)
 {
     Debug.Log("PATH: " + val + "\n " + Controller.getInstance().getSelectedChapterDataControl().getAtrezzoList().getAtrezzoList()[
                   GameRources.GetInstance().selectedSetItemIndex].getPreviewImage());
     pathToImg = val;
     Controller.getInstance().getSelectedChapterDataControl().getAtrezzoList().getAtrezzoList()[
         GameRources.GetInstance().selectedSetItemIndex].setImage(val);
     if (pathToImg != null && !pathToImg.Equals(""))
     {
         atrezzoImg = AssetsController.getImage(pathToImg).texture;
     }
 }
Пример #8
0
 public ScenesWindowPlayerMovement(Rect aStartPos, GUIContent aContent, GUIStyle aStyle,
                                   params GUILayoutOption[] aOptions)
     : base(aStartPos, aContent, aStyle, aOptions)
 {
     if (GameRources.GetInstance().selectedSceneIndex >= 0)
     {
         backgroundPath =
             Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                 GameRources.GetInstance().selectedSceneIndex].getPreviewBackground();
     }
     if (backgroundPath != null && !backgroundPath.Equals(""))
     {
         backgroundPreviewTex = AssetsController.getImage(backgroundPath).texture;
     }
 }
Пример #9
0
        public Sprite getPlayerImage()
        {
            //CHANGE: Now, the image of the player must be taken from
            return(AssetsController.getImage(Controller.getInstance().getPlayerImagePath()));

            /*if (playerPositionInAllReferences==NO_PLAYER)
             * return AssetsController.getImage(Controller.getInstance().getPlayerImagePath());
             * else{
             * if (imagePathHasChanged){
             *  allReferencesDataControl.get(playerPositionInAllReferences).setImage(AssetsController.getImage( this.playerImagePath ));
             *  imagePathHasChanged = false;
             * }
             * //	if (allReferences!=null)
             *  return allReferencesDataControl.get(playerPositionInAllReferences).getImage();
             * }*/
        }
        public SetItemsWindowApperance(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, params GUILayoutOption[] aOptions)
            : base(aStartPos, aContent, aStyle, aOptions)
        {
            clearImg = (Texture2D)Resources.Load("EAdventureData/img/icons/deleteContent", typeof(Texture2D));

            if (GameRources.GetInstance().selectedSetItemIndex >= 0)
            {
                pathToImg =
                    Controller.getInstance().getSelectedChapterDataControl().getAtrezzoList().getAtrezzoList()[
                        GameRources.GetInstance().selectedSetItemIndex].getPreviewImage();
            }


            if (pathToImg != null && !pathToImg.Equals(""))
            {
                atrezzoImg = AssetsController.getImage(pathToImg).texture;
            }
        }
        /**
         * Shows a dialog to choose a new path for the given asset.
         *
         * @param index
         *            Index of the asset
         */
        public void editImagePath()
        {
            // Get the list of assets from the ZIP file
            string selectedAsset = null;

            //TODO: implement
            //AssetChooser chooser = AssetsController.getAssetChooser(AssetsConstants.CATEGORY_IMAGE, AssetsController.FILTER_NONE);
            //int option = chooser.showAssetChooser(controller.peekWindow());
            ////In case the asset was selected from the zip file
            //if (option == AssetChooser.ASSET_FROM_ZIP)
            //{
            //    selectedAsset = chooser.getSelectedAsset();
            //}

            ////In case the asset was not in the zip file: first add it
            //else if (option == AssetChooser.ASSET_FROM_OUTSIDE)
            //{
            //    bool added = AssetsController.addSingleAsset(AssetsConstants.CATEGORY_IMAGE, chooser.getSelectedFile().getAbsolutePath());
            //    if (added)
            //    {
            //        selectedAsset = chooser.getSelectedFile().getName();
            //    }
            //}

            // If a file was selected
            if (selectedAsset != null)
            {
                // Take the index of the selected asset
                string[] assetFilenames = AssetsController.getAssetFilenames(AssetsConstants.CATEGORY_IMAGE);
                string[] assetPaths     = AssetsController.getAssetsList(AssetsConstants.CATEGORY_IMAGE);
                int      assetIndex     = -1;
                for (int i = 0; i < assetFilenames.Length; i++)
                {
                    if (assetFilenames[i].Equals(selectedAsset))
                    {
                        assetIndex = i;
                    }
                }

                Controller.getInstance().addTool(new ChangeParagraphContentTool(bookParagraph, assetPaths[assetIndex]));
            }
        }
Пример #12
0
        public Sprite getImage()
        {
            if (erdc != null)
            {
                int    type      = erdc.getType();
                string imagePath = string.Empty;

                if (type == Controller.ITEM_REFERENCE)
                {
                    imagePath =
                        Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                            Controller.getInstance()
                            .getSelectedChapterDataControl()
                            .getItemsList()
                            .getItemIndexByID(erdc.getElementId())].getPreviewImage();
                }
                else if (type == Controller.ATREZZO_REFERENCE)
                {
                    imagePath =
                        Controller.getInstance().getSelectedChapterDataControl().getAtrezzoList().getAtrezzoList()[
                            Controller.getInstance()
                            .getSelectedChapterDataControl()
                            .getAtrezzoList()
                            .getAtrezzoIndexByID(erdc.getElementId())].getPreviewImage();
                }
                else if (type == Controller.NPC_REFERENCE)
                {
                    imagePath =
                        Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                            Controller.getInstance()
                            .getSelectedChapterDataControl()
                            .getNPCsList()
                            .getNPCIndexByID(erdc.getElementId())].getPreviewImage();
                }

                if (!string.IsNullOrEmpty(imagePath))
                {
                    image = AssetsController.getImage(imagePath);
                }
            }
            return(image);
        }
Пример #13
0
        public ScenesWindowExits(Rect aStartPos, GUIContent aContent, GUIStyle aStyle,
                                 params GUILayoutOption[] aOptions)
            : base(aStartPos, aContent, aStyle, aOptions)
        {
            clearImg     = (Texture2D)Resources.Load("EAdventureData/img/icons/deleteContent", typeof(Texture2D));
            addTexture   = (Texture2D)Resources.Load("EAdventureData/img/icons/addNode", typeof(Texture2D));
            moveUp       = (Texture2D)Resources.Load("EAdventureData/img/icons/moveNodeUp", typeof(Texture2D));
            moveDown     = (Texture2D)Resources.Load("EAdventureData/img/icons/moveNodeDown", typeof(Texture2D));
            duplicateImg = (Texture2D)Resources.Load("EAdventureData/img/icons/duplicateNode", typeof(Texture2D));


            transitionTypes = new string[]
            { TC.get("Exit.NoTransition"), TC.get("Exit.TopToBottom"), TC.get("Exit.BottomToTop"), TC.get("Exit.LeftToRight"), TC.get("Exit.RightToLeft"), TC.get("Exit.FadeIn") };

            transitionTimeInt    = 0;
            transitionTimeString = transitionTimeStringLast = transitionTimeInt.ToString();

            if (GameRources.GetInstance().selectedSceneIndex >= 0)
            {
                backgroundPath =
                    Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                        GameRources.GetInstance().selectedSceneIndex].getPreviewBackground();
            }



            if (backgroundPath != null && !backgroundPath.Equals(""))
            {
                backgroundPreviewTex = AssetsController.getImage(backgroundPath).texture;
            }

            //TODO: do new skin?
            selectedAreaSkin = (GUISkin)Resources.Load("Editor/EditorLeftMenuItemSkinConcreteOptions", typeof(GUISkin));
            noBackgroundSkin = (GUISkin)Resources.Load("Editor/EditorNoBackgroundSkin", typeof(GUISkin));


            selectedExit = 0;
        }
        public CutscenesWindowAppearance(Rect aStartPos, GUIContent aContent, GUIStyle aStyle,
                                         params GUILayoutOption[] aOptions)
            : base(aStartPos, aContent, aStyle, aOptions)
        {
            clearImg = (Texture2D)Resources.Load("EAdventureData/img/icons/deleteContent", typeof(Texture2D));

            if (GameRources.GetInstance().selectedCutsceneIndex >= 0)
            {
                slidesPath =
                    Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[
                        GameRources.GetInstance().selectedCutsceneIndex].getPathToSlides();
                slidesPathPreview =
                    Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[
                        GameRources.GetInstance().selectedCutsceneIndex].getPreviewImage();
                canSkipVideo         =
                    canSkipVideoLast =
                        Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[
                            GameRources.GetInstance().selectedCutsceneIndex].getCanSkip();
                // Get videopath
                videoscenePath =
                    Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[
                        GameRources.GetInstance().selectedCutsceneIndex].getPathToVideo();
            }

            //musicPath =
            //    Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[
            //        GameRources.GetInstance().selectedCutsceneIndex].music();

            if (slidesPath != null && !slidesPath.Equals(""))
            {
                slidesPreview = AssetsController.getImage(slidesPathPreview).texture;
            }


            slidePreviewMovie = (Texture2D)Resources.Load("EAdventureData/img/icons/video", typeof(Texture2D));
        }
Пример #15
0
        protected void OnGUI()
        {
            if (workingAnimation == null)
            {
                this.Close();
                return;
            }

            switch (Event.current.type)
            {
            case EventType.DragUpdated:
                if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
                    Debug.Log("Dragging (" + Event.current.type + "):" + System.String.Join("\n", DragAndDrop.paths));
                }
                break;

            case EventType.DragPerform:
                if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
                {
                    DragAndDrop.AcceptDrag();
                    foreach (var path in DragAndDrop.paths)
                    {
                        var uri   = AssetsController.AddSingleAsset(AssetsConstants.CATEGORY_ANIMATION_IMAGE, path);
                        var frame = workingAnimation.addFrame(selectedFrame, null);
                        frame.setUri(uri);
                    }
                }
                break;
            }

            EditorGUILayout.PrefixLabel(TC.get("Animation.GeneralInfo"), GUIStyle.none, titleStyle);
            EditorGUI.BeginChangeCheck();
            var documentationTextContent = EditorGUILayout.TextField(TC.get("Animation.Documentation"), workingAnimation.getDocumentation());

            if (EditorGUI.EndChangeCheck())
            {
                workingAnimation.setDocumentation(documentationTextContent);
            }

            EditorGUI.BeginChangeCheck();
            var useTransitions = EditorGUILayout.Toggle(TC.get("Animation.UseTransitions"), workingAnimation.isUseTransitions());

            if (EditorGUI.EndChangeCheck())
            {
                workingAnimation.setUseTransitions(useTransitions);
            }

            EditorGUI.BeginChangeCheck();
            var isSlides = EditorGUILayout.Toggle(TC.get("Animation.Slides"), workingAnimation.isSlides());

            if (EditorGUI.EndChangeCheck())
            {
                workingAnimation.setSlides(isSlides);
            }

            /*
             * Transition panel
             */
            EditorGUILayout.PrefixLabel(TC.get("Animation.Timeline"), GUIStyle.none, titleStyle);

            using (var scroll = new EditorGUILayout.ScrollViewScope(scrollPosition, true, false, GUILayout.Height(125)))
                using (new EditorGUILayout.HorizontalScope())
                    using (new GUIUtil.SkinScope(noBackgroundSkin))
                    {
                        scrollPosition = scroll.scrollPosition;
                        for (int i = 0, frameCount = workingAnimation.getFrames().Count; i < frameCount; i++)
                        {
                            if (selectedFrame == i)
                            {
                                GUI.skin = selectedFrameSkin;
                            }

                            var frame        = workingAnimation.getFrame(i);
                            var image        = Controller.ResourceManager.getImage(frame.getUri());
                            var frameContent = new GUIContent(frame.getTime().ToString(), image);
                            if (GUILayout.Button(frameContent, GUILayout.Height(100), GUILayout.Width(80)))
                            {
                                selectedFrame = (i == selectedFrame) ? -1 : i;
                                GUI.FocusControl(null);
                            }
                            if (useTransitions && i != workingAnimation.getFrames().Count - 1)
                            {
                                var transition        = workingAnimation.getTranstionForFrame(i);
                                var transitionContent = new GUIContent(transition.getTime().ToString(), transitionTypeTexture[(int)transition.getType()]);
                                if (GUILayout.Button(transitionContent, GUILayout.Height(100), GUILayout.Width(80)))
                                {
                                    selectedFrame = (i == selectedFrame) ? -1 : i;
                                    GUI.FocusControl(null);
                                }
                            }
                            GUI.skin = noBackgroundSkin;
                        }
                    }

            /*
             * Transition button panel
             */
            using (new EditorGUILayout.HorizontalScope())
                using (new GUIUtil.SkinScope(noBackgroundSkin))
                {
                    GUILayout.FlexibleSpace();
                    using (new EditorGUI.DisabledScope(selectedFrame < 0))
                    {
                        if (GUILayout.Button(moveLeft))
                        {
                            workingAnimation.moveLeft(selectedFrame);
                            selectedFrame--;
                        }
                    }
                    using (new EditorGUI.DisabledScope(selectedFrame < 0 || workingAnimation.getFrames().Count < 2))
                    {
                        if (GUILayout.Button(clearImg))
                        {
                            workingAnimation.removeFrame(selectedFrame);
                            selectedFrame--;
                        }
                    }

                    if (GUILayout.Button(addTexture))
                    {
                        var frame = workingAnimation.addFrame(selectedFrame, null);
                        frame.setUri(SpecialAssetPaths.ASSET_EMPTY_ANIMATION + "_01.png");
                    }

                    using (new EditorGUI.DisabledScope(selectedFrame < 0))
                    {
                        if (GUILayout.Button(duplicateImg))
                        {
                            workingAnimation.addFrame(selectedFrame, workingAnimation.getFrame(selectedFrame));
                        }
                    }

                    using (new EditorGUI.DisabledScope(selectedFrame >= workingAnimation.getFrames().Count - 1))
                    {
                        if (GUILayout.Button(moveRight))
                        {
                            workingAnimation.moveRight(selectedFrame);
                            selectedFrame++;
                        }
                    }
                    GUILayout.FlexibleSpace();
                }


            using (new EditorGUI.DisabledScope(selectedFrame == -1))
            {/*
              * Frame info panel
              */
                var frame = selectedFrame >= 0 ? workingAnimation.getFrame(selectedFrame): emptyFrame;

                EditorGUILayout.PrefixLabel(TC.get("Animation.Details"), GUIStyle.none, titleStyle);

                EditorGUI.BeginChangeCheck();
                var frameDocumentation = EditorGUILayout.TextField(TC.get("Animation.Documentation"), frame.getDocumentation());
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setDocumentation(frameDocumentation);
                }

                EditorGUI.BeginChangeCheck();
                var frameDuration = System.Math.Max(0, EditorGUILayout.LongField(TC.get("Animation.Duration"), frame.getTime()));
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setTime(frameDuration);
                }

                EditorGUI.BeginChangeCheck();
                imageChooser.Path = frame.getUri();
                imageChooser.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setUri(imageChooser.Path);
                }

                EditorGUI.BeginChangeCheck();
                soundChooser.Path = frame.getSoundUri();
                soundChooser.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setSoundUri(soundChooser.Path);
                }

                var editTransition = useTransitions && selectedFrame.InRange(-1, workingAnimation.getFrames().Count - 1);
                var transition     = editTransition ? workingAnimation.getTranstionForFrame(selectedFrame) : emptyTransition;

                using (new EditorGUI.DisabledScope(!editTransition))
                {
                    EditorGUILayout.PrefixLabel(TC.get("NextScene.Transition"), GUIStyle.none, titleStyle);
                    EditorGUI.BeginChangeCheck();
                    var transitionDuration = EditorGUILayout.LongField(TC.get("Animation.Duration"), transition.getTime());
                    if (EditorGUI.EndChangeCheck())
                    {
                        transition.setTime(transitionDuration);
                    }

                    EditorGUI.BeginChangeCheck();
                    var transitionType = EditorGUILayout.Popup(TC.get("Conditions.Type"), (int)transition.getType(), transitionTypeName);
                    if (EditorGUI.EndChangeCheck())
                    {
                        transition.setType((TransitionType)transitionType);
                    }
                }
            }

            var lastEditorRect = GUILayoutUtility.GetLastRect();


            // Ending buttons
            GUILayout.FlexibleSpace();
            using (new EditorGUILayout.HorizontalScope())
            {
                if (GUILayout.Button("OK"))
                {
                    // If it doesnt have an extension its because its an old animation
                    if (!Path.HasExtension(cutscenePath))
                    {
                        cutscenePath = cutscenePath + ".eaa.xml";
                    }

                    AnimationWriter.WriteAnimation(cutscenePath, workingAnimation);
                    AssetDatabase.Refresh(ImportAssetOptions.Default);
                    if (reference != null)
                    {
                        reference.OnDialogOk(cutscenePath, this);
                    }
                    this.Close();
                }
                if (GUILayout.Button(TC.get("GeneralText.Cancel")))
                {
                    if (reference != null)
                    {
                        reference.OnDialogCanceled();
                    }
                    this.Close();
                }
            }

            if (Event.current.type == EventType.Repaint)
            {
                var lastButtonRect = GUILayoutUtility.GetLastRect();
                var minheight      = lastEditorRect.y + lastEditorRect.height + lastEditorRect.height + 10;
                minSize = new Vector2(400, minheight);
            }
        }
Пример #16
0
 protected void CopySelectedAssset()
 {
     returnPath = AssetsController.AddSingleAsset(fileType.GetAssetCategory(), selectedAssetPath);
 }
Пример #17
0
        // this function was made to insert player in correct position in SwapPlayerModeTool
        // CAUTION!! dont check if has layer or if it is allowed, because where it is call that has been checked
        //			 dont call to setPlayerLayer() because it has been checked
        public void restorePlayer()
        {
            ElementContainer ec = new ElementContainer(null, sceneDataControl.getPlayerLayer(), AssetsController.getImage(this.playerImagePath));
            int layer           = insertInOrder(ec, true);

            reassignLayerAllReferencesDataControl(layer);
        }
Пример #18
0
 public void changeImagePlayerPath(string imagePath)
 {
     this.playerImagePath     = imagePath;
     this.imagePathHasChanged = true;
     if (allReferencesDataControl.Count == 0)
     {
         playerPositionInAllReferences = 0;
         reassignLayerAllReferencesDataControl(insertInOrder(new ElementContainer(null, 0, AssetsController.getImage(this.playerImagePath)), true));
     }
 }
Пример #19
0
        public override bool doTool()
        {
            bool done = false;

            AssetsController.addSingleAsset(assetsInformation[index].category, filename, destinyAssetName, true);
            // Dirty fix?
            string selectedAsset = destinyAssetName == null ? (new FileInfo(filename)).FullName : destinyAssetName;

            // If a file was selected
            if (selectedAsset != null)
            {
                // Take the index of the selected asset
                string[] assetFilenames = AssetsController.getAssetFilenames(assetsInformation[index].category,
                                                                             assetsInformation[index].filter);
                string[] assetPaths = AssetsController.getAssetsList(assetsInformation[index].category,
                                                                     assetsInformation[index].filter);
                int assetIndex = -1;
                for (int i = 0; i < assetFilenames.Length; i++)
                {
                    if (assetFilenames[i].Equals(selectedAsset))
                    {
                        assetIndex = i;
                    }
                }

                // check if the asset is "standright" or "standleft" in order to modify the attr assetNecessary
                // for the assetInformation
                if (assetsInformation[index].name.Equals("standright"))
                {
                    // if "standright" asset is necessary, set the "standleft" as not necessary
                    if (assetsInformation[index].assetNecessary)
                    {
                        for (int i = 0; i < assetsInformation.Length; i++)
                        {
                            if (assetsInformation[i].name.Equals("standleft"))
                            {
                                assetsInformation[i].assetNecessary = false;
                            }
                        }
                    }
                    //if is not art necessary and is 3rd person game, look for "standleft", if this asset is
                    // not necessary, set "standright as necessary"
                    else if (!Controller.getInstance().isPlayTransparent())
                    {
                        for (int i = 0; i < assetsInformation.Length; i++)
                        {
                            if (assetsInformation[i].name.Equals("standleft"))
                            {
                                assetsInformation[index].assetNecessary = true;
                                assetsInformation[i].assetNecessary     = false;
                            }
                        }
                    }
                }
                else if (assetsInformation[index].name.Equals("standleft"))
                {
                    // if "standleft" asset is necessary, set the "standright" as not necessary
                    if (assetsInformation[index].assetNecessary)
                    {
                        for (int i = 0; i < assetsInformation.Length; i++)
                        {
                            assetsInformation[i].assetNecessary = false;
                        }
                    } //if is not art necessary and is 3rd person game, look for "standright", if this asset is
                      // not necessary, set "standright as necessary"
                    else if (!Controller.getInstance().isPlayTransparent())
                    {
                        for (int i = 0; i < assetsInformation.Length; i++)
                        {
                            if (assetsInformation[i].name.Equals("standright"))
                            {
                                assetsInformation[index].assetNecessary = true;
                                assetsInformation[i].assetNecessary     = false;
                            }
                        }
                    }
                }
                //The empty animation is, in fact, a special asset. When this asset is in an animation, it is considered as animation asset.
                // For this reason,at this point, assetIndex is = -1. So, if animation is emptyAnimation, change the path in addAsset method
                bool   changeFilter = false;
                string specialPath  = AssetsController.CATEGORY_SPECIAL_ASSETS + "/" + "EmptyAnimation.eaa";
                if (filename.Contains("EmptyAnimation"))
                {
                    changeFilter = true;
                }

                resources.addAsset(assetsInformation[index].name, changeFilter ? specialPath : assetPaths[assetIndex]);
                done = true;
            }
            return(done);
        }
Пример #20
0
        protected void CopySelectedAssset()
        {
            string assetTypeDir;

            switch (fileType)
            {
            case FileType.SCENE_BACKGROUND:
                assetTypeDir = AssetsController.CATEGORY_BACKGROUND_FOLDER;
                break;

            case FileType.SCENE_FOREGROUND:
                assetTypeDir = AssetsController.CATEGORY_BACKGROUND_FOLDER;
                break;

            case FileType.SCENE_MUSIC:
            case FileType.EXIT_MUSIC:
            case FileType.CUTSCENE_MUSIC:
            case FileType.FRAME_MUSIC:
            case FileType.ITEM_DESCRIPTION_NAME_SOUND:
            case FileType.ITEM_DESCRIPTION_BRIEF_SOUND:
            case FileType.ITEM_DESCRIPTION_DETAILED_SOUND:
            case FileType.NPC_DESCRIPTION_NAME_SOUND:
            case FileType.NPC_DESCRIPTION_BRIEF_SOUND:
            case FileType.NPC_DESCRIPTION_DETAILED_SOUND:
            case FileType.PLAY_SOUND_EFFECT:
                assetTypeDir = AssetsController.CATEGORY_AUDIO_PATH;
                break;

            case FileType.EXIT_ICON:
                assetTypeDir = AssetsController.CATEGORY_CURSOR_PATH;
                break;

            case FileType.CUTSCENE_VIDEO:
                assetTypeDir = AssetsController.CATEGORY_VIDEO_PATH;
                break;

            case FileType.CUTSCENE_SLIDES:
            case FileType.CHARACTER_ANIM:
            case FileType.PLAY_ANIMATION_EFFECT:
                //TODO: copy all assets files (slides, music)
                assetTypeDir = AssetsController.CATEGORY_ANIMATION_FOLDER;
                break;

            case FileType.FRAME_IMAGE:
                assetTypeDir = AssetsController.CATEGORY_ANIMATION_FOLDER;
                break;

            case FileType.BOOK_IMAGE_PARAGRAPH:
            case FileType.ITEM_IMAGE:
            case FileType.ITEM_IMAGE_OVER:
            case FileType.SET_ITEM_IMAGE:
                assetTypeDir = AssetsController.CATEGORY_IMAGE_FOLDER;
                break;

            case FileType.ITEM_ICON:
                assetTypeDir = AssetsController.CATEGORY_ICON_FOLDER;
                break;

            case FileType.BOOK_ARROW_LEFT_NORMAL:
            case FileType.BOOK_ARROW_RIGHT_NORMAL:
            case FileType.BOOK_ARROW_LEFT_OVER:
            case FileType.BOOK_ARROW_RIGHT_OVER:
                assetTypeDir = AssetsController.CATEGORY_ARROW_BOOK_PATH;
                break;

            default:
                assetTypeDir = "";
                break;
            }

            string file = Controller.getInstance().getProjectFolder();

            DirectoryInfo path = new DirectoryInfo(DIR_PREFIX + "/" + assetTypeDir);

            if (!Directory.Exists(path.FullName))
            {
                Directory.CreateDirectory(path.FullName);
            }

            string nameOnly = Path.GetFileName(selectedAssetPath);

            if (selectedAssetPath != Path.Combine(path.FullName, nameOnly)) // Avoid to copy the same origin to same destination files
            {
                File.Copy(selectedAssetPath, Path.Combine(path.FullName, nameOnly), true);

                if (fileType == FileType.CUTSCENE_SLIDES || fileType == FileType.CHARACTER_ANIM || fileType == FileType.PLAY_ANIMATION_EFFECT)
                {
                    AssetsController.copyAllFiles(Path.GetDirectoryName(selectedAssetPath), path.FullName);
                }
                AssetDatabase.Refresh();
            }

            returnPath = assetTypeDir + "/" + nameOnly;
        }
Пример #21
0
        /**
         * Constructor.
         *
         * @param sceneDataControl
         *            Link to the parent scene controller
         * @param itemReferencesList
         *            List of item references
         */
        public ReferencesListDataControl(string playerImagePath, SceneDataControl sceneDataControl, List <ElementReference> itemReferencesList, List <ElementReference> atrezzoReferencesList, List <ElementReference> npcReferencesList)
        {
            this.playerImagePath               = playerImagePath;
            this.sceneDataControl              = sceneDataControl;
            this.itemReferencesList            = itemReferencesList;
            this.atrezzoReferencesList         = atrezzoReferencesList;
            this.npcReferencesList             = npcReferencesList;
            this.allReferencesDataControl      = new List <ElementContainer>();
            this.lastElementContainer          = null;
            this.playerPositionInAllReferences = NO_PLAYER;
            this.imagePathHasChanged           = false;
            // Check if one of references has layer -1: if it is true, it means that element references has no layer.
            // Create subcontrollers

            bool hasLayerV = hasLayer();

            foreach (ElementReference itemReference in itemReferencesList)
            {
                int counter = count(itemReference);
                ElementReferenceDataControl erdc = new ElementReferenceDataControl(sceneDataControl, itemReference, Controller.ITEM_REFERENCE, counter);
                insertInOrder(new ElementContainer(erdc, -1, null), hasLayerV);
            }

            foreach (ElementReference atrezzoReference in atrezzoReferencesList)
            {
                int counter = count(atrezzoReference);
                ElementReferenceDataControl erdc = new ElementReferenceDataControl(sceneDataControl, atrezzoReference, Controller.ATREZZO_REFERENCE, counter);
                insertInOrder(new ElementContainer(erdc, -1, null), hasLayerV);
            }

            foreach (ElementReference npcReference in npcReferencesList)
            {
                int counter = count(npcReference);
                ElementReferenceDataControl erdc = new ElementReferenceDataControl(sceneDataControl, npcReference, Controller.NPC_REFERENCE, counter);
                insertInOrder(new ElementContainer(erdc, -1, null), hasLayerV);
            }

            // insert player
            // by default, if player don´t have layer, we give it to him.
            if (playerImagePath != null && (!Controller.getInstance().isPlayTransparent()) && sceneDataControl.isForcedPlayerLayer())
            {
                int layer;
                if (sceneDataControl.getPlayerLayer() == Scene.PLAYER_WITHOUT_LAYER)
                {
                    layer = 0;
                }
                else
                {
                    layer = sceneDataControl.getPlayerLayer();
                }
                reassignLayerAllReferencesDataControl(insertInOrder(new ElementContainer(null, layer, AssetsController.getImage(this.playerImagePath)), true));
            }
        }
Пример #22
0
 public Sprite getImageFromPath(string uri)
 {
     return(AssetsController.getImage(uri));
 }