|
@@ -35,6 +35,7 @@ public class PlazaRoomManager
|
|
|
}
|
|
|
|
|
|
hudTarget.PosTra = Player.ChildDic["NickName"];
|
|
|
+ hudTarget.SetPosition();
|
|
|
|
|
|
NickName.GetComponent<Text>().text = string.IsNullOrEmpty(nickname) ? Language.GetStr("UI", "未命名") : nickname;
|
|
|
|
|
@@ -63,12 +64,14 @@ public class PlazaRoomManager
|
|
|
ManaReso.Save(Player);
|
|
|
ManaReso.Save(NickName);
|
|
|
ManaReso.Save(MessageBox);
|
|
|
+
|
|
|
+ Player.PlayAnim(Player.IdleAnimationName);
|
|
|
}
|
|
|
|
|
|
public bool IsMoving;
|
|
|
public float Speed = 1f;
|
|
|
public Vector3 Destination;
|
|
|
- public TweenRoot MoveTween;
|
|
|
+ public TweenVec MoveTween;
|
|
|
public void MoveTo(Vector3 destination)
|
|
|
{
|
|
|
if (destination.Equal(Player.transform.position))
|
|
@@ -137,13 +140,13 @@ public class PlazaRoomManager
|
|
|
|
|
|
public bool EnteringPlazaRoom;
|
|
|
public bool IsBlackMaskFinish;
|
|
|
- public RequestStatus JoinRoomStatus;
|
|
|
+ public RequestStatus JoinRoomStatus = RequestStatus.Pending;
|
|
|
|
|
|
public Dictionary<User, PlazaRoomPlayer> UserInstanceDictionary = new Dictionary<User, PlazaRoomPlayer>();
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- public void OnEnterPlazaButton()
|
|
|
+ public void OnEnterPlazaRoomButton()
|
|
|
{
|
|
|
IsBlackMaskFinish = false;
|
|
|
EnteringPlazaRoom = true;
|
|
@@ -165,7 +168,7 @@ public class PlazaRoomManager
|
|
|
{
|
|
|
if (!succeed)
|
|
|
{
|
|
|
- JoinRoomStatus = RequestStatus.Failed;
|
|
|
+ GardenSmartFox.PlazaRoomManager.JoinRoomStatus = RequestStatus.Failed;
|
|
|
TryEnterPlazaRoom();
|
|
|
}
|
|
|
},
|
|
@@ -173,7 +176,7 @@ public class PlazaRoomManager
|
|
|
{
|
|
|
if (!succeed)
|
|
|
{
|
|
|
- JoinRoomStatus = RequestStatus.Failed;
|
|
|
+ GardenSmartFox.PlazaRoomManager.JoinRoomStatus = RequestStatus.Failed;
|
|
|
TryEnterPlazaRoom();
|
|
|
}
|
|
|
else
|
|
@@ -196,6 +199,11 @@ public class PlazaRoomManager
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (GardenSmartFox.PlazaRoomManager.JoinRoomStatus == RequestStatus.Pending)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (GardenSmartFox.PlazaRoomManager.JoinRoomStatus == RequestStatus.Failed)
|
|
|
{
|
|
|
QuitPlazaRoom();
|
|
@@ -214,17 +222,18 @@ public class PlazaRoomManager
|
|
|
|
|
|
public void EnterPlazaRoom()
|
|
|
{
|
|
|
- GardenSmartFox.PlazaRoomManager.PlazaRoomCamera = ManaReso.Get<Camera>("MainCamera");
|
|
|
- GardenSmartFox.PlazaRoomManager.CameraOriginPosition = PlazaRoomCamera.transform.position;
|
|
|
GardenSmartFox.PlazaRoomManager.CameraLeftBorder = ManaReso.Get("PlazaRoomCameraLeftBorder").position.x;
|
|
|
GardenSmartFox.PlazaRoomManager.CameraRightBorder = ManaReso.Get("PlazaRoomCameraRightBorder").position.x;
|
|
|
-
|
|
|
+
|
|
|
+ GardenSmartFox.PlazaRoomManager.PlazaRoomCamera.transform.SetX(GardenSmartFox.PlazaRoomManager.CameraLeftBorder);
|
|
|
+
|
|
|
ManaReso.Get("V_BlackMask").TweenForCG();
|
|
|
|
|
|
- ManaReso.SetActive("C_Main", false);
|
|
|
+ ManaReso.SetActive("C_Main2", false);
|
|
|
ManaReso.SetActive("Garden", false);
|
|
|
ManaReso.SetActive("PlazaRoom", true);
|
|
|
ManaReso.SetActive("W_HudParent", true);
|
|
|
+ ManaReso.SetActive("X_PlazaRoom", true);
|
|
|
}
|
|
|
|
|
|
public void ExitPlazaRoom()
|
|
@@ -238,12 +247,14 @@ public class PlazaRoomManager
|
|
|
EventType.BackwardFinish,
|
|
|
() =>
|
|
|
{
|
|
|
+ PlazaRoomSky.position = SkyOriginPosition;
|
|
|
PlazaRoomCamera.transform.position = CameraOriginPosition;
|
|
|
|
|
|
- ManaReso.SetActive("C_Main", true);
|
|
|
+ ManaReso.SetActive("C_Main2", true);
|
|
|
ManaReso.SetActive("Garden", true);
|
|
|
ManaReso.SetActive("PlazaRoom", false);
|
|
|
ManaReso.SetActive("W_HudParent", false);
|
|
|
+ ManaReso.SetActive("X_PlazaRoom", false);
|
|
|
|
|
|
ManaReso.Get("V_BlackMask").TweenForCG();
|
|
|
|
|
@@ -260,6 +271,10 @@ public class PlazaRoomManager
|
|
|
public void QuitPlazaRoom()
|
|
|
{
|
|
|
ManaCenter.SceneSwitchLock = false;
|
|
|
+
|
|
|
+ GardenSmartFox.SmartFox.Send(new LeaveRoomRequest(CurrentPlazaRoom));
|
|
|
+
|
|
|
+ GardenSmartFox.PlazaRoomManager.CurrentPlazaRoom = null;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -283,6 +298,9 @@ public class PlazaRoomManager
|
|
|
if (!InPlazaRoom)
|
|
|
return;
|
|
|
|
|
|
+ if (EnteringPlazaRoom)
|
|
|
+ return;
|
|
|
+
|
|
|
KeepAliveThread();
|
|
|
|
|
|
CameraControllThread();
|
|
@@ -318,10 +336,16 @@ public class PlazaRoomManager
|
|
|
if (SelfInstance.Player.transform.position.x <= CameraLeftBorder)
|
|
|
{
|
|
|
x = Mathf.Lerp(PlazaRoomCamera.transform.position.x, CameraLeftBorder, Time.deltaTime);
|
|
|
+
|
|
|
+ if (SkyTween != null)
|
|
|
+ SkyTween.Pause();
|
|
|
}
|
|
|
else if (SelfInstance.Player.transform.position.x >= CameraRightBorder)
|
|
|
{
|
|
|
x = Mathf.Lerp(PlazaRoomCamera.transform.position.x, CameraRightBorder, Time.deltaTime);
|
|
|
+
|
|
|
+ if (SkyTween != null)
|
|
|
+ SkyTween.Pause();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -331,6 +355,32 @@ public class PlazaRoomManager
|
|
|
PlazaRoomCamera.transform.SetX(x);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public void MoveTo(Vector3 destination)
|
|
|
+ {
|
|
|
+ GardenSmartFoxManager.GardenSmartFox.PlazaRoomManager.SelfInstance.MoveTo(destination);
|
|
|
+
|
|
|
+ GardenSmartFoxManager.GardenSmartFox.PlazaRoomManager.SendSynchronizeDestination(destination);
|
|
|
+
|
|
|
+ MoveSky(SelfInstance.MoveTween.Duration, SelfInstance.MoveTween.Delta);
|
|
|
+ }
|
|
|
+
|
|
|
+ private float SkyMoveRatio = 0.2f;
|
|
|
+ private Vector3 SkyOriginPosition;
|
|
|
+ private TweenRoot SkyTween;
|
|
|
+ public Transform PlazaRoomSky;
|
|
|
+ private void MoveSky(float duration, Vector3 offset)
|
|
|
+ {
|
|
|
+ offset *= SkyMoveRatio;
|
|
|
+ offset.y = 0;
|
|
|
+ offset.z = 0;
|
|
|
+
|
|
|
+ SkyTween = PlazaRoomSky.transform.CreateTweenVecOffset2D(offset, duration, false, true, true, Curve.Linear);
|
|
|
+
|
|
|
+ SkyTween.StartForward();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public void OnConectionLost(BaseEvent baseEvent)
|
|
|
{
|
|
|
if (InPlazaRoom)
|
|
@@ -342,17 +392,23 @@ public class PlazaRoomManager
|
|
|
|
|
|
public void OnExitPlazaRoom()
|
|
|
{
|
|
|
- CurrentPlazaRoom = null;
|
|
|
-
|
|
|
ExitPlazaRoom();
|
|
|
}
|
|
|
|
|
|
+ private Vector3 PlayerDefaultPosition;
|
|
|
public void OnJoinPlazaRoom(Room room)
|
|
|
{
|
|
|
- CurrentPlazaRoom = room;
|
|
|
+ GardenSmartFox.PlazaRoomManager.PlazaRoomSky = ManaReso.Get("PlazaRoomSky");
|
|
|
+ SkyOriginPosition = GardenSmartFox.PlazaRoomManager.PlazaRoomSky.position;
|
|
|
+
|
|
|
+ GardenSmartFox.PlazaRoomManager.PlazaRoomCamera = ManaReso.Get<Camera>("MainCamera");
|
|
|
+ GardenSmartFox.PlazaRoomManager.CameraOriginPosition = GardenSmartFox.PlazaRoomManager.PlazaRoomCamera.transform.position;
|
|
|
+
|
|
|
+ GardenSmartFox.PlazaRoomManager.CurrentPlazaRoom = room;
|
|
|
|
|
|
SelfUser = GardenSmartFox.User;
|
|
|
- SelfInstance = InstantiatePlayer(SelfUser, ManaNickName.NickName, ManaReso.Get("PlazaRoomDefaultPosition").position, PlayerDirection.Left, ManaData.GetDressDataIDs(ManaPlayer.Player));
|
|
|
+ PlayerDefaultPosition = ManaReso.Get("PlazaRoomDefaultPosition").position;
|
|
|
+ SelfInstance = InstantiatePlayer(SelfUser, ManaNickName.NickName, PlayerDefaultPosition, PlayerDirection.Left, ManaData.GetDressDataIDs(ManaPlayer.Player));
|
|
|
|
|
|
UserInstanceDictionary.Add(SelfUser, SelfInstance);
|
|
|
|
|
@@ -385,7 +441,7 @@ public class PlazaRoomManager
|
|
|
|
|
|
if (parameter.ContainsKey(DataID.Destination.GetHashString()))
|
|
|
{
|
|
|
- Vector3 destination = parameter.GetText(DataID.Destination.GetHashString()).StringToVector();
|
|
|
+ Vector3 destination = parameter.GetUtfString(DataID.Destination.GetHashString()).StringToVector();
|
|
|
|
|
|
SynchronizeDestination(destination, sender);
|
|
|
}
|
|
@@ -431,6 +487,28 @@ public class PlazaRoomManager
|
|
|
}
|
|
|
|
|
|
|
|
|
+ private string LastPublicMessage;
|
|
|
+ public void SendPublicMessage(string message)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(message))
|
|
|
+ {
|
|
|
+ Bubble.Show(null, Language.GetStr("UI", "内容不能为空"));
|
|
|
+ }
|
|
|
+ else if (LastPublicMessage == message)
|
|
|
+ {
|
|
|
+ Bubble.Show(null, Language.GetStr("UI", "请勿重复发送"));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LastPublicMessage = message;
|
|
|
+
|
|
|
+ message = StringFilter.GetFilteredString(message);
|
|
|
+
|
|
|
+ GardenSmartFoxManager.GardenSmartFox.ExtensionManager.PlazaRoomExtension.SendPublicMessage(message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public void SendInstantiateRequset(User receiver)
|
|
|
{
|
|
|
SendInstantiateRequset(receiver.Id);
|
|
@@ -441,9 +519,9 @@ public class PlazaRoomManager
|
|
|
SFSObject parameter = new SFSObject();
|
|
|
parameter.PutInt(DataID.SenderID.GetHashString(), GardenSmartFox.User.Id);
|
|
|
parameter.PutIntArray(DataID.Close.GetHashString(), ManaData.GetDressDataIDs(SelfInstance.Player).ToArray());
|
|
|
- parameter.PutText(DataID.Position.GetHashString(), SelfInstance.Player.transform.position.VectorToString());
|
|
|
+ parameter.PutUtfString(DataID.Position.GetHashString(), SelfInstance.Player.transform.position.VectorToString());
|
|
|
parameter.PutInt(DataID.PlayerDirection.GetHashString(), SelfInstance.Player.PlayerDirection.GetHashCode());
|
|
|
- parameter.PutText(DataID.NickName.GetHashString(), ManaNickName.NickName);
|
|
|
+ parameter.PutUtfString(DataID.NickName.GetHashString(), ManaNickName.NickName);
|
|
|
|
|
|
GardenSmartFox.AddRequest(GardenSmartFox.ConstructCommandParameter(CommandID.Instantiate.GetHashCode(), parameter, receiverID), RequestType.Immediate);
|
|
|
|
|
@@ -483,7 +561,7 @@ public class PlazaRoomManager
|
|
|
player.transform.position = position;
|
|
|
player.Flip(direction);
|
|
|
|
|
|
- tra.localScale = new Vector3(0.5f, 0.5f, 0.5f);
|
|
|
+ tra.localScale = new Vector3(0.3125f, 0.3125f, 0.3125f);
|
|
|
|
|
|
return new PlazaRoomPlayer(player, nickName);
|
|
|
}
|
|
@@ -491,9 +569,9 @@ public class PlazaRoomManager
|
|
|
public PlazaRoomPlayer InstantiatePlayer(User user, SFSObject parameter)
|
|
|
{
|
|
|
List<int> dressDatas = ManaData.GetDressDataIDs(parameter);
|
|
|
- Vector3 position = parameter.GetText(DataID.Position.GetHashString()).StringToVector();
|
|
|
+ Vector3 position = parameter.GetUtfString(DataID.Position.GetHashString()).StringToVector();
|
|
|
PlayerDirection direction = (PlayerDirection) parameter.GetInt(DataID.PlayerDirection.GetHashString());
|
|
|
- string nickName = parameter.GetText(DataID.NickName.GetHashString());
|
|
|
+ string nickName = parameter.GetUtfString(DataID.NickName.GetHashString());
|
|
|
|
|
|
PlazaRoomPlayer plazaRoomPlayer = InstantiatePlayer(user, nickName, position, direction, dressDatas);
|
|
|
|