initial commit
This commit is contained in:
@@ -0,0 +1,284 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CameraOrbit : MonoBehaviour
|
||||
{
|
||||
public int CameraMode = 0;
|
||||
|
||||
[Header("Light")]
|
||||
public GameObject Light;
|
||||
|
||||
public Dropdown CameraModeDropdown;
|
||||
|
||||
public GameObject CameraTargetHelper;
|
||||
public Vector3 TargetCenter;
|
||||
|
||||
EventSystem eventSystem;
|
||||
bool controlOn;
|
||||
|
||||
|
||||
[Header("Orbit Camera")]
|
||||
public GameObject OrbitCamSettingsTab;
|
||||
public Slider OrbitCamFovSlider;
|
||||
public Slider OrbitCamZoomSlider;
|
||||
public Slider OrbitCamZoomSpeedSlider;
|
||||
public Slider OrbitCamTargetHeightSlider;
|
||||
public Slider OrbitCamHeightSlider;
|
||||
public Slider OrbitCamSpeedSlider;
|
||||
float camDistMin = 1, camDistMax = 15;
|
||||
|
||||
[Header("Free Camera")]
|
||||
public GameObject FreeCamSettingsTab;
|
||||
public Slider FreeCamFovSlider;
|
||||
public Slider FreeCamMoveSpeedSlider;
|
||||
public Slider FreeCamRotateSpeedSlider;
|
||||
bool FreeCamLeft = false;
|
||||
bool FreeCamRight = false;
|
||||
private Quaternion lookRotation;
|
||||
|
||||
void Start()
|
||||
{
|
||||
OrbitCamZoomSlider.minValue = camDistMin;
|
||||
OrbitCamZoomSlider.maxValue = camDistMax;
|
||||
|
||||
eventSystem = EventSystem.current;
|
||||
|
||||
lookRotation = transform.localRotation;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if(CameraMode != CameraModeDropdown.value)
|
||||
{
|
||||
switch (CameraMode) //old
|
||||
{
|
||||
case 0:
|
||||
OrbitCamSettingsTab.SetActive(false);
|
||||
break;
|
||||
case 1:
|
||||
FreeCamSettingsTab.SetActive(false);
|
||||
break;
|
||||
}
|
||||
switch (CameraModeDropdown.value) //new
|
||||
{
|
||||
case 0:
|
||||
OrbitCamSettingsTab.SetActive(true);
|
||||
break;
|
||||
case 1:
|
||||
FreeCamSettingsTab.SetActive(true);
|
||||
lookRotation.y = transform.eulerAngles.y;
|
||||
break;
|
||||
}
|
||||
CameraMode = CameraModeDropdown.value;
|
||||
}
|
||||
#if UNITY_ANDROID
|
||||
switch (CameraModeDropdown.value)
|
||||
{
|
||||
case 0:
|
||||
MobileOrbitAround();
|
||||
MobileOrbitLight();
|
||||
break;
|
||||
case 1:
|
||||
MobileOrbitAround(true);
|
||||
MobileOrbitLight();
|
||||
break;
|
||||
case 2: FreeCamera(); break;
|
||||
}
|
||||
#else
|
||||
switch (CameraModeDropdown.value)
|
||||
{
|
||||
case 0:
|
||||
OrbitAround();
|
||||
OrbitLight();
|
||||
break;
|
||||
case 1: FreeCamera(); break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#region PC controls
|
||||
/// <summary>
|
||||
/// Rotate Light Source
|
||||
/// </summary>
|
||||
private void OrbitLight()
|
||||
{
|
||||
if (Input.GetMouseButton(1))
|
||||
{
|
||||
Light.transform.Rotate(Input.GetAxis("Mouse X") * Vector3.up, Space.Self);
|
||||
Light.transform.Rotate(Input.GetAxis("Mouse Y") * Vector3.right, Space.Self);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Orbit camera around world center
|
||||
/// </summary>
|
||||
void OrbitAround(bool aroundCharacter = false)
|
||||
{
|
||||
TargetCenter = Vector3.zero;
|
||||
|
||||
Camera.main.fieldOfView = OrbitCamFovSlider.value;
|
||||
Vector3 position = transform.position;
|
||||
|
||||
if (Input.GetMouseButtonDown(0) && !eventSystem.IsPointerOverGameObject())
|
||||
{
|
||||
controlOn = true;
|
||||
}
|
||||
if (Input.GetMouseButton(0) && controlOn)
|
||||
{
|
||||
position -= Input.GetAxis("Mouse X") * transform.right * OrbitCamSpeedSlider.value;
|
||||
OrbitCamZoomSlider.value -= Input.mouseScrollDelta.y * OrbitCamZoomSpeedSlider.value;
|
||||
OrbitCamHeightSlider.value -= Input.GetAxis("Mouse Y") * OrbitCamSpeedSlider.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
controlOn = false;
|
||||
}
|
||||
|
||||
if ((Input.GetMouseButtonDown(2) || Input.GetKeyDown(KeyCode.LeftControl)) && !eventSystem.IsPointerOverGameObject())
|
||||
{
|
||||
CameraTargetHelper.SetActive(true);
|
||||
}
|
||||
if ((Input.GetMouseButton(2) || Input.GetKey(KeyCode.LeftControl)) && CameraTargetHelper.activeSelf)
|
||||
{
|
||||
OrbitCamTargetHeightSlider.value -= Input.GetAxis("Mouse Y");
|
||||
CameraTargetHelper.transform.position = OrbitCamTargetHeightSlider.value * Vector3.up;
|
||||
}
|
||||
if (Input.GetMouseButtonUp(2) || Input.GetKeyUp(KeyCode.LeftControl))
|
||||
{
|
||||
CameraTargetHelper.SetActive(false);
|
||||
}
|
||||
|
||||
float camDist = OrbitCamZoomSlider.value;
|
||||
OrbitCamHeightSlider.maxValue = camDist + 1 - camDist * 0.2f;
|
||||
OrbitCamHeightSlider.minValue = -camDist + 1 + camDist * 0.2f;
|
||||
|
||||
Vector3 target = TargetCenter + OrbitCamTargetHeightSlider.value * Vector3.up; //set target offsets
|
||||
|
||||
position.y = TargetCenter.y + OrbitCamHeightSlider.value; //set camera height
|
||||
transform.position = position; //set final position of camera at target
|
||||
transform.LookAt(target); //look at target position
|
||||
transform.position = target - transform.forward * camDist; //move away from target
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Free Camera, Unity-Style
|
||||
/// </summary>
|
||||
void FreeCamera()
|
||||
{
|
||||
Camera.main.fieldOfView = FreeCamFovSlider.value;
|
||||
float moveSpeed = FreeCamMoveSpeedSlider.value;
|
||||
float rotateSpeed = FreeCamRotateSpeedSlider.value;
|
||||
|
||||
if (Input.GetMouseButtonDown(0) && !eventSystem.IsPointerOverGameObject())
|
||||
{
|
||||
FreeCamLeft = true;
|
||||
}
|
||||
if (Input.GetMouseButton(0) && FreeCamLeft)
|
||||
{
|
||||
transform.position += Input.GetAxis("Vertical") * transform.forward * Time.deltaTime * moveSpeed;
|
||||
transform.position += Input.GetAxis("Horizontal") * transform.right * Time.deltaTime * moveSpeed;
|
||||
|
||||
lookRotation.x -= Input.GetAxis("Mouse Y") * rotateSpeed;
|
||||
lookRotation.y += Input.GetAxis("Mouse X") * rotateSpeed;
|
||||
|
||||
lookRotation.x = Mathf.Clamp(lookRotation.x, -90, 90);
|
||||
|
||||
transform.localRotation = Quaternion.Euler(lookRotation.x, lookRotation.y, lookRotation.z);
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeCamLeft = false;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonDown(1) && !eventSystem.IsPointerOverGameObject())
|
||||
{
|
||||
FreeCamRight = true;
|
||||
}
|
||||
if (Input.GetMouseButton(1) && FreeCamRight)
|
||||
{
|
||||
transform.position += Input.GetAxis("Mouse X") * transform.right * Time.deltaTime * moveSpeed;
|
||||
transform.position += Input.GetAxis("Mouse Y") * transform.up * Time.deltaTime * moveSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeCamRight = false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Mobile Controls
|
||||
Vector3 mouseBasePos = Vector3.zero;
|
||||
|
||||
/// <summary>
|
||||
/// Rotate Light Source
|
||||
/// </summary>
|
||||
private void MobileOrbitLight()
|
||||
{
|
||||
return;
|
||||
if (Input.touchCount == 2 && !eventSystem.IsPointerOverGameObject(Input.touches[0].fingerId) && !eventSystem.IsPointerOverGameObject(Input.touches[1].fingerId))
|
||||
{
|
||||
Light.transform.Rotate(Input.GetAxis("Mouse X") * Vector3.up, Space.Self);
|
||||
Light.transform.Rotate(Input.GetAxis("Mouse Y") * Vector3.right, Space.Self);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Orbit camera around world center
|
||||
/// </summary>
|
||||
void MobileOrbitAround(bool aroundCharacter = false)
|
||||
{
|
||||
TargetCenter = Vector3.zero;
|
||||
|
||||
Camera.main.fieldOfView = OrbitCamFovSlider.value;
|
||||
Vector3 position = transform.position;
|
||||
|
||||
if (Input.GetMouseButtonDown(0) && !eventSystem.IsPointerOverGameObject(0))
|
||||
{
|
||||
mouseBasePos = Input.mousePosition;
|
||||
controlOn = true;
|
||||
}
|
||||
if (Input.touchCount==1 && controlOn)
|
||||
{
|
||||
position -= (Input.mousePosition - mouseBasePos).x * 0.001f * transform.right * OrbitCamSpeedSlider.value;
|
||||
OrbitCamHeightSlider.value -= (Input.mousePosition - mouseBasePos).y * 0.001f * OrbitCamSpeedSlider.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouseBasePos = Vector3.zero;
|
||||
controlOn = false;
|
||||
}
|
||||
|
||||
if (Input.touchCount == 2)
|
||||
{
|
||||
Touch touchZero = Input.GetTouch(0);
|
||||
Touch touchOne = Input.GetTouch(1);
|
||||
|
||||
Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition;
|
||||
Vector2 touchOnePrevPos = touchOne.position - touchOne.deltaPosition;
|
||||
|
||||
float prevMagnitude = (touchZeroPrevPos - touchOnePrevPos).magnitude;
|
||||
float currentMagnitude = (touchZero.position - touchOne.position).magnitude;
|
||||
|
||||
float difference = currentMagnitude - prevMagnitude;
|
||||
|
||||
OrbitCamZoomSlider.value -= difference * 0.01f * OrbitCamZoomSpeedSlider.value;
|
||||
}
|
||||
|
||||
float camDist = OrbitCamZoomSlider.value;
|
||||
OrbitCamHeightSlider.maxValue = camDist + 1 - camDist * 0.2f;
|
||||
OrbitCamHeightSlider.minValue = -camDist + 1 + camDist * 0.2f;
|
||||
|
||||
Vector3 target = TargetCenter + OrbitCamTargetHeightSlider.value * Vector3.up; //set target offsets
|
||||
|
||||
position.y = TargetCenter.y + OrbitCamHeightSlider.value; //set camera height
|
||||
transform.position = position; //set final position of camera at target
|
||||
transform.LookAt(target); //look at target position
|
||||
transform.position = target - transform.forward * camDist; //move away from target
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32a48605970827e4999f4dd7807a5eac
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,52 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class HeadTracker : MonoBehaviour
|
||||
{
|
||||
//bool HorseLoaded = false;
|
||||
//public Transform HeadNeck, HeadHead, HorseNeck, HorseHead;
|
||||
|
||||
//private void Start()
|
||||
//{
|
||||
// HeadHead = FindBoneInChildren(transform, "Head");
|
||||
// HeadNeck = FindBoneInChildren(transform, "Neck");
|
||||
//}
|
||||
|
||||
//private void LateUpdate()
|
||||
//{
|
||||
// if (UmaViewerBuilder.Instance.Body != null)
|
||||
// {
|
||||
// if (HorseHead == null)
|
||||
// {
|
||||
// HorseHead = FindBoneInChildren(UmaViewerBuilder.Instance.Body.transform, "Head");
|
||||
// }
|
||||
// if (HorseNeck == null)
|
||||
// {
|
||||
// HorseNeck = FindBoneInChildren(UmaViewerBuilder.Instance.Body.transform, "Neck");
|
||||
// }
|
||||
|
||||
// HeadNeck.transform.position = HorseNeck.transform.position;
|
||||
// HeadNeck.transform.rotation = HorseNeck.transform.rotation;
|
||||
// HeadHead.transform.position = HorseHead.transform.position;
|
||||
// HeadHead.transform.rotation = HorseHead.transform.rotation;
|
||||
// }
|
||||
//}
|
||||
|
||||
//public Transform FindBoneInChildren(Transform trans, string name)
|
||||
//{
|
||||
// foreach (Transform t in trans)
|
||||
// {
|
||||
// if (t.name == name)
|
||||
// {
|
||||
// return t;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Transform candidate = FindBoneInChildren(t, name);
|
||||
// if (candidate != null) return candidate;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
//}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c2f066ae47d0204dbce3393e36aa22f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SliderDisplay : MonoBehaviour
|
||||
{
|
||||
public void UpdateDisplay(float value)
|
||||
{
|
||||
this.GetComponent<Text>().text = value.ToString("F2");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da09db22068c39445a2454d09ac5b09c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d93296fcef016c42bf9112d78907ff1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UmaUIContainer : MonoBehaviour
|
||||
{
|
||||
public TMPro.TextMeshProUGUI Name;
|
||||
public Button Button;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 908bc558174093149b89e5c25c1be244
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,48 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class UIElementDragger : EventTrigger
|
||||
{
|
||||
private bool dragging;
|
||||
public Transform alsoDrag;
|
||||
public Vector3 alsoDragOffset = Vector3.zero;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
alsoDrag = transform.parent.GetChild(0);
|
||||
if (alsoDrag)
|
||||
{
|
||||
alsoDragOffset = transform.position - alsoDrag.position;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (dragging)
|
||||
{
|
||||
transform.position = new Vector2(Mathf.Clamp(Input.mousePosition.x, 10, Screen.width-10), Mathf.Clamp(Input.mousePosition.y, 10, Screen.height-10));
|
||||
if (alsoDrag)
|
||||
{
|
||||
alsoDrag.position = transform.position - alsoDragOffset;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.position = new Vector2(Mathf.Clamp(transform.position.x, 10, Screen.width - 10), Mathf.Clamp(transform.position.y, 10, Screen.height - 10));
|
||||
if (alsoDrag)
|
||||
{
|
||||
alsoDrag.position = transform.position - alsoDragOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
dragging = true;
|
||||
}
|
||||
|
||||
public override void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
dragging = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cabaf29aa96c5f44d807cc8c0e1996d7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UmaContainer : MonoBehaviour
|
||||
{
|
||||
public Transform UmaNeckBone;
|
||||
public Transform UmaHeadBone;
|
||||
public Transform HeadNeckBone;
|
||||
public Transform HeadHeadBone;
|
||||
public GameObject Body;
|
||||
public GameObject Tail;
|
||||
public List<Texture2D> TailTextures = new List<Texture2D>();
|
||||
public GameObject Head;
|
||||
public Animator UmaAnimator;
|
||||
public AnimatorOverrideController OverrideController;
|
||||
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (Body != null && Head != null)
|
||||
{
|
||||
if (UmaNeckBone == null) UmaNeckBone = FindBoneInChildren(Body.transform, "Neck");
|
||||
if (UmaHeadBone == null) UmaHeadBone = FindBoneInChildren(Body.transform, "Head");
|
||||
if (HeadNeckBone == null) HeadNeckBone = FindBoneInChildren(Head.transform, "Neck");
|
||||
if (HeadHeadBone == null) HeadHeadBone = FindBoneInChildren(Head.transform, "Head");
|
||||
HeadNeckBone.transform.SetPositionAndRotation(UmaNeckBone.position, UmaNeckBone.rotation);
|
||||
HeadHeadBone.transform.SetPositionAndRotation(UmaHeadBone.position, UmaHeadBone.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
public static Transform FindBoneInChildren(Transform trans, string name)
|
||||
{
|
||||
foreach (Transform t in trans)
|
||||
{
|
||||
if (t.name == name)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
else
|
||||
{
|
||||
Transform candidate = FindBoneInChildren(t, name);
|
||||
if (candidate != null) return candidate;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23381f145fc0db543b2702e49f4bfe28
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb61b19e3bc5dd2429a5394d0be856f2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
//DO NOT SERIALIZE OR FPS DIES
|
||||
public class UmaDatabaseEntry
|
||||
{
|
||||
public UmaFileType Type;
|
||||
public string Name;
|
||||
public string Url;
|
||||
public string Checksum;
|
||||
public string Prerequisites;
|
||||
}
|
||||
|
||||
public class UmaCharaData
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string tail_model_id { get; set; }
|
||||
}
|
||||
|
||||
public enum UmaFileType
|
||||
{
|
||||
_3d_cutt,
|
||||
announce,
|
||||
atlas,
|
||||
bg,
|
||||
chara,
|
||||
font,
|
||||
gacha,
|
||||
gachaselect,
|
||||
guide,
|
||||
home,
|
||||
imageeffect,
|
||||
item,
|
||||
lipsync,
|
||||
live,
|
||||
loginbonus,
|
||||
manifest,
|
||||
manifest2,
|
||||
manifest3,
|
||||
master,
|
||||
minigame,
|
||||
mob,
|
||||
movie,
|
||||
outgame,
|
||||
paddock,
|
||||
race,
|
||||
shader,
|
||||
single,
|
||||
sound,
|
||||
story,
|
||||
storyevent,
|
||||
supportcard,
|
||||
uianimation,
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4513d438d8cfd83409d651c5ebb06172
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,117 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Mono.Data.Sqlite;
|
||||
using System.IO;
|
||||
|
||||
public class UmaDatabaseController
|
||||
{
|
||||
private static UmaDatabaseController instance;
|
||||
|
||||
/// <summary>
|
||||
/// Database Loader instance
|
||||
/// </summary>
|
||||
public static UmaDatabaseController Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new UmaDatabaseController();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// https://prd-storage-umamusume.akamaized.net/dl/resources/
|
||||
/// </summary>
|
||||
public static string ServerUrl = "https://prd-storage-umamusume.akamaized.net/dl/resources/";
|
||||
/// <summary>
|
||||
/// Android/assetbundles/
|
||||
/// </summary>
|
||||
public static string AssetUrl = "Windows/assetbundles/";
|
||||
/// <summary>
|
||||
/// 3d/chara/body/
|
||||
/// </summary>
|
||||
public static string BodyPath = "3d/chara/body/";
|
||||
/// <summary>
|
||||
/// 3d/chara/head/
|
||||
/// </summary>
|
||||
public static string HeadPath = "3d/chara/head/";
|
||||
/// <summary>
|
||||
/// 3d/motion/event/body/
|
||||
/// </summary>
|
||||
public static string MotionPath = "3d/motion/";
|
||||
public IEnumerable<UmaDatabaseEntry> MetaEntries;
|
||||
public IEnumerable<UmaCharaData> CharaData;
|
||||
|
||||
/// <summary>
|
||||
/// Meta Database Connection
|
||||
/// </summary>
|
||||
private SqliteConnection metaDb;
|
||||
/// <summary>
|
||||
/// Master Database Connection
|
||||
/// </summary>
|
||||
private SqliteConnection masterDb;
|
||||
|
||||
/// <summary>
|
||||
/// Loads the file database
|
||||
/// </summary>
|
||||
public UmaDatabaseController()
|
||||
{
|
||||
metaDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\meta;");
|
||||
metaDb.Open();
|
||||
MetaEntries = ReadMeta(metaDb);
|
||||
Debug.Log("1");
|
||||
masterDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\master\master.mdb;");
|
||||
masterDb.Open();
|
||||
CharaData = ReadMaster(masterDb);
|
||||
Debug.Log("2");
|
||||
}
|
||||
|
||||
static IEnumerable<UmaDatabaseEntry> ReadMeta(SqliteConnection conn)
|
||||
{
|
||||
List<UmaDatabaseEntry> entries = new List<UmaDatabaseEntry>();
|
||||
SqliteCommand sqlite_cmd = conn.CreateCommand();
|
||||
sqlite_cmd.CommandText = "SELECT m,n,h,c,d FROM a";
|
||||
SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader();
|
||||
while (sqlite_datareader.Read())
|
||||
{
|
||||
try
|
||||
{
|
||||
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
|
||||
};
|
||||
entries.Add(entry);
|
||||
}
|
||||
catch(Exception e) { Debug.LogError("Error caught: " + e); }
|
||||
}
|
||||
return entries;
|
||||
//conn.Close();
|
||||
}
|
||||
|
||||
static IEnumerable<UmaCharaData> ReadMaster(SqliteConnection conn)
|
||||
{
|
||||
SqliteCommand sqlite_cmd = conn.CreateCommand();
|
||||
sqlite_cmd.CommandText = "SELECT id,tail_model_id FROM chara_data";
|
||||
SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader();
|
||||
while (sqlite_datareader.Read())
|
||||
{
|
||||
UmaCharaData entry = new UmaCharaData()
|
||||
{
|
||||
id = sqlite_datareader.GetInt32(0).ToString(),
|
||||
tail_model_id = sqlite_datareader.GetInt32(1).ToString(),
|
||||
};
|
||||
yield return entry;
|
||||
}
|
||||
//conn.Close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b5ed8b3f660c8a4c879b40805d80877
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,272 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class UmaViewerBuilder : MonoBehaviour
|
||||
{
|
||||
public static UmaViewerBuilder Instance;
|
||||
UmaViewerMain Main => UmaViewerMain.Instance;
|
||||
|
||||
public List<AssetBundle> Loaded;
|
||||
public List<Shader> ShaderList = new List<Shader>();
|
||||
public Material InvisibleMaterial;
|
||||
private UmaContainer CurrentContainer;
|
||||
|
||||
public AnimatorOverrideController OverrideController;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public IEnumerator LoadUma(int id, string costumeId)
|
||||
{
|
||||
if(CurrentContainer != null)
|
||||
{
|
||||
Destroy(CurrentContainer);
|
||||
}
|
||||
CurrentContainer = new GameObject($"{id}_{costumeId}").AddComponent<UmaContainer>();
|
||||
|
||||
foreach (var bundle in Main.LoadedBundles)
|
||||
{
|
||||
bundle.Value.Unload(true);
|
||||
}
|
||||
Main.LoadedBundles.Clear();
|
||||
|
||||
yield return UmaViewerDownload.DownloadText($"https://www.tracenacademy.com/api/CharaData/{id}", txt =>
|
||||
{
|
||||
Debug.Log(txt);
|
||||
|
||||
string body = UmaDatabaseController.BodyPath + $"bdy{id}_{costumeId}/pfb_bdy{id}_{costumeId}";
|
||||
UmaDatabaseEntry asset = UmaViewerMain.Instance.AbList.FirstOrDefault(a => a.Name == body);
|
||||
if (asset == null)
|
||||
{
|
||||
Debug.LogError("No body, can't load!");
|
||||
return;
|
||||
}
|
||||
RecursiveLoadAsset(asset);
|
||||
|
||||
string head = UmaDatabaseController.HeadPath + $"chr{id}_{costumeId}/pfb_chr{id}_{costumeId}";
|
||||
asset = UmaViewerMain.Instance.AbList.FirstOrDefault(a => a.Name == head);
|
||||
if (asset != null)
|
||||
{
|
||||
//Load Hair Textures
|
||||
foreach (var asset1 in UmaViewerMain.Instance.AbList.Where(a => a.Name.StartsWith($"{UmaDatabaseController.HeadPath}chr{id}_{costumeId}/textures")))
|
||||
{
|
||||
RecursiveLoadAsset(asset1);
|
||||
}
|
||||
//Load Hair
|
||||
RecursiveLoadAsset(asset);
|
||||
}
|
||||
|
||||
int tailId = (int)JObject.Parse(txt)["tailModelId"];
|
||||
if(tailId != 0)
|
||||
{
|
||||
string tailName = $"tail{tailId.ToString().PadLeft(4, '0')}_00";
|
||||
string tailPath = $"3d/chara/tail/{tailName}/";
|
||||
string tailPfb = tailPath + $"pfb_{tailName}";
|
||||
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}")))
|
||||
{
|
||||
RecursiveLoadAsset(asset1);
|
||||
}
|
||||
RecursiveLoadAsset(asset);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("no tail");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void RecursiveLoadAsset(UmaDatabaseEntry entry)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entry.Prerequisites))
|
||||
{
|
||||
foreach (string prerequisite in entry.Prerequisites.Split(';'))
|
||||
{
|
||||
RecursiveLoadAsset(Main.AbList.FirstOrDefault(ab => ab.Name == prerequisite));
|
||||
}
|
||||
}
|
||||
LoadAsset(entry);
|
||||
}
|
||||
|
||||
|
||||
public void LoadAsset(UmaDatabaseEntry entry)
|
||||
{
|
||||
Debug.Log("Loading " + entry.Name);
|
||||
if (Main.LoadedBundles.ContainsKey(entry.Name)) return;
|
||||
|
||||
string filePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\\Cygames\\umamusume\\dat\\{entry.Url.Substring(0, 2)}\\{entry.Url}";
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
AssetBundle bundle = AssetBundle.LoadFromFile(filePath);
|
||||
if (bundle == null)
|
||||
{
|
||||
Debug.Log(filePath + " exists and doesn't work");
|
||||
return;
|
||||
}
|
||||
Main.LoadedBundles.Add(entry.Name, bundle);
|
||||
LoadBundle(bundle);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadBundle(AssetBundle bundle)
|
||||
{
|
||||
if (bundle.name == "shader.a")
|
||||
{
|
||||
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))
|
||||
{
|
||||
if (CurrentContainer.Body)
|
||||
{
|
||||
AnimationClip bbb = asset as AnimationClip;
|
||||
bbb.wrapMode = WrapMode.Loop;
|
||||
CurrentContainer.OverrideController["clip"] = bbb;
|
||||
CurrentContainer.UmaAnimator.Play("clip");
|
||||
UnloadBundle(bundle, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
UnloadBundle(bundle, true);
|
||||
}
|
||||
}
|
||||
else if (asset.GetType() == typeof(GameObject))
|
||||
{
|
||||
if (bundle.name.Contains("/head/"))
|
||||
{
|
||||
LoadHead(asset as GameObject);
|
||||
}
|
||||
else if (bundle.name.Contains("/body/"))
|
||||
{
|
||||
LoadBody(bundle.name, asset as GameObject);
|
||||
}
|
||||
else if (bundle.name.Contains("/tail/"))
|
||||
{
|
||||
LoadTail(asset as GameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
UnloadBundle(bundle, true);
|
||||
}
|
||||
//else if (aaa.GetType() == typeof(FaceDrivenKeyTarget))
|
||||
//{
|
||||
// Debug.LogError(name);
|
||||
//}
|
||||
}
|
||||
else if (asset.GetType() == typeof(Shader))
|
||||
{
|
||||
ShaderList.Add(asset as Shader);
|
||||
}
|
||||
else if (asset.GetType() == typeof(Texture2D))
|
||||
{
|
||||
if (bundle.name.Contains("/tail/"))
|
||||
{
|
||||
CurrentContainer.TailTextures.Add(asset as Texture2D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadBody(string bundleName, GameObject go)
|
||||
{
|
||||
string umaID = "";
|
||||
string[] nameSplit = bundleName.Split(new char[] { '/', '_' });
|
||||
foreach (string s in nameSplit)
|
||||
{
|
||||
if (s.Contains("bdy"))
|
||||
{
|
||||
umaID = s.Substring(s.Length - 4, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CurrentContainer.Body = Instantiate(go, CurrentContainer.transform);
|
||||
CurrentContainer.UmaAnimator = CurrentContainer.Body.GetComponent<Animator>();
|
||||
CurrentContainer.UmaAnimator.runtimeAnimatorController = CurrentContainer.OverrideController = Instantiate(OverrideController);
|
||||
|
||||
foreach (Renderer r in CurrentContainer.Body.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
{
|
||||
m.shader = Shader.Find("Nars/UmaMusume/Body");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadHead(GameObject go)
|
||||
{
|
||||
CurrentContainer.Head = Instantiate(go, CurrentContainer.transform);
|
||||
|
||||
foreach (Renderer r in CurrentContainer.Head.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
{
|
||||
switch (m.shader.name)
|
||||
{
|
||||
case "Gallop/3D/Chara/MultiplyCheek":
|
||||
m.CopyPropertiesFromMaterial(InvisibleMaterial);
|
||||
break;
|
||||
case "Gallop/3D/Chara/ToonEye/T":
|
||||
case "Nars/UmaMusume/Eyes":
|
||||
m.shader = Shader.Find("Nars/UmaMusume/Eyes");
|
||||
break;
|
||||
case "Gallop/3D/Chara/ToonFace/TSER":
|
||||
case "Nars/UmaMusume/Face":
|
||||
m.shader = Shader.Find("Nars/UmaMusume/Face");
|
||||
break;
|
||||
case "Gallop/3D/Chara/ToonHair/TSER":
|
||||
m.shader = Shader.Find("Nars/UmaMusume/Body");
|
||||
break;
|
||||
default:
|
||||
Debug.LogError(m.shader.name);
|
||||
// m.shader = Shader.Find("Nars/UmaMusume/Body");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadTail(GameObject gameObject)
|
||||
{
|
||||
Transform hHip = UmaContainer.FindBoneInChildren(CurrentContainer.Body.transform, "Hip");
|
||||
if(hHip == null) return;
|
||||
CurrentContainer.Tail = Instantiate(gameObject, hHip);
|
||||
var textures = CurrentContainer.TailTextures;
|
||||
foreach (Renderer r in CurrentContainer.Tail.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
{
|
||||
m.shader = Shader.Find("Nars/UmaMusume/Body");
|
||||
m.SetTexture("_MainTex", textures.FirstOrDefault(t => t.name.EndsWith("diff")));
|
||||
m.SetTexture("_ToonMap", textures.FirstOrDefault(t => t.name.Contains("shad")));
|
||||
m.SetTexture("_TripleMaskMap", textures.FirstOrDefault(t => t.name.Contains("base")));
|
||||
m.SetTexture("_OptionMaskMap", textures.FirstOrDefault(t => t.name.Contains("ctrl")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UnloadBundle(AssetBundle bundle, bool unloadAllObjects)
|
||||
{
|
||||
var entry = Main.LoadedBundles.FirstOrDefault(b=>b.Value == bundle);
|
||||
if (entry.Key != null)
|
||||
{
|
||||
Main.LoadedBundles.Remove(entry.Key);
|
||||
}
|
||||
bundle.Unload(unloadAllObjects);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 802a07dab5fa2e04fac9910977b8afb6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
public class UmaViewerDownload : MonoBehaviour
|
||||
{
|
||||
public static IEnumerator DownloadText(string url, System.Action<string> callback)
|
||||
{
|
||||
UnityWebRequest www = UnityWebRequest.Get(url);
|
||||
yield return www.SendWebRequest();
|
||||
|
||||
if (www.result != UnityWebRequest.Result.Success)
|
||||
{
|
||||
Debug.Log(www.error);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(www.downloadHandler.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 731c92d7702229d4193e1017e3991b7e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,136 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UmaViewerMain : MonoBehaviour
|
||||
{
|
||||
public static UmaViewerMain Instance;
|
||||
private UmaViewerUI UI => UmaViewerUI.Instance;
|
||||
private UmaViewerBuilder Builder => UmaViewerBuilder.Instance;
|
||||
public JArray UmaCharaData;
|
||||
|
||||
public List<CharaEntry> Characters = new List<CharaEntry>();
|
||||
public List<UmaDatabaseEntry> AbList = new List<UmaDatabaseEntry>();
|
||||
|
||||
[Header("Asset Memory")]
|
||||
public bool ShadersLoaded = false;
|
||||
public Dictionary<string, AssetBundle> LoadedBundles = new Dictionary<string, AssetBundle>();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Application.targetFrameRate = 30;
|
||||
Instance = this;
|
||||
AbList = UmaDatabaseController.Instance.MetaEntries.ToList();
|
||||
}
|
||||
|
||||
IEnumerator Start()
|
||||
{
|
||||
yield return UmaViewerDownload.DownloadText("https://www.tracenacademy.com/api/BasicCharaDataInfo", txt =>
|
||||
{
|
||||
UmaCharaData = JArray.Parse(txt);
|
||||
foreach (var item in UmaCharaData)
|
||||
{
|
||||
//Debug.Log(item);
|
||||
if (!Characters.Where(c => c.Id == (int)item["charaId"]).Any())
|
||||
{
|
||||
Characters.Add(new CharaEntry()
|
||||
{
|
||||
Name = (string)item["charaNameEnglish"],
|
||||
Id = (int)item["charaId"]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var container = Instantiate(UI.UmaContainerPrefab, UI.AnimationSetList.content).GetComponent<UmaUIContainer>();
|
||||
container.Name.text = container.name = "type00";
|
||||
var imageInstance = container.GetComponent<Image>();
|
||||
container.Button.onClick.AddListener(() => {
|
||||
UI.HighlightChildImage(UI.AnimationSetList.content, imageInstance);
|
||||
ListAnimations(-1);
|
||||
});
|
||||
|
||||
foreach (var chara in Characters.OrderBy(c => c.Id))
|
||||
{
|
||||
var charaInstance = chara;
|
||||
container = Instantiate(UI.UmaContainerPrefab, UI.CharactersList.content).GetComponent<UmaUIContainer>();
|
||||
container.Name.text = container.name = chara.Id + " " + chara.Name;
|
||||
var imageInstance1 = container.GetComponent<Image>();
|
||||
container.Button.onClick.AddListener(() => {
|
||||
UI.HighlightChildImage(UI.CharactersList.content, imageInstance1);
|
||||
ListCostumes(charaInstance.Id);
|
||||
});
|
||||
|
||||
container = Instantiate(UI.UmaContainerPrefab, UI.AnimationSetList.content).GetComponent<UmaUIContainer>();
|
||||
container.Name.text = container.name = chara.Id + " " + chara.Name;
|
||||
var imageInstance2 = container.GetComponent<Image>();
|
||||
container.Button.onClick.AddListener(() => {
|
||||
UI.HighlightChildImage(UI.AnimationSetList.content, imageInstance2);
|
||||
ListAnimations(charaInstance.Id);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void ListCostumes(int umaId)
|
||||
{
|
||||
for(int i = UI.CostumeList.content.childCount - 1; i >=0; i--)
|
||||
{
|
||||
Destroy(UI.CostumeList.content.GetChild(i).gameObject);
|
||||
}
|
||||
foreach(var entry in AbList.Where(a => !a.Name.Contains("clothes") && a.Name.Contains($"pfb_bdy{umaId}")))
|
||||
{
|
||||
var container = Instantiate(UI.UmaContainerPrefab, UI.CostumeList.content).GetComponent<UmaUIContainer>();
|
||||
string[] split = entry.Name.Split('_');
|
||||
string costumeId = split[split.Length - 1];
|
||||
container.Name.text = container.name = costumeId;
|
||||
container.Button.onClick.AddListener(() => {
|
||||
UI.HighlightChildImage(UI.CostumeList.content, container.GetComponent<Image>());
|
||||
StartCoroutine(Builder.LoadUma(umaId, costumeId));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void ListAnimations(int umaId)
|
||||
{
|
||||
for (int i = UI.AnimationList.content.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
Destroy(UI.AnimationList.content.GetChild(i).gameObject);
|
||||
}
|
||||
if(umaId == -1)
|
||||
{
|
||||
foreach (var entry in AbList.Where(a => a.Name.StartsWith(UmaDatabaseController.MotionPath) && a.Name.Contains($"/type00") && !a.Name.Contains($"mirror") && !a.Name.Contains($"mini") && !a.Name.Contains($"facial") && !a.Name.Contains($"_cam")))
|
||||
{
|
||||
var entryInstance = entry;
|
||||
var container = Instantiate(UI.UmaContainerPrefab, UI.AnimationList.content).GetComponent<UmaUIContainer>();
|
||||
container.Name.text = container.name = Path.GetFileName(entry.Name);
|
||||
container.Button.onClick.AddListener(() => {
|
||||
UI.HighlightChildImage(UI.AnimationList.content, container.GetComponent<Image>());
|
||||
Builder.LoadAsset(entryInstance);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
foreach (var entry in AbList.Where(a => a.Name.StartsWith(UmaDatabaseController.MotionPath) && a.Name.Contains($"chara/chr{umaId}") && !a.Name.Contains($"mirror") && !a.Name.Contains($"mini") && !a.Name.Contains($"facial") && !a.Name.Contains($"_cam")))
|
||||
{
|
||||
var entryInstance = entry;
|
||||
var container = Instantiate(UI.UmaContainerPrefab, UI.AnimationList.content).GetComponent<UmaUIContainer>();
|
||||
container.Name.text = container.name = Path.GetFileName(entry.Name);
|
||||
container.Button.onClick.AddListener(() => {
|
||||
UI.HighlightChildImage(UI.AnimationList.content, container.GetComponent<Image>());
|
||||
Builder.LoadAsset(entryInstance);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CharaEntry
|
||||
{
|
||||
public string Name;
|
||||
public int Id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb5d6e69c73fb3f4f8842e3b78fe99fc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UmaViewerUI : MonoBehaviour
|
||||
{
|
||||
public static UmaViewerUI Instance;
|
||||
|
||||
public ScrollRect CharactersList;
|
||||
public ScrollRect CostumeList;
|
||||
public ScrollRect AnimationSetList;
|
||||
public ScrollRect AnimationList;
|
||||
|
||||
public GameObject UmaContainerPrefab;
|
||||
|
||||
public Color UIColor1, UIColor2;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public void HighlightChildImage(Transform mainObject, Image child)
|
||||
{
|
||||
Debug.Log("Looking for " + child.name + " in " + mainObject.name);
|
||||
foreach(var t in mainObject.GetComponentsInChildren<Image>())
|
||||
{
|
||||
if (t.transform.parent != mainObject) continue;
|
||||
t.color = t == child ? UIColor2 : UIColor1;
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleUI(GameObject go)
|
||||
{
|
||||
go.SetActive(!go.activeSelf);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94327bb2c8a0f0a418a2eb8912da68d3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a13d479058b0f6c489aa6c3464af39c7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gallop
|
||||
{
|
||||
public class AssetHolder : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private AssetTable _assetTable;
|
||||
[SerializeField] private AssetTableValue _assetTableValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f306c52d5bccbe34c8bbbe33079a3d69
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gallop
|
||||
{
|
||||
public class DrivenKeyTarget : MonoBehaviour
|
||||
{
|
||||
public List<TargetInfomation> _targetFaces { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67f8baba5e37adf4eb7bbbcc28176459
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gallop
|
||||
{
|
||||
public class FaceDrivenKeyTarget : MonoBehaviour
|
||||
{
|
||||
public List<EyeTarget> _eyeTarget { get; set; }
|
||||
public List<EyebrowTarget> _eyebrowTarget { get; set; }
|
||||
public List<MouthTarget> _mouthTarget { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fee6c2398c4b694b8464880721ece99
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
using Unity;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class AssetTable
|
||||
{
|
||||
public List<StringObjectPair> list;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class AssetTableValue
|
||||
{
|
||||
public List<StringValuePair> i;
|
||||
}
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class StringObjectPair
|
||||
{
|
||||
public string Key;
|
||||
public GameObject Value;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class StringValuePair
|
||||
{
|
||||
public string Key;
|
||||
public float Value;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class TrsArray
|
||||
{
|
||||
public string _path { get; set; }
|
||||
public int _isValidScaleTransform { get; set; }
|
||||
public Vector3 _position { get; set; }
|
||||
public Vector3 _scale { get; set; }
|
||||
public Vector3 _rotation { get; set; }
|
||||
public int IsOverrideTarget { get; set; }
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class FaceGroupInfo
|
||||
{
|
||||
public List<TrsArray> _trsArray { get; set; }
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class EyeTarget
|
||||
{
|
||||
public List<FaceGroupInfo> _faceGroupInfo { get; set; }
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class EyebrowTarget
|
||||
{
|
||||
public List<FaceGroupInfo> _faceGroupInfo { get; set; }
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class MouthTarget
|
||||
{
|
||||
public List<FaceGroupInfo> _faceGroupInfo { get; set; }
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class TargetInfomation
|
||||
{
|
||||
public List<FaceGroupInfo> _faceGroupInfo { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11181f9a4cb66d84fb1f79db78040d2d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "umamusume"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bfbe5f35cfda4e488c0fb232ba9c5ce
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user