public void Clear() { _parentAnimPlayQueue = null; //_tNextPlayStart = 0.0f; _tBlend = 0.0f; _tLive = 0.0f; _isNextUnitPlayed = false; _isNextUnitFrameReset = false; _requestType = REQUEST_TYPE.New; _nextPlayUnit = null; _prevWaitingPlayUnit = null; _prevPlayUnits.Clear(); _requestWeight = 1.0f; _nextUnitWeight = 1.0f; _prevUnitWeight = 1.0f; _tActiveStart = 0.0f; _tActiveEnd = 0.0f; _tActiveMiddle = 0.0f; _status = STATUS.Ready; _isNextPlayUnitIsInPrevUnit = false; }
public void PlayQueuedAt(apAnimPlayUnit nextPlayUnit, apAnimPlayUnit prevLastPlayUnit, int frame, float tBlend) { //Debug.LogError(">> AnimRequest <Queued> : " + nextPlayUnit._linkedAnimClip._name + " >> 대기"); //_tNextPlayStart = -1;//Queued 타입은 플레이 시간을 받지 않는다. _tBlend = tBlend; _tLive = 0.0f; _isNextUnitPlayed = false; _isNextUnitFrameReset = false; _requestType = REQUEST_TYPE.Queued; _nextPlayUnit = nextPlayUnit; _nextPlayUnit.SetOwnerRequest_Next(this); _prevWaitingPlayUnit = prevLastPlayUnit; _requestWeight = 0.0f; _nextUnitWeight = 1.0f; _prevUnitWeight = 1.0f; _tActiveStart = -1.0f; _tActiveEnd = -1.0f; //<<알 수 없다. _tActiveMiddle = -1.0f; _status = STATUS.Ready; //<<일단 대기 _isNextPlayUnitIsInPrevUnit = false; _nextUnitWeight_Overlap = 1.0f; //추가 1.15 사용자가 지정한 시작 프레임 > On _isResetPlayAtStartFrame = false; _frameToStart = frame; }
public void Clear() { _parentAnimPlayQueue = null; //_tNextPlayStart = 0.0f; _tBlend = 0.0f; _tLive = 0.0f; _isNextUnitPlayed = false; _isNextUnitFrameReset = false; _requestType = REQUEST_TYPE.New; _nextPlayUnit = null; _prevWaitingPlayUnit = null; //_prevPlayUnits.Clear(); _prevPlayUnitKeys.Clear(); _prevPlayUnitWeight.Clear(); _requestWeight = 1.0f; _nextUnitWeight = 1.0f; _prevUnitWeight = 1.0f; _tActiveStart = 0.0f; _tActiveEnd = 0.0f; _tActiveMiddle = 0.0f; _status = STATUS.Ready; _isNextPlayUnitIsInPrevUnit = false; //추가 1.15 사용자가 지정한 시작 프레임을 쓸 것인지 여부 (True면 StartFrame으로 강제됨) _isResetPlayAtStartFrame = true; _frameToStart = -1; ReleaseChainedRequest(); }
private IEnumerator Crt_RequestEditor() { yield return(new WaitForEndOfFrame()); Selection.activeObject = null; yield return(new WaitForEndOfFrame()); if (_requestPortrait != null) { try { apEditor anyPortraitEditor = apEditor.ShowWindow(); if (_requestType == REQUEST_TYPE.OpenAndSet) { anyPortraitEditor.SetPortraitByInspector(_requestPortrait, false); } else if (_requestType == REQUEST_TYPE.QuickBake) { anyPortraitEditor.SetPortraitByInspector(_requestPortrait, true); Selection.activeObject = _requestPortrait.gameObject; } } catch (Exception ex) { Debug.LogError("Open Editor Error : " + ex); } } _requestType = REQUEST_TYPE.None; _requestPortrait = null; }
private void ExecuteCoroutine() { if (_coroutine == null) { _requestType = REQUEST_TYPE.None; _requestPortrait = null; //Debug.Log("ExecuteCoroutine => End"); EditorApplication.update -= ExecuteCoroutine; return; } //Debug.Log("Update Coroutine"); bool isResult = _coroutine.MoveNext(); if (!isResult) { _coroutine = null; _requestType = REQUEST_TYPE.None; _requestPortrait = null; //Debug.Log("ExecuteCoroutine => End"); EditorApplication.update -= ExecuteCoroutine; return; } }
public void PlayNew(apAnimPlayUnit nextPlayUnit, float tBlend) { //Debug.LogError(">> AnimRequest <New> : " + nextPlayUnit._linkedAnimClip._name + " >> 바로 시작한다"); //_tNextPlayStart = tNextPlay;//<<이게 필요한가? _tBlend = tBlend; _tLive = 0.0f; _isNextUnitPlayed = false; _isNextUnitFrameReset = false; _requestType = REQUEST_TYPE.New; _nextPlayUnit = nextPlayUnit; _nextPlayUnit.SetOwnerRequest_Next(this); _prevWaitingPlayUnit = null; _requestWeight = 0.0f; _nextUnitWeight = 1.0f; _prevUnitWeight = 1.0f; _tActiveStart = 0.0f; _tActiveEnd = _tBlend; _tActiveMiddle = _tBlend * 0.5f; _status = STATUS.Active; //<<바로 시작 _isNextPlayUnitIsInPrevUnit = false; //이전 코드 //for (int i = 0; i < _prevPlayUnits.Count; i++) //{ // if (nextPlayUnit == _prevPlayUnits[i] // && _prevPlayUnits[i].UnitWeight > 0.05f) // { // _isNextPlayUnitIsInPrevUnit = true; // break; // } //} _isNextPlayUnitIsInPrevUnit = _parentAnimPlayQueue.IsAlreadyAnimUnitPlayed(_nextPlayUnit); _nextUnitWeight_Overlap = 1.0f; if (_isNextPlayUnitIsInPrevUnit) { _nextUnitWeight_Overlap = _nextPlayUnit.UnitWeight; if (!_nextPlayUnit.IsLoop) { _nextPlayUnit.ResetPlay(); } } else { _nextPlayUnit.ResetPlay(); } }
private bool CheckRateLimit(REQUEST_TYPE type) { long t = _lastRequestTime[type]; long now = DateTime.Now.Millisecond; _lastRequestTime[type] = now; return(t == 0 || _authenticated && now - t < ConfigurationManager.Settings.TIMEDIFFAUTH || !_authenticated && now - t < ConfigurationManager.Settings.TIMEDIFFNOAUTH); }
public void PlayQueued(apAnimPlayUnit nextPlayUnit, apAnimPlayUnit prevLastPlayUnit, float tBlend) { //Debug.LogError(">> AnimRequest <Queued> : " + nextPlayUnit._linkedAnimClip._name + " >> 대기"); //_tNextPlayStart = -1;//Queued 타입은 플레이 시간을 받지 않는다. _tBlend = tBlend; _tLive = 0.0f; _isNextUnitPlayed = false; _isNextUnitFrameReset = false; _requestType = REQUEST_TYPE.Queued; _nextPlayUnit = nextPlayUnit; _nextPlayUnit.SetOwnerRequest_Next(this); _prevWaitingPlayUnit = prevLastPlayUnit; _requestWeight = 0.0f; _nextUnitWeight = 1.0f; _prevUnitWeight = 1.0f; _tActiveStart = -1.0f; _tActiveEnd = -1.0f; //<<알 수 없다. _tActiveMiddle = -1.0f; _status = STATUS.Ready; //<<일단 대기 _isNextPlayUnitIsInPrevUnit = false; //이전코드 //for (int i = 0; i < _prevPlayUnits.Count; i++) //{ // if (nextPlayUnit == _prevPlayUnits[i] // && _prevPlayUnits[i].UnitWeight > 0.05f) // { // _isNextPlayUnitIsInPrevUnit = true; // break; // } //} _nextUnitWeight_Overlap = 1.0f; //이걸 플레이하는 시점에서 지정 //_isNextPlayUnitIsInPrevUnit = _parentAnimPlayQueue.IsAlreadyAnimUnitPlayed(_nextPlayUnit); //_nextUnitWeight_Overlap = 1.0f; //if (_isNextPlayUnitIsInPrevUnit) //{ // _nextUnitWeight_Overlap = _nextPlayUnit.UnitWeight; //} }
public static RESULT Check(PBConnect_buyShopItem.SHOP_TYPE shopId, REQUEST_TYPE requestType) { if (requestType == REQUEST_TYPE.REFRESH) { Assert.assert(refreshCostType >= 0); if (!Model_Helper.HasEnoughResource(refreshCostType, refreshCostCount)) { return(RESULT.LACK_RESOURCE); } } return(RESULT.OK); }
private void RequestDelayedOpenEditor(apPortrait portrait, REQUEST_TYPE requestType) { if (_coroutine != null) { return; } _requestPortrait = portrait; _requestType = requestType; _coroutine = Crt_RequestEditor(); EditorApplication.update -= ExecuteCoroutine; EditorApplication.update += ExecuteCoroutine; }
public void PlayNew(apAnimPlayUnit nextPlayUnit, float tBlend) { _tBlend = tBlend; _tLive = 0.0f; _isNextUnitPlayed = false; _isNextUnitFrameReset = false; _requestType = REQUEST_TYPE.New; _nextPlayUnit = nextPlayUnit; _nextPlayUnit.SetOwnerRequest_Next(this); _prevWaitingPlayUnit = null; _requestWeight = 0.0f; _nextUnitWeight = 1.0f; _prevUnitWeight = 1.0f; _tActiveStart = 0.0f; _tActiveEnd = _tBlend; _tActiveMiddle = _tBlend * 0.5f; _status = STATUS.Active; //<<바로 시작 _isNextPlayUnitIsInPrevUnit = false; _isNextPlayUnitIsInPrevUnit = _parentAnimPlayQueue.IsAlreadyAnimUnitPlayed(_nextPlayUnit); _nextUnitWeight_Overlap = 1.0f; //추가 1.15 사용자가 지정한 시작 프레임 > Off _isResetPlayAtStartFrame = true; _frameToStart = -1; if (_isNextPlayUnitIsInPrevUnit) { _nextUnitWeight_Overlap = _nextPlayUnit.UnitWeight; if (!_nextPlayUnit.IsLoop) { _nextPlayUnit.ResetPlay(); } } else { _nextPlayUnit.ResetPlay(); } }
public void PlayNew(apAnimPlayUnit nextPlayUnit, float tBlend) { //_tNextPlayStart = tNextPlay;//<<이게 필요한가? _tBlend = tBlend; _tLive = 0.0f; _isNextUnitPlayed = false; _isNextUnitFrameReset = false; _requestType = REQUEST_TYPE.New; _nextPlayUnit = nextPlayUnit; _nextPlayUnit._ownerRequest = this; _prevWaitingPlayUnit = null; _requestWeight = 0.0f; _nextUnitWeight = 1.0f; _prevUnitWeight = 1.0f; _tActiveStart = 0.0f; _tActiveEnd = _tBlend; _tActiveMiddle = _tBlend * 0.5f; _status = STATUS.Active; //<<바로 시작 _isNextPlayUnitIsInPrevUnit = false; for (int i = 0; i < _prevPlayUnits.Count; i++) { if (nextPlayUnit == _prevPlayUnits[i]) { _isNextPlayUnitIsInPrevUnit = true; break; } } _nextUnitWeight_Overlap = 1.0f; if (_isNextPlayUnitIsInPrevUnit) { _nextUnitWeight_Overlap = _nextPlayUnit.UnitWeight; } }
public void PlayQueued(apAnimPlayUnit nextPlayUnit, apAnimPlayUnit prevLastPlayUnit, float tBlend) { //_tNextPlayStart = -1;//Queued 타입은 플레이 시간을 받지 않는다. _tBlend = tBlend; _tLive = 0.0f; _isNextUnitPlayed = false; _isNextUnitFrameReset = false; _requestType = REQUEST_TYPE.Queued; _nextPlayUnit = nextPlayUnit; _nextPlayUnit._ownerRequest = this; _prevWaitingPlayUnit = prevLastPlayUnit; _requestWeight = 0.0f; _nextUnitWeight = 1.0f; _prevUnitWeight = 1.0f; _tActiveStart = -1.0f; _tActiveEnd = -1.0f; //<<알 수 없다. _tActiveMiddle = -1.0f; _status = STATUS.Ready; //<<일단 대기 _isNextPlayUnitIsInPrevUnit = false; for (int i = 0; i < _prevPlayUnits.Count; i++) { if (nextPlayUnit == _prevPlayUnits[i]) { _isNextPlayUnitIsInPrevUnit = true; break; } } _nextUnitWeight_Overlap = 1.0f; if (_isNextPlayUnitIsInPrevUnit) { _nextUnitWeight_Overlap = _nextPlayUnit.UnitWeight; } }
private string CallOpenSkyAPI(string url, ParameterList queryParams) { REQUEST_TYPE requestType = _authenticated ? REQUEST_TYPE.AUTH : REQUEST_TYPE.NOT_AUTH; if (!CheckRateLimit(requestType)) { return(null); } string json; Uri uri = new Uri(url); try { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; WebClient client = new WebClient { Encoding = Encoding.UTF8, Headers = { [HttpRequestHeader.ContentType] = "application/json" }, Proxy = null }; queryParams.ForEach(dic => client.QueryString.Add(dic.Key, dic.Value)); json = client.DownloadString(uri); } catch (Exception ex) { if (ex.Message.Contains("404")) { return(null); } throw new Exception($"{ex.Message}"); } return(json); }
public static RESULT GetShop(PBConnect_buyShopItem.SHOP_TYPE shopId, PBConnect_getShop.DelegateConnectCallback callback) { REQUEST_TYPE requestType = REQUEST_TYPE.GET; RESULT r = Check(shopId, requestType); if (r != RESULT.OK) { return(r); } GetShopRequest request = new GetShopRequest(); request.api = (new Model_ApiRequest()).api; request.shopId = (int)shopId; request.refresh = (int)requestType; (new PBConnect_getShop()).Send(request, callback); return(r); }
public void Stop(float tBlend) { //_tNextPlayStart = -1; _tBlend = tBlend; _tLive = 0.0f; _isNextUnitPlayed = false; _isNextUnitFrameReset = false; _requestType = REQUEST_TYPE.Stop; _nextPlayUnit = null; _prevWaitingPlayUnit = null; _requestWeight = 0.0f; _nextUnitWeight = 1.0f; _prevUnitWeight = 1.0f; _tActiveStart = 0.0f; _tActiveEnd = _tBlend; _tActiveMiddle = _tBlend * 0.5f; _status = STATUS.Active; //<<바로 시작 _isNextPlayUnitIsInPrevUnit = false; }
/// <summary> /// Constructor /// </summary> /// <param name="type"> The Type of the Request </param> public SongRequestEvent(REQUEST_TYPE type) { Type = type; }
// Init //----------------------------------------------- public apOptVertexRequest(REQUEST_TYPE requestType) { _requestType = requestType; Clear(); }
//http://dev-api.playz.virtual-gate.co.kr/member/100059/fcm/token IEnumerator SendToken(REQUEST_TYPE _TYPE, int member_no) { string token = FindObjectOfType <FirebaseMSGSet>().userToken; if (string.IsNullOrEmpty(token)) { Debugging.instance.DebugLog($"::: IsNullOrEmpty(FCM_token)"); yield return(null); } string adress = $"{host}/member/{member_no}/fcm/token?t={DateTime.Now.Millisecond}"; Debugging.instance.DebugLog("::: adress " + adress); Debugging.instance.DebugLog("::: access_token : " + loginAuth.token.access_token); Debugging.instance.DebugLog($"::: FCM_token : {token}"); UnityWebRequest www = new UnityWebRequest(); if (_TYPE == REQUEST_TYPE.Post) { WWWForm form = new WWWForm(); form.AddField("token", token); www = UnityWebRequest.Post(adress, form); } else if (_TYPE == REQUEST_TYPE.Delete) { www = UnityWebRequest.Delete(adress); var sendToken = new SendToken(); sendToken.token = token; var jsonstring = JsonConvert.SerializeObject(sendToken); if (!string.IsNullOrEmpty(jsonstring)) { byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes(jsonstring); www.uploadHandler = (UploadHandler) new UploadHandlerRaw(jsonToSend); www.SetRequestHeader("Content-Type", "Application/json"); } www.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer(); } www.SetRequestHeader("Authorization", $"{loginAuth.token.token_type} {loginAuth.token.access_token}"); //Send the request then wait here until it returns yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); yield return(null); } // Show results as text //Debug.Log(www.downloadHandler.text); // Or retrieve results as binary data Debugging.instance.DebugLog("::: downloadHandler " + www.downloadHandler.text); byte[] results = www.downloadHandler.data; ////string str = Encoding.Default.GetString(results); //Debug.Log($"dataStr {str}"); //var JsonObject = ParsingJson2TeamInfoList(str); //ActiveRequestEvent(JsonObject); // using (FileStream file = new FileStream(Application.dataPath + "\\urls33333333333333.txt", FileMode.Create, FileAccess.ReadWrite, FileShare.Read)) // 지정된 경로에 파일을 생성 // { // // 생성된 파일에 바이트배열로 저장한 컨텐츠 파일을 씀 // file.Write(results, 0, results.Length); // Debug.LogError("!!! : " + results); // } yield return(null); }
// Init //------------------------------------------------------------------------ public void Init(apEditor editor, object loadKey, apBone targetBone, apMeshGroup targetMeshGroup, REQUEST_TYPE requestType, FUNC_SELECT_LINKED_BONE funcResult) { _editor = editor; _loadKey = loadKey; _funcResult = funcResult; _targetBone = targetBone; _targetMeshGroup = targetMeshGroup; _requestType = requestType; _selectedBoneUnit = null; _boneUnits.Clear(); _boneUnits_Root.Clear(); List <apBone> exclusiveBones = new List <apBone>(); //None 유닛 선택 //Parent에서만 가능 //추가 : IKController에서도 가능 if (_requestType == REQUEST_TYPE.ChangeParent || _requestType == REQUEST_TYPE.SelectIKLookAtControllerEffector || _requestType == REQUEST_TYPE.SelectIKLookAtControllerStartBone || _requestType == REQUEST_TYPE.SelectIKPositionControllerEffector || _requestType == REQUEST_TYPE.Mirror) { BoneUnit nullUnit = new BoneUnit(null, true, false, null, 0); _boneUnits.Add(nullUnit); _boneUnits_Root.Add(nullUnit); } //기존 Rootqnxj 순회하는 방식으로 리스트를 만들되, //"제외"되는 것들을 음영처리하자 //별도의 Unit 필요 //모두 None Unit이 있다. switch (_requestType) { case REQUEST_TYPE.AttachChild: //Parent 중 하나를 Child로 둬선 안된다. (Loop 발생) case REQUEST_TYPE.ChangeParent: { //전체 Bone 중에서 //- 자기 자신 제외 //- Parent 제외 exclusiveBones.Add(_targetBone); if (_targetBone._parentBone != null) { exclusiveBones.Add(_targetBone._parentBone); if (_requestType == REQUEST_TYPE.AttachChild) { //재귀적인 Parent 제외 AddExclusiveBoneRecursive(exclusiveBones, _targetBone._parentBone, false); } } for (int iChild = 0; iChild < _targetBone._childBones.Count; iChild++) { apBone childBone = _targetBone._childBones[iChild]; if (childBone != null) { exclusiveBones.Add(childBone); } if (_requestType == REQUEST_TYPE.ChangeParent) { //재귀적인 Child 제외 AddExclusiveBoneRecursive(exclusiveBones, childBone, true); } } //BoneUnit을 넣자 for (int i = 0; i < _targetMeshGroup._boneList_Root.Count; i++) { AddBoneUnitRecursive(_targetMeshGroup._boneList_Root[i], exclusiveBones, _targetBone, null); } } break; case REQUEST_TYPE.SelectIKTarget: { //<재귀적인 Child 중에서> //-자기 자신 제외 exclusiveBones.Add(_targetBone); for (int iChild = 0; iChild < _targetBone._childBones.Count; iChild++) { apBone childBone = _targetBone._childBones[iChild]; if (childBone != null) { AddBoneUnitRecursive(childBone, exclusiveBones, _targetBone, null); } } } break; case REQUEST_TYPE.SelectIKLookAtControllerEffector: case REQUEST_TYPE.SelectIKPositionControllerEffector: { //IK Controller의 Effector를 결정할때 //-자기 자신 제외 //-자신의 IK Header가 있다면, IK Header의 모든 Child 제외 (무한 움직임을 보일 것이므로) //-자기 바로 위의 Parent 제외 //-자신의 모든 Child 제외 (chain 상관없이) exclusiveBones.Add(_targetBone); if (_targetBone._parentBone != null) { exclusiveBones.Add(_targetBone._parentBone); } if (_targetBone._IKHeaderBone != null) { //IKHeader로부터 모든 Chained은 삭제 exclusiveBones.Add(_targetBone._IKHeaderBone); List <apBone> chainedChildBonesFromIKHeader = _targetBone._IKHeaderBone.GetAllChildBones(); if (chainedChildBonesFromIKHeader != null) { for (int i = 0; i < chainedChildBonesFromIKHeader.Count; i++) { exclusiveBones.Add(chainedChildBonesFromIKHeader[i]); } } } List <apBone> childBones = _targetBone.GetAllChildBones(); if (childBones != null) { for (int i = 0; i < childBones.Count; i++) { if (!exclusiveBones.Contains(childBones[i])) { exclusiveBones.Add(childBones[i]); } } } //그외 모든 본을 추가한다. //BoneUnit을 넣자 for (int i = 0; i < _targetMeshGroup._boneList_Root.Count; i++) { AddBoneUnitRecursive(_targetMeshGroup._boneList_Root[i], exclusiveBones, _targetBone, null); } } break; case REQUEST_TYPE.SelectIKLookAtControllerStartBone: { //IK LookAt Controller의 EndBone을 결정할 때 //-자기 자신을 제외한 Chained의 모든 자식 본들만 선택가능 //List<apBone> childChainedBones = _targetBone.GetAllChainedChildBones(); //if(childChainedBones.Contains(_targetBone)) //{ // childChainedBones.Remove(_targetBone); //} //for (int iChild = 0; iChild < _targetBone._childBones.Count; iChild++) //{ // apBone childBone = _targetBone._childBones[iChild]; // if (childBone != null) // { // AddBoneUnitRecursive(childBone, exclusiveBones, childChainedBones, _targetBone, null); // } //} //수정 : StartBone을 결정한다. //-자기 자신을 제외한 Chained의 모든 부모 본들만 선택 가능 List <apBone> parentChainedBones = _targetBone.GetAllChainedParentBones(); if (parentChainedBones != null) { if (parentChainedBones.Contains(_targetBone)) { parentChainedBones.Remove(_targetBone); } //가장 첫 루트 본에서 BoneUnit을 만들자 apBone parentRootBone = parentChainedBones[parentChainedBones.Count - 1]; //<<리스트 마지막이 가장 Parent이다. if (parentRootBone != null) { AddBoneUnitRecursive(parentRootBone, exclusiveBones, parentChainedBones, _targetBone, null); } } //for (int iChild = 0; iChild < _targetBone._childBones.Count; iChild++) //{ // apBone childBone = _targetBone._childBones[iChild]; // if (childBone != null) // { // AddBoneUnitRecursive(childBone, exclusiveBones, childChainedBones, _targetBone, null); // } //} } break; case REQUEST_TYPE.Mirror: { //Mirror Bone 선택 //자신의 Parent 본들과 자식 본들은 선택 불가. 그 외에는 모두 가능 exclusiveBones.Add(_targetBone); AddExclusiveBoneRecursive(exclusiveBones, _targetBone, true); AddExclusiveBoneRecursive(exclusiveBones, _targetBone, false); //그외 모든 본을 추가한다. //BoneUnit을 넣자 for (int i = 0; i < _targetMeshGroup._boneList_Root.Count; i++) { AddBoneUnitRecursive(_targetMeshGroup._boneList_Root[i], exclusiveBones, _targetBone, null); } } break; } _isSearched = false; _strSearchKeyword = ""; _boneUnits_Root.Sort(delegate(BoneUnit a, BoneUnit b) { if (a._bone == null && b._bone == null) { return(0); } if (a._bone == null) { return(-1); } else if (b._bone == null) { return(1); } return(string.Compare(a._name, b._name)); }); }
// Show Window / Close Dialog //------------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apBone targetBone, apMeshGroup targetMeshGroup, REQUEST_TYPE requestType, FUNC_SELECT_LINKED_BONE funcResult) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } string windowName = ""; switch (requestType) { case REQUEST_TYPE.AttachChild: windowName = "Select a Bone as Child"; break; case REQUEST_TYPE.ChangeParent: windowName = "Select a Bone as Parent"; break; case REQUEST_TYPE.SelectIKTarget: windowName = "Select a Bone as IK Target"; break; case REQUEST_TYPE.SelectIKPositionControllerEffector: case REQUEST_TYPE.SelectIKLookAtControllerEffector: case REQUEST_TYPE.SelectIKLookAtControllerStartBone: windowName = "Select a Bone as IK Effector"; break; case REQUEST_TYPE.Mirror: windowName = "Select a Mirror Bone"; break; } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_SelectLinkedBone), true, windowName, true); apDialog_SelectLinkedBone curTool = curWindow as apDialog_SelectLinkedBone; object loadKey = new object(); if (curTool != null && curTool != s_window) { //기본 Dialog보다 조금 더 크다. Hierarchy 방식으로 가로 스크롤이 포함되기 때문 int width = 350; int height = 600; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, loadKey, targetBone, targetMeshGroup, requestType, funcResult); return(loadKey); } else { return(null); } }
// Init //------------------------------------------------------------------------ public void Init(apEditor editor, object loadKey, apBone targetBone, apMeshGroup targetMeshGroup, REQUEST_TYPE requestType, FUNC_SELECT_LINKED_BONE funcResult) { _editor = editor; _loadKey = loadKey; _funcResult = funcResult; _targetBone = targetBone; _targetMeshGroup = targetMeshGroup; _requestType = requestType; _selectedBoneUnit = null; _boneUnits.Clear(); _boneUnits_Root.Clear(); List <apBone> exclusiveBones = new List <apBone>(); //None 유닛 선택 //Parent에서만 가능 if (_requestType == REQUEST_TYPE.ChangeParent) { BoneUnit nullUnit = new BoneUnit(null, true, false, null, 0); _boneUnits.Add(nullUnit); _boneUnits_Root.Add(nullUnit); } //기존 Rootqnxj 순회하는 방식으로 리스트를 만들되, //"제외"되는 것들을 음영처리하자 //별도의 Unit 필요 //모두 None Unit이 있다. switch (_requestType) { case REQUEST_TYPE.AttachChild: //Parent 중 하나를 Child로 둬선 안된다. (Loop 발생) case REQUEST_TYPE.ChangeParent: { //전체 Bone 중에서 //- 자기 자신 제외 //- Parent 제외 exclusiveBones.Add(_targetBone); if (_targetBone._parentBone != null) { exclusiveBones.Add(_targetBone._parentBone); if (_requestType == REQUEST_TYPE.AttachChild) { //재귀적인 Parent 제외 AddExclusiveBoneRecursive(exclusiveBones, _targetBone._parentBone, false); } } for (int iChild = 0; iChild < _targetBone._childBones.Count; iChild++) { apBone childBone = _targetBone._childBones[iChild]; if (childBone != null) { exclusiveBones.Add(childBone); } if (_requestType == REQUEST_TYPE.ChangeParent) { //재귀적인 Child 제외 AddExclusiveBoneRecursive(exclusiveBones, childBone, true); } } //BoneUnit을 넣자 for (int i = 0; i < _targetMeshGroup._boneList_Root.Count; i++) { AddBoneUnitRecursive(_targetMeshGroup._boneList_Root[i], exclusiveBones, _targetBone, null); } } break; case REQUEST_TYPE.SelectIKTarget: { //<재귀적인 Child 중에서> //-자기 자신 제외 exclusiveBones.Add(_targetBone); for (int iChild = 0; iChild < _targetBone._childBones.Count; iChild++) { apBone childBone = _targetBone._childBones[iChild]; if (childBone != null) { AddBoneUnitRecursive(childBone, exclusiveBones, _targetBone, null); } } } break; } _isSearched = false; _strSearchKeyword = ""; _boneUnits_Root.Sort(delegate(BoneUnit a, BoneUnit b) { if (a._bone == null && b._bone == null) { return(0); } if (a._bone == null) { return(-1); } else if (b._bone == null) { return(1); } return(string.Compare(a._name, b._name)); }); }