More Assets
Added Prop and Env loading support. Fixed shaders. Added background color selection. Added screenshot button.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
/[Mm]emoryCaptures/
|
||||
/Assets/AmplifyShaderEditor/
|
||||
/Ignore/
|
||||
/Screenshots/
|
||||
|
||||
# Asset meta data should only be ignored when the corresponding asset is also ignored
|
||||
!/[Aa]ssets/**/*.meta
|
||||
|
||||
@@ -7,7 +7,7 @@ Material:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: InvisibleMaterial
|
||||
m_Name: InvisibleStandard
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _ALPHATEST_ON
|
||||
m_LightmapFlags: 4
|
||||
@@ -0,0 +1,97 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: InvisibleUnlit
|
||||
m_Shader: {fileID: 10751, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _ALPHATEST_ON
|
||||
m_LightmapFlags: 0
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BlendOp: 0
|
||||
- _BumpScale: 1
|
||||
- _CameraFadingEnabled: 0
|
||||
- _CameraFarFadeDistance: 2
|
||||
- _CameraNearFadeDistance: 1
|
||||
- _ColorMode: 0
|
||||
- _Cull: 0
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DistortionBlend: 0.5
|
||||
- _DistortionEnabled: 0
|
||||
- _DistortionStrength: 1
|
||||
- _DistortionStrengthScaled: 0
|
||||
- _DstBlend: 0
|
||||
- _EmissionEnabled: 0
|
||||
- _FlipbookMode: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _LightingEnabled: 0
|
||||
- _Metallic: 0
|
||||
- _Mode: 1
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SoftParticlesEnabled: 0
|
||||
- _SoftParticlesFarFadeDistance: 1
|
||||
- _SoftParticlesNearFadeDistance: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
- _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59dfbb3f0a697874c81bba8ff758c891
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+5285
-44
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 667e8e9da20031342bb8ca7bfd025c32
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
public class Screenshot : MonoBehaviour
|
||||
{
|
||||
public static Screenshot Instance;
|
||||
bool recording = false;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public static void TakeScreenshot()
|
||||
{
|
||||
var image = GrabFrame(Screen.width, Screen.height);
|
||||
|
||||
string fileName = Application.dataPath + "/../Screenshots/" + string.Format("UmaViewer_{0}", DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss-fff"));
|
||||
byte[] pngShot = ImageConversion.EncodeToPNG(image);
|
||||
Directory.CreateDirectory(Application.dataPath + "/../Screenshots");
|
||||
File.WriteAllBytes(fileName + ".png", pngShot);
|
||||
|
||||
Destroy(image);
|
||||
}
|
||||
|
||||
public static Texture2D GrabFrame(int width, int height)
|
||||
{
|
||||
var dimensions = GetResolution(width, height);
|
||||
width = dimensions.x;
|
||||
height = dimensions.y;
|
||||
|
||||
Camera cam = Camera.main;
|
||||
int oldMask = cam.cullingMask;
|
||||
var bak_cam_clearFlags = cam.clearFlags;
|
||||
cam.cullingMask = ~LayerMask.GetMask("UI");
|
||||
cam.clearFlags = CameraClearFlags.Depth;
|
||||
|
||||
var tex_color = new Texture2D(width, height, TextureFormat.ARGB32, false);
|
||||
var render_texture = RenderTexture.GetTemporary(width, height, 24, RenderTextureFormat.ARGB32);
|
||||
var grab_area = new Rect(0, 0, width, height);
|
||||
|
||||
RenderTexture.active = render_texture;
|
||||
cam.targetTexture = render_texture;
|
||||
|
||||
cam.Render();
|
||||
tex_color.ReadPixels(grab_area, 0, 0);
|
||||
tex_color.Apply();
|
||||
|
||||
cam.clearFlags = bak_cam_clearFlags;
|
||||
cam.cullingMask = oldMask;
|
||||
cam.targetTexture = null;
|
||||
RenderTexture.active = null;
|
||||
RenderTexture.ReleaseTemporary(render_texture);
|
||||
|
||||
return tex_color;
|
||||
}
|
||||
|
||||
public static Vector2Int GetResolution(int width, int height)
|
||||
{
|
||||
if (width == 0 && height == 0)
|
||||
{
|
||||
width = Screen.width;
|
||||
height = Screen.height;
|
||||
}
|
||||
else if (width == 0)
|
||||
{
|
||||
float ratio = (float)Screen.width / (float)Screen.height;
|
||||
width = Mathf.RoundToInt((float)height * ratio);
|
||||
}
|
||||
else if (height == 0)
|
||||
{
|
||||
float ratio = (float)Screen.height / (float)Screen.width;
|
||||
height = Mathf.RoundToInt((float)width * ratio);
|
||||
}
|
||||
return new Vector2Int(width, height);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b4f73cfe8953614eadf26f26c5801c8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,3 +1,4 @@
|
||||
using Gallop;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,6 +13,10 @@ public class UmaContainer : MonoBehaviour
|
||||
public Animator UmaAnimator;
|
||||
public AnimatorOverrideController OverrideController;
|
||||
|
||||
[Header("Face")]
|
||||
public List<AnimationClip> FacialClips = new List<AnimationClip>();
|
||||
public List<FaceDrivenKeyTarget> FaceDrivenKeyTargets = new List<FaceDrivenKeyTarget>();
|
||||
|
||||
[Header("Generic")]
|
||||
public bool IsGeneric = false;
|
||||
public string VarCostumeIdShort, VarCostumeIdLong, VarSkin, VarHeight, VarSocks, VarBust;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
//DO NOT SERIALIZE OR FPS DIES
|
||||
public class UmaDatabaseEntry
|
||||
{
|
||||
public UmaFileType Type;
|
||||
@@ -14,8 +13,8 @@ public class UmaDatabaseEntry
|
||||
|
||||
public class UmaCharaData
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string tail_model_id { get; set; }
|
||||
public int id;
|
||||
public string tail_model_id;
|
||||
}
|
||||
|
||||
public enum UmaFileType
|
||||
|
||||
@@ -84,11 +84,11 @@ public class UmaDatabaseController
|
||||
{
|
||||
UmaDatabaseEntry entry = new UmaDatabaseEntry()
|
||||
{
|
||||
Type = (UmaFileType)Enum.Parse(typeof(UmaFileType), sqlite_datareader.GetValue(0) as String),
|
||||
Name = sqlite_datareader.GetValue(1) as String,
|
||||
Url = sqlite_datareader.GetValue(2) as String,
|
||||
Checksum = sqlite_datareader.GetInt64(3).ToString(),
|
||||
Prerequisites = sqlite_datareader.GetValue(4) as String
|
||||
Type = (UmaFileType)Enum.Parse(typeof(UmaFileType), sqlite_datareader["m"] as String),
|
||||
Name = sqlite_datareader["n"] as String,
|
||||
Url = sqlite_datareader["h"] as String,
|
||||
Checksum = sqlite_datareader["c"].ToString(),
|
||||
Prerequisites = sqlite_datareader["d"] as String
|
||||
};
|
||||
entries.Add(entry);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class UmaDatabaseController
|
||||
{
|
||||
UmaCharaData entry = new UmaCharaData()
|
||||
{
|
||||
id = sqlite_datareader.GetInt32(0).ToString(),
|
||||
id = sqlite_datareader.GetInt32(0),
|
||||
tail_model_id = sqlite_datareader.GetInt32(1).ToString(),
|
||||
};
|
||||
yield return entry;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Gallop;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -14,7 +15,8 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
|
||||
public List<AssetBundle> Loaded;
|
||||
public List<Shader> ShaderList = new List<Shader>();
|
||||
public Material InvisibleMaterial;
|
||||
public Material TransMaterialCharas;
|
||||
public Material TransMaterialProps;
|
||||
private UmaContainer CurrentContainer;
|
||||
|
||||
public AnimatorOverrideController OverrideController;
|
||||
@@ -62,6 +64,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
height = (string)charaData["height"],
|
||||
socks = (string)charaData["socks"],
|
||||
bust = (string)charaData["bust"],
|
||||
sex = (string)charaData["sex"],
|
||||
costumeIdShort = "";
|
||||
|
||||
UmaDatabaseEntry asset = null;
|
||||
@@ -74,7 +77,12 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
CurrentContainer.VarSkin = skin;
|
||||
CurrentContainer.VarSocks = socks;
|
||||
CurrentContainer.VarHeight = height;
|
||||
string body = UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/pfb_bdy{costumeId}_{height}_{0}_{bust}";
|
||||
//Not sure about the pattern, some models are missing
|
||||
string body = "";
|
||||
if (costumeId.Split('_')[2] == "03")
|
||||
body = UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/pfb_bdy{costumeId}_{sex}_{0}_{(bust == "0"? "1" : bust == "4"? "3" : bust)}";
|
||||
else
|
||||
body = UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/pfb_bdy{costumeId}_{sex}_{0}_{(bust == "0" ? "1" : bust == "4" ? "3" : bust)}";
|
||||
Debug.Log("Looking for " + body);
|
||||
asset = UmaViewerMain.Instance.AbList.FirstOrDefault(a => a.Name == body);
|
||||
}
|
||||
@@ -91,8 +99,8 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
switch (costumeId.Split('_')[0])
|
||||
{
|
||||
case "0001":
|
||||
texPattern1 = $"tex_bdy{costumeIdShort}_00_{skin}_{socks}_0{bust}";
|
||||
texPattern2 = $"tex_bdy{costumeIdShort}_00_0_{socks}_00_";
|
||||
texPattern1 = $"tex_bdy{costumeIdShort}_00_{skin}_{bust}_0{socks}";
|
||||
texPattern2 = $"tex_bdy{costumeIdShort}_00_0_{bust}_00_";
|
||||
break;
|
||||
case "0003":
|
||||
texPattern1 = $"tex_bdy{costumeIdShort}_00_{skin}_{bust}";
|
||||
@@ -147,7 +155,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
asset = UmaViewerMain.Instance.AbList.FirstOrDefault(a => a.Name == tailPfb);
|
||||
if (asset != null)
|
||||
{
|
||||
foreach (var asset1 in UmaViewerMain.Instance.AbList.Where(a => a.Name.StartsWith($"{tailPath}textures/tex_{tailName}_{id}")))
|
||||
foreach (var asset1 in UmaViewerMain.Instance.AbList.Where(a => a.Name.StartsWith($"{tailPath}textures/tex_{tailName}_{id}") || a.Name.StartsWith($"{tailPath}textures/tex_{tailName}_0000")))
|
||||
{
|
||||
RecursiveLoadAsset(asset1);
|
||||
}
|
||||
@@ -169,6 +177,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
height = (string)charaData["height"],
|
||||
socks = (string)charaData["socks"],
|
||||
bust = (string)charaData["bust"],
|
||||
sex = (string)charaData["sex"],
|
||||
costumeIdShort = "";
|
||||
bool customHead = true;
|
||||
|
||||
@@ -251,6 +260,24 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadProp(UmaDatabaseEntry entry)
|
||||
{
|
||||
if (CurrentContainer != null)
|
||||
{
|
||||
Destroy(CurrentContainer);
|
||||
}
|
||||
|
||||
foreach (var bundle in Main.LoadedBundles)
|
||||
{
|
||||
bundle.Value.Unload(true);
|
||||
}
|
||||
Main.LoadedBundles.Clear();
|
||||
UI.LoadedAssetsClear();
|
||||
|
||||
CurrentContainer = new GameObject(Path.GetFileName(entry.Name)).AddComponent<UmaContainer>();
|
||||
RecursiveLoadAsset(entry);
|
||||
}
|
||||
|
||||
private void RecursiveLoadAsset(UmaDatabaseEntry entry)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entry.Prerequisites))
|
||||
@@ -263,7 +290,6 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
LoadAsset(entry);
|
||||
}
|
||||
|
||||
|
||||
public void LoadAsset(UmaDatabaseEntry entry)
|
||||
{
|
||||
Debug.Log("Loading " + entry.Name);
|
||||
@@ -291,12 +317,14 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
if(Main.ShadersLoaded) return;
|
||||
else Main.ShadersLoaded = true;
|
||||
}
|
||||
|
||||
|
||||
foreach (string name in bundle.GetAllAssetNames())
|
||||
{
|
||||
object asset = bundle.LoadAsset(name);
|
||||
if (asset == null) { continue; }
|
||||
if (asset.GetType() == typeof(AnimationClip))
|
||||
Debug.Log(bundle.name + "/" + name + $" ({asset.GetType()})");
|
||||
Type aType = asset.GetType();
|
||||
if (aType == typeof(AnimationClip))
|
||||
{
|
||||
if (CurrentContainer.Body)
|
||||
{
|
||||
@@ -311,7 +339,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
UnloadBundle(bundle, true);
|
||||
}
|
||||
}
|
||||
else if (asset.GetType() == typeof(GameObject))
|
||||
else if (aType == typeof(GameObject))
|
||||
{
|
||||
if (bundle.name.Contains("/head/"))
|
||||
{
|
||||
@@ -327,18 +355,18 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
UnloadBundle(bundle, true);
|
||||
LoadProp(asset as GameObject);
|
||||
}
|
||||
//else if (aaa.GetType() == typeof(FaceDrivenKeyTarget))
|
||||
//{
|
||||
// Debug.LogError(name);
|
||||
//}
|
||||
}
|
||||
else if (asset.GetType() == typeof(Shader))
|
||||
else if (aType == typeof(FaceDrivenKeyTarget))
|
||||
{
|
||||
//CurrentContainer.FaceDrivenKeyTargets.Add(Instantiate(asset as FaceDrivenKeyTarget));
|
||||
}
|
||||
else if (aType == typeof(Shader))
|
||||
{
|
||||
ShaderList.Add(asset as Shader);
|
||||
}
|
||||
else if (asset.GetType() == typeof(Texture2D))
|
||||
else if (aType == typeof(Texture2D))
|
||||
{
|
||||
if (bundle.name.Contains("/mini/head"))
|
||||
{
|
||||
@@ -387,10 +415,10 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
switch (costumeIdShort.Split('_')[0]) //costume ID
|
||||
{
|
||||
case "0001":
|
||||
mainTex = $"tex_bdy{costumeIdShort}_00_{skin}_{socks}_{bust.PadLeft(2, '0')}_diff";
|
||||
toonMap = $"tex_bdy{costumeIdShort}_00_{skin}_{socks}_{bust.PadLeft(2, '0')}_shad_c";
|
||||
tripleMap = $"tex_bdy{costumeIdShort}_00_0_{socks}_00_base";
|
||||
optionMap = $"tex_bdy{costumeIdShort}_00_0_{socks}_00_ctrl";
|
||||
mainTex = $"tex_bdy{costumeIdShort}_00_{skin}_{bust}_{socks.PadLeft(2, '0')}_diff";
|
||||
toonMap = $"tex_bdy{costumeIdShort}_00_{skin}_{bust}_{socks.PadLeft(2, '0')}_shad_c";
|
||||
tripleMap = $"tex_bdy{costumeIdShort}_00_0_{bust}_00_base";
|
||||
optionMap = $"tex_bdy{costumeIdShort}_00_0_{bust}_00_ctrl";
|
||||
break;
|
||||
case "0003":
|
||||
mainTex = $"tex_bdy{costumeIdShort}_00_{skin}_{bust}_diff";
|
||||
@@ -456,7 +484,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
if (r.name == "M_Cheek")
|
||||
{
|
||||
m.CopyPropertiesFromMaterial(InvisibleMaterial);
|
||||
m.CopyPropertiesFromMaterial(TransMaterialCharas);
|
||||
m.SetTexture("_MainTex", CurrentContainer.MiniHeadTextures.First(t => t.name.Contains("cheek")));
|
||||
}
|
||||
if (r.name == "M_Mouth")
|
||||
@@ -477,7 +505,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
switch (m.shader.name)
|
||||
{
|
||||
case "Gallop/3D/Chara/MultiplyCheek":
|
||||
m.CopyPropertiesFromMaterial(InvisibleMaterial);
|
||||
m.CopyPropertiesFromMaterial(TransMaterialCharas);
|
||||
break;
|
||||
case "Gallop/3D/Chara/ToonEye/T":
|
||||
case "Nars/UmaMusume/Eyes":
|
||||
@@ -505,6 +533,11 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//foreach (var anim in Main.AbList.Where(a => a.Name.StartsWith("3d/chara/head/chr0001_00/facial/")))
|
||||
//{
|
||||
// RecursiveLoadAsset(anim);
|
||||
//}
|
||||
}
|
||||
|
||||
private void LoadTail(GameObject gameObject)
|
||||
@@ -526,7 +559,20 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
void UnloadBundle(AssetBundle bundle, bool unloadAllObjects)
|
||||
private void LoadProp(GameObject go)
|
||||
{
|
||||
var prop = Instantiate(go, CurrentContainer.transform);
|
||||
foreach (Renderer r in prop.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
{
|
||||
//Shaders can be differentiated by checking m.shader.name
|
||||
m.shader = Shader.Find("Unlit/Transparent Cutout");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UnloadBundle(AssetBundle bundle, bool unloadAllObjects)
|
||||
{
|
||||
var entry = Main.LoadedBundles.FirstOrDefault(b=>b.Value == bundle);
|
||||
if (entry.Key != null)
|
||||
|
||||
@@ -47,7 +47,8 @@ public class UmaViewerMain : MonoBehaviour
|
||||
|
||||
UI.LoadModelPanels();
|
||||
UI.LoadMiniModelPanels();
|
||||
|
||||
UI.LoadPropPanel();
|
||||
UI.LoadMapPanel();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,12 @@ public class UmaViewerUI : MonoBehaviour
|
||||
public ScrollRect MiniCostumeList;
|
||||
public ScrollRect MiniAnimationSetList;
|
||||
public ScrollRect MiniAnimationList;
|
||||
//other
|
||||
public ScrollRect PropList;
|
||||
public ScrollRect SceneList;
|
||||
|
||||
//settings
|
||||
public TMPro.TMP_InputField SSWidth, SSHeight;
|
||||
|
||||
public List<GameObject> TogglablePanels = new List<GameObject>();
|
||||
|
||||
@@ -39,7 +45,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
|
||||
public void HighlightChildImage(Transform mainObject, Image child)
|
||||
{
|
||||
Debug.Log("Looking for " + child.name + " in " + mainObject.name);
|
||||
//Debug.Log("Looking for " + child.name + " in " + mainObject.name);
|
||||
foreach(var t in mainObject.GetComponentsInChildren<Image>())
|
||||
{
|
||||
if (t.transform.parent != mainObject) continue;
|
||||
@@ -125,6 +131,36 @@ public class UmaViewerUI : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadPropPanel()
|
||||
{
|
||||
foreach (var prop in Main.AbList.Where(a=>a.Name.Contains("pfb_chr_prop") && !a.Name.Contains("clothes")))
|
||||
{
|
||||
var propInstance = prop;
|
||||
var container = Instantiate(UmaContainerPrefab, PropList.content).GetComponent<UmaUIContainer>();
|
||||
container.Name.text = container.name = Path.GetFileName(prop.Name);
|
||||
var imageInstance1 = container.GetComponent<Image>();
|
||||
container.Button.onClick.AddListener(() => {
|
||||
HighlightChildImage(PropList.content, imageInstance1);
|
||||
Builder.LoadProp(propInstance);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadMapPanel()
|
||||
{
|
||||
foreach (var scene in Main.AbList.Where(a => a.Name.StartsWith("3d/env") && Path.GetFileName(a.Name).StartsWith("pfb_")))
|
||||
{
|
||||
var sceneInstance = scene;
|
||||
var container = Instantiate(UmaContainerPrefab, SceneList.content).GetComponent<UmaUIContainer>();
|
||||
container.Name.text = container.name = Path.GetFileName(scene.Name);
|
||||
var imageInstance1 = container.GetComponent<Image>();
|
||||
container.Button.onClick.AddListener(() => {
|
||||
HighlightChildImage(SceneList.content, imageInstance1);
|
||||
Builder.LoadProp(sceneInstance);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void ListCostumes(int umaId, bool mini)
|
||||
{
|
||||
ScrollRect costumeList = mini ? MiniCostumeList : CostumeList;
|
||||
@@ -138,7 +174,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
var container = Instantiate(UmaContainerPrefab, costumeList.content).GetComponent<UmaUIContainer>();
|
||||
string[] split = entry.Name.Split('_');
|
||||
string costumeId = split[split.Length - 1];
|
||||
container.Name.text = container.name = costumeId;
|
||||
container.Name.text = container.name = GetCostumeName(costumeId);
|
||||
container.Button.onClick.AddListener(() => {
|
||||
HighlightChildImage(costumeList.content, container.GetComponent<Image>());
|
||||
StartCoroutine(Builder.LoadUma(umaId, costumeId, mini));
|
||||
@@ -154,8 +190,9 @@ public class UmaViewerUI : MonoBehaviour
|
||||
if (!costumes.Contains(id))
|
||||
{
|
||||
costumes.Add(id);
|
||||
string costumeId = id;
|
||||
var container = Instantiate(UmaContainerPrefab, costumeList.content).GetComponent<UmaUIContainer>();
|
||||
string costumeId = container.Name.text = container.name = id;
|
||||
container.Name.text = container.name = GetCostumeName(id);
|
||||
container.Button.onClick.AddListener(() => {
|
||||
HighlightChildImage(costumeList.content, container.GetComponent<Image>());
|
||||
StartCoroutine(Builder.LoadUma(umaId, costumeId, mini));
|
||||
@@ -164,6 +201,43 @@ public class UmaViewerUI : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetCostumeName(string costumeId)
|
||||
{
|
||||
switch (costumeId)
|
||||
{
|
||||
case "00":
|
||||
return "Default";
|
||||
case "90":
|
||||
return "Upgraded";
|
||||
case "0001_00_01":
|
||||
return "Race Shorts";
|
||||
case "0001_00_02":
|
||||
return "Race Bloomers";
|
||||
case "0002_00_00":
|
||||
return "School Short Sleeves";
|
||||
case "0002_00_03":
|
||||
return "School Short Sleeves Big Belly";
|
||||
case "0002_01_00":
|
||||
return "School Long Sleeves";
|
||||
case "0002_01_03":
|
||||
return "School Long Sleeves Big Belly";
|
||||
case "0003_00_01":
|
||||
return "Tracksuit Shorts";
|
||||
case "0003_00_02":
|
||||
return "Tracksuit Bloomers";
|
||||
case "0003_01_01":
|
||||
return "Tracksuit Long Pants";
|
||||
case "0003_01_02":
|
||||
return "Tracksuit Rolled Up Pants";
|
||||
case "0004_00_00":
|
||||
return "Swimsuit";
|
||||
case "0004_01_00":
|
||||
return "Towel";
|
||||
default:
|
||||
return costumeId;
|
||||
}
|
||||
}
|
||||
|
||||
void ListAnimations(int umaId, bool mini)
|
||||
{
|
||||
ScrollRect animationList = mini ? MiniAnimationList : AnimationList;
|
||||
@@ -217,4 +291,21 @@ public class UmaViewerUI : MonoBehaviour
|
||||
panel.SetActive(panel == go);
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeBackground(int index)
|
||||
{
|
||||
if(index == 0)
|
||||
{
|
||||
Camera.main.clearFlags = CameraClearFlags.Skybox;
|
||||
}
|
||||
else
|
||||
{
|
||||
Camera.main.clearFlags = CameraClearFlags.SolidColor;
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeBackgroundColor(Color color)
|
||||
{
|
||||
Camera.main.backgroundColor = color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class AssetTable
|
||||
[System.Serializable]
|
||||
public class AssetTableValue
|
||||
{
|
||||
public List<StringValuePair> i;
|
||||
public List<StringValuePair> list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user