Skip to content

Commit

Permalink
v1.85
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmfinol committed Jun 4, 2023
1 parent cc0217c commit 419e33d
Show file tree
Hide file tree
Showing 17 changed files with 262 additions and 108 deletions.
124 changes: 124 additions & 0 deletions Assets/Prefabs/CardGameView/Multiplayer/Token.prefab

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

7 changes: 7 additions & 0 deletions Assets/Prefabs/CardGameView/Multiplayer/Token.prefab.meta

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

40 changes: 40 additions & 0 deletions Assets/Prefabs/Menus/Set Import Menu.prefab

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

7 changes: 1 addition & 6 deletions Assets/Prefabs/Play/Play Menu.prefab

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

7 changes: 7 additions & 0 deletions Assets/Scenes/PlayGame.unity

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

25 changes: 0 additions & 25 deletions Assets/Scripts/Cgs/CardGameView/Multiplayer/CardStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,31 +169,6 @@ protected override void OnPointerUpSelectPlayable(PointerEventData eventData)
EventSystem.current.SetSelectedGameObject(gameObject, eventData);
}

protected override void OnPointerEnterPlayable(PointerEventData eventData)
{
if (Settings.PreviewOnMouseOver && CardViewer.Instance != null && !CardViewer.Instance.IsVisible
&& PlayableViewer.Instance != null && !PlayableViewer.Instance.IsVisible)
PlayableViewer.Instance.Preview(this);
}

protected override void OnPointerExitPlayable(PointerEventData eventData)
{
if (PlayableViewer.Instance != null)
PlayableViewer.Instance.HidePreview();
}

protected override void OnSelectPlayable(BaseEventData eventData)
{
if (PlayableViewer.Instance != null)
PlayableViewer.Instance.SelectedPlayable = this;
}

protected override void OnDeselectPlayable(BaseEventData eventData)
{
if (PlayableViewer.Instance != null)
PlayableViewer.Instance.IsVisible = false;
}

protected override void OnBeginDragPlayable(PointerEventData eventData)
{
if (IsDraggingCard)
Expand Down
29 changes: 20 additions & 9 deletions Assets/Scripts/Cgs/CardGameView/Multiplayer/CgsNetPlayable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

using System.Collections.Generic;
using System.Linq;
using Cgs.CardGameView.Viewer;
using Cgs.Menu;
using Cgs.Play;
using Cgs.Play.Multiplayer;
using JetBrains.Annotations;
Expand Down Expand Up @@ -202,7 +204,9 @@ public void OnPointerEnter(PointerEventData eventData)

protected virtual void OnPointerEnterPlayable(PointerEventData eventData)
{
// Child classes may override
if (Settings.PreviewOnMouseOver && CardViewer.Instance != null && !CardViewer.Instance.IsVisible
&& PlayableViewer.Instance != null && !PlayableViewer.Instance.IsVisible)
PlayableViewer.Instance.Preview(this);
}

public void OnPointerExit(PointerEventData eventData)
Expand All @@ -212,7 +216,8 @@ public void OnPointerExit(PointerEventData eventData)

protected virtual void OnPointerExitPlayable(PointerEventData eventData)
{
// Child classes may override
if (PlayableViewer.Instance != null)
PlayableViewer.Instance.HidePreview();
}

public void OnPointerDown(PointerEventData eventData)
Expand Down Expand Up @@ -257,7 +262,8 @@ public void OnSelect(BaseEventData eventData)

protected virtual void OnSelectPlayable(BaseEventData eventData)
{
// Child classes may override
if (PlayableViewer.Instance != null)
PlayableViewer.Instance.SelectedPlayable = this;
}

public void OnDeselect(BaseEventData eventData)
Expand All @@ -267,7 +273,8 @@ public void OnDeselect(BaseEventData eventData)

protected virtual void OnDeselectPlayable(BaseEventData eventData)
{
// Child classes may override
if (PlayableViewer.Instance != null)
PlayableViewer.Instance.IsVisible = false;
}

protected virtual bool PreBeginDrag(PointerEventData eventData)
Expand All @@ -289,7 +296,8 @@ public void OnBeginDrag(PointerEventData eventData)

protected virtual void OnBeginDragPlayable(PointerEventData eventData)
{
// Child classes may override
if (IsOnline)
RequestChangeOwnership();
}

public void OnDrag(PointerEventData eventData)
Expand All @@ -303,7 +311,10 @@ public void OnDrag(PointerEventData eventData)

protected virtual void OnDragPlayable(PointerEventData eventData)
{
// Child classes may override
if (LacksOwnership)
RequestChangeOwnership();
else
UpdatePosition();
}

public void OnEndDrag(PointerEventData eventData)
Expand All @@ -323,7 +334,8 @@ public void OnEndDrag(PointerEventData eventData)

protected virtual void OnEndDragPlayable(PointerEventData eventData)
{
// Child classes may override
if (!LacksOwnership)
UpdatePosition();
}

protected virtual void PostDragPlayable(PointerEventData eventData)
Expand Down Expand Up @@ -393,8 +405,7 @@ protected Vector2 CalculateGridPosition()
{
var rectTransform = (RectTransform) transform;
var currentPosition = rectTransform.position;
if (CardGameManager.Current.PlayMatGridCellSize == null ||
CardGameManager.Current.PlayMatGridCellSize.X <= 0 ||
if (CardGameManager.Current.PlayMatGridCellSize.X <= 0 ||
CardGameManager.Current.PlayMatGridCellSize.Y <= 0)
return currentPosition;

Expand Down
Loading

0 comments on commit 419e33d

Please sign in to comment.