static List <UnitAnimInfo> GetHeroAnimInfo() { string HeroAnimPath = ResourcesPath.GetRelativePath(ResourcesType.HeroAnim, ResourcesPathMode.Editor); List <UnitAnimInfo> list = new List <UnitAnimInfo>(); DirectoryInfo dir = new DirectoryInfo(Application.dataPath + "/" + HeroAnimPath); DirectoryInfo[] subDirs = dir.GetDirectories(); for (int i = 0; i < subDirs.Length; i++) { FileInfo[] files = subDirs[i].GetFiles(); for (int j = 0; j < files.Length; j++) { if (!files[j].Name.EndsWith(".anim")) { continue; } string assetPath = "Assets/" + HeroAnimPath + subDirs[i].Name + "/" + files[j].Name; AnimationClip anim = AssetDatabase.LoadAssetAtPath(assetPath, typeof(AnimationClip)) as AnimationClip; if (null != anim) { UnitAnimInfo info = new UnitAnimInfo(); info.ActorName = subDirs[i].Name; info.ActName = files[j].Name.Remove(files[j].Name.LastIndexOf('.')); info.FrameCount = (uint)(anim.frameRate * anim.length); list.Add(info); } } EditorUtility.DisplayProgressBar("导出英雄动画帧数", subDirs[i].Name, (float)(i + 1) / subDirs.Length); } EditorUtility.ClearProgressBar(); return(list); }
// 加载mesh动画文件 //Modify by Aoicocoon 2017/12/06 //修改打包士兵数据+动画文件 public override void LoadSoldierAnim(string meshName, string animName, bool IsCache, AssetLoadHook pfun) { if (null == pfun) { return; } string folder = ResourcesPath.GetRelativePath(ResourcesType.ActorSoldierMesh, ResourcesPathMode.AssetBundle); string key = GetKey(folder, meshName + "/" + animName.ToLower()); string path = key + ConstantData.ABEXT; Object obj = FindAssetObj(key); if (null != obj) { pfun.Invoke(obj); } else { ABLoad.LoadAB(path, true, (ab) => { LoadQueue.AddLoadTask(path, animName, typeof(Texture2D), IsCache, IsCache, false, pfun); }); } }
// 加载shader 的接口 public override void LoadShader(string shaderName, bool async, AssetLoadHook pfun) { string shaderkey = ResourcesPath.GetAssetResourceRunPath(ResourcesType.Shader, ResourcesPathMode.Editor) + shaderName + ".shader"; shaderkey = shaderkey.ToLower(); LoadObj(ResourcesType.Shader, "shader", shaderkey, typeof(Shader), true, true, false, async, pfun); }
private void LoadBGM() { List <string> list = new List <string>(); List <string> list2 = new List <string>(); for (int i = 0; i < base.hierarchyData.batteWaves.Length; i++) { if (!list2.Contains(base.hierarchyData.batteWaves[i].bgmId) && !BattleFunctionUtility.IsEmptyPath(base.hierarchyData.batteWaves[i].bgmId)) { list2.Add(base.hierarchyData.batteWaves[i].bgmId); } if (!list2.Contains(base.hierarchyData.batteWaves[i].changedBgmId) && !BattleFunctionUtility.IsEmptyPath(base.hierarchyData.batteWaves[i].changedBgmId) && !BoolExtension.AllMachValue(false, base.hierarchyData.batteWaves[i].enemiesBossFlag)) { list2.Add(base.hierarchyData.batteWaves[i].changedBgmId); } } for (int j = 0; j < list2.Count; j++) { list.Add(ResourcesPath.CreatePath(new string[] { "BGM", list2[j], "sound" })); } base.stateManager.soundManager.PreLoadAudio(list.ToArray(), list2.ToArray()); }
// 获取相对目录, public static string GetRelativePath(string ResType, string ABName) { string path = ResourcesPath.GetRelativePath(ResType, ResourcesPathMode.AssetBundle); string fullname = string.Format("{0}{1}{2}", path, ABName, ConstantData.ABEXT); return(fullname.ToLower()); }
public static Sprite GetCharacterThumbnail(string id) { Sprite sprite = Resources.Load <Sprite>(ResourcesPath.CreatePath(new string[] { "CharacterThumbnail", id, "thumb" })); if (sprite == null) { Texture2D texture2D = Resources.Load <Texture2D>(ResourcesPath.CreatePath(new string[] { "CharacterThumbnail", id, "thumb" })); if (texture2D != null) { sprite = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), new Vector2(0.5f, 0.5f)); } } if (sprite == null) { global::Debug.LogWarning("キャラクターサムネイルデータが存在しません. (" + id + ")"); } return(sprite); }
private void LoadSE() { List <string> list = new List <string>(); this.AddEffectSe("bt_207"); this.AddEffectSe("bt_010"); this.AddEffectSe(string.Empty); this.AddEffectSe(string.Empty); for (int i = 0; i < this.effectSe.Count; i++) { list.Add(ResourcesPath.CreatePath(new string[] { "SE", this.effectSe[i], "sound" })); } this.effectSe.Add("bt_541Test"); list.Add(ResourcesPath.CreatePath(new string[] { "SEInternal/Battle", "bt_541", "sound" })); base.stateManager.soundManager.PreLoadAudio(list.ToArray(), this.effectSe.ToArray()); this.effectSe.Clear(); }
// 加载配置文件 public override Object LoadConfig(string name) { string path = ResourcesPath.GetRelativePath(ResourcesType.Config, ResourcesPathMode.Editor); string ext = ResourcesPath.GetFileExt(ResourcesType.Config); string fullpath = string.Format("Assets/{0}{1}.{2}", path, name, ext); return(AssetDatabase.LoadAssetAtPath(fullpath, typeof(Object))); }
public Water(int x, int y, int width, int height, List <Player> players) : base(x, y, width, height) { Players = players; Image = ResourcesPath.BitmapFromPath(ResourcesPath.WaterPath); foreach (Player player in players) { player.FinishedMove += CheckIfCollisionWithPlayer; } }
protected virtual void ApplyBattleHierarchy(BattleStateHierarchyData hierarchyData, bool onAutoPlay = false, int continueWaitSecond = 10) { hierarchyData.batteWaves = this._battleWaves; hierarchyData.digiStoneNumber = this._digiStoneNumber; hierarchyData.useStageId = this._useStageId; hierarchyData.areaName = this._areaName; hierarchyData.leaderCharacter = 0; hierarchyData.limitRound = this._limitRound; int onAutoPlay2 = 0; if (onAutoPlay) { onAutoPlay2 = 2; } hierarchyData.onAutoPlay = onAutoPlay2; hierarchyData.usePlayerCharacters = new PlayerStatus[this._usePlayerCharactersId.Length]; for (int i = 0; i < hierarchyData.usePlayerCharacters.Length; i++) { PlayerStatus playerStatus = ResourcesPath.GetPlayerStatus(this._usePlayerCharactersId[i]); List <string> list = new List <string>(); list.Add("public_attack"); foreach (string text in playerStatus.skillIds) { if (text != "public_attack") { list.Add(text); } } playerStatus.skillIds = list.ToArray(); hierarchyData.usePlayerCharacters[i] = playerStatus; hierarchyData.AddCharacterDatas(playerStatus.groupId, ResourcesPath.GetCharacterData(playerStatus.groupId)); hierarchyData.AddLeaderSkillStatus(playerStatus.leaderSkillId, ResourcesPath.GetLeaderSkillStatus(playerStatus.leaderSkillId)); hierarchyData.AddSkillStatus("public_attack", ResourcesPath.GetSkillStatus("public_attack")); hierarchyData.AddSkillStatus(playerStatus.skillIds[1], ResourcesPath.GetSkillStatus(playerStatus.skillIds[1])); hierarchyData.AddSkillStatus(playerStatus.skillIds[2], ResourcesPath.GetSkillStatus(playerStatus.skillIds[2])); } foreach (BattleWave battleWave in hierarchyData.batteWaves) { battleWave.enemyStatuses = new CharacterStatus[battleWave.useEnemiesId.Length]; for (int l = 0; l < battleWave.useEnemiesId.Length; l++) { string id = battleWave.useEnemiesId[l]; EnemyStatus enemyStatus = ResourcesPath.GetEnemyStatus(id); battleWave.enemyStatuses[l] = enemyStatus; List <string> list2 = new List <string>(); list2.Add("public_attack"); list2.AddRange(enemyStatus.enemyAiPattern.GetAllSkillID()); battleWave.enemyStatuses[l].skillIds = list2.ToArray(); hierarchyData.AddCharacterDatas(enemyStatus.groupId, ResourcesPath.GetCharacterData(enemyStatus.groupId)); hierarchyData.AddLeaderSkillStatus(enemyStatus.leaderSkillId, ResourcesPath.GetLeaderSkillStatus(enemyStatus.leaderSkillId)); foreach (string text2 in battleWave.enemyStatuses[l].skillIds) { hierarchyData.AddSkillStatus(text2, ResourcesPath.GetSkillStatus(text2)); } } } }
public static bool CreateItem(string ItemName, string BaseItem, bool isLoad = false) { if (string.IsNullOrEmpty(ItemName) == true) { return(false); } string ClassItem = ""; if (ItemName.EndsWith("Item") == true) { ClassItem = ItemName; } else { ClassItem = ItemName + "Item"; } MakeItem_HCode(ClassItem); MakeItemCode(ClassItem, BaseItem); AssetDatabase.Refresh(); EditorUtility.DisplayDialog("提示", "脚本生成完毕", "确定"); if (isLoad == true) { string path = ResourcesPath.GetAssetResourceRunPath(ResourcesType.UIWndItem, ResourcesPathMode.Editor); path += ClassItem + ".prefab"; Debug.Log(path); //GameObject Prefab = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject; GameObject Prefab = PrefabUtility.LoadPrefabContents(path); if (Prefab != null) { //GameObject go = GameObject.Instantiate(Prefab); GameObject go = Prefab; if (null != go) { go.transform.SetParent(GameObject.Find("UI/Wnd").transform, false); Debug.Log("窗口模本生成完毕"); } } else { Prefab = AssetDatabase.LoadAssetAtPath("Assets/Editor/UITool/XXXItem.prefab", typeof(GameObject)) as GameObject; GameObject go = GameObject.Instantiate(Prefab); if (null != go) { go.transform.SetParent(GameObject.Find("UI/Wnd").transform, false); go.name = ClassItem; // Debug.Log("Item模板生成完毕"); } } } return(true); }
public void CreateMonsterButtons() { GameObject uibattlePrefab = ResourcesPath.GetUIBattlePrefab("MonsterButtons"); this.monsterButtonRoot = UnityEngine.Object.Instantiate <GameObject>(uibattlePrefab); Transform transform = this.monsterButtonRoot.transform; transform.SetParent(this.leftParent); transform.localPosition = new Vector3(0f, 92f, 0f); transform.localScale = Vector3.one; }
private void CreateBattleRoundEnd() { GameObject pvPPrefab = ResourcesPath.GetPvPPrefab("PvPBattle_RoundEnd"); GameObject gameObject = base.Instantiate <GameObject>(pvPPrefab); Transform transform = gameObject.transform; transform.SetParent(this.ui.skillSelectUi.transform); transform.localPosition = new Vector3(0f, 310f, 0f); transform.localScale = Vector3.one; this.battleRoundEnd = gameObject.GetComponent <BattleRoundEndPvP>(); }
public override void LoadVoice(string audioName, bool async, AssetLoadHook pfun) { //LoadObj(ResourcesType.Audio, audioName.ToLower(), audioName.ToLower(), typeof(AudioClip), true, true, false, async,pfun) ; string RelativePath = ResourcesPath.GetRelativePath(ResourcesType.Voice, ResourcesPathMode.AssetBundle); AudioClip go = Resources.Load <AudioClip>(RelativePath + audioName) as AudioClip; if (pfun != null) { pfun(go); } }
public BattleDigimonEnemyStatus CreateStatusEnemy() { GameObject uibattlePrefab = ResourcesPath.GetUIBattlePrefab("Status_Enemy_M"); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(uibattlePrefab); Transform transform = gameObject.transform; transform.SetParent(this.leftParent); transform.localPosition = new Vector3(308f, 243f, 0f); transform.localScale = Vector3.one; return(gameObject.GetComponent <BattleDigimonEnemyStatus>()); }
// 加载精灵 public override void LoadSprite(string AtlasName, string SpriteName, bool async, AssetLoadHook pfun) { //LoadObj(ResourcesType.UIAltas, AtlasName.ToLower(), SpriteName.ToLower(), typeof(Sprite), true, true, false, async,pfun); string RelativePath = ResourcesPath.GetRelativePath(ResourcesType.UIAltas, ResourcesPathMode.AssetBundle); Sprite go = Resources.Load <Sprite>(RelativePath + AtlasName + "/" + SpriteName) as Sprite; if (pfun != null) { pfun(go); } }
public override void LoadMaterial(string MaterialName, bool async, AssetLoadHook pfun) { // LoadObj(ResourcesType.Material, MaterialName, "", typeof(Material), true, pfun); string RelativePath = ResourcesPath.GetRelativePath(ResourcesType.Material, ResourcesPathMode.AssetBundle); Material go = Resources.Load <Material>(RelativePath + MaterialName) as Material; if (pfun != null) { pfun(go); } }
public Pod(int x, int y, int width, int height, List <Player> players) : base(x, y, width, height) { CreatedPods++; Image = ResourcesPath.BitmapFromPath(ResourcesPath.PodEmptyPath); Players = players; foreach (Player player in Players) { player.FinishedMove += CheckIfCollisionWithPlayer; player.TryingToMove += CheckIfPlayerCanGetIn; } }
public MenuDialog SetupMenu() { GameObject uibattlePrefab = ResourcesPath.GetUIBattlePrefab("Menu"); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(uibattlePrefab); Transform transform = gameObject.transform; BattleMenu component = transform.GetComponent <BattleMenu>(); this.helpDialogGO = component.helpDialogGO; this.battleMenu = component; return(component.SetupMenu(base.transform)); }
private void CreateUI() { pc1Canvas.mainCanvas = Instantiate(Resources.Load(ResourcesPath.Ui("PC1Canvas")), GameObject.Find(CanvasName.UI).transform) as GameObject; pc1Canvas.mainCanvas.name = "PC1Canvas"; pc1Canvas.mainCanvas.AddComponent <PlayerUI>().playerSlot = PlayerSlot.PC1; pc2Canvas.mainCanvas = Instantiate(Resources.Load(ResourcesPath.Ui("PC2Canvas")), GameObject.Find(CanvasName.UI).transform) as GameObject; pc2Canvas.mainCanvas.name = "PC2Canvas"; pc2Canvas.mainCanvas.AddComponent <PlayerUI>().playerSlot = PlayerSlot.PC2; }
internal static void InitializeUtility() { var dirs = Directory.GetDirectories(Application.dataPath, "Editor Toolbox", SearchOption.AllDirectories); if (dirs == null || dirs.Length == 0) { return; } ResourcesPath = dirs[0].Replace('\\', '/') + "/Editor Resources"; ResourcesPathRelative = ResourcesPath.Replace(Application.dataPath, "Assets"); }
private void CreateRetireObject() { GameObject uibattlePrefab = ResourcesPath.GetUIBattlePrefab("DialogRetire"); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(uibattlePrefab); Transform transform = gameObject.transform; this.SetupDialogs(transform); transform.localPosition = new Vector3(2f, 0f, 0f); transform.localScale = Vector3.one; this.dialogRetire = gameObject.GetComponent <DialogRetire>(); gameObject.SetActive(false); }
public IEnumerator LoadBattleInternalResources(string id, Action <GameObject> result) { BattleDebug.Log("--- バトル内部リソース単体ロード id[" + id + "] : 開始"); GameObject BattleInternalResources = base.Instantiate <GameObject>(ResourcesPath.GetBattleInternalResourcesPrefab(id)); yield return(null); BattleInternalResources.name = id; BattleInternalResources.transform.SetParent(base.battleStateData.BattleInternalResourcesRoot); BattleInternalResources.transform.Clear(); result(BattleInternalResources); BattleDebug.Log("--- バトル内部リソース単体ロード id[" + id + "] : 完了"); yield break; }
// 获取资源存储路径 public static string GetAssetResourceSavePath(string Type, ResourcesPathMode Mode) { StringBuilder Builder = new StringBuilder(string.Empty); if (Mode == ResourcesPathMode.AssetBundle) { Builder.Append(AssetBundlePath); } string str = ResourcesPath.GetRelativePath(Type, Mode); Builder.Append(str); return(Builder.ToString()); }
/// <summary> /// <para> 获取资源存储路径 </para> /// </summary> /// <param name="type"></param> /// <param name="mode"></param> /// <returns></returns> public static string GetAssetResourceSavePath(string type, ResourcesPathMode mode) { StringBuilder stringBuilder = new StringBuilder(string.Empty); if (mode == ResourcesPathMode.AssetBundle) { stringBuilder.Append(BuildSettings.assetBundleOutputPath); } string path = ResourcesPath.GetRelativePath(type, mode); stringBuilder.Append(path); return(stringBuilder.ToString()); }
public static GameObject GetBattleInternalResourcesPrefab(string id) { GameObject gameObject = Resources.Load <GameObject>(ResourcesPath.CreatePath(new string[] { "BattleInternalResources", id, "prefab" })); if (gameObject == null) { global::Debug.LogError("内部リソースデータが存在しません. (" + id + ")"); } return(gameObject); }
public static GameObject GetCameraMotionPrefab(string id) { GameObject gameObject = Resources.Load <GameObject>(ResourcesPath.CreatePath(new string[] { "CameraMotions", id, "prefab" })); if (gameObject == null) { global::Debug.LogWarning("カメラモーションデータが存在しません. (" + id + ")"); } return(gameObject); }
public Wood(int x, int y, int width, int height, int xmovement, int ymovement, MapInfo mapInfo, List <Player> players) : base(x, y, width, height) { Image = ResourcesPath.BitmapFromPath(ResourcesPath.WoodPath); Players = players; foreach (Player player in Players) { player.Moved += CheckIfCollisionWithPlayer; } Xmovement = xmovement; Ymovement = ymovement; this.mapInfo = mapInfo; timer.Tick += MoveOnTick; timer.Interval = TimeSpan.FromSeconds(0.02); timer.Start(); }
public static GameObject GetSpawnPointPrefab(string id) { GameObject gameObject = Resources.Load <GameObject>(ResourcesPath.CreatePath(new string[] { "SpawnPoints", id, "prefab" })); if (gameObject == null) { global::Debug.LogWarning("出現ポイントデータが存在しません. (" + id + ")"); } return(gameObject); }
public static GameObject GetCharacterPrefab(string id) { GameObject gameObject = Resources.Load <GameObject>(ResourcesPath.CreatePath(new string[] { "Characters", id, "prefab" })); if (gameObject == null) { global::Debug.LogWarning("キャラクターデータが存在しません. (" + id + ")"); } return(gameObject); }