Пример #1
0
	void StoreInputMessage(eInputType _type, GameObject _inputObject, Vector3 _screenPosition, 
		Vector3 _deltaPosition, Vector3 _worldPosition, float _deltaTime)
	{
		m_StoredMessage = new Msg_Input(_type, _inputObject, _screenPosition,
				                                _deltaPosition, _worldPosition, _deltaTime);
	}
Пример #2
0
	void DecideSingleTouchInput( Msg_Input _single)
	{
//		Debug.Log( "layer : " + LayerMask.LayerToName( _single.inputObject_.layer) + " Name : " + _single.inputObject_.name);
		
		if( null == _single.inputObject_)
			return;
		
		string layerName = LayerMask.LayerToName( _single.inputObject_.layer);
		switch( layerName)
		{
		case "Terrain":
		case "Item":
		case "Potal":
			{
				AsUserEntity user = AsUserInfo.Instance.GetCurrentUserEntity();
				if( null != user)
				{
					if( _single.worldPosition_ != Vector3.zero)
					{
						user.HandleMessage( new Msg_Input_Move( _single.worldPosition_));
						m_eInputEvent = eInputEventType.ONE_FINGER_TOUCH_MOVE; // ilmeda 20120418
					}
					else
					{
						Debug.LogWarning("AsInputManager:: DecideSingleTouchInput: input process is ignored. _single.worldPosition_ = " + _single.worldPosition_);
					}
				}
			}
			break;
		case "Monster":
			{
				AsNpcEntity enemy = AsEntityManager.Instance.GetEntityByInstanceId( _single.inputObject_.GetInstanceID()) as AsNpcEntity;
				if( null != enemy)
				{
					if( enemy.isSegregate == false)
					{
						AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage( new Msg_Input_Attack( enemy));
						m_eInputEvent = eInputEventType.ONE_FINGER_TOUCH_ATTACK; // ilmeda 20120418
					}
				}
				else
				{
					Debug.LogError( "AsInputManager::DecideSingleTouchInput: invalid enemy selection.");
				}
			}
			break;
		case "Object":
			{
				
				AsNpcEntity npcObject = AsEntityManager.Instance.GetEntityByInstanceId( _single.inputObject_.GetInstanceID()) as AsNpcEntity;
				if( null != npcObject)
				{	
				
					AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage( new Msg_NpcClick(npcObject.SessionId));
				
					int iGroupIndex = npcObject.GetProperty<int>( eComponentProperty.GROUP_INDEX);
					if( 0 >= iGroupIndex)
					{
						/*AsEntityManager.Instance.BroadcastMessageToAllEntities( new Msg_Input_Move( _single.worldPosition_));
						m_eInputEvent = eInputEventType.ONE_FINGER_TOUCH_MOVE; // ilmeda 20120418*/				
						
						//AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage(new Msg_NpcClick(npcObject.SessionId) );
						//AsEntityManager.Instance.BroadcastMessageToAllEntities( new Msg_NpcClick(npcObject.SessionId) );
						AsEntityManager.Instance.DispatchMessageByNpcSessionId(npcObject.SessionId, new Msg_NpcClick(npcObject.SessionId) );
					}
					else
					{
		                int iLinkIndex = npcObject.GetProperty<int>( eComponentProperty.LINK_INDEX);
		                int iDeiff = Mathf.Abs( iLinkIndex - AsEntityManager.Instance.UserEntity.linkIndex_);
		                if( AsEntityManager.Instance.UserEntity.linkIndex_ != 0 && ( iLinkIndex == AsEntityManager.Instance.UserEntity.linkIndex_ || iDeiff > 1) )
		                {
		                    Debug.Log( "LinkIndex return");
		                }
		                else
						{
		                    ObjSteppingMgr.Instance.ClickObject( iGroupIndex, npcObject, _single.worldPosition_);
		                }
					}
				}
				else
				{
					Debug.LogError( "AsInputManager::DecideSingleTouchInput: invalid Object selection.");
				}
			}
			break;
		case "OtherUser":
			AsUserEntity otherUser = AsEntityManager.Instance.GetEntityByInstanceId( _single.inputObject_.GetInstanceID()) as AsUserEntity;
			if( null != otherUser)// && otherUser.Hide == false)
			{
				AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage( new Msg_OtherUserClick( otherUser.UniqueId));
				m_eInputEvent = eInputEventType.ONE_FINGER_TOUCH_ATTACK;
			}
			break;
		case "Npc":
			AsNpcEntity enemy = AsEntityManager.Instance.GetEntityByInstanceId( _single.inputObject_.GetInstanceID()) as AsNpcEntity;
			if( null != enemy)
			{
				if( enemy.isNoWarpIndex )
				{
					if(enemy.GetClickable() == true)
					{
						AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage( new Msg_NpcClick(enemy.SessionId));
						m_eInputEvent = eInputEventType.ONE_FINGER_TOUCH_ATTACK; // ilmeda 20120418
					}
				}
				else
				{
					AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage( new Msg_NpcClick(enemy.SessionId));
					m_eInputEvent = eInputEventType.ONE_FINGER_TOUCH_ATTACK; // ilmeda 20120418
				}				
			}
			break;
		case "Collection":
			AsNpcEntity _collection = AsEntityManager.Instance.GetEntityByInstanceId( _single.inputObject_.GetInstanceID()) as AsNpcEntity;
			if( null != _collection )
			{
				eITEM_PRODUCT_TECHNIQUE_TYPE _type = (eITEM_PRODUCT_TECHNIQUE_TYPE)_collection.GetProperty<int>(eComponentProperty.COLLECTOR_TECHNIC_TYPE);
				
				bool bCanCollect = false;
				if (_collection.collectionMark != null)
					 bCanCollect = _collection.collectionMark.Visible;
				
				if( _type != eITEM_PRODUCT_TECHNIQUE_TYPE.QUEST || true == bCanCollect )
				{
					AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage( new Msg_CollectClick(_collection.SessionId));
					AsEntityManager.Instance.DispatchMessageByNpcSessionId(_collection.SessionId, new Msg_NpcClick(_collection.SessionId) );
					m_eInputEvent = eInputEventType.ONE_FINGER_TOUCH_ATTACK; // ilmeda 20120418
				}
			}
			break;
		case "Player":
			AsUserEntity user = AsUserInfo.Instance.GetCurrentUserEntity();
			if(user != null)
				user.HandleMessage(new Msg_PlayerClick());
			break;
		}
	}
Пример #3
0
	void DecideDoubleTouchInput(Msg_Input _double)
	{
		if(_double.inputObject_ != null)
		{
			AsUserEntity user = AsUserInfo.Instance.GetCurrentUserEntity();
			
			if(_double.inputObject_.layer == LayerMask.NameToLayer("Terrain"))
			{		
//				if(user != null)
//				{
////					Vector3 direction = _double.screenPosition_ - new Vector3(Screen.width * 0.5f, Screen.height * 0.5f, 0);
//					Vector3 direction = _double.worldPosition_ - user.transform.position;
////					direction.z = direction.y;direction.y = 0;
//					
//					user.HandleMessage(new Msg_Input_Dash(direction.normalized));
//				} 
				
				if( null != user )
				{
					Msg_Input_DoubleTab input = new Msg_Input_DoubleTab(_double, Msg_Input_DoubleTab.eDoubleTabType.Terrain);				
					user.HandleMessage(input);
				}
				
				
			}
			else if(_double.inputObject_.layer == LayerMask.NameToLayer("Player"))
			{
				Msg_Input_DoubleTab input = new Msg_Input_DoubleTab(_double, Msg_Input_DoubleTab.eDoubleTabType.Player);				
					user.HandleMessage(input);
			}
			else if(_double.inputObject_.layer == LayerMask.NameToLayer("OtherUser"))
			{
			}
			else if(_double.inputObject_.layer == LayerMask.NameToLayer("Monster"))
			{
				AsNpcEntity enemy = AsEntityManager.Instance.GetEntityByInstanceId( _double.inputObject_.GetInstanceID()) as AsNpcEntity;
				if( null != enemy && enemy.isSegregate == false)
				{
					Msg_Input_DoubleTab input = new Msg_Input_DoubleTab(_double, Msg_Input_DoubleTab.eDoubleTabType.Monster);				
					user.HandleMessage(input);
				}
				
			}
			
			m_eInputEvent = eInputEventType.ONE_FINGER_TOUCH_ATTACK; // ilmeda 20120716
		}
	}
Пример #4
0
	public Msg_Input_DoubleTab( Msg_Input _input, eDoubleTabType _type)
	{
		m_MessageType = eMessageType.INPUT_DOUBLE_TAB;

		type_ = _type;
		input_ = _input;
	}