changesparty
This commit is contained in:
parent
5ade16b0eb
commit
d3fd9e9620
BIN
Assets/.DS_Store
vendored
BIN
Assets/.DS_Store
vendored
Binary file not shown.
|
|
@ -2273,7 +2273,8 @@ MonoBehaviour:
|
|||
PrimaryWeapon: {fileID: 21300000, guid: 1fde2e89cec53e640997f2e11b658532, type: 3}
|
||||
SecondaryWeapon: {fileID: 0}
|
||||
Cape: {fileID: 0}
|
||||
Back: {fileID: 0}
|
||||
Quiver: {fileID: 0}
|
||||
Backpack: {fileID: 0}
|
||||
Shield: []
|
||||
Armor:
|
||||
- {fileID: 21300040, guid: 932eb8d5023602e45bd0f3d4e1206516, type: 3}
|
||||
|
|
@ -2355,8 +2356,8 @@ MonoBehaviour:
|
|||
LeggingsRenderers:
|
||||
- {fileID: 5460818288070623950}
|
||||
- {fileID: 7939274065524057377}
|
||||
CapeRenderer: {fileID: 0}
|
||||
BackRenderer: {fileID: 0}
|
||||
QuiverRenderer: {fileID: 0}
|
||||
BackpackRenderer: {fileID: 0}
|
||||
ShieldRenderers:
|
||||
- {fileID: 2816459151010776475}
|
||||
BowRenderers:
|
||||
|
|
@ -2365,7 +2366,7 @@ MonoBehaviour:
|
|||
- {fileID: 2277310147209446500}
|
||||
- {fileID: 5449786263906794857}
|
||||
- {fileID: 4698824689103266890}
|
||||
FirearmsRenderers: []
|
||||
CrossbowRenderers: []
|
||||
MakeupRenderer: {fileID: 5665153843562924393}
|
||||
MaskRenderer: {fileID: 1330441514144925353}
|
||||
EarringsRenderers:
|
||||
|
|
@ -2397,6 +2398,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: e6dbda98e8614ec8a935809c1a0ace8a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
SortingGroup: {fileID: 2642874521782211868}
|
||||
Sprites:
|
||||
- {fileID: 3435519960737444863}
|
||||
- {fileID: 770255024123046226}
|
||||
|
|
@ -2433,8 +2435,6 @@ MonoBehaviour:
|
|||
- {fileID: 1330441514144925353}
|
||||
- {fileID: 5449786263906794857}
|
||||
- {fileID: 4698824689103266890}
|
||||
SortingGroup: {fileID: 2642874521782211868}
|
||||
SortingOrderStep: 10
|
||||
CopyTo: {fileID: 0}
|
||||
--- !u!114 &843127271529294997
|
||||
MonoBehaviour:
|
||||
|
|
@ -4926,6 +4926,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: e6dbda98e8614ec8a935809c1a0ace8a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
SortingGroup: {fileID: 2642874521782211868}
|
||||
Sprites:
|
||||
- {fileID: 6684673773296626903}
|
||||
- {fileID: 4194971619543077301}
|
||||
|
|
@ -5081,8 +5082,6 @@ MonoBehaviour:
|
|||
- {fileID: 1330441514144925353}
|
||||
- {fileID: 5449786263906794857}
|
||||
- {fileID: 4698824689103266890}
|
||||
SortingGroup: {fileID: 2642874521782211868}
|
||||
SortingOrderStep: 10
|
||||
CopyTo: {fileID: 0}
|
||||
--- !u!95 &8745129960027346450
|
||||
Animator:
|
||||
|
|
@ -6474,7 +6473,8 @@ MonoBehaviour:
|
|||
PrimaryWeapon: {fileID: 21300000, guid: 1fde2e89cec53e640997f2e11b658532, type: 3}
|
||||
SecondaryWeapon: {fileID: 0}
|
||||
Cape: {fileID: 0}
|
||||
Back: {fileID: 0}
|
||||
Quiver: {fileID: 0}
|
||||
Backpack: {fileID: 0}
|
||||
Shield: []
|
||||
Armor:
|
||||
- {fileID: 21300040, guid: 932eb8d5023602e45bd0f3d4e1206516, type: 3}
|
||||
|
|
@ -6555,8 +6555,8 @@ MonoBehaviour:
|
|||
LeggingsRenderers:
|
||||
- {fileID: 6960788829903527684}
|
||||
- {fileID: 3231806984399289353}
|
||||
CapeRenderer: {fileID: 0}
|
||||
BackRenderer: {fileID: 0}
|
||||
QuiverRenderer: {fileID: 0}
|
||||
BackpackRenderer: {fileID: 0}
|
||||
ShieldRenderers:
|
||||
- {fileID: 7311041767872155725}
|
||||
- {fileID: 6980468645066611400}
|
||||
|
|
@ -6566,7 +6566,7 @@ MonoBehaviour:
|
|||
- {fileID: 7360430681077632512}
|
||||
- {fileID: 1364851250167138380}
|
||||
- {fileID: 3800483606247586909}
|
||||
FirearmsRenderers: []
|
||||
CrossbowRenderers: []
|
||||
MakeupRenderer: {fileID: 3435998627430565249}
|
||||
MaskRenderer: {fileID: 7780066744865994545}
|
||||
EarringsRenderers:
|
||||
|
|
@ -6598,6 +6598,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: e6dbda98e8614ec8a935809c1a0ace8a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
SortingGroup: {fileID: 2642874521782211868}
|
||||
Sprites:
|
||||
- {fileID: 6684673773296626903}
|
||||
- {fileID: 8761156241998211234}
|
||||
|
|
@ -6638,8 +6639,6 @@ MonoBehaviour:
|
|||
- {fileID: 7311041767872155725}
|
||||
- {fileID: 6980468645066611400}
|
||||
- {fileID: 1364851250167138380}
|
||||
SortingGroup: {fileID: 2642874521782211868}
|
||||
SortingOrderStep: 10
|
||||
CopyTo: {fileID: 0}
|
||||
--- !u!114 &7345451240784811756
|
||||
MonoBehaviour:
|
||||
|
|
@ -9910,7 +9909,8 @@ MonoBehaviour:
|
|||
PrimaryWeapon: {fileID: 21300000, guid: 1fde2e89cec53e640997f2e11b658532, type: 3}
|
||||
SecondaryWeapon: {fileID: 0}
|
||||
Cape: {fileID: 0}
|
||||
Back: {fileID: 0}
|
||||
Quiver: {fileID: 0}
|
||||
Backpack: {fileID: 0}
|
||||
Shield: []
|
||||
Armor:
|
||||
- {fileID: 21300040, guid: 932eb8d5023602e45bd0f3d4e1206516, type: 3}
|
||||
|
|
@ -9991,8 +9991,8 @@ MonoBehaviour:
|
|||
LeggingsRenderers:
|
||||
- {fileID: 5182926700030229988}
|
||||
- {fileID: 582777995261747491}
|
||||
CapeRenderer: {fileID: 0}
|
||||
BackRenderer: {fileID: 0}
|
||||
QuiverRenderer: {fileID: 0}
|
||||
BackpackRenderer: {fileID: 0}
|
||||
ShieldRenderers:
|
||||
- {fileID: 2787766321566281354}
|
||||
- {fileID: 8597157043698818456}
|
||||
|
|
@ -10002,7 +10002,7 @@ MonoBehaviour:
|
|||
- {fileID: 4343227825107918571}
|
||||
- {fileID: 6442799930695964210}
|
||||
- {fileID: 4208179434356543406}
|
||||
FirearmsRenderers: []
|
||||
CrossbowRenderers: []
|
||||
MakeupRenderer: {fileID: 4518295013249658832}
|
||||
MaskRenderer: {fileID: 1894255218323147008}
|
||||
EarringsRenderers:
|
||||
|
|
@ -10034,6 +10034,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: e6dbda98e8614ec8a935809c1a0ace8a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
SortingGroup: {fileID: 2642874521782211868}
|
||||
Sprites:
|
||||
- {fileID: 4208179434356543406}
|
||||
- {fileID: 3374391492828420216}
|
||||
|
|
@ -10074,8 +10075,6 @@ MonoBehaviour:
|
|||
- {fileID: 6790471686932509478}
|
||||
- {fileID: 3908659237553944341}
|
||||
- {fileID: 6442799930695964210}
|
||||
SortingGroup: {fileID: 2642874521782211868}
|
||||
SortingOrderStep: 10
|
||||
CopyTo: {fileID: 0}
|
||||
--- !u!114 &4726317439633481665
|
||||
MonoBehaviour:
|
||||
|
|
@ -12006,7 +12005,8 @@ MonoBehaviour:
|
|||
PrimaryWeapon: {fileID: 21300000, guid: 1fde2e89cec53e640997f2e11b658532, type: 3}
|
||||
SecondaryWeapon: {fileID: 0}
|
||||
Cape: {fileID: 0}
|
||||
Back: {fileID: 0}
|
||||
Quiver: {fileID: 0}
|
||||
Backpack: {fileID: 0}
|
||||
Shield: []
|
||||
Armor:
|
||||
- {fileID: 21300040, guid: 932eb8d5023602e45bd0f3d4e1206516, type: 3}
|
||||
|
|
@ -12086,8 +12086,8 @@ MonoBehaviour:
|
|||
LeggingsRenderers:
|
||||
- {fileID: 3089589498850820000}
|
||||
- {fileID: 4240573199286117781}
|
||||
CapeRenderer: {fileID: 0}
|
||||
BackRenderer: {fileID: 0}
|
||||
QuiverRenderer: {fileID: 0}
|
||||
BackpackRenderer: {fileID: 0}
|
||||
ShieldRenderers:
|
||||
- {fileID: 6484598956806664084}
|
||||
BowRenderers:
|
||||
|
|
@ -12096,7 +12096,7 @@ MonoBehaviour:
|
|||
- {fileID: 6919781975252132588}
|
||||
- {fileID: 4001757439886918657}
|
||||
- {fileID: 4540248313070711360}
|
||||
FirearmsRenderers: []
|
||||
CrossbowRenderers: []
|
||||
MakeupRenderer: {fileID: 1300368150109098810}
|
||||
MaskRenderer: {fileID: 1500454596874129539}
|
||||
EarringsRenderers:
|
||||
|
|
@ -12128,6 +12128,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: e6dbda98e8614ec8a935809c1a0ace8a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
SortingGroup: {fileID: 2642874521782211868}
|
||||
Sprites:
|
||||
- {fileID: 6909974970348155436}
|
||||
- {fileID: 3089589498850820000}
|
||||
|
|
@ -12166,8 +12167,6 @@ MonoBehaviour:
|
|||
- {fileID: 5846372446835895647}
|
||||
- {fileID: 3808550755457449931}
|
||||
- {fileID: 1500454596874129539}
|
||||
SortingGroup: {fileID: 2642874521782211868}
|
||||
SortingOrderStep: 10
|
||||
CopyTo: {fileID: 0}
|
||||
--- !u!114 &2326834231955293773
|
||||
MonoBehaviour:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -46,6 +46,7 @@ public class FarmingManager : NetworkBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void Spawn(int index){
|
||||
FarmingPositionEntry item = farmingItems[index];
|
||||
GameObject spawn = Instantiate(item.prefab , item.spawnLocation.position , Quaternion.identity);
|
||||
|
|
@ -95,7 +96,6 @@ public class FarmingPositionEntry{
|
|||
|
||||
}
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class FarmingSpawnPoints{
|
||||
public Transform pointsParent;
|
||||
|
|
|
|||
|
|
@ -32,4 +32,6 @@ public class cameraRPG : MonoBehaviour
|
|||
public void Teleport(Vector3 newLocation){
|
||||
transform.position = newLocation - offset;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
151
Assets/Script/invitePlayer.cs
Normal file
151
Assets/Script/invitePlayer.cs
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
using Mirror;
|
||||
using TMPro;
|
||||
|
||||
public class invitePlayer : NetworkBehaviour
|
||||
{
|
||||
[Header("UI References")]
|
||||
[SerializeField] private GameObject inviteUI, beingInviteUI;
|
||||
[SerializeField] private GameObject inPartyUI;
|
||||
[SerializeField] private TMP_Text inPartyOwnerNameTxt;
|
||||
[SerializeField] private TMP_Text inPartyPlayersTxt;
|
||||
[SerializeField] private TMP_Text inviteOwnerNameTxt;
|
||||
[SerializeField] private CanvasGroup uiCanvasGroup, bUiCanvasGroup;
|
||||
[SerializeField] private RectTransform uiRectTransform, panelRect;
|
||||
|
||||
|
||||
[Header("Animation Settings")]
|
||||
[SerializeField] private float appearDuration = 0.3f;
|
||||
[SerializeField] private float disappearDuration = 0.2f;
|
||||
[SerializeField] private Ease appearEase = Ease.OutBack;
|
||||
[SerializeField] private Ease disappearEase = Ease.InBack;
|
||||
|
||||
[SerializeField] private Vector2 offScreenPosition = new Vector2(1200, -140);
|
||||
[SerializeField] private Vector2 onScreenPosition = new Vector2(1300, -140);
|
||||
private void Start()
|
||||
{
|
||||
|
||||
uiRectTransform.localScale = Vector3.zero;
|
||||
uiCanvasGroup.alpha = 0;
|
||||
|
||||
inviteUI.SetActive(false);
|
||||
beingInviteUI.SetActive(false);
|
||||
|
||||
onScreenPosition = panelRect.anchoredPosition;
|
||||
|
||||
offScreenPosition = new Vector2(
|
||||
+Screen.width, // Use screen width for consistent off-screen positioning
|
||||
onScreenPosition.y
|
||||
);
|
||||
|
||||
|
||||
panelRect.anchoredPosition = offScreenPosition;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.L))
|
||||
{
|
||||
ShowInvite("keyBoard");
|
||||
}
|
||||
}
|
||||
private void OnMouseDown() //clicking on collider
|
||||
{
|
||||
ShowInviteUI();
|
||||
}
|
||||
|
||||
public void ShowInviteUI()
|
||||
{
|
||||
inviteUI.SetActive(true);
|
||||
|
||||
uiCanvasGroup.alpha = 0;
|
||||
uiRectTransform.localScale = Vector3.zero;
|
||||
|
||||
Sequence showSequence = DOTween.Sequence();
|
||||
showSequence.Append(uiRectTransform.DOScale(1, appearDuration).SetEase(appearEase))
|
||||
.Join(uiCanvasGroup.DOFade(1, appearDuration))
|
||||
.SetUpdate(true);
|
||||
Camera.main.DOShakePosition(0.2f, 0.1f, 1, 90f, false);
|
||||
|
||||
}
|
||||
|
||||
public void CloseInviteUI()
|
||||
{
|
||||
|
||||
Sequence hideSequence = DOTween.Sequence();
|
||||
hideSequence.Append(uiRectTransform.DOScale(0, disappearDuration).SetEase(disappearEase))
|
||||
.Join(uiCanvasGroup.DOFade(0, disappearDuration))
|
||||
.OnComplete(() => inviteUI.SetActive(false));
|
||||
}
|
||||
|
||||
public void InvitePlayer()
|
||||
{
|
||||
string thisPlayerName = GetComponent<playerNetwork>().playerName;
|
||||
playerNetwork.localPlayer.CmdInvitePlayer(thisPlayerName);
|
||||
HidePanel();
|
||||
}
|
||||
|
||||
public string InviteOwner = "";
|
||||
|
||||
public void ShowInvite(string ownerName)
|
||||
{
|
||||
InviteOwner = ownerName;
|
||||
inviteOwnerNameTxt.text = "You are being invited to a Party by " + ownerName;
|
||||
Debug.Log("ShowPanel called");
|
||||
|
||||
beingInviteUI.SetActive(true);
|
||||
|
||||
panelRect.DOAnchorPos(onScreenPosition, 0.5f)
|
||||
.SetEase(Ease.OutBack);
|
||||
}
|
||||
|
||||
|
||||
public void AcceptInvite()
|
||||
{
|
||||
playerNetwork.localPlayer.CmdAcceptInvite(InviteOwner);
|
||||
HidePanel();
|
||||
}
|
||||
|
||||
public void DeclineInvite()
|
||||
{
|
||||
HidePanel();
|
||||
}
|
||||
public void HidePanel()
|
||||
{
|
||||
panelRect.DOAnchorPos(offScreenPosition, 0.5f)
|
||||
.SetEase(Ease.OutBack)
|
||||
.OnComplete(() => beingInviteUI.SetActive(false));
|
||||
}
|
||||
|
||||
public void InParty(string ownerName)
|
||||
{
|
||||
if (ownerName.Length == 0)
|
||||
{
|
||||
inPartyUI.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
inPartyUI.SetActive(true);
|
||||
inPartyOwnerNameTxt.text = $"{ownerName}'s Party";
|
||||
|
||||
playerNetwork[] players = FindObjectsOfType<playerNetwork>();
|
||||
List<string> playerNames = new List<string>();
|
||||
foreach (playerNetwork player in players)
|
||||
{
|
||||
if (player.myPartyOwner == ownerName)
|
||||
{
|
||||
playerNames.Add(player.playerName);
|
||||
}
|
||||
}
|
||||
inPartyPlayersTxt.text = string.Join(", ", playerNames);
|
||||
}
|
||||
}
|
||||
|
||||
public void LeaveParty(){
|
||||
//playerNetwork.localPlayer.CmdLeaveParty();
|
||||
inPartyUI.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,9 @@ using Newtonsoft.Json;
|
|||
|
||||
public class playerNetwork : NetworkBehaviour
|
||||
{
|
||||
public static playerNetwork localPlayer;
|
||||
public invitePlayer invitePlayer;
|
||||
|
||||
public const float ATTACK_COOLDOWN = 0.6f;
|
||||
[HideInInspector]
|
||||
public StatManager statManager;
|
||||
|
|
@ -44,6 +47,8 @@ public class playerNetwork : NetworkBehaviour
|
|||
[SyncVar(hook = nameof(OnXpChanged))]
|
||||
public int XP;
|
||||
|
||||
[SyncVar]
|
||||
public string myPartyOwner;
|
||||
|
||||
public int lvl2 { get{
|
||||
return GetLevelForKills2(enemyKillCount);
|
||||
|
|
@ -204,7 +209,10 @@ public class playerNetwork : NetworkBehaviour
|
|||
localPlayerTransform.GetComponent<playerNetwork>().questActions.Add(action);
|
||||
}
|
||||
|
||||
|
||||
void Awake(){
|
||||
invitePlayer = GetComponent<invitePlayer>();
|
||||
rangeEnemyFind = GetComponent<rangeEnemyFinder>();
|
||||
}
|
||||
void Start(){
|
||||
|
||||
// for(int i =0; i < 2000; i+=10){
|
||||
|
|
@ -221,6 +229,7 @@ public class playerNetwork : NetworkBehaviour
|
|||
}else{
|
||||
|
||||
localPlayerTransform = transform;
|
||||
localPlayer = this;
|
||||
cameraRPG.instance.SetTarget(transform);
|
||||
#if UNITY_EDITOR
|
||||
ResetHealthAndArmor();
|
||||
|
|
@ -244,6 +253,43 @@ public class playerNetwork : NetworkBehaviour
|
|||
|
||||
}
|
||||
|
||||
[Command]
|
||||
public void CmdInvitePlayer(string otherPlayerName){
|
||||
if(myPartyOwner == null || myPartyOwner.Length == 0){
|
||||
FindPlayerByName(otherPlayerName).ShowInvite(playerName);
|
||||
}else{
|
||||
FindPlayerByName(otherPlayerName).ShowInvite(myPartyOwner);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void ShowInvite(string ownerName){
|
||||
RpcInvitePlayer(ownerName);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcInvitePlayer(string playerName){
|
||||
if(!isLocalPlayer){return;}
|
||||
|
||||
invitePlayer.ShowInvite(playerName);
|
||||
}
|
||||
|
||||
[Command]
|
||||
public void CmdAcceptInvite(string otherPlayerName){
|
||||
myPartyOwner = otherPlayerName;
|
||||
}
|
||||
|
||||
playerNetwork FindPlayerByName(string playerName){
|
||||
playerNetwork[] players = FindObjectsOfType<playerNetwork>();
|
||||
foreach(playerNetwork player in players){
|
||||
if(player.playerName == playerName){
|
||||
return player;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void LoadCharFromJson(string json){
|
||||
if(json.Length <=0){return;}
|
||||
character.FromJson(json,true);
|
||||
|
|
@ -372,9 +418,7 @@ public class playerNetwork : NetworkBehaviour
|
|||
rangeEnemyFinder rangeEnemyFind;
|
||||
|
||||
enemyScript closestEnemy => rangeEnemyFind.targetEnemy;
|
||||
void Awake(){
|
||||
rangeEnemyFind = GetComponent<rangeEnemyFinder>();
|
||||
}
|
||||
|
||||
|
||||
float attackTimer = 0;
|
||||
[HideInInspector]
|
||||
|
|
@ -395,6 +439,12 @@ public class playerNetwork : NetworkBehaviour
|
|||
txtEnemyKillCount.text = enemyKillCount.ToString();
|
||||
coinText.text = playerCoin.ToString();
|
||||
txtPlayerName.text = gplayAuth.userNameCloud;
|
||||
|
||||
if(myPartyOwner != null && myPartyOwner.Length > 0){
|
||||
invitePlayer.InParty(myPartyOwner);
|
||||
}else{
|
||||
invitePlayer.InParty("");
|
||||
}
|
||||
}
|
||||
ShowXP();
|
||||
ShowLevel();
|
||||
|
|
|
|||
|
|
@ -1,99 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
|
||||
public class InviteUIManager : MonoBehaviour
|
||||
{
|
||||
[Header("UI References")]
|
||||
[SerializeField] private GameObject inviteUI , beingInviteUI;
|
||||
[SerializeField] private CanvasGroup uiCanvasGroup , bUiCanvasGroup ;
|
||||
[SerializeField] private RectTransform uiRectTransform , panelRect ;
|
||||
|
||||
|
||||
[Header("Animation Settings")]
|
||||
[SerializeField] private float appearDuration = 0.3f;
|
||||
[SerializeField] private float disappearDuration = 0.2f;
|
||||
[SerializeField] private Ease appearEase = Ease.OutBack;
|
||||
[SerializeField] private Ease disappearEase = Ease.InBack;
|
||||
|
||||
[SerializeField] private Vector2 offScreenPosition = new Vector2(1200 , -140);
|
||||
[SerializeField] private Vector2 onScreenPosition = new Vector2(1300 , -140);
|
||||
private void Start()
|
||||
{
|
||||
// Initialize hidden state
|
||||
uiRectTransform.localScale = Vector3.zero;
|
||||
uiCanvasGroup.alpha = 0;
|
||||
|
||||
inviteUI.SetActive(false);
|
||||
beingInviteUI.SetActive(false);
|
||||
|
||||
onScreenPosition = panelRect.anchoredPosition;
|
||||
|
||||
offScreenPosition = new Vector2(
|
||||
+Screen.width, // Use screen width for consistent off-screen positioning
|
||||
onScreenPosition.y
|
||||
);
|
||||
|
||||
// Start with panel hidden
|
||||
panelRect.anchoredPosition = offScreenPosition;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.L))
|
||||
{
|
||||
ShowPanel();
|
||||
}
|
||||
}
|
||||
private void OnMouseDown()
|
||||
{
|
||||
ShowInviteUI();
|
||||
|
||||
}
|
||||
|
||||
public void ShowInviteUI()
|
||||
{
|
||||
inviteUI.SetActive(true);
|
||||
|
||||
// Reset values before animation
|
||||
uiCanvasGroup.alpha = 0;
|
||||
uiRectTransform.localScale = Vector3.zero;
|
||||
|
||||
// Parallel animations
|
||||
Sequence showSequence = DOTween.Sequence();
|
||||
showSequence.Append(uiRectTransform.DOScale(1, appearDuration).SetEase(appearEase))
|
||||
.Join(uiCanvasGroup.DOFade(1, appearDuration))
|
||||
.SetUpdate(true); // Ensures animation runs smoothly even if time scale is modified
|
||||
// Add to ShowInviteUI()
|
||||
Camera.main.DOShakePosition(0.2f, 0.1f, 1, 90f, false );
|
||||
// Ensures animation runs smoothly even if time scale is modified
|
||||
}
|
||||
|
||||
public void CloseInviteUI()
|
||||
{
|
||||
// Animate before disabling
|
||||
Sequence hideSequence = DOTween.Sequence();
|
||||
hideSequence.Append(uiRectTransform.DOScale(0, disappearDuration).SetEase(disappearEase))
|
||||
.Join(uiCanvasGroup.DOFade(0, disappearDuration))
|
||||
.OnComplete(() => inviteUI.SetActive(false));
|
||||
}
|
||||
|
||||
|
||||
public void ShowPanel()
|
||||
{
|
||||
Debug.Log("ShowPanel called");
|
||||
// Enable panel before animation
|
||||
beingInviteUI.SetActive(true);
|
||||
|
||||
panelRect.DOAnchorPos(onScreenPosition, 0.5f)
|
||||
.SetEase(Ease.OutBack);
|
||||
}
|
||||
|
||||
public void HidePanel()
|
||||
{
|
||||
panelRect.DOAnchorPos(offScreenPosition, 0.5f)
|
||||
.SetEase(Ease.OutBack)
|
||||
.OnComplete(() => beingInviteUI.SetActive(false));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"com.boxqkrtm.ide.cursor": "https://github.com/boxqkrtm/com.unity.ide.cursor.git",
|
||||
"com.hwaet.projectcloner": "https://github.com/hwaet/UnityProjectCloner.git",
|
||||
"com.unity.collab-proxy": "2.2.0",
|
||||
"com.unity.feature.2d": "2.0.0",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,14 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"com.boxqkrtm.ide.cursor": {
|
||||
"version": "https://github.com/boxqkrtm/com.unity.ide.cursor.git",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {
|
||||
"com.unity.test-framework": "1.1.9"
|
||||
},
|
||||
"hash": "38fecf55e4fd94ccfe58a92ed8ad1a529ba1694e"
|
||||
},
|
||||
"com.hwaet.projectcloner": {
|
||||
"version": "https://github.com/hwaet/UnityProjectCloner.git",
|
||||
"depth": 0,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user