Example #1
0
	private void ChannelSelectResult( byte[] _packet)
	{
		Debug.Log( "ChannelSelectResult");

		body_GC_CHANNEL_SELECT_RESULT selectResult = new body_GC_CHANNEL_SELECT_RESULT();
		selectResult.PacketBytesToClass( _packet);

		switch( selectResult.eResult)
		{
		case eRESULTCODE.eRESULT_FAIL_CHANNEL_INVALID:
			AsChannelListBtn.s_ChannelSelected = false;	// #12066
			return;
		case eRESULTCODE.eRESULT_FAIL_CHANNEL_FULL:
			if( AsUserInfo.Instance.PlayerPrivateShopOpened == false)
				AsNotify.Instance.MessageBox( AsTableManager.Instance.GetTbl_String(206), AsTableManager.Instance.GetTbl_String(831), AsNotify.MSG_BOX_TYPE.MBT_OK, AsNotify.MSG_BOX_ICON.MBI_NOTICE);
			else // private shop opened
				AsPStoreManager.Instance.OpenChannelDlgInCharacterSelect();
			AsChannelListBtn.s_ChannelSelected = false;	// #12066
			return;
		case eRESULTCODE.eRESULT_FAIL_CHANNEL_COMBAT:
			AsNotify.Instance.MessageBox( AsTableManager.Instance.GetTbl_String(206), AsTableManager.Instance.GetTbl_String(208), AsNotify.MSG_BOX_TYPE.MBT_OK, AsNotify.MSG_BOX_ICON.MBI_NOTICE);
			AsChannelListBtn.s_ChannelSelected = false;	// #12066
			return;
		case eRESULTCODE.eRESULT_FAIL_CHANNEL_USING_CONTENT:
			AsNotify.Instance.MessageBox( AsTableManager.Instance.GetTbl_String(206), AsTableManager.Instance.GetTbl_String(832), AsNotify.MSG_BOX_TYPE.MBT_OK, AsNotify.MSG_BOX_ICON.MBI_NOTICE);
			AsChannelListBtn.s_ChannelSelected = false;	// #12066
			return;
		}

		AsUserInfo.Instance.currentChannel = selectResult.nChannel;
//		body2_GC_CHANNEL_LIST channel = AsChannelListData.Instance.GetData( selectResult.nChannel - 1);
		body2_GC_CHANNEL_LIST channel = AsChannelListData.Instance.GetDataByChannelIndex( selectResult.nChannel);
		if( null != channel)
			AsUserInfo.Instance.currentChannelName = channel.szChannelName;
		else
			AsUserInfo.Instance.currentChannelName = string.Empty;

		//$yde
		AsPromotionManager.Instance.Reserve_ChannelChanged();

		AS_CG_ENTER_WORLD enterWorld = new AS_CG_ENTER_WORLD();
		byte[] data = enterWorld.ClassToPacketBytes();
		AsNetworkMessageHandler.Instance.Send( data);

		AsUserEntity userEntity = AsUserInfo.Instance.GetCurrentUserEntity();
		if( null != userEntity)
		{
			StringBuilder sb = new StringBuilder( "ChannelCooltime_");
			sb.Append( userEntity.UniqueId);

			PlayerPrefs.SetString( sb.ToString(), System.DateTime.Now.Ticks.ToString());
			PlayerPrefs.Save();
		}
	}
Example #2
0
	private void ChannelAutoSelect( byte[] _packet)
	{
		Debug.Log( "ChannelAutoSelect");

		body_GC_CHANNEL_AUTO_SELECT channelAutoSelect = new body_GC_CHANNEL_AUTO_SELECT();
		channelAutoSelect.PacketBytesToClass( _packet);

		if( 0 == channelAutoSelect.nChannel)
		{
			body_CG_CHANNEL_LIST channelList = new body_CG_CHANNEL_LIST( false);
			byte[] data = channelList.ClassToPacketBytes();
			AsNetworkMessageHandler.Instance.Send( data);
		}
		else
		{
			Debug.Log( "Enter channel : " + channelAutoSelect.nChannel);

			AsUserInfo.Instance.currentChannel = channelAutoSelect.nChannel;
			AsUserInfo.Instance.currentChannelName = channelAutoSelect.szChannelName;

			AS_CG_ENTER_WORLD enterWorld = new AS_CG_ENTER_WORLD();
			byte[] data = enterWorld.ClassToPacketBytes();
			AsNetworkMessageHandler.Instance.Send( data);

#if false
			AsUserEntity userEntity = AsUserInfo.Instance.GetCurrentUserEntity();
			if( null != userEntity)
			{
				StringBuilder sb = new StringBuilder( "ChannelCooltime_");
				sb.Append( userEntity.UniqueId);

				PlayerPrefs.SetString( sb.ToString(), System.DateTime.Now.Ticks.ToString());
				PlayerPrefs.Save();
			}
#endif
		}
	}