Skip to content
Snippets Groups Projects
Commit 18aa9a2c authored by Robin Halseth Sandvik's avatar Robin Halseth Sandvik
Browse files

Fix for build.

parent cb6c98aa
No related branches found
No related tags found
2 merge requests!74Juliuses nye super branch,!73Fix for build.
Showing
with 67 additions and 8 deletions
...@@ -16,7 +16,8 @@ namespace BigSock { ...@@ -16,7 +16,8 @@ namespace BigSock {
public class BasicProjectile2 : BaseAttack { public class BasicProjectile2 : BaseAttack {
//protected static readonly GameObject PROJECTILE_BASE = new AttackMovement(); //protected static readonly GameObject PROJECTILE_BASE = new AttackMovement();
public const string PROJECTILE_NAME = "bullets/basicsquarebullet"; public const string PROJECTILE_NAME = "bullets/basicsquarebullet";
public const string AUDIO_PATH = "The Essential Retro Video Game Sound Effects Collection [512 sounds] By Juhani Junkala/explosions/Shortest/sfx_exp_shortest_hard1"; //public const string AUDIO_PATH = "The Essential Retro Video Game Sound Effects Collection [512 sounds] By Juhani Junkala\\explosions\\Shortest\\sfx_exp_shortest_hard1";
public const string AUDIO_PATH = "theessentialretrovideogamesoundeffectscollection[512sounds]byjuhanijunkala\\explosions\\short\\sfxexpshorthard16";
public override ulong Id => 104; public override ulong Id => 104;
......
...@@ -3,6 +3,7 @@ using System; ...@@ -3,6 +3,7 @@ using System;
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.IO;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
...@@ -46,6 +47,22 @@ namespace BigSock.Service { ...@@ -46,6 +47,22 @@ namespace BigSock.Service {
Based on: https://stackoverflow.com/a/67670629 Based on: https://stackoverflow.com/a/67670629
*/ */
private void _loadItems() { private void _loadItems() {
var dict = new Dictionary<string, AudioClip>();
foreach (string file in Directory.EnumerateFiles("Assets\\Resources\\sound", "*.*", SearchOption.AllDirectories)) {
// Skip meta files.
if(file.Contains(".meta")) continue;
var name = _sanitize(file.Replace(".wav", "").Replace(".mp3", "").Replace("Assets\\Resources\\sound\\", ""));
AudioClip go = Resources.Load<AudioClip>( file.Replace("Assets\\Resources\\", "").Replace(".wav", "").Replace(".mp3", "") );
Debug.Log($"[AudioService._loadItems()] {name}");
if(go == null) Debug.Log($"[AudioService._loadItems()] ITEM IS NULL!!! {name}");
dict[name] = go;
}
_items = dict;
}
private void _loadItems2() {
string[] guids = AssetDatabase.FindAssets( "t:AudioClip", new string[] {"Assets/sound"} ); string[] guids = AssetDatabase.FindAssets( "t:AudioClip", new string[] {"Assets/sound"} );
var dict = new Dictionary<string, AudioClip>(); var dict = new Dictionary<string, AudioClip>();
...@@ -63,7 +80,7 @@ namespace BigSock.Service { ...@@ -63,7 +80,7 @@ namespace BigSock.Service {
} }
private string _sanitize(string name) private string _sanitize(string name)
=> name.Replace(" ", "").Replace("_", "").ToLower(); => name.Replace("/", "\\").Replace(" ", "").Replace("_", "").ToLower();
} }
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ using System; ...@@ -3,6 +3,7 @@ using System;
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.IO;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
...@@ -79,13 +80,29 @@ namespace BigSock.Service { ...@@ -79,13 +80,29 @@ namespace BigSock.Service {
Based on: https://stackoverflow.com/a/67670629 Based on: https://stackoverflow.com/a/67670629
*/ */
private void _loadItems() { private void _loadItems() {
string[] guids = AssetDatabase.FindAssets( "t:Prefab", new string[] {"Assets/Prefabs"} ); var dict = new Dictionary<string, GameObject>();
foreach (string file in Directory.EnumerateFiles("Assets\\Resources\\Prefabs", "*.*", SearchOption.AllDirectories)) {
// Skip meta files.
if(file.Contains(".meta")) continue;
var name = _sanitize(file.Replace(".prefab", "").Replace("Assets\\Resources\\Prefabs\\", ""));
GameObject go = Resources.Load<GameObject>( file.Replace("Assets\\Resources\\", "").Replace(".prefab", "") );
//Debug.Log($"[AudioService._loadItems()] {name}");
//if(go == null) Debug.Log($"[AudioService._loadItems()] ITEM IS NULL!!! {name}");
dict[name] = go;
}
_prefabs = dict;
}
private void _loadItems2() {
string[] guids = AssetDatabase.FindAssets( "t:Prefab", new string[] {"Assets/Resources/Prefabs"} );
var dict = new Dictionary<string, GameObject>(); var dict = new Dictionary<string, GameObject>();
foreach(var guid in guids) { foreach(var guid in guids) {
var path = AssetDatabase.GUIDToAssetPath( guid ); var path = AssetDatabase.GUIDToAssetPath( guid );
var name = _sanitize(path.Replace(".prefab", "").Replace("Assets/Prefabs/", "")); var name = _sanitize(path.Replace(".prefab", "").Replace("Assets/Resources/Prefabs/", ""));
GameObject go = AssetDatabase.LoadAssetAtPath<GameObject>( path ); GameObject go = AssetDatabase.LoadAssetAtPath<GameObject>( path );
//Debug.Log($"[PrefabService._loadItems()] {name}"); //Debug.Log($"[PrefabService._loadItems()] {name}");
...@@ -96,7 +113,7 @@ namespace BigSock.Service { ...@@ -96,7 +113,7 @@ namespace BigSock.Service {
} }
private string _sanitize(string name) private string _sanitize(string name)
=> name.Replace(" ", "").Replace("_", "").ToLower(); => name.Replace("/", "\\").Replace(" ", "").Replace("_", "").ToLower();
} }
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ using System; ...@@ -3,6 +3,7 @@ using System;
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.IO;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
...@@ -46,13 +47,28 @@ namespace BigSock.Service { ...@@ -46,13 +47,28 @@ namespace BigSock.Service {
Based on: https://stackoverflow.com/a/67670629 Based on: https://stackoverflow.com/a/67670629
*/ */
private void _loadItems() { private void _loadItems() {
string[] guids = AssetDatabase.FindAssets( "t:Sprite", new string[] {"Assets/Sprites"} ); var dict = new Dictionary<string, Sprite>();
foreach (string file in Directory.EnumerateFiles("Assets\\Resources\\Sprites", "*.*", SearchOption.AllDirectories)) {
// Skip meta files.
if(file.Contains(".meta")) continue;
var name = _sanitize(file.Replace(".png", "").Replace(".jpg", "").Replace("Assets\\Resources\\Sprites\\", ""));
Sprite go = Resources.Load<Sprite>( file.Replace("Assets\\Resources\\", "").Replace(".png", "").Replace(".jpg", "") );
//Debug.Log($"[AudioService._loadItems()] {name}");
//if(go == null) Debug.Log($"[AudioService._loadItems()] ITEM IS NULL!!! {name}");
dict[name] = go;
}
_sprites = dict;
}
private void _loadItems2() {
string[] guids = AssetDatabase.FindAssets( "t:Sprite", new string[] {"Assets/Resources/Sprites"} );
var dict = new Dictionary<string, Sprite>(); var dict = new Dictionary<string, Sprite>();
foreach(var guid in guids) { foreach(var guid in guids) {
var path = AssetDatabase.GUIDToAssetPath( guid ); var path = AssetDatabase.GUIDToAssetPath( guid );
var name = _sanitize(path.Replace(".png", "").Replace(".jpg", "").Replace("Assets/Sprites/", "")); var name = _sanitize(path.Replace(".png", "").Replace(".jpg", "").Replace("Assets/Resources/Sprites/", ""));
Sprite go = AssetDatabase.LoadAssetAtPath<Sprite>( path ); Sprite go = AssetDatabase.LoadAssetAtPath<Sprite>( path );
//Debug.Log($"[SpriteService._loadItems()] {name}"); //Debug.Log($"[SpriteService._loadItems()] {name}");
...@@ -63,7 +79,7 @@ namespace BigSock.Service { ...@@ -63,7 +79,7 @@ namespace BigSock.Service {
} }
private string _sanitize(string name) private string _sanitize(string name)
=> name.Replace(" ", "").Replace("_", "").ToLower(); => name.Replace("/", "\\").Replace(" ", "").Replace("_", "").ToLower();
} }
} }
\ No newline at end of file
fileFormatVersion: 2
guid: d8025453ac102614fa3718324f74e318
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment