Ejemplo n.º 1
0
        /// <summary>
        /// <para>Eng. Create scene with copied scene. </para>
        /// <para>Kor. 씬 그래프를 복사해서 새로운 씬을 생성합니다. </para>
        /// </summary>
        /// <param name="_copiedScene"> <para> Eng. Origin copied graph </para>
        ///                           <para> Kor. 복사할 씬 그래프. </para> </param>
        public void PasteScene(VinoveScene _copiedScene, Rect _position)
        {
            VinoveScene CreatedScene = new VinoveScene(_copiedScene, _position);

            _uids.Add(CreatedScene.UID);
            _scenes.Add(CreatedScene);

            if (ErrorDetector.Instance.IsStringEmpty(StarterUID))
            {
                StarterUID = CreatedScene.UID;
            }

            for (int i = 0; i < _copiedScene.Scripts.Count; i++)
            {
                CreateScript(CreatedScene, _copiedScene.Scripts[i]);
            }

            foreach (VinoveScript _script in CreatedScene.Scripts)
            {
                string _instancedUID = UIDGenerator.Instance.Generate("SCR");
                if (_copiedScene.StarterUID == _script.UID)
                {
                    CreatedScene.StarterUID = _instancedUID;
                }

                if (ErrorDetector.Instance.IsStringHasData(_script.Next))
                {   // it has next link
                    VinoveScript _nextScript = CreatedScene.FindScriptWithUID(_script.Next);

                    if (!ErrorDetector.Instance.IsStringHasData(_script.Prev))
                    {   // it has prev link, already had new uid
                        _script.UID = _instancedUID;
                        _uids.Add(_instancedUID);
                    }

                    if (_copiedScene.StarterUID == _nextScript.UID)
                    {
                        _nextScript.UID         = UIDGenerator.Instance.Generate("SCR");
                        CreatedScene.StarterUID = _nextScript.UID;
                        _uids.Add(_nextScript.UID);
                    }
                    else
                    {
                        _nextScript.UID = UIDGenerator.Instance.Generate("SCR");
                        _uids.Add(_nextScript.UID);
                    }

                    _script.Next     = _nextScript.UID;
                    _nextScript.Prev = _script.UID;
                }
                else
                {     // non-next link
                    if (!ErrorDetector.Instance.IsStringHasData(_script.Prev))
                    { // it has prev link, already had new uid
                        _script.UID = _instancedUID;
                        _uids.Add(_instancedUID);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// <para>Eng. Create script class with Copy/Paste(Only for Scene Copy). Manage one dialogue </para>
        /// <para>Kor. 복사/붙여넣기로 스크립트 클래스를 생성합니다(씬 복사 전용). 한 개의 대사를 담당합니다. </para>
        /// </summary>
        /// <param name="_scene"> <para> Eng. Scene for add script</para>
        ///                           <para> Kor. 스크립트를 추가 대상인 씬입니다.</para> </param>
        /// <param name="_originScript"> <para> Eng. Origin script data </para>
        ///                           <para> Kor. 기존 스크립트 정보입니다.</para> </param>
        public void CreateScript(VinoveScene _scene, VinoveScript _originScript)
        {
            //Debug.Log("Created Script Graph in : " + _originScript.Position);
            VinoveScript CreatedScript = new VinoveScript(_originScript, _scene.UID, _originScript.Prev, _originScript.Next);

            //_uids.Add(CreatedScript.UID);
            _scene.Scripts.Add(CreatedScript);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// <para>Eng. Create script class with Copy/Paste. Manage one dialogue </para>
        /// <para>Kor. 복사/붙여넣기로 스크립트 클래스를 생성합니다. 한 개의 대사를 담당합니다. </para>
        /// </summary>
        /// <param name="_scene"> <para> Eng. Scene for add script</para>
        ///                           <para> Kor. 스크립트를 추가 대상인 씬입니다.</para> </param>
        /// <param name="_originScript"> <para> Eng. Origin script data </para>
        ///                           <para> Kor. 기존 스크립트 정보입니다.</para> </param>
        /// <param name="_position"> <para> Eng. Rect for Pos and Scale on graph </para>
        ///                           <para> Kor. 그래프상의 위치, 크기 용 Rect 입니다</para> </param>
        public void PasteScript(VinoveScene _scene, VinoveScript _originScript, Rect _position)
        {
            Debug.Log("Pasted Script Graph in : " + _position);
            VinoveScript CreatedScript = new VinoveScript(_originScript, _scene.UID, _position);

            _uids.Add(CreatedScript.UID);
            _scene.Scripts.Add(CreatedScript);

            if (ErrorDetector.Instance.IsStringEmpty(_scene.StarterUID))
            {
                _scene.StarterUID = CreatedScript.UID;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// <para>Eng. Create script class. Manage one dialogue </para>
        /// <para>Kor. 스크립트 클래스를 생성합니다. 한 개의 대사를 담당합니다. </para>
        /// </summary>
        /// <param name="_scene"> <para> Eng. Scene for add script</para>
        ///                           <para> Kor. 스크립트를 추가 대상인 씬입니다.</para> </param>
        /// <param name="_name"> <para> Eng. Name display on graph </para>
        ///                           <para> Kor. 그래프 상 표시될 이름입니다.</para> </param>
        /// <param name="_position"> <para> Eng. Rect for Pos and Scale on graph </para>
        ///                           <para> Kor. 그래프상의 위치, 크기 용 Rect 입니다</para> </param>
        public void CreateScript(VinoveScene _scene, string _name, Rect _position)
        {
            Debug.Log("Created Script Graph in : " + _position);
            VinoveScript CreatedScript = new VinoveScript(_name, _position, _scene.UID);

            _uids.Add(CreatedScript.UID);
            _scene.Scripts.Add(CreatedScript);

            if (ErrorDetector.Instance.IsStringEmpty(_scene.StarterUID))
            {
                _scene.StarterUID = CreatedScript.UID;
            }

            GraphViewer.GraphViewer.UndoStackCreate(CreatedScript.UID, CreatedScript);
        }
Ejemplo n.º 5
0
        /////////////////////////////
        /// Graph

#if UNITY_EDITOR
        /// <summary>
        /// <para>Eng. Create scene class. Manage one conversation </para>
        /// <para>Kor. 씬 클래스를 생성합니다. 한 개의 대화를 담당합니다. </para>
        /// </summary>
        /// <param name="_name"> <para> Eng. Want add link in this node </para>
        ///                           <para> Kor. 링크를 추가할 노드</para> </param>
        /// <param name="_position"> <para> Eng. Rect for Pos and Scale on graph </para>
        ///                           <para> Kor. 그래프상의 위치, 크기 용 Rect 입니다</para> </param>
        public void CreateScene(string _name, Rect _position)
        {
            Debug.Log("Created Scene Graph in : " + _position);
            VinoveScene CreatedScene = new VinoveScene(_name, _position);

            _uids.Add(CreatedScene.UID);
            _scenes.Add(CreatedScene);

            if (ErrorDetector.Instance.IsStringEmpty(StarterUID))
            {
                StarterUID = CreatedScene.UID;
            }

            GraphViewer.GraphViewer.UndoStackCreate(CreatedScene.UID, CreatedScene);
        }
Ejemplo n.º 6
0
        public void RestoreGraph(VinoveScript _targetScript)
        {
            if (ErrorDetector.Instance.IsStringHasData(_targetScript.Prev))
            {
                if (_targetScript.Prev.StartsWith("SCE"))
                {
                    VinoveScene _prevScene = FindSceneWithUID(_targetScript.Prev);
                    _prevScene.Next = _targetScript.UID;
                }
                else if (_targetScript.Prev.StartsWith("BRA"))
                {
                    VinoveBranch _prevBranch = FindBranchWithUID(_targetScript.Prev);
                }
                if (_targetScript.Prev.StartsWith("MRG"))
                {
                    VinoveMerge _prevMerge = FindMergeWithUID(_targetScript.Prev);
                    _prevMerge.Next = _targetScript.UID;
                }
            }

            if (ErrorDetector.Instance.IsStringHasData(_targetScript.Next))
            {
                if (_targetScript.Next.StartsWith("SCE"))
                {
                    VinoveScene _nextScene = FindSceneWithUID(_targetScript.Next);
                    _nextScene.Prev = _targetScript.UID;
                }
                else if (_targetScript.Next.StartsWith("BRA"))
                {
                    VinoveBranch _nextBranch = FindBranchWithUID(_targetScript.Next);
                    _nextBranch.Prev = _targetScript.UID;
                }
                if (_targetScript.Next.StartsWith("MRG"))
                {
                    VinoveMerge _nextMerge = FindMergeWithUID(_targetScript.Next);
                }
            }

            VinoveScene _parentScene = FindSceneWithUID(_targetScript.ParentSceneUID);

            _parentScene.Scripts.Add(_targetScript);
            _uids.Add(_targetScript.UID);

            if (ErrorDetector.Instance.IsStringEmpty(_parentScene.StarterUID))
            {
                _parentScene.StarterUID = _targetScript.UID;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// <para>Eng. Create copied Scene class. Manage one conversation </para>
        /// <para>Kor. 씬 클래스를 복사 생성합니다. 여러 개의 대사 집합을 가집니다. </para>
        /// </summary>
        /// <param name="_originScene"> <para> Eng. Copied origin Scene graph </para>
        ///                           <para> Kor. 복사 주체 씬 그래프입니다.</para> </param>
        /// <param name="_position"> <para> Eng. Rect for Pos and Scale on graph </para>
        ///                           <para> Kor. 그래프상의 위치, 크기 용 Rect 입니다</para> </param>
        public VinoveScene(VinoveScene _originScene, Rect _position)
        {
            _sceneName = _originScene.Name;
            _rectSize  = _position;
            _UID       = UIDGenerator.Instance.Generate("SCE");

            _translation = _originScene.Translation;
            _zoomFactor  = _originScene.ZoomFactor;

            BackgroundIllustKey = _originScene.BackgroundIllustKey;
            BackgroundMusic     = _originScene.BackgroundMusic;

            _scripts = new List <VinoveScript>();

            SyncLinkerPosition();
        }
Ejemplo n.º 8
0
        public void RestoreGraph(VinoveMerge _targetMerge)
        {
            foreach (string _mergePrevUID in _targetMerge.MergeUIDs)
            {
                if (ErrorDetector.Instance.IsStringHasData(_mergePrevUID))
                {
                    if (_mergePrevUID.StartsWith("SCE"))
                    {
                        VinoveScene _prevScene = FindSceneWithUID(_mergePrevUID);
                        _prevScene.Next = _targetMerge.UID;
                    }
                    else if (_mergePrevUID.StartsWith("BRA"))
                    {
                        VinoveBranch _prevBranch = FindBranchWithUID(_mergePrevUID);
                    }
                    if (_mergePrevUID.StartsWith("MRG"))
                    {
                        VinoveMerge _prevMerge = FindMergeWithUID(_mergePrevUID);
                        _prevMerge.Next = _targetMerge.UID;
                    }
                }
            }

            if (ErrorDetector.Instance.IsStringHasData(_targetMerge.Next))
            {
                if (_targetMerge.Next.StartsWith("SCE"))
                {
                    VinoveScene _nextScene = FindSceneWithUID(_targetMerge.Next);
                    _nextScene.Prev = _targetMerge.UID;
                }
                else if (_targetMerge.Next.StartsWith("BRA"))
                {
                    VinoveBranch _nextBranch = FindBranchWithUID(_targetMerge.Next);
                    _nextBranch.Prev = _targetMerge.UID;
                }
                if (_targetMerge.Next.StartsWith("MRG"))
                {
                    VinoveMerge _nextMerge = FindMergeWithUID(_targetMerge.Next);
                }
            }

            _merges.Add(_targetMerge);
            _uids.Add(_targetMerge.UID);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// <para>Eng. Change Merge count on VinoveMerge </para>
        /// <para>Kor. 그래프 분기점의 분기 개수를 변경합니다 </para>
        /// </summary>
        /// <param name="_changedCount"> <para> Eng. Wanna change count to this num </para>
        ///                           <para> Kor. 이 값으로 변경하겠습니다. </para> </param>
        /// <param name="_min"> <para> Eng. Minimum value of change target var </para>
        ///                           <para> Kor. 변경 대상 값의 최소값. </para> </param>
        /// <param name="_max"> <para> Eng. Maximum value of change target var </para>
        ///                           <para> Kor. 변경 대상의 최대값. </para> </param>
        public void ChangeMergeCount(Vinove _currentVinove, int _changedCount, int _min, int _max)
        {
            int _mergeCountTmp = _mergeCount;

            _mergeCount = _changedCount;

            if (_changedCount < _min || _changedCount > _max)
            {
                ErrorMessages.Instance.WrongInputRange(_min, _max);
            }
            else if (_mergeCountTmp == _changedCount)
            {   // if, same. no need to change
                return;
            }

            string[] _uidTmp  = new string[_mergeCountTmp];
            Rect[]   _rectTmp = new Rect[_mergeCountTmp];

            for (int i = 0; i < _mergeCountTmp; i++)
            {
                _uidTmp[i]  = _mergeGraphUID[i];
                _rectTmp[i] = _mergeGraphRect[i];
            }

            _mergeGraphUID  = new string[_changedCount];
            _mergeGraphRect = new Rect[_changedCount];

            if (_mergeCountTmp < _changedCount)
            {
                for (int i = 0; i < _mergeCountTmp; i++)
                {
                    _mergeGraphUID[i]  = _uidTmp[i];
                    _mergeGraphRect[i] = _rectTmp[i];
                }
            }
            else
            {
                int _repeatCount;
                for (_repeatCount = 0; _repeatCount < _changedCount; _repeatCount++)
                {
                    _mergeGraphUID[_repeatCount]  = _uidTmp[_repeatCount];
                    _mergeGraphRect[_repeatCount] = _rectTmp[_repeatCount];
                }

                for (; _repeatCount < _mergeCountTmp; _repeatCount++)
                {
                    if (_uidTmp[_repeatCount].StartsWith("MRG"))
                    {
                        VinoveMerge _nextMerge = _currentVinove.FindMergeWithUID(_uidTmp[_repeatCount]);
                        _nextMerge.Next = null;
                    }
                    else if (_uidTmp[_repeatCount].StartsWith("BRA"))
                    {
                        VinoveBranch _nextBranch = _currentVinove.FindBranchWithUID(_uidTmp[_repeatCount]);
                        _nextBranch.BranchsUIDs[_nextBranch.FindUIDLinkIndex(UID)] = null;
                    }
                    else if (_uidTmp[_repeatCount].StartsWith("SCE"))
                    {
                        VinoveScene _nextScene = _currentVinove.FindSceneWithUID(_uidTmp[_repeatCount]);
                        _nextScene.Next = null;
                    }
                }
            }

            SyncLinkerPosition();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// <para>Eng. Change branch count on VinoveBranch </para>
        /// <para>Kor. 그래프 분기점의 분기 개수를 변경합니다 </para>
        /// </summary>
        /// <param name="_changedCount"> <para> Eng. Wanna change count to this num </para>
        ///                           <para> Kor. 이 값으로 변경하겠습니다. </para> </param>
        /// <param name="_min"> <para> Eng. Minimum value of change target var </para>
        ///                           <para> Kor. 변경 대상 값의 최소값. </para> </param>
        /// <param name="_max"> <para> Eng. Maximum value of change target var </para>
        ///                           <para> Kor. 변경 대상의 최대값. </para> </param>
        public void ChangeBranchCount(Vinove _currentVinove, int _changedCount, int _min, int _max)
        {
            int _branchCountTmp = _branchCount;

            _branchCount = _changedCount;

            if (_changedCount < _min || _changedCount > _max)
            {
                ErrorMessages.Instance.WrongInputRange(_min, _max);
            }
            else if (_branchCountTmp == _changedCount)
            {   // if, same. no need to change
                return;
            }

            string[] _AlterTmp = new string[_branchCountTmp];
            string[] _uidTmp   = new string[_branchCountTmp];
            Rect[]   _rectTmp  = new Rect[_branchCountTmp];

            for (int i = 0; i < _branchCountTmp; i++)
            {   //back up link data before change
                _AlterTmp[i] = _branchAlternatives[i];
                _uidTmp[i]   = _branchGraphUID[i];
                _rectTmp[i]  = _branchGraphRect[i];
            }

            _branchAlternatives = new string[_changedCount];
            _branchGraphUID     = new string[_changedCount];
            _branchGraphRect    = new Rect[_changedCount];
            //re-delegate branch datas

            for (int i = 0; i < _changedCount; i++)
            {
                BranchsAlternatives[i] = "";    // init Alternatives
            }

            if (_branchCountTmp < _changedCount)
            {
                for (int i = 0; i < _branchCountTmp; i++)
                {
                    _branchAlternatives[i] = _AlterTmp[i];
                    _branchGraphUID[i]     = _uidTmp[i];
                    _branchGraphRect[i]    = _rectTmp[i];
                }
            }
            else
            {
                int _repeatCount = 0;
                for (_repeatCount = 0; _repeatCount < _changedCount; _repeatCount++)
                {
                    _branchAlternatives[_repeatCount] = _AlterTmp[_repeatCount];
                    _branchGraphUID[_repeatCount]     = _uidTmp[_repeatCount];
                    _branchGraphRect[_repeatCount]    = _rectTmp[_repeatCount];
                }

                for (; _repeatCount < _branchCountTmp; _repeatCount++)
                {
                    if (_uidTmp[_repeatCount].StartsWith("MRG"))
                    {
                        VinoveMerge _nextMerge = _currentVinove.FindMergeWithUID(_uidTmp[_repeatCount]);
                        _nextMerge.MergeUIDs[_nextMerge.FindUIDLinkIndex(UID)] = null;
                    }
                    else if (_uidTmp[_repeatCount].StartsWith("BRA"))
                    {
                        VinoveBranch _nextBranch = _currentVinove.FindBranchWithUID(_uidTmp[_repeatCount]);
                        _nextBranch.Prev = null;
                    }
                    else if (_uidTmp[_repeatCount].StartsWith("SCE"))
                    {
                        VinoveScene _nextScene = _currentVinove.FindSceneWithUID(_uidTmp[_repeatCount]);
                        _nextScene.Prev = null;
                    }
                }
            }

            SyncLinkerPosition();
        }