mirror of
https://github.com/ConjureETS/DeathBook.git
synced 2026-03-25 21:10:57 +00:00
Merge branch 'master' of https://github.com/ConjureETS/DeathBook
Conflicts: Assets/Prefabs/NetworkingSphere.prefab Assets/Scenes/Gameplay.unity Assets/Scripts/Models/Person.cs Assets/Scripts/NetworkingSphere.cs Signed-off-by: RosimInc <rosim_inc@hotmail.com>
This commit is contained in:
commit
bcbf97fa44
@ -395,7 +395,19 @@ MonoBehaviour:
|
||||
m_TargetGraphic: {fileID: 11443318}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 11476684}
|
||||
m_MethodName: KillNode
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine, Version=0.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
--- !u!114 &11411578
|
||||
@ -457,8 +469,8 @@ MonoBehaviour:
|
||||
m_TargetGraphic: {fileID: 11431992}
|
||||
m_HandleRect: {fileID: 22417254}
|
||||
m_Direction: 2
|
||||
m_Value: 1
|
||||
m_Size: .427392095
|
||||
m_Value: .999378026
|
||||
m_Size: .427392036
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
@ -645,7 +657,7 @@ MonoBehaviour:
|
||||
WatchButton: {fileID: 11491412}
|
||||
XButton: {fileID: 11494666}
|
||||
Container: {fileID: 147852}
|
||||
UIFriendPicture: {fileID: 11467422, guid: 16a1d168f1ef75b4690435675a9e69b0, type: 2}
|
||||
FriendPicture: {fileID: 11469406, guid: 16a1d168f1ef75b4690435675a9e69b0, type: 2}
|
||||
--- !u!114 &11478962
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
@ -1093,7 +1105,7 @@ RectTransform:
|
||||
m_RootOrder: 0
|
||||
m_AnchorMin: {x: .5, y: 1}
|
||||
m_AnchorMax: {x: .5, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -65.9999924}
|
||||
m_AnchoredPosition: {x: 0, y: -65.95298}
|
||||
m_SizeDelta: {x: 90, y: 132}
|
||||
m_Pivot: {x: .5, y: .5}
|
||||
--- !u!224 &22462244
|
||||
|
||||
@ -62,7 +62,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 193868}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalPosition: {x: -544.163269, y: -235.973114, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 496448}
|
||||
@ -75,7 +75,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 136744}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -.00100000005}
|
||||
m_LocalScale: {x: .800000012, y: .800000012, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 498100}
|
||||
|
||||
@ -10,6 +10,8 @@ GameObject:
|
||||
- 224: {fileID: 22403202}
|
||||
- 222: {fileID: 22221002}
|
||||
- 114: {fileID: 11467422}
|
||||
- 114: {fileID: 11469406}
|
||||
- 114: {fileID: 11492734}
|
||||
m_Layer: 5
|
||||
m_Name: UIFriendPicture
|
||||
m_TagString: Untagged
|
||||
@ -38,6 +40,47 @@ MonoBehaviour:
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
--- !u!114 &11469406
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 115844}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 343d57f2bac42ae48ba9722c53e5526f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &11492734
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 115844}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: -1862395651, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
delegates:
|
||||
- eventID: 4
|
||||
callback:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 11469406}
|
||||
m_MethodName: OnClick
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine, Version=0.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
m_TypeName: UnityEngine.EventSystems.EventTrigger+TriggerEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
--- !u!222 &22221002
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -48,6 +48,8 @@ namespace DeathBook.Model
|
||||
private Sprite picture;
|
||||
public Sprite Picture { get { return picture; } }
|
||||
|
||||
private Action onSelected;
|
||||
public Action OnSelected {get {return onSelected;} set { onSelected = value; } }
|
||||
|
||||
public Person(int id, string fName, string lName, Vector3 pos, int conn, int disconn, float freq, Sprite pic)
|
||||
{
|
||||
@ -126,5 +128,13 @@ namespace DeathBook.Model
|
||||
foreach (Friendship f in deadFriendsList)
|
||||
f.Update(deltaTime);
|
||||
}
|
||||
|
||||
public void SelectNode()
|
||||
{
|
||||
if (OnSelected != null)
|
||||
{
|
||||
OnSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -40,6 +40,9 @@ public class NetworkingSphere : MonoBehaviour
|
||||
|
||||
private PersonNode _selectedNode;
|
||||
|
||||
// Used to disable the physics when the user has clicked on a node
|
||||
private bool _isRotatingTowardsNode = false;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
manager = LevelManager.Instance;
|
||||
@ -87,7 +90,7 @@ public class NetworkingSphere : MonoBehaviour
|
||||
delta = new Vector3();
|
||||
}
|
||||
|
||||
if (dragging)
|
||||
if (dragging && !_isRotatingTowardsNode)
|
||||
{
|
||||
MoveSphere();
|
||||
}
|
||||
@ -140,17 +143,20 @@ public class NetworkingSphere : MonoBehaviour
|
||||
|
||||
private void OnNodeClicked(PersonNode node)
|
||||
{
|
||||
if (node == _selectedNode) return;
|
||||
|
||||
if (_selectedNode != null)
|
||||
{
|
||||
_selectedNode.Select(false);
|
||||
}
|
||||
|
||||
node.Kill();
|
||||
|
||||
DetailsPanel.SetNode(node);
|
||||
node.Select(true);
|
||||
|
||||
_selectedNode = node;
|
||||
|
||||
// Testing to see how it looks and feels like
|
||||
FocusOnNode(node);
|
||||
}
|
||||
|
||||
private void AssignLinks(Level lvl)
|
||||
@ -168,4 +174,65 @@ public class NetworkingSphere : MonoBehaviour
|
||||
peopleNodes[id2].AddLink(link);
|
||||
}
|
||||
}
|
||||
|
||||
public void FocusOnNode(PersonNode node)
|
||||
{
|
||||
StopCoroutine("RotateTowardsNodeCoroutine");
|
||||
StartCoroutine("RotateTowardsNodeCoroutine", node);
|
||||
|
||||
/*
|
||||
Debug.Log(node.transform.eulerAngles);
|
||||
|
||||
float xangle = (Mathf.Atan2(finalPos.z, finalPos.y) - Mathf.Atan2(initialPos.z, initialPos.y)) * Mathf.Rad2Deg;
|
||||
|
||||
Debug.Log(node.transform.position);
|
||||
transform.Rotate(new Vector3(90, 0, 0));
|
||||
//transform.rotation = transform.rotation * Quaternion.AngleAxis(xangle, Vector3.right);
|
||||
Debug.Log(xangle);
|
||||
float yAngle = (Mathf.Atan2(finalPos.x, finalPos.z) - Mathf.Atan2(node.transform.position.x, node.transform.position.z)) * Mathf.Rad2Deg;
|
||||
Debug.Log(yAngle);
|
||||
//transform.Rotate(new Vector3(xangle, yAngle, 0));
|
||||
|
||||
//float zAngle = (Mathf.Atan2(finalPos.y, finalPos.x) - Mathf.Atan2(initialPos.y, initialPos.x)) * Mathf.Rad2Deg;
|
||||
|
||||
//transform.rotation = transform.rotation * Quaternion.AngleAxis(xangle, Vector3.right) * Quaternion.AngleAxis(yAngle, Vector3.up) * Quaternion.AngleAxis(zAngle, Vector3.forward);
|
||||
*/
|
||||
}
|
||||
|
||||
private IEnumerator RotateTowardsNodeCoroutine(PersonNode node)
|
||||
{
|
||||
_isRotatingTowardsNode = true;
|
||||
rb.angularVelocity = Vector3.zero;
|
||||
|
||||
//Vector3 finalPos = new Vector3(0f, 0f, -SphereRadius);
|
||||
|
||||
Quaternion initialRot = transform.localRotation;
|
||||
|
||||
|
||||
transform.localRotation = Quaternion.identity; // Temporary hack for the game jam
|
||||
|
||||
|
||||
Vector3 nodePos = node.transform.position;
|
||||
|
||||
Vector3 longDir = nodePos;
|
||||
longDir.y = 0;
|
||||
|
||||
float xAngle = Mathf.Asin(nodePos.normalized.y) * Mathf.Rad2Deg; // Latitude
|
||||
float yAngle = Vector3.Angle(-Vector3.forward, longDir) * (longDir.x < 0 ? -1 : 1); // Longitude
|
||||
|
||||
Quaternion finalRot = Quaternion.AngleAxis(-xAngle, Vector3.right) * Quaternion.AngleAxis(yAngle, Vector3.up);
|
||||
|
||||
float ratio = 0f;
|
||||
|
||||
while (ratio < 1f)
|
||||
{
|
||||
ratio += Time.deltaTime / 1.5f;
|
||||
|
||||
transform.localRotation = Quaternion.Lerp(initialRot, finalRot, Mathf.SmoothStep(0f, 1f, ratio));
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
_isRotatingTowardsNode = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ public class PersonDetailsPanel : MonoBehaviour, IObserver
|
||||
public Button XButton;
|
||||
public GameObject Container;
|
||||
|
||||
public Image UIFriendPicture;
|
||||
public UIFriendPicture FriendPicture;
|
||||
|
||||
private PersonNode _node;
|
||||
private Person _model;
|
||||
@ -50,6 +50,9 @@ public class PersonDetailsPanel : MonoBehaviour, IObserver
|
||||
{
|
||||
Name.text = _model.Name;
|
||||
|
||||
KillButton.gameObject.SetActive(_model.Alive);
|
||||
WatchButton.gameObject.SetActive(_model.Alive);
|
||||
|
||||
foreach (Transform picture in FriendsPanel.transform)
|
||||
{
|
||||
Destroy(picture.gameObject);
|
||||
@ -70,24 +73,19 @@ public class PersonDetailsPanel : MonoBehaviour, IObserver
|
||||
{
|
||||
Person friend = _model.FriendList[i].Friend;
|
||||
|
||||
Image friendPicture = Instantiate(UIFriendPicture) as Image;
|
||||
UIFriendPicture friendPicture = Instantiate(FriendPicture) as UIFriendPicture;
|
||||
|
||||
friendPicture.sprite = friend.Picture;
|
||||
friendPicture.Model = friend;
|
||||
|
||||
friendPicture.transform.SetParent(FriendsPanel.transform);
|
||||
friendPicture.rectTransform.anchorMin = new Vector2(0.022f, 1f - (height - 0.01f) * (i + 1) - i * 0.01f);
|
||||
friendPicture.rectTransform.anchorMax = new Vector2(0.26f, (1f - height * i));
|
||||
friendPicture.rectTransform.offsetMin = Vector2.zero;
|
||||
friendPicture.rectTransform.offsetMax = Vector2.zero;
|
||||
Image picture = friendPicture.Picture;
|
||||
|
||||
if (i == _model.FriendList.Count - 1)
|
||||
{
|
||||
Debug.Log(friendPicture.rectTransform.position);
|
||||
}
|
||||
else if (i == 0)
|
||||
{
|
||||
Debug.Log(friendPicture.rectTransform.position);
|
||||
}
|
||||
picture.sprite = friend.Picture;
|
||||
|
||||
picture.transform.SetParent(FriendsPanel.transform);
|
||||
picture.rectTransform.anchorMin = new Vector2(0.022f, 1f - (height - 0.01f) * (i + 1) - i * 0.01f);
|
||||
picture.rectTransform.anchorMax = new Vector2(0.26f, (1f - height * i));
|
||||
picture.rectTransform.offsetMin = Vector2.zero;
|
||||
picture.rectTransform.offsetMax = Vector2.zero;
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,4 +94,9 @@ public class PersonDetailsPanel : MonoBehaviour, IObserver
|
||||
Container.SetActive(false);
|
||||
_node.Select(false);
|
||||
}
|
||||
|
||||
public void KillNode()
|
||||
{
|
||||
_node.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ public class PersonNode : MonoBehaviour, IObserver
|
||||
{
|
||||
_model = value;
|
||||
_model.Subscribe(this);
|
||||
_model.OnSelected += () => { OnClicked(this); };
|
||||
UpdateInfo();
|
||||
SetProfilePicture();
|
||||
}
|
||||
|
||||
33
Assets/Scripts/UIFriendPicture.cs
Normal file
33
Assets/Scripts/UIFriendPicture.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using DeathBook.Model;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[RequireComponent(typeof(Image))]
|
||||
public class UIFriendPicture : MonoBehaviour
|
||||
{
|
||||
private Person _model;
|
||||
|
||||
public Person Model
|
||||
{
|
||||
get { return _model; }
|
||||
set { _model = value; }
|
||||
}
|
||||
|
||||
private Image _picture;
|
||||
|
||||
public Image Picture
|
||||
{
|
||||
get { return _picture; }
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
_picture = GetComponent<Image>();
|
||||
}
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
_model.SelectNode();
|
||||
}
|
||||
}
|
||||
12
Assets/Scripts/UIFriendPicture.cs.meta
Normal file
12
Assets/Scripts/UIFriendPicture.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 343d57f2bac42ae48ba9722c53e5526f
|
||||
timeCreated: 1439693427
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user