Ejemplo n.º 1
0
        public void NewGameInitialize()
        {
            _gameState = GameState.InGame;
            _uiState   = InGameInterfaceDisplayState.Dialogue;

            // ----------------------- Vinove - Starter Scene -----------------------

            if (ErrorDetector.Instance.IsStringHasData(_currentVinove.StarterUID))
            {
                // ----------------------- Scene -----------------------
                _currentScene = _currentVinove.FindSceneWithUID(_currentVinove.StarterUID);

                // ----------------------- Scene - Starter Script -----------------------
                if (ErrorDetector.Instance.IsStringHasData(_currentScene.StarterUID))
                {
                    _currentScript = _currentScene.FindScriptWithUID(_currentScene.StarterUID);
                }
            }

            _speakerLeftIllustration.GetComponent <SpeakerIllustrationPosition>().SetDeactivated();
            _speakerCenterIllustration.GetComponent <SpeakerIllustrationPosition>().SetDeactivated();
            _speakerRightIllustration.GetComponent <SpeakerIllustrationPosition>().SetDeactivated();

            SyncInterface();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// <para>Eng. Load game using script uid. </para>
        /// <para>Kor. 스크립트 UID 등의 정보로, 게임을 불러옵니다. </para>
        /// </summary>
        public void LoadGameByScript(VinoveGameSaveData _savedData)
        {
            _currentScene  = _currentVinove.FindSceneWithUID(_savedData._parentSceneUID);
            _currentScript = _currentScene.FindScriptWithUID(_savedData._scriptUID);

            // ----------------------- Scene - Background Img -----------------------
            Texture2D _sceneBackgroundIllust;

            if (_currentVinove.BackgroundIllustrations.GetTextureData(_currentScene.BackgroundIllustKey, out _sceneBackgroundIllust))
            {
                Rect _backgroundTexRect = new Rect(0, 0, _sceneBackgroundIllust.width, _sceneBackgroundIllust.height);
                _backgroundIllustration.sprite = Sprite.Create(_sceneBackgroundIllust, _backgroundTexRect, new Vector2(0.5f, 0.5f));
            }

            // ----------------------- Scene - Background Music -----------------------
            if (_currentScene.BackgroundMusic != null)
            {
                _sceneBGM.clip = _currentScene.BackgroundMusic;

                _sceneBGM.Play();
            }

            // ----------------------- Script - Speaker Illustrations & Color -----------------------

            Texture2D _speakerIllust;

            if (_currentVinove.SpeakerIllustrations.GetTextureData(_savedData._speakerIllustKey[0], out _speakerIllust))
            {
                SetSpeakerIllustImageFromTexture(_speakerLeftIllustration, _speakerIllust);

                Color _illustColor = _speakerLeftIllustration.color;
                _speakerLeftIllustration.color = new Color(_illustColor.r, _illustColor.g, _illustColor.b, _savedData._speakerIllustColorAlpha[0]);
                _speakerLeftIllustration.GetComponent <SpeakerIllustrationPosition>().IsActivated = _savedData._speakerIllustActivated[0];
                _speakerLeftIllustration.GetComponent <SpeakerIllustrationPosition>().ColorUncurrentSpeaker();
            }

            if (_currentVinove.SpeakerIllustrations.GetTextureData(_savedData._speakerIllustKey[1], out _speakerIllust))
            {
                SetSpeakerIllustImageFromTexture(_speakerCenterIllustration, _speakerIllust);

                Color _illustColor = _speakerCenterIllustration.color;
                _speakerCenterIllustration.color = new Color(_illustColor.r, _illustColor.g, _illustColor.b, _savedData._speakerIllustColorAlpha[1]);
                _speakerCenterIllustration.GetComponent <SpeakerIllustrationPosition>().IsActivated = _savedData._speakerIllustActivated[1];
                _speakerCenterIllustration.GetComponent <SpeakerIllustrationPosition>().ColorUncurrentSpeaker();
            }

            if (_currentVinove.SpeakerIllustrations.GetTextureData(_savedData._speakerIllustKey[2], out _speakerIllust))
            {
                SetSpeakerIllustImageFromTexture(_speakerRightIllustration, _speakerIllust);

                Color _illustColor = _speakerRightIllustration.color;
                _speakerRightIllustration.color = new Color(_illustColor.r, _illustColor.g, _illustColor.b, _savedData._speakerIllustColorAlpha[2]);
                _speakerRightIllustration.GetComponent <SpeakerIllustrationPosition>().IsActivated = _savedData._speakerIllustActivated[2];
                _speakerRightIllustration.GetComponent <SpeakerIllustrationPosition>().ColorUncurrentSpeaker();
            }

            // ----------------------- Script -----------------------
            SyncScript();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// <para>Eng. Push 'Move' into Undo Stack </para>
        /// <para>Kor. Undo 스택에 '이동' 스택을 넣습니다. </para>
        /// </summary>
        /// <param name="_targetUID">
        /// <para>Eng. Target Graph UID </para>
        /// <para>Kor. 대상 그래프의 UID 입니다. </para></param>
        /// <param name="_script">
        /// <para>Eng. Target Graph Data </para>
        /// <para>Kor. 대상 그래프 데이터입니다. </para></param>
        public static void UndoStackMove(string _targetUID, VinoveScript _script)
        {
            UndoRedoStackData _stackData = new UndoRedoStackData(UndoRedoWorkType.GraphMove, GraphType.Script, _targetUID);

            _stackData.SetGraphData(_script);

            AddUndoData(_stackData);
        }
Ejemplo n.º 4
0
        static void OpenScriptInspector(VinoveScript _openedScript)
        {
            ScriptInspector _scriptInspector = new ScriptInspector(currentVinove, _openedScript);

            Rect _activeRect = new Rect(e.mousePosition.x, e.mousePosition.y, 0, 0);

            PopupWindow.Show(_activeRect, _scriptInspector);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// <para>Eng. Load all save file in local save folder </para>
        /// <para>Kor. 세이브 폴더내에 저장된 파일을 게임으로 모두 불러옵니다. </para>
        /// </summary>
        void ReloadSaveFile(VinoveGameSaveData _saveData)
        {
            VinoveScript _script = InGameManager.GetInstance()._currentVinove.FindSceneWithUID(_saveData._parentSceneUID).FindScriptWithUID(_saveData._scriptUID);

            _pushedSavedButton.GetComponent <SavedButtonManager>().ChangeSaveData(_saveData);
            _pushedSavedButton.GetComponent <SavedButtonManager>().ChangeTexts(_saveData._savedDate, _script.ScriptConversation.Speaker, _script.ScriptConversation.Dialog);

            _pushedSavedButton = null;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// <para>Eng. Inspector for Script Graph rename</para>
        /// <para>Kor. 스크립트 그래프의 이름을 변경하는 인스펙터입니다. </para>
        /// </summary>
        /// <param name="_vinove"> <para> Eng. Parent vinove class of graph</para>
        ///                         <para> Kor. 해당 그래프를 지니고 있는 Vinove 클래스 입니다. </para> </param>
        /// <param name="_scene"> <para> Eng. parent scene class of Scrip</para>
        ///                         <para> Kor. 이름 변경 대상 스크립트를 지닌 씬 클래스 입니다. </para> </param>
        /// <param name="_uid"> <para> Eng. UID of rename target Graph</para>
        ///                         <para> Kor. 이름을 변경할 대상 그래프의 UID 입니다 </para> </param>
        public RenameInspector(Vinove _vinove, VinoveScene _scene, string _uid)
        {
            _currentVinove = _vinove;
            _sourceUID     = _uid;

            if (_sourceUID.StartsWith("SCR"))
            {
                _script = _scene.FindScriptWithUID(_uid);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// <para>Eng. Assign Vinove file on Canvas UI GameObject. </para>
        /// <para>Kor. 비노비 파일을 인게임 매니저 오브젝트에 등록합니다. </para>
        /// </summary>
        public void VinoveInitialize()
        {
#if UNITY_EDITOR
            string _archivePath = Application.dataPath + "/TemporaryArchive.vnvach";

            if (System.IO.File.Exists(_archivePath))
            {
                var loaded = Resources.Load <Vinove>("Gamedat");
                AssetPathArchive _archive = BinaryIOManager.GetInst().BinaryDeserialize <AssetPathArchive>(_archivePath);

                AssetDatabase.ImportAsset(_archive._path);
                var currentLoaded = AssetDatabase.LoadAssetAtPath <Vinove>(_archive._path);
                _currentVinove = currentLoaded as Vinove;
                // ----------------------- Vinove - Starter Scene -----------------------

                if (ErrorDetector.Instance.IsStringHasData(_archive._sceneUID))
                {
                    // ----------------------- Scene -----------------------
                    _currentScene = _currentVinove.FindSceneWithUID(_archive._sceneUID);

                    // ----------------------- Scene - Specific Script -----------------------

                    if (ErrorDetector.Instance.IsStringHasData(_archive._scriptUID))
                    {
                        _currentScript = _currentScene.FindScriptWithUID(_archive._scriptUID);
                    }
                    // ----------------------- Scene - Starter Script -----------------------
                    else if (ErrorDetector.Instance.IsStringHasData(_currentScene.StarterUID))
                    {
                        _currentScript = _currentScene.FindScriptWithUID(_currentScene.StarterUID);
                    }
                }
            }
#else
            if (_currentVinove == null)
            {
                _currentVinove = Resources.Load <Vinove>("Gamedat");

                // ----------------------- Vinove - Starter Scene -----------------------

                if (ErrorDetector.Instance.IsStringHasData(_currentVinove.StarterUID))
                {
                    // ----------------------- Scene -----------------------
                    _currentScene = _currentVinove.FindSceneWithUID(_currentVinove.StarterUID);

                    // ----------------------- Scene - Specific Script -----------------------

                    if (ErrorDetector.Instance.IsStringHasData(_currentScene.StarterUID))
                    {
                        _currentScript = _currentScene.FindScriptWithUID(_currentScene.StarterUID);
                    }
                }
            }
#endif
        }
Ejemplo n.º 8
0
        /// <summary>
        /// <para>Eng. Load all save file in local save folder </para>
        /// <para>Kor. 세이브 폴더내에 저장된 파일을 게임으로 모두 불러옵니다. </para>
        /// </summary>
        void ReloadSaveFile(string _path)
        {
            VinoveGameSaveData _saveData = BinaryIOManager.GetInst().BinaryDeserialize <VinoveGameSaveData>(_path);

            _saveDatas.Add(_saveData);

            VinoveScript _script = InGameManager.GetInstance()._currentVinove.FindSceneWithUID(_saveData._parentSceneUID).FindScriptWithUID(_saveData._scriptUID);

            GameObject _instantiatedButton = Instantiate(_savedFileButtonPrefab, _contentParent.transform);

            _instantiatedButton.GetComponent <SavedButtonManager>().ChangeSaveData(_saveData);
            _instantiatedButton.GetComponent <SavedButtonManager>().ChangeTexts(_saveData._savedDate, _script.ScriptConversation.Speaker, _script.ScriptConversation.Dialog);
            _savedFileButtons.Add(_instantiatedButton);
        }
Ejemplo n.º 9
0
        ///////////////////////////////
        /// Save & Load Sequence

        /// <summary>
        /// <para>Eng. Load all save file in local save folder </para>
        /// <para>Kor. 세이브 폴더내에 저장된 파일을 게임으로 모두 불러옵니다. </para>
        /// </summary>
        void ReloadSaveFiles()
        {
            DirectoryInfo info = new System.IO.DirectoryInfo(_saveFolderDir);

            FileInfo [] fileInfo = info.GetFiles();

            foreach (FileInfo file in fileInfo)
            {
                if (file.Name.EndsWith(".sav"))
                {
                    VinoveGameSaveData _saveData = BinaryIOManager.GetInst().BinaryDeserialize <VinoveGameSaveData>(file.FullName);
                    _saveDatas.Add(_saveData);

                    VinoveScript _script = InGameManager.GetInstance()._currentVinove.FindSceneWithUID(_saveData._parentSceneUID).FindScriptWithUID(_saveData._scriptUID);

                    GameObject _instantiatedButton = Instantiate(_savedFileButtonPrefab, _contentParent.transform);
                    _instantiatedButton.GetComponent <SavedButtonManager>().ChangeSaveData(_saveData);
                    _instantiatedButton.GetComponent <SavedButtonManager>().ChangeTexts(_saveData._savedDate, _script.ScriptConversation.Speaker, _script.ScriptConversation.Dialog);
                    _savedFileButtons.Add(_instantiatedButton);
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// <para>Eng. Requested game save. </para>
        /// <para>Kor. 저장 요청을 받았습니다. </para>
        /// </summary>
        public void RequestSaveSlot(VinoveScript _targetScript, SaveLoadSlotManagerState _calledBy, string[] _illustKey = null, float[] _illustColorAlpha = null, bool[] _illustActivated = null)
        {
            _state = _calledBy;

            switch (_state)
            {
            case SaveLoadSlotManagerState.OptionSave:
                _saveTargetScript = _targetScript;
                _saveTargetUID    = _targetScript.UID;
                _parentSceneUID   = _targetScript.ParentSceneUID;

                _speakerIllustKey        = _illustKey;
                _speakerIllustColorAlpha = _illustColorAlpha;
                _speakerIllustActivated  = _illustActivated;

                _addSaveFileButton.SetActive(true);

                EnableSlot();

                break;

            case SaveLoadSlotManagerState.NewGameSave:
                _saveTargetScript = _targetScript;
                _saveTargetUID    = _targetScript.UID;
                _parentSceneUID   = _targetScript.ParentSceneUID;

                _speakerIllustKey        = _illustKey;
                _speakerIllustColorAlpha = _illustColorAlpha;
                _speakerIllustActivated  = _illustActivated;

                _addSaveFileButton.SetActive(true);

                EnableSlot();
                break;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// <para>Eng. Script GraphViewer Event Proc Func </para>
        /// <para>Kor. Script GraphViewer의 이벤트를 담당하는 함수 </para>
        /// </summary>
        /// <param name="_vinove"> <para> Eng. Currently opened vinove file</para>
        ///                           <para> Kor. 현재 열린 비노비 파일 </para> </param>
        /// <param name="_openedScene"> <para> Eng. Currently opened scene</para>
        ///                           <para> Kor. 현재 뷰어로 열린 씬</para> </param>
        /// <param name="_canvasMousePos"> <para> Eng. Mouse pos in Canvas</para>
        ///                           <para> Kor. 캔버스 내에서의 마우스 위치</para> </param>
        static void ScriptGraphEvents(Vinove _vinove, VinoveScene _openedScene, Vector2 _canvasMousePos)
        {
            if (IsMouseOnMinimap())
            {
            }
            else
            {
                if (e.type == EventType.Repaint)
                {
                    needRepaint = false;
                }

                if (e.type == EventType.MouseUp)
                {
                    graphTranslating = false;
                    hoverScript      = null;
                }

                if (e.type == EventType.ScrollWheel)
                {   // Zoom
                    if (canvasRect.Contains(e.mousePosition))
                    {
                        float zoomCtrl  = e.control ? 0.1f : 0.2f;
                        float zoomValue = e.delta.y > 0 ? -zoomCtrl : zoomCtrl;

                        ZoomWithFocus(e.mousePosition, zoomValue);
                        e.Use();
                    }
                }

                if (((e.alt && e.button == 0 && e.type == EventType.MouseDrag && e.isMouse)) ||
                    (e.button == 2 && e.type == EventType.MouseDrag && canvasRect.Contains(e.mousePosition)))
                {   //translation canvas
                    _openedScene.Translation += e.delta;

                    e.Use();
                }

                if (e.type == EventType.MouseDown && e.button == 1 && canvasRect.Contains(e.mousePosition))
                {   // Open node popupMenu
                    GenericMenu popupMenu = new GenericMenu();

                    VinoveScript overScript = _openedScene.IsContainWholeGraph(e.mousePosition);
                    if (overScript == null)
                    {   // if, right click not on scene node
                        popupMenu.AddItem(new GUIContent("Add Script"), false, () =>
                        {
                            currentVinove.CreateScript(_openedScene, "New Script", new Rect(_canvasMousePos.x, _canvasMousePos.y, Constants.HORIZONTAL_GRAPH_SIZE_X, Constants.HORIZONTAL_GRAPH_SIZE_Y));
                            Debug.Log("popupMenu_AddScript Test");
                        });
                        popupMenu.AddSeparator("");

                        if (_copiedScript == null)
                        {
                            popupMenu.AddDisabledItem(new GUIContent("Paste Script"));
                        }
                        else
                        {
                            popupMenu.AddItem(new GUIContent("Paste Script"), false, () =>
                            {
                                currentVinove.PasteScript(currentScene, _copiedScript, new Rect(_canvasMousePos.x, _canvasMousePos.y, Constants.HORIZONTAL_GRAPH_SIZE_X, Constants.HORIZONTAL_GRAPH_SIZE_Y));
                                _copiedScript = null;
                            });
                        }
                        popupMenu.AddSeparator("");
                    }
                    else
                    {   // on graph
                        popupMenu.AddItem(new GUIContent("Open Script"), false, () =>
                        {
                            OpenScriptInspector(overScript);
                            Debug.Log("popupMenu_OpenScript Test : " + overScript.UID);
                        });

                        popupMenu.AddItem(new GUIContent("Copy Script"), false, () =>
                        {
                            _copiedScript = overScript;
                        });

                        popupMenu.AddItem(new GUIContent("Delete Script"), false, () =>
                        {
                            GraphDeleteSequence(overScript.UID, true);
                            Debug.Log("popupMenu_DeleteScript Test");
                        });

                        popupMenu.AddSeparator("");

                        popupMenu.AddItem(new GUIContent("Select Starter"), false, () =>
                        {
                            currentScene.StarterUID = overScript.UID;
                        });

                        popupMenu.AddSeparator("");

                        popupMenu.AddItem(new GUIContent("Rename"), false, () =>
                        {
                            OpenRenameInspector(overScript.ParentSceneUID, overScript.UID);
                        });

                        popupMenu.AddItem(new GUIContent("Run"), false, () =>
                        {
                            ToolbarFuncSave();

                            AssetPathArchive _archive = new AssetPathArchive(currentVinovePath, overScript.ParentSceneUID, overScript.UID);
                            string _archivePath       = "Assets/TemporaryArchive.vnvach";

                            BinaryIOManager.GetInst().BinarySerialize <AssetPathArchive>(_archive, _archivePath);

                            EditorApplication.isPlaying = true;
                        });
                    }

                    popupMenu.ShowAsContext();
                }

                if (e.type == EventType.MouseDrag && e.button == 0 && canvasRect.Contains(e.mousePosition))
                {   // Graph Translating
                    VinoveScript overScript = currentScene.IsContainWholeGraph(e.mousePosition);

                    if (hoverScript != null)
                    {
                        graphTranslating = true;

                        hoverScript.MoveScriptGraph((e.delta / currentScene.ZoomFactor));
                        needRepaint = true;
                    }

                    e.Use();
                }

                if (e.isMouse && e.type == EventType.MouseDown && e.clickCount == 2)
                {   // Double clicked
                    graphTranslating = false;

                    VinoveScript overScript = currentScene.IsContainWholeGraph(e.mousePosition);

                    if (overScript != null)
                    {
                        OpenScriptInspector(overScript);
                    }
                    e.Use();
                }

                if (e.type == EventType.MouseDown && e.button == 0)
                {
                    VinoveScript _scriptTmp = currentScene.IsContainWholeGraph(e.mousePosition);

                    if (_scriptTmp == null)
                    {
                        linkerControllActivated = false;
                    }
                    else if (graphTranslating == false)
                    {
                        hoverScript = _scriptTmp;
                    }
                }
            }
        }
Ejemplo n.º 12
0
 public void SetGraphData(VinoveScript _script)
 {
     _targetScript = _script;
 }