示例#1
0
	private void _SendWorldChat(string strChat)
	{
		body_CS_CHAT_MESSAGE chat = new body_CS_CHAT_MESSAGE( strChat, eCHATTYPE.eCHATTYPE_SERVER, true, m_nSlotIndex);
		byte[] data = chat.ClassToPacketBytes();
		AsNetworkMessageHandler.Instance.Send( data);
	}
示例#2
0
	void ShowQuestClearMsg(QuestData _questData)
	{
		string msg = string.Empty;

		int stringIdx = 0;
		int npcID = 0;
		Tbl_Npc_Record npcRecord = null;

		if (_questData.Info.QuestType == QuestType.QUEST_MAIN || _questData.Info.QuestType == QuestType.QUEST_FIELD ||
			_questData.Info.QuestType == QuestType.QUEST_BOSS || _questData.Info.QuestType == QuestType.QUEST_PVP || _questData.Info.QuestType == QuestType.QUEST_NPC_DAILY)
		{
			npcID = _questData.Info.QuestCompleteNpcID;
			npcRecord = AsTableManager.Instance.GetTbl_Npc_Record(npcID);
			stringIdx = 847;
		}
		else if (_questData.Info.QuestType == QuestType.QUEST_DAILY)
			stringIdx = 848;
		else if (_questData.Info.QuestType == QuestType.QUEST_WANTED)
			stringIdx = 860;


		if (_questData.Info.QuestType == QuestType.QUEST_MAIN || _questData.Info.QuestType == QuestType.QUEST_FIELD ||
			_questData.Info.QuestType == QuestType.QUEST_BOSS || _questData.Info.QuestType == QuestType.QUEST_PVP || _questData.Info.QuestType == QuestType.QUEST_NPC_DAILY)
			msg = string.Format(AsTableManager.Instance.GetTbl_String(stringIdx), _questData.Info.Name, npcRecord.NpcName);
		else
			msg = string.Format(AsTableManager.Instance.GetTbl_String(stringIdx), _questData.Info.Name);

		if (AsHudDlgMgr.Instance != null)
			if (AsHudDlgMgr.Instance.questCompleteMsgManager != null)
			{
				AsHudDlgMgr.Instance.questCompleteMsgManager.AddMessage(msg, _questData.Info.QuestType);

			}


		// quest clear chat msg
		string chatMsg = string.Format(AsTableManager.Instance.GetTbl_String(2102), _questData.Info.Name);

		if (TerrainMgr.Instance.IsCurMapType(eMAP_TYPE.Tutorial) == true)
		{
			StringBuilder sb = new StringBuilder("[");
			sb.Append(AsUtil.GetRealString(System.Text.Encoding.UTF8.GetString(AsUserInfo.Instance.GetCurrentUserCharacterInfo().szCharName)));
			sb.Append("]:");
			sb.Append(chatMsg);

			AsChatManager.Instance.InsertChat(sb.ToString(), eCHATTYPE.eCHATTYPE_PUBLIC, true);

			AsChatManager.Instance.ShowChatBalloon(AsEntityManager.Instance.UserEntity.UniqueId, chatMsg, eCHATTYPE.eCHATTYPE_PUBLIC);
		}
		else
		{
			body_CS_CHAT_MESSAGE chat = new body_CS_CHAT_MESSAGE(chatMsg, eCHATTYPE.eCHATTYPE_PUBLIC, false);
			byte[] data = chat.ClassToPacketBytes();
			AsNetworkMessageHandler.Instance.Send(data);
		}
	}
示例#3
0
	public void SendChat()
	{
		if( true == CommandJudgment( textField.Text))
		{
			textField.spriteText.transform.localPosition = new Vector3( 0.0f, 0.0f, -0.2f);
			textField.Text = m_strDefaultText;
		}
		
		if( 0 >= textField.Text.Length || textField.Text.Equals( m_strDefaultText))
		{
			textField.spriteText.transform.localPosition = new Vector3( 0.0f, 0.0f, -0.2f);
			textField.Text = m_strDefaultText;
			return;
		}
		
		AsUserEntity userEntity = AsUserInfo.Instance.GetCurrentUserEntity();
		if( null == userEntity)
			return;
		
		string name = userEntity.GetProperty<string>( eComponentProperty.NAME);
		string msg = textField.Text;
		
		eCHATTYPE chatType = GetChatType( msg);

		if( eCHATTYPE.eCHATTYPE_GUILD == chatType)
		{
			if( true == AsInstanceDungeonManager.Instance.CheckInIndun() || true == AsPvpManager.Instance.CheckInArena())
				return;
		}

		switch( chatType)
		{
		case eCHATTYPE.eCHATTYPE_PUBLIC:
			{
				string strRes = _Substring_TokenNormalChat( msg);
			
				if( strRes.Length > 0)
				{
					if( false == _isChatLock())
					{
						body_CS_CHAT_MESSAGE chat = new body_CS_CHAT_MESSAGE( strRes, chatType);
						byte[] data = chat.ClassToPacketBytes();
						AsNetworkMessageHandler.Instance.Send( data);
					}
				}
			}
			break;
		case eCHATTYPE.eCHATTYPE_SERVER:
		case eCHATTYPE.eCHATTYPE_SYSTEM:
			{
				if( false == _isChatLock())
				{
					body_CS_CHAT_MESSAGE chat = new body_CS_CHAT_MESSAGE( msg, chatType);
					byte[] data = chat.ClassToPacketBytes();
					AsNetworkMessageHandler.Instance.Send( data);
				}
			}
			break;
		case eCHATTYPE.eCHATTYPE_GUILD:
		case eCHATTYPE.eCHATTYPE_MAP:
		case eCHATTYPE.eCHATTYPE_PARTY:
			{
				if( 0 >= msg.Length)
					break;

				string[] tokens = msg.Split( TOKEN_SPLIT);
				string typeToken = tokens[0];

				if( ( 1 < tokens.Length) && ( ( 0 == string.Compare( typeToken, TOKEN_GUILD_CHAT1)) || ( 0 == string.Compare( typeToken, TOKEN_PARTY_CHAT1))))
				{
					msg = msg.Remove( 0, typeToken.Length + 1);
				}

				if( eCHATTYPE.eCHATTYPE_PARTY == chatType)
				{
					if( null == AsPartyManager.Instance.GetPartyMember( userEntity.UniqueId))
					{
						AsChatManager.Instance.InsertChat( AsTableManager.Instance.GetTbl_String(1477), eCHATTYPE.eCHATTYPE_SYSTEM);
						break;
					}
				}

				if( eCHATTYPE.eCHATTYPE_GUILD == chatType)
				{
					if( null == AsUserInfo.Instance.GuildData)
					{
						AsChatManager.Instance.InsertChat( AsTableManager.Instance.GetTbl_String(1478), eCHATTYPE.eCHATTYPE_SYSTEM);
						break;
					}
				}
			
				if( false == _isChatLock())
				{
					body_CS_CHAT_MESSAGE chat = new body_CS_CHAT_MESSAGE( msg, chatType);
					byte[] data = chat.ClassToPacketBytes();
					AsNetworkMessageHandler.Instance.Send( data);
				}
			}
			break;
		case eCHATTYPE.eCHATTYPE_PRIVATE:
			{
				if( 0 >= msg.Length)
					break;

				string[] tokens = msg.Split( TOKEN_SPLIT);
				string typeToken = tokens[0];

				if( ( 2 >= tokens.Length) || ( 0 != string.Compare( typeToken, TOKEN_WHISPER_CHAT1)))
				{
					if( 0 >= filterField.Text.Length)
						return;

					if( false == _isChatLock())
					{
						string receiver = AsUtil.GetRealString( filterField.Text);
						PlayerPrefs.SetString( "LatestWhisper", receiver);
						PlayerPrefs.Save();

						body_CS_CHAT_PRIVATE chat = new body_CS_CHAT_PRIVATE( receiver, msg);
						byte[] data = chat.ClassToPacketBytes();
						AsNetworkMessageHandler.Instance.Send( data);
					}
				}
				else
				{
					string receiverToken = tokens[1];

					if( receiverToken == name)
					{
						AsChatManager.Instance.InsertChat( AsTableManager.Instance.GetTbl_String(112), eCHATTYPE.eCHATTYPE_SYSTEM);
						break;
					}
	
					//dopamin #16068
					if( 0 >= receiverToken.Length)
					{
						string format = AsTableManager.Instance.GetTbl_String(113);
						string sysMsg = string.Format( format, receiverToken);
						AsChatManager.Instance.InsertChat( sysMsg, eCHATTYPE.eCHATTYPE_SYSTEM);
						break;
					}
	
					msg = msg.Remove( 0, typeToken.Length + receiverToken.Length + 2);
					if( 0 >= msg.Length)
						return;
				
					if( false == _isChatLock())
					{
						PlayerPrefs.SetString( "LatestWhisper", receiverToken);
						PlayerPrefs.Save();
					
						body_CS_CHAT_PRIVATE chat = new body_CS_CHAT_PRIVATE( receiverToken, msg);
						byte[] data = chat.ClassToPacketBytes();
						AsNetworkMessageHandler.Instance.Send( data);
					}
				}
			}
			break;
		case eCHATTYPE.eCHATTYPE_REPLY:
			{
				if( null == latestWhisperer)
					break;

				if( latestWhisperer == name)
				{
					AsChatManager.Instance.InsertChat( AsTableManager.Instance.GetTbl_String(112), eCHATTYPE.eCHATTYPE_SYSTEM);
					break;
				}

				string[] tokens = msg.Split( TOKEN_SPLIT);
				if( 1 < tokens.Length)
				{
					string typeToken = tokens[0];
					msg = msg.Remove( 0, typeToken.Length + 1);
				}

				if( 0 >= msg.Length)
					return;

				if( false == _isChatLock())
				{
					body_CS_CHAT_PRIVATE chat = new body_CS_CHAT_PRIVATE( latestWhisperer, msg);
					byte[] data = chat.ClassToPacketBytes();
					AsNetworkMessageHandler.Instance.Send( data);
				}
			}
			break;
		}
		
		textField.spriteText.transform.localPosition = new Vector3( 0.0f, 0.0f, -0.2f);
		textField.Text = m_strDefaultText;
	}
示例#4
0
	void ShowAdMsg()
	{
		if (pressObject == null)
			return;

		if (!dicQuestListItem.ContainsKey(pressObject))
			return;

		int idx = dicQuestListItem[pressObject];

		ArkQuest quest = listQuest[idx];

		ArkSphereQuestTool.QuestData questData = quest.GetQuestData();

		StringBuilder sb = new StringBuilder(questData.Info.GetQuestTypeString());
		sb.Append(questData.Info.Name);
		sb.Append(" ");
		sb.Append(AsTableManager.Instance.GetTbl_String(2132));

		body_CS_CHAT_MESSAGE chat = new body_CS_CHAT_MESSAGE(sb.ToString(), eCHATTYPE.eCHATTYPE_PUBLIC, false);
		byte[] data = chat.ClassToPacketBytes();
		AsNetworkMessageHandler.Instance.Send(data);

		// set cool Time
		nowAdCoolTime = adCoolTime;
	}