/// <summary> /// <para>Eng. Create Branch class. Manage one branch </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 CreateBranch(string _name, Rect _position) { Debug.Log("Created Scene Branch in : " + _position); VinoveBranch CreatedBranch = new VinoveBranch(_name, _position); _uids.Add(CreatedBranch.UID); _branchs.Add(CreatedBranch); GraphViewer.GraphViewer.UndoStackCreate(CreatedBranch.UID, CreatedBranch); }
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; } }
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); }
/// <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(); }
/// <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(); }