|
@@ -88,6 +88,10 @@ public class PlazaRoomManager
|
|
|
|
|
|
public void EnterPlazaRoom()
|
|
|
{
|
|
|
+ CameraOriginPosition = Camera.main.transform.position;
|
|
|
+ CameraLeftBorder = ManaReso.Get("PlazaRoomCameraLeftBorder").position.x;
|
|
|
+ CameraRightBorder = ManaReso.Get("PlazaRoomCameraRightBorder").position.x;
|
|
|
+
|
|
|
ManaReso.Get("U_BlackMask").TweenForCG();
|
|
|
|
|
|
ManaReso.SetActive("C_Main", false);
|
|
@@ -106,6 +110,8 @@ public class PlazaRoomManager
|
|
|
EventType.BackwardFinish,
|
|
|
() =>
|
|
|
{
|
|
|
+ Camera.main.transform.position = CameraOriginPosition;
|
|
|
+
|
|
|
ManaReso.SetActive("C_Main", true);
|
|
|
ManaReso.SetActive("Garden", true);
|
|
|
ManaReso.SetActive("PlazaRoom", false);
|
|
@@ -121,7 +127,6 @@ public class PlazaRoomManager
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public PlazaRoomManager(GardenSmartFox gardenSmartFox)
|
|
|
{
|
|
|
GardenSmartFox = gardenSmartFox;
|
|
@@ -150,9 +155,13 @@ public class PlazaRoomManager
|
|
|
if (SelfInstance.DirectionDirty)
|
|
|
SyncDirection();
|
|
|
|
|
|
+ if (SelfInstance.AnimationDirty)
|
|
|
+ SyncAnimation();
|
|
|
+
|
|
|
KeepAliveThread();
|
|
|
- }
|
|
|
|
|
|
+ CameraControllThread();
|
|
|
+ }
|
|
|
public void SyncDirection()
|
|
|
{
|
|
|
List<UserVariable> userVariables = new List<UserVariable>();
|
|
@@ -160,7 +169,6 @@ public class PlazaRoomManager
|
|
|
GardenSmartFox.SmartFox.Send(new SetUserVariablesRequest(userVariables));
|
|
|
SelfInstance.DirectionDirty = false;
|
|
|
}
|
|
|
-
|
|
|
public void SyncTransform()
|
|
|
{
|
|
|
List<UserVariable> userVariables = new List<UserVariable>();
|
|
@@ -168,6 +176,13 @@ public class PlazaRoomManager
|
|
|
GardenSmartFox.SmartFox.Send(new SetUserVariablesRequest(userVariables));
|
|
|
SelfInstance.transform.hasChanged = false;
|
|
|
}
|
|
|
+ public void SyncAnimation()
|
|
|
+ {
|
|
|
+ List<UserVariable> userVariables = new List<UserVariable>();
|
|
|
+ userVariables.Add(new SFSUserVariable("animation", $"{SelfInstance.CurrentAnimationName}"));
|
|
|
+ GardenSmartFox.SmartFox.Send(new SetUserVariablesRequest(userVariables));
|
|
|
+ SelfInstance.AnimationDirty = false;
|
|
|
+ }
|
|
|
|
|
|
public bool CloseDirty;
|
|
|
public void SyncClose()
|
|
@@ -209,6 +224,19 @@ public class PlazaRoomManager
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public float CameraLeftBorder;
|
|
|
+ public float CameraRightBorder;
|
|
|
+ public Vector3 CameraOriginPosition;
|
|
|
+ public void CameraControllThread()
|
|
|
+ {
|
|
|
+ if (SelfInstance.transform.position.x <= CameraLeftBorder || SelfInstance.transform.position.x >= CameraRightBorder)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Camera.main.transform.SetX(SelfInstance.transform.position.x);
|
|
|
+ }
|
|
|
+
|
|
|
public void ChangeUserClose(User user, List<string> dressData)
|
|
|
{
|
|
|
ManaPlayer.BuildPlayer(dressData, UserInstanceDictionary[user]);
|
|
@@ -225,6 +253,11 @@ public class PlazaRoomManager
|
|
|
UserInstanceDictionary[user].transform.eulerAngles = eulerAngles;
|
|
|
}
|
|
|
|
|
|
+ public void ChangeUserAnimation(User user, string animationName)
|
|
|
+ {
|
|
|
+ UserInstanceDictionary[user].PlayAnim(animationName);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public void OnConectionLost(BaseEvent baseEvent)
|
|
|
{
|
|
@@ -303,6 +336,10 @@ public class PlazaRoomManager
|
|
|
|
|
|
ChangeUserDirection(user, playerDirection);
|
|
|
}
|
|
|
+ else if (changeVars[i] == "animation")
|
|
|
+ {
|
|
|
+ ChangeUserAnimation(user, user.GetVariable(changeVars[i]).Value as string);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -310,6 +347,7 @@ public class PlazaRoomManager
|
|
|
|
|
|
public Player InstanciatePlayer(User user)
|
|
|
{
|
|
|
+ string animationName = Player.IdleAnimationName;
|
|
|
Vector3 position = ManaReso.Get("PlazaRoomDefaultPosition").position;
|
|
|
Vector3 eulerAngles = new Vector3();
|
|
|
PlayerDirection playerDirection = PlayerDirection.Left;
|
|
@@ -329,14 +367,19 @@ public class PlazaRoomManager
|
|
|
playerDirection = (user.GetVariable("direction").Value as string).ToEnum<PlayerDirection>();
|
|
|
}
|
|
|
|
|
|
+ if (user.ContainsVariable("animation"))
|
|
|
+ {
|
|
|
+ animationName = user.GetVariable("animation").Value as string;
|
|
|
+ }
|
|
|
+
|
|
|
dressData = ManaData.GetDressData(user);
|
|
|
|
|
|
- return InstanciatePlayer(position, eulerAngles, playerDirection, dressData);
|
|
|
+ return InstanciatePlayer(position, eulerAngles, playerDirection, animationName, dressData);
|
|
|
}
|
|
|
|
|
|
- public Player InstanciatePlayer(Vector3 position, Vector3 eulerAngles, PlayerDirection direction, List<string> dressData)
|
|
|
+ public Player InstanciatePlayer(Vector3 position, Vector3 eulerAngles, PlayerDirection direction, string animationName, List<string> dressData)
|
|
|
{
|
|
|
- Transform tra = ManaReso.Get("Player", Folder.Scene, false, ManaReso.Get("PlazaRoom"), position, ObjType.Player);
|
|
|
+ Transform tra = ManaReso.Get("Player", Folder.Scene, false, ManaReso.Get("PlazaRoom"), false, ObjType.Player);
|
|
|
|
|
|
Player player = tra.GetComponent<Player>();
|
|
|
|
|
@@ -351,6 +394,9 @@ public class PlazaRoomManager
|
|
|
|
|
|
player.SetAllCollider(false);
|
|
|
player.Flip(direction);
|
|
|
+ player.transform.position = position;
|
|
|
+
|
|
|
+ player.PlayAnim(animationName);
|
|
|
|
|
|
tra.localScale = new Vector3(0.5f, 0.5f, 0.5f);
|
|
|
|