fenix 8 년 전
부모
커밋
4c1577ead2

+ 12 - 2
Assets/Scripts/Net/Message/MessageManager.cs

@@ -250,6 +250,7 @@ public class MessageManager
 					LoadingPanel.Increase (0.2f);
 					Session.GetInstance ().GetNetworkManager ().Login (() => {
 						battleSession.GetBattleController ().menuUI.clanChatBar.Refresh ();
+						battleSession.SetMyPlayerId(Session.myUserId);
 						CheckConnection ();
 						if (LocalSaver.GetInstance ().noAutoBinding == 0)
 							Session.GetInstance ().GetNetworkManager ().Binding ();
@@ -364,7 +365,11 @@ public class MessageManager
 	private void RemoteToLocal()
 	{
 		server.SetConnection (BAServer.ConnectionType.Local);
-		battleSession.aiTakerUserId = Session.myUserId;
+	}
+
+	private void LocalToRemote()
+	{
+		server.SetConnection (BAServer.ConnectionType.Remote);
 	}
 
 
@@ -400,9 +405,11 @@ public class MessageManager
 	private void CheckConnection()
 	{
 		if (Session.GetInstance ().myUserData.clanId > 0) {
+			LocalToRemote ();
 			battleSession.GetMessageManager ().Ready ();
 		} else {
-			battleSession.GetMessageManager ().Connect ();
+//			battleSession.GetMessageManager ().Connect ();
+			RemoteToLocal ();
 			OnReady (Command.Ready.ToString(), null);
 		}
 	}
@@ -1530,6 +1537,9 @@ public class MessageManager
 	public void ClanJoin()
 	{
 		if (Session.GetInstance ().myUserData.clanId > 0) {
+
+			LocalToRemote ();
+
 			ISFSObject data = new SFSObject ();
 			data.PutInt (UserSFSObjectLabel.CLAN, Session.GetInstance().myUserData.clanId);
 			Message msg = new Message (Command.ClanJoin, data);

+ 1 - 1
Assets/Scripts/Net/Server/Connections/LocalConnection.cs

@@ -126,7 +126,7 @@ public class LocalConnection : IConnection
 
 	private void DealBattleMessage(Message msg)
 	{
-		msg.data.PutInt (Message.LABEL_SENDER, myUserId);
+		msg.data.PutUtfString (Message.LABEL_SENDER, Session.myUserId.ToString());
 		msg.data.PutInt (Message.LABEL_TIMESTAMP, 0);
 		callBack(msg.GetMessagePackage());
 	}

+ 9 - 0
Assets/Scripts/Session/BattleSession.cs

@@ -69,6 +69,15 @@ public class BattleSession
 		}
 	}
 
+	public void SetMyPlayerId(int id)
+	{
+		int oldId = myPlayer.userId;
+		playerDict.Remove (oldId);
+
+		myPlayer.userId = id;
+		playerDict.Add (id, myPlayer);
+	}
+
 	public Player AddPlayer(int id, string nick, TeamUtil.Team team, int playerId)
 	{
 		Player player = null;

+ 11 - 0
Assets/Scripts/UI/Shop/PaymentManager.cs

@@ -52,6 +52,17 @@ public class PaymentManager : IStoreListener
 		Debug.Log("Billing initialize!");
 		this.controller = controller;
 		this.extensions = extensions;
+
+		extensions.GetExtension<IAppleExtensions> ().RefreshAppReceipt ((string result) => {
+			if (!StringUtil.Empty(result)) {
+				// Refresh finished successfully.
+			} else {
+				// Refresh failed.
+			}
+			Debug.Log("RefreshAppReceipt result "+result);
+		}, () => {
+			Debug.Log("RefreshAppReceipt error");
+		});
 	}
 
 	/// <summary>