You've already forked UniversalViewer
							
							DanMachi:
-compatibility improvements Core: -simplified object and keyframe serialization -complicated assetbundle loading
This commit is contained in:
		
							
								
								
									
										30
									
								
								Assets/KF3/Scripts/Handles/UIHandleCerulean.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								Assets/KF3/Scripts/Handles/UIHandleCerulean.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
|  | ||||
| public class UIHandleCerulean : UIHandle | ||||
| { | ||||
|     protected KF3CeruleanContainer mContainer => Owner as KF3CeruleanContainer; | ||||
|  | ||||
|     public static UIHandleCerulean CreateAsChild(KF3ObjectContainer owner) | ||||
|     { | ||||
|         var handle = CreateAsChild<UIHandleCerulean>(owner.transform); | ||||
|         handle.Init(owner).SetColor(Color.yellow).SetScale(1.5f); | ||||
|         return handle; | ||||
|     } | ||||
|  | ||||
|     public override UIHandle Init(ObjectContainer owner) | ||||
|     { | ||||
|         base.Init(owner); | ||||
|  | ||||
|         Popup.AddButton("Reset Position", () => TransformResetPosition()); | ||||
|         Popup.AddButton("Reset Rotation", () => TransformResetRotation()); | ||||
|         Popup.AddButton("Reset Scale", () => TransformResetScale()); | ||||
|         Popup.AddButton("Toggle Physics", () => mContainer.TogglePhysics()); | ||||
|         Popup.AddButton("Toggle Bones", () => mContainer.ToggleBonesVisible(!mContainer.BonesVisible)); | ||||
|         Popup.AddButton("Reset Bones", () => mContainer.ResetBones()); | ||||
|         Popup.AddButton("Delete", () => Destroy(Owner)); | ||||
|  | ||||
|         return this; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/KF3/Scripts/Handles/UIHandleCerulean.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/KF3/Scripts/Handles/UIHandleCerulean.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: fcc0e948bb20f034e8b7ae8492816bd4 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										52
									
								
								Assets/KF3/Scripts/Handles/UIHandleEyes.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								Assets/KF3/Scripts/Handles/UIHandleEyes.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| using UnityEngine; | ||||
|  | ||||
| public class UIHandleEyes : UIHandle | ||||
| { | ||||
|     public static UIHandleEyes Create(KF3FriendContainer owner, Transform head) | ||||
|     { | ||||
|         var handle = new GameObject().AddComponent<UIHandleEyes>(); | ||||
|  | ||||
|         handle.Init(owner, handle.transform) | ||||
|             .SetScale(2) | ||||
|             .SetColor(Color.red); | ||||
|  | ||||
|         handle.name = $"Eyes_{owner.ModelId}"; | ||||
|         handle.transform.localScale = 0.1f * Vector3.one; | ||||
|         handle.transform.SetParent(head); | ||||
|         handle.transform.position = head.position + head.forward; | ||||
|  | ||||
|         return handle; | ||||
|     } | ||||
|  | ||||
|     public override UIHandle Init(ObjectContainer friend) | ||||
|     { | ||||
|         base.Init(friend); | ||||
|         Popup.AddButton("Reset Position", () => LookAtPositionReset()); | ||||
|         Popup.AddButton("Change mode", () => SwapLookAtMode()); | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     public override void UpdateManual(Camera camera, bool linesEnabled) | ||||
|     { | ||||
|         base.UpdateManual(camera, linesEnabled); | ||||
|         transform.localEulerAngles = _defaultTransform.Rotation; | ||||
|     } | ||||
|  | ||||
|     void SwapLookAtMode() | ||||
|     { | ||||
|         var mContainer = (KF3FriendContainer)Owner; | ||||
|         if (transform.parent == mContainer.HumanBones[HumanBodyBones.Head]) | ||||
|         { | ||||
|             transform.SetParent(mContainer.Body.transform); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             transform.SetParent(mContainer.HumanBones[HumanBodyBones.Head]); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void LookAtPositionReset() | ||||
|     { | ||||
|         transform.position = transform.parent.position + Vector3.forward; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/KF3/Scripts/Handles/UIHandleEyes.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/KF3/Scripts/Handles/UIHandleEyes.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 60bfe8cf0d5fae34fb9d3ba5ba2306b8 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										38
									
								
								Assets/KF3/Scripts/Handles/UIHandleFriend.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Assets/KF3/Scripts/Handles/UIHandleFriend.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| using UnityEngine; | ||||
|  | ||||
| public class UIHandleFriend : UIHandle | ||||
| { | ||||
|     protected KF3FriendContainer mContainer => Owner as KF3FriendContainer; | ||||
|  | ||||
|     public static UIHandleFriend CreateAsChild(KF3ObjectContainer owner) | ||||
|     { | ||||
|         var handle = CreateAsChild<UIHandleFriend>(owner.transform); | ||||
|         handle.Init(owner).SetColor(Color.yellow).SetScale(1.5f); | ||||
|         return handle; | ||||
|     } | ||||
|  | ||||
|     public override UIHandle Init(ObjectContainer owner) | ||||
|     { | ||||
|         base.Init(owner); | ||||
|  | ||||
|         Popup.AddButton("Reset All", TransformResetAll); | ||||
|         Popup.AddButton("Reset Position", TransformResetPosition); | ||||
|         Popup.AddButton("Reset Rotation", TransformResetRotation); | ||||
|         Popup.AddButton("Reset Scale", TransformResetScale); | ||||
|         Popup.AddButton("Toggle Physics", () => | ||||
|         { | ||||
|             mContainer.TogglePhysics(); | ||||
|             mContainer.SetKeyframe(); | ||||
|         }); | ||||
|         Popup.AddButton("Toggle Bones", () => mContainer.ToggleBonesVisible(!mContainer.BonesVisible)); | ||||
|         Popup.AddButton("Toggle IK", () => { | ||||
|             mContainer.ToggleIK(!mContainer.IKEnabled); | ||||
|             mContainer.SetKeyframe(); | ||||
|         }); | ||||
|         Popup.AddButton("Reset Bones", () => mContainer.ResetBones()); | ||||
|         Popup.AddButton("Delete", () => Destroy(Owner)); | ||||
|  | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/KF3/Scripts/Handles/UIHandleFriend.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/KF3/Scripts/Handles/UIHandleFriend.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 2dd174b81dfa2fb47b2abf859285ec7f | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
		Reference in New Issue
	
	Block a user