Skip to content

Commit

Permalink
#78 Battle revisit: unit hover fixes for build
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Krupovich committed Mar 15, 2023
1 parent 87020b0 commit 9ece6ac
Show file tree
Hide file tree
Showing 45 changed files with 476 additions and 449 deletions.
14 changes: 0 additions & 14 deletions Assets/Bundles/Default/Prefabs/Battle/BattleUnit.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ GameObject:
- component: {fileID: -8504297149246846156}
- component: {fileID: 3714480927714868945}
- component: {fileID: 7526219828721324036}
- component: {fileID: 1614191798481415639}
m_Layer: 5
m_Name: BattleUnit
m_TagString: Untagged
Expand Down Expand Up @@ -303,19 +302,6 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &1614191798481415639
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5222742129451753485}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 717a02054ef2699498e6bd4234fd7995, type: 3}
m_Name:
m_EditorClassIdentifier:
_containerSource: 1
--- !u!1 &5837563014804781224
GameObject:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion Assets/Bundles/Default/Prefabs/Common/BarWTitle.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
Expand Down
9 changes: 4 additions & 5 deletions Assets/Bundles/Default/Prefabs/Common/HeroDetailsLib.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.8773585, g: 0.7705829, b: 0.36970446, a: 0.7921569}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
Expand Down Expand Up @@ -92,7 +92,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
heroNameText: {fileID: 1378264244367865577}
barsContainer: {fileID: 7664545967994426508}
--- !u!1 &5591091341761570896
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -231,7 +230,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
Expand Down Expand Up @@ -265,10 +264,10 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSize: 44.75
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
Expand Down
65 changes: 25 additions & 40 deletions Assets/Scenes/Library.unity
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ RectTransform:
m_Children:
- {fileID: 130185994}
m_Father: {fileID: 2998433099271763072}
m_RootOrder: 5
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
Expand Down Expand Up @@ -401,7 +401,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 2998433098678818409}
m_TransformParent: {fileID: 2998433099271763072}
m_Modifications:
- target: {fileID: 856648663466641187, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
Expand Down Expand Up @@ -436,37 +436,37 @@ PrefabInstance:
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
propertyPath: m_RootOrder
value: 2
value: 7
objectReference: {fileID: 0}
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
propertyPath: m_SizeDelta.x
value: 300
value: 250
objectReference: {fileID: 0}
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
propertyPath: m_SizeDelta.y
value: 240
value: 250
objectReference: {fileID: 0}
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
Expand All @@ -491,17 +491,17 @@ PrefabInstance:
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5902917116430794639, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
Expand Down Expand Up @@ -769,18 +769,6 @@ RectTransform:
type: 3}
m_PrefabInstance: {fileID: 1273615398}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1694862402 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 2426921261985612588, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
m_PrefabInstance: {fileID: 1273615398}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 343b4b993db383e4a811ecdc8e89bc96, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!222 &272888564115443092
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1806,7 +1794,7 @@ RectTransform:
m_Children:
- {fileID: 272888565803765989}
m_Father: {fileID: 2998433099271763072}
m_RootOrder: 4
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
Expand Down Expand Up @@ -3714,8 +3702,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
cardPrefab: {fileID: 3098798994690606055, guid: 831329e00a658c54d860600582706b04,
type: 3}
heroDetailsPrefab: {fileID: 3905912016691865442, guid: fd878fdae4a61954eb2de5e637d505bf,
type: 3}
--- !u!224 &272888565493329764
RectTransform:
m_ObjectHideFlags: 0
Expand All @@ -3729,7 +3715,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2998433099271763072}
m_RootOrder: 6
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -4883,7 +4869,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 4715160395810678623}
m_HandleRect: {fileID: 7542885699069018076}
m_Direction: 2
m_Value: 1
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
Expand Down Expand Up @@ -5256,7 +5242,7 @@ PrefabInstance:
- target: {fileID: 2963600359012566615, guid: 119c9b1002cbf4ddba4d87429db4dcde,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0.000030517578
value: 0.000061035156
objectReference: {fileID: 0}
- target: {fileID: 2963600359012566615, guid: 119c9b1002cbf4ddba4d87429db4dcde,
type: 3}
Expand Down Expand Up @@ -5752,7 +5738,7 @@ RectTransform:
m_Children:
- {fileID: 2998433097413153558}
- {fileID: 2998433098208773282}
- {fileID: 1694862401}
- {fileID: 6116690198661930462}
m_Father: {fileID: 2998433098744740588}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -5926,10 +5912,10 @@ RectTransform:
- {fileID: 2376718325952412015}
- {fileID: 835875805333007472}
- {fileID: 272888566118155944}
- {fileID: 6116690198661930462}
- {fileID: 272888564627515548}
- {fileID: 651686542}
- {fileID: 272888565493329764}
- {fileID: 1694862401}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -6036,7 +6022,6 @@ MonoBehaviour:
libraryContainer: {fileID: 2998433098769755011}
playerTeamContainer: {fileID: 272888564433205192}
enemyTeamContainer: {fileID: 272888565392526500}
heroDetails: {fileID: 1694862402}
cardPool: {fileID: 272888565493329763}
raidButton: {fileID: 651686543}
--- !u!114 &2998433099271763200
Expand Down Expand Up @@ -6309,19 +6294,19 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6116690198661930457}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1144152906451754513}
m_Father: {fileID: 2998433099271763072}
m_RootOrder: 3
m_Father: {fileID: 2998433098678818409}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -796, y: -904}
m_SizeDelta: {x: 309.888, y: 406.809}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 309.888, y: 200}
m_Pivot: {x: 1, y: 1}
--- !u!114 &6116690198661930463
MonoBehaviour:
Expand Down
107 changes: 107 additions & 0 deletions Assets/Scripts/ECS/BaseEntityView+IEntityView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using Assets.Scripts.ECS.Data;
using Assets.Scripts.Services;
using Leopotam.EcsLite;
using UnityEngine;

namespace Assets.Scripts.ECS
{
public partial class BaseEntityView<T> : IEntityView<T>
where T : struct
{
#region IEntityView<T>

public EcsPackedEntityWithWorld? PackedEntity { get; set; }
public IEcsService EcsService { get; set; }
public DataLoadDelegate<T> DataLoader { get; set; }

public virtual void Destroy() =>
GameObject.Destroy(gameObject);

public virtual void UpdateData() =>
CurrentData = DataLoader?.Invoke(PackedEntity);

#endregion

#region IEntityView

public void AttachChild<C>(ITransform<C> child)
where C : struct
{
if (PackedEntity == null || !PackedEntity.Value.Unpack(out var world, out var entity))
return; //throw new Exception("No Entity for Entity view");

ref var transformRef = ref world.GetPool<TransformRef<C>>().Add(entity);
transformRef.Transform = child.Transform;
}

public void AttachChild<C>(IItemsContainer<C> child)
where C : struct
{

if (PackedEntity == null || !PackedEntity.Value.Unpack(out var world, out var entity))
return; //throw new Exception("No Entity for Entity view");

ref var transformRef = ref world.GetPool<ItemsContainerRef<C>>().Add(entity);
transformRef.Container = child;
}

public void AttachChild<C>(IDataView<C> child)
where C : struct
{
if (PackedEntity == null || !PackedEntity.Value.Unpack(out var world, out var entity))
return; //throw new Exception("No Entity for Entity view");

ref var transformRef = ref world.GetPool<DataViewRef<C>>().Add(entity);
transformRef.DataView = child;
child.Reset();
}

public void DetachChild<C>(IItemsContainer<C> child)
where C : struct
{
if (PackedEntity == null || !PackedEntity.Value.Unpack(out var world, out var entity))
return; //throw new Exception("No Entity for Entity view");

var pool = world.GetPool<ItemsContainerRef<C>>();
if (!pool.Has(entity))
return;

ref var transformRef = ref pool.Get(entity);
transformRef.Container = null;
pool.Del(entity);
}

public void DetachChild<C>(ITransform<C> child)
where C : struct
{
if (PackedEntity == null || !PackedEntity.Value.Unpack(out var world, out var entity))
return; //throw new Exception("No Entity for Entity view");

var pool = world.GetPool<TransformRef<C>>();
if (!pool.Has(entity))
return;

ref var transformRef = ref pool.Get(entity);
transformRef.Transform = null;
pool.Del(entity);
}

public void DetachChild<C>(IDataView<C> child)
where C : struct
{
if (PackedEntity == null || !PackedEntity.Value.Unpack(out var world, out var entity))
return; //throw new Exception("No Entity for Entity view");

var pool = world.GetPool<DataViewRef<C>>();
if (!pool.Has(entity))
return;

ref var transformRef = ref pool.Get(entity);
transformRef.DataView = null;
pool.Del(entity);
}

#endregion

}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9ece6ac

Please sign in to comment.