private void CheckAutoDestroyObject(bool bIsChangeScene) { var pDestroys = new List <SHObjectInfo>(); ForItemActives((pItem) => { switch (pItem.m_eDestroyType) { case ePoolDestroyType.ChangeScene: if (true == bIsChangeScene) { pDestroys.Add(pItem); } break; } }); ForItemInactives((pItem) => { switch (pItem.m_eDestroyType) { case ePoolDestroyType.ChangeScene: if (true == bIsChangeScene) { pDestroys.Add(pItem); } break; } }); SHUtils.ForToList(pDestroys, (pItem) => { SetDestroyObject(pItem.GetName(), pItem); }); }
void RefleshSlotForSelect() { SHUtils.ForToList(m_pSticks, (pSlot) => { pSlot.SetSelector(); }); }
void CheckCollision() { SHUtils.ForToList(Single.Monster.GetMonsters(), (pMonster) => { if (true == pMonster.IsDie()) { return; } // 충돌체크 var pMonCollider = pMonster.GetCollider(); if (false == pMonCollider.bounds.Intersects(m_pCollider.bounds)) { return; } // 점수처리 var eDecision = Single.Balance.GetDecision(this, pMonster); Single.ScoreBoard.AddScore(pMonster.GetScore(eDecision)); // 상태처리 pMonster.SetCrash(this); this.SetCrash(pMonster); // 효과음 Single.Sound.PlayEffect("Audio_Effect_Crash"); }); }
public override void Load(SHLoadData pInfo, Action <string, SHLoadStartInfo> pStart, Action <string, SHLoadEndInfo> pDone) { SHBaseTable pTable = GetTable(pInfo.m_strName); if (null == pTable) { Debug.LogError(string.Format("[TableData] 등록된 테이블이 아닙니다.!!({0})", pInfo.m_strName)); pDone(pInfo.m_strName, new SHLoadEndInfo(false, eLoadErrorCode.Load_Table)); return; } SHUtils.ForToList(GetLoadOrder(pTable), (pLambda) => { bool?bIsSuccess = pLambda(); if (null != bIsSuccess) { if (true == bIsSuccess.Value) { pDone(pInfo.m_strName, new SHLoadEndInfo(true, eLoadErrorCode.None)); } else { pDone(pInfo.m_strName, new SHLoadEndInfo(true, eLoadErrorCode.Load_Table)); } return; } }); pDone(pInfo.m_strName, new SHLoadEndInfo(false, eLoadErrorCode.Load_Table)); }
public void SetStickTypeToPlayerPrefs(eStickType eType, eGoodsState eGoods) { switch (eGoods) { case eGoodsState.Disable: if (1 >= GetEnableSticksToPlayerPrefs().Count) { Single.UI.ShowNotice("알림", "꼬쟁이는 최소 1개 이상입니다."); return; } break; } var pEnableSticks = GetEnableSticksToPlayerPrefs(); SHPlayerPrefs.SetInt(string.Format("Inventory_Stick_{0}", (int)eType), (int)eGoods); switch (eGoods) { case eGoodsState.Enable: SHUtils.ForToList(pEnableSticks, (eStick) => { SetStickTypeToPlayerPrefs(eStick, eGoodsState.Disable); }); break; } }
void ClearEffect() { SHUtils.ForToList(m_pInfo.m_pEffectInfo, (pInfo) => { pInfo.ClearEffectObject(); }); }
void RefleshSlotForSelect() { SHUtils.ForToList(m_pMonster, (pSlot) => { pSlot.SetGoodsState(); }); }
private void CheckAutoReturnObject(bool bIsChangeScene) { var pReturns = new List <SHObjectInfo>(); ForItemActives((pItem) => { switch (pItem.m_eReturnType) { case ePoolReturnType.Disable: if (false == pItem.IsActive()) { pReturns.Add(pItem); } break; case ePoolReturnType.ChangeScene: if (true == bIsChangeScene) { pReturns.Add(pItem); } break; } }); SHUtils.ForToList(pReturns, (pItem) => { SetReturnObject(pItem.GetName(), pItem); }); }
void AddLoadList(List <Dictionary <string, SHLoadData> > pLoadList) { SHUtils.ForToList <Dictionary <string, SHLoadData> >( pLoadList, (dicLoadList) => { m_pPrograss.AddLoadInfo(dicLoadList); }); }
void ClearMonster() { SHUtils.ForToList(m_pMonsters, (pMonster) => { pMonster.SetActive(false); }); m_pMonsters.Clear(); }
// 유틸 : 번들 패킹 시작 및 아웃풋 static bool MakeAssetBundle(BuildTarget eTarget, string strOutputPath, Dictionary <string, AssetBundleInfo> dicBundles) { // 디렉토리 정리 SHUtils.DeleteDirectory(strOutputPath); SHUtils.CreateDirectory(strOutputPath); // 번들 빌드 정보 만들기 List <AssetBundleBuild> pBuildList = new List <AssetBundleBuild>(); SHUtils.ForToDic(dicBundles, (pKey, pValue) => { List <string> pAssets = new List <string>(); SHUtils.ForToDic(pValue.m_dicResources, (pResKey, pResValue) => { pAssets.Add(string.Format("{0}/{1}{2}", "Assets/Resources", pResValue.m_strPath, pResValue.m_strExtension)); }); AssetBundleBuild pAssetInfo = new AssetBundleBuild(); pAssetInfo.assetBundleName = string.Format("{0}.unity3d", pValue.m_strBundleName); pAssetInfo.assetNames = pAssets.ToArray(); pBuildList.Add(pAssetInfo); }); // 빌드할 번들이 없으면 종료 if (0 == pBuildList.Count) { return(true); } // 번들 빌드하기 AssetBundleManifest pManifest = BuildPipeline.BuildAssetBundles(strOutputPath, pBuildList.ToArray(), BuildAssetBundleOptions.DeterministicAssetBundle, eTarget); if (null == pManifest) { Debug.LogErrorFormat("Error!!! Make Assets Bundle : {0}", strOutputPath); return(false); } // 후 처리 SHUtils.ForToList(pBuildList, (pBundle) => { // 번들 크기와 해시코드 기록 string strKey = pBundle.assetBundleName.Substring(0, pBundle.assetBundleName.Length - ".unity3d".Length).ToLower(); if (true == dicBundles.ContainsKey(strKey)) { dicBundles[strKey].m_pHash128 = pManifest.GetAssetBundleHash(pBundle.assetBundleName); dicBundles[strKey].m_lBundleSize = (new FileInfo(string.Format("{0}/{1}", strOutputPath, pBundle.assetBundleName))).Length; } // Manifest제거 ( 사용하지 않는 불필요한 파일이라 그냥 제거시킴 ) SHUtils.DeleteFile(string.Format("{0}/{1}.manifest", strOutputPath, pBundle.assetBundleName)); }); SHUtils.DeleteFile(string.Format("{0}/{1}", strOutputPath, SHHard.GetStrToPlatform(eTarget))); SHUtils.DeleteFile(string.Format("{0}/{1}.manifest", strOutputPath, SHHard.GetStrToPlatform(eTarget))); return(true); }
void PlayEffect(eDamageEvent eEvent) { SHUtils.ForToList(m_pInfo.m_pEffectInfo, (pInfo) => { var strPrefabName = string.Empty; switch (eEvent) { case eDamageEvent.Tick: if (m_pInfo.m_iLifeTick == pInfo.m_iPlayToLifeTick) { strPrefabName = pInfo.m_strPrefabName; } break; case eDamageEvent.Start: if (true == pInfo.m_bIsPlayToStart) { strPrefabName = pInfo.m_strPrefabName; } break; case eDamageEvent.Delete: if (true == pInfo.m_bIsPlayToDelete) { strPrefabName = pInfo.m_strPrefabName; } if (true == pInfo.m_bIsDeleteWithDamage) { pInfo.SetDisableObject(); } break; case eDamageEvent.Crash: if (true == pInfo.m_bIsPlayToCrash) { strPrefabName = pInfo.m_strPrefabName; } break; } if (true == string.IsNullOrEmpty(strPrefabName)) { return; } var pEffect = CreateEffect(strPrefabName); if (null == pEffect) { return; } pInfo.SetEffectObject(pEffect); SetupEffectTransform(pEffect, pInfo); pEffect.SetActive(true); }); }
static void SelectFiles() { // 시작팝업 if (false == ShowDialog("[SHTools] Prefab Dependency Check", "리소스 폴더 내에 있는 원본 리소스들이\n선택한 프리팹에 종속되어 있는지 체크합니다.", "확인", "취소")) { return; } // 선택 오브젝트 체크 var pObjects = new List <UnityEngine.Object>(Selection.objects); if (0 == pObjects.Count) { ShowDialog("[SHTools] Resources Listing", "선택된 프리팹이 없습니다.", "확인"); return; } // 알리아싱 var pChecker = new SHPrefabDependencyChecker(); // 절대경로처리 var strAbsolutePath = SHPath.GetPathToAssets(); strAbsolutePath = strAbsolutePath.Substring(0, (strAbsolutePath.IndexOf("Assets") - 1)).Replace("\\", "/"); // 종속체크 string strBuff = string.Empty; SHUtils.ForToList(pObjects, (pObject) => { string strSearchPath = string.Format("{0}/{1}", strAbsolutePath, AssetDatabase.GetAssetPath(pObject)); SHUtils.Search(strSearchPath, (pFileInfo) => { var pDependencys = pChecker.GetDependency(pFileInfo.FullName); if (null == pDependencys) { return; } strBuff += string.Format("< Prefab : {0} >\n", Path.GetFileNameWithoutExtension(pFileInfo.FullName)); SHUtils.ForToList(pDependencys, (pDependency) => { strBuff += string.Format(" Dependency : {0}\n", pDependency); }); }); }); string strSavePath = string.Format("{0}/{1}", strAbsolutePath, "DependencyList.txt"); SHUtils.SaveFile(strBuff, strSavePath); System.Diagnostics.Process.Start(strSavePath); }
// 유틸 : 씬 변경이 시작될때 알려달라고 한 곳에 알려주자 void SendCallback(eSceneType eCurrent, eSceneType eChange) { SHUtils.ForToList(m_pEventToChangeScene, (pAction) => { if (null == pAction) { return; } pAction(eCurrent, eChange); }); }
private void ForItemInactives(Action <SHObjectInfo> pCallback) { if (null == pCallback) { return; } SHUtils.ForToDic(m_dicInactives, (pKey, pValue) => { SHUtils.ForToList(pValue, (pItem) => pCallback(pItem)); }); }
private void ClearAll() { SHUtils.ForToDic(m_dicActives, (pKey, pValue) => { SHUtils.ForToList(pValue, (pObject) => pObject.DestroyObject()); }); SHUtils.ForToDic(m_dicInactives, (pKey, pValue) => { SHUtils.ForToList(pValue, (pObject) => pObject.DestroyObject()); }); m_dicActives.Clear(); m_dicInactives.Clear(); }
private void CheckDeleteMonster() { var pDelete = new Monsters(m_pMonsters); SHUtils.ForToList(pDelete, (pMonster) => { if (false == pMonster.IsDie()) { return; } m_pMonsters.Remove(pMonster); }); }
void OnDelUnits() { SHUtils.ForToDic(m_dicDelUnits, (pKey, pValue) => { if (false == m_dicUnits.ContainsKey(pKey)) { return; } SHUtils.ForToList(pValue, (pUnit) => { m_dicUnits[pKey].Remove(pUnit); }); }); m_dicDelUnits.Clear(); }
public void SaveLoadResourceList() { string strBuff = string.Empty; SHUtils.ForToDic(m_dicRealLoadInfo, (pKey, pValue) => { strBuff += string.Format("Scene : {0}\n", pKey); SHUtils.ForToList(pValue, (pInfo) => { strBuff += string.Format("\t{0}\n", pInfo); }); }); string strSavePath = string.Format("{0}/{1}", SHPath.GetPathToAssets(), "RealTimeLoadResource.txt"); SHUtils.SaveFile(strBuff, strSavePath); System.Diagnostics.Process.Start(strSavePath); }
// 다양화 : 로드할 데이터 리스트 알려주기 public override Dictionary <string, SHLoadData> GetLoadList(eSceneType eType) { var dicLoadList = new Dictionary <string, SHLoadData>(); SHUtils.ForToList(Single.Table.GetPreLoadResourcesList(eType), (pValue) => { if (true == IsLoadResource(pValue)) { return; } dicLoadList.Add(pValue, CreateLoadInfo(pValue)); }); return(dicLoadList); }
// 유틸 : 언어파일 로드 List <byte> LoadLocalization() { var pByte = new List <byte>(); var pNewLine = System.Text.Encoding.UTF8.GetBytes("\n"); SHUtils.ForToList(m_pLocalFiles, (strFile) => { var pData = Single.Resource.GetTextAsset(strFile); if (null == pData) { return; } pByte.AddRange(pNewLine); pByte.AddRange(pData.bytes); }); return(pByte); }
void CheckCollision(SHDamageObject pDamage) { if (null == pDamage) { return; } if (false == pDamage.IsCheckCrash()) { return; } SHUtils.ForToList(GetTargets(pDamage), (pTarget) => { var pDamageCollider = pDamage.GetCollider(); var pTargetCollider = pTarget.GetCollider(); if ((null == pDamageCollider) || (null == pTargetCollider)) { return; } var bIsCollistion = false; var bBounds = pDamage.m_pBeforeBounds; for (float fRatio = 0.0f; fRatio <= 1.0f; fRatio += 0.1f) { bBounds.center = SHMath.Lerp(pDamage.m_pBeforeBounds.center, pDamageCollider.bounds.center, fRatio); if (true == bBounds.Intersects(pTargetCollider.bounds)) { bIsCollistion = true; break; } } if (false == bIsCollistion) { return; } pTarget.OnCrashDamage(pDamage); pDamage.OnCrashDamage(pTarget); }); }
void OnAddUnits() { SHUtils.ForToDic(m_dicAddUnits, (pKey, pValue) => { if (false == m_dicUnits.ContainsKey(pKey)) { m_dicUnits.Add(pKey, new List <SHMonoWrapper>()); } SHUtils.ForToList(pValue, (pUnit) => { if (true == m_dicUnits[pKey].Contains(pUnit)) { return; } m_dicUnits[pKey].Add(pUnit); }); }); m_dicAddUnits.Clear(); }
// 인터페이스 : 중복파일 리스트 내보내기 public static void SaveToDuplicationList(Dictionary <string, List <string> > dicDuplications, string strSaveFilePath) { if (0 == dicDuplications.Count) { return; } string strNewLine = "\r\n"; string strBuff = string.Empty; SHUtils.ForToDic(dicDuplications, (pKey, pValue) => { strBuff += string.Format("FileName : {0}{1}", pKey, strNewLine); SHUtils.ForToList(pValue, (strPath) => { strBuff += string.Format("\tPath : Resources/{0}{1}", strPath, strNewLine); }); strBuff += string.Format("{0}", strNewLine); }); SHUtils.SaveFile(strBuff, strSaveFilePath); }
// 데이터 셋 생성 // DB에 어떤 시트 어떤 데이터가 있는지 모르는 상태에서 모든 데이터를 string형태로 뽑아 버리는 기능 public Dictionary <string, List <SHTableDataSet> > GetDataSet() { var dicData = new Dictionary <string, List <SHTableDataSet> >(); // 테이블 리스트 생성 var strTableList = "TableList"; var pQuery = GetTable(strTableList); var pTableList = GetTableDataSet(pQuery, strTableList); dicData[strTableList] = pTableList; pQuery.Release(); // 테이블별 데이터 생성 SHUtils.ForToList(pTableList, (pTable) => { string strTableName = pTable.m_pDatas[0]; pQuery = GetTable(strTableName); strTableName = strTableName.Trim('"'); dicData[strTableName] = GetTableDataSet(pQuery, strTableName);; pQuery.Release(); }); return(dicData); }
// 인터페이스 : DataSet을 Json으로 쓰기 public void Write(string strFileName, Dictionary <string, List <SHTableDataSet> > dicData) { #if UNITY_EDITOR if (null == dicData) { Debug.LogError(string.Format("Json으로 저장할 데이터가 없습니다!!")); return; } string strNewLine = "\r\n"; string strBuff = "{" + strNewLine; SHUtils.ForToDic(dicData, (pKey, pValue) => { strBuff += string.Format("\t\"{0}\": [{1}", pKey, strNewLine); SHUtils.ForToList(pValue, (pData) => { strBuff += "\t\t{" + strNewLine; SHUtils.For(0, pData.m_iMaxCol, (iCol) => { strBuff += string.Format("\t\t\t\"{0}\": {1},{2}", pData.m_ColumnNames[iCol], pData.m_pDatas[iCol], strNewLine); }); strBuff = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine); strBuff += "\t\t}," + strNewLine; }); strBuff = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine); strBuff += string.Format("\t],{0}", strNewLine); }); strBuff = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine); strBuff += "}"; SHUtils.SaveFile(strBuff, string.Format("{0}/{1}.json", SHPath.GetPathToJson(), Path.GetFileNameWithoutExtension(strFileName))); #endif }
// 이벤트 : 클릭 이벤트 void OnCliSH() { if (null == m_pLabel) { return; } var strURL = m_pLabel.GetUrlAtPosition(UICamera.lastHit.point); if (true == string.IsNullOrEmpty(strURL)) { return; } if (true == m_bIsAutoOpenURL) { Application.OpenURL(strURL); } SHUtils.ForToList(m_pEvent, (pEvent) => { pEvent(strURL); }); }
void PlaySound(eDamageEvent eEvent) { SHUtils.ForToList(m_pInfo.m_pSoundInfo, (pInfo) => { switch (eEvent) { case eDamageEvent.Tick: if (m_pInfo.m_iLifeTick == pInfo.m_iPlayToLifeTick) { Single.Sound.PlayEffect(pInfo.m_strClipName); } break; case eDamageEvent.Start: if (true == pInfo.m_bIsPlayToStart) { Single.Sound.PlayEffect(pInfo.m_strClipName); } break; case eDamageEvent.Delete: if (true == pInfo.m_bIsPlayToDelete) { Single.Sound.PlayEffect(pInfo.m_strClipName); } break; case eDamageEvent.Crash: if (true == pInfo.m_bIsPlayToCrash) { Single.Sound.PlayEffect(pInfo.m_strClipName); } break; } }); }
List <SHMonoWrapper> GetTargets(SHDamageObject pDamage) { if (null == pDamage) { return(null); } var pTargets = new List <SHMonoWrapper>(); SHUtils.ForToDic(m_dicUnits, (pKey, pValue) => { SHUtils.ForToList(pValue, (pUnit) => { if (false == pDamage.IsTarget(pUnit.tag)) { return; } pTargets.Add(pUnit); }); }); return(pTargets); }
public void SendEventToCollision(SHDamageObject pDamage) { SHUtils.ForToList(m_pEventToCollision, (pCallback) => pCallback(pDamage)); }