Esempio n. 1
0
    void CreateEvent(MessageName message)
    {
        MovingJoystick move = new MovingJoystick();
        move.joystickName = gameObject.name;
        move.joystickAxis = joystickAxis;
        move.joystickValue = joystickValue;
        move.joystick = this;

        //
        if (!useBroadcast){
            switch (message){
                case MessageName.On_JoystickMoveStart:
                    if (On_JoystickMoveStart!=null){
                        On_JoystickMoveStart( move);
                    }
                    break;
                case MessageName.On_JoystickMove:
                    if (On_JoystickMove!=null){
                        On_JoystickMove( move);
                    }
                    break;
                case MessageName.On_JoystickMoveEnd:
                    if (On_JoystickMoveEnd!=null){
                        On_JoystickMoveEnd( move);
                    }
                    break;
                case MessageName.On_JoystickTouchStart:
                    if (On_JoystickTouchStart!=null){
                        On_JoystickTouchStart( move);
                    }
                    break;
                case MessageName.On_JoystickTap:
                    if (On_JoystickTap!=null){
                        On_JoystickTap( move);
                    }
                    break;

                case MessageName.On_JoystickDoubleTap:
                    if (On_JoystickDoubleTap!=null){
                        On_JoystickDoubleTap( move);
                    }
                    break;
                case MessageName.On_JoystickTouchUp:
                    if (On_JoystickTouchUp!=null){
                        On_JoystickTouchUp( move);
                    }
                    break;
            }
        }
        else if (useBroadcast){
            if (receiverGameObject!=null){
                switch(messageMode){
                    case Broadcast.BroadcastMessage:
                        receiverGameObject.BroadcastMessage( message.ToString(),move,SendMessageOptions.DontRequireReceiver);
                        break;
                    case Broadcast.SendMessage:
                        receiverGameObject.SendMessage( message.ToString(),move,SendMessageOptions.DontRequireReceiver);
                        break;
                    case Broadcast.SendMessageUpwards:
                        receiverGameObject.SendMessageUpwards( message.ToString(),move,SendMessageOptions.DontRequireReceiver);
                        break;
                    }
            }
            else{
                Debug.LogError("Joystick : " + gameObject.name + " : you must setup receiver gameobject");
            }
        }
    }
Esempio n. 2
0
    void RaiseEvent(MessageName msg)
    {
        if (interaction == InteractionType.Event){
            if (!useBroadcast){
                switch (msg){
                    case MessageName.On_ButtonDown:
                        if (On_ButtonDown!=null){
                            On_ButtonDown( gameObject.name);
                        }
                        break;
                    case MessageName.On_ButtonUp:
                        if (On_ButtonUp!=null){
                            On_ButtonUp( gameObject.name);
                        }
                        break;
                    case MessageName.On_ButtonPress:

                        if (On_ButtonPress!=null){
                            On_ButtonPress( gameObject.name);
                        }
                        break;
                }
            }
            else{
                string method = msg.ToString();

                if (msg == MessageName.On_ButtonDown && downMethodName!="" && useSpecificalMethod){
                    method = downMethodName;
                }

                if (msg == MessageName.On_ButtonPress && pressMethodName!="" && useSpecificalMethod){
                    method = pressMethodName;
                }

                if (msg == MessageName.On_ButtonUp && upMethodName!="" && useSpecificalMethod){
                    method = upMethodName;
                }
                if (receiverGameObject!=null){
                    switch(messageMode){
                        case Broadcast.BroadcastMessage:
                            receiverGameObject.BroadcastMessage( method,name,SendMessageOptions.DontRequireReceiver);
                            break;
                        case Broadcast.SendMessage:
                            receiverGameObject.SendMessage( method,name,SendMessageOptions.DontRequireReceiver);
                            break;
                        case Broadcast.SendMessageUpwards:
                            receiverGameObject.SendMessageUpwards( method,name,SendMessageOptions.DontRequireReceiver);
                            break;
                    }
                }
                else{
                    Debug.LogError("Button : " + gameObject.name + " : you must setup receiver gameobject");

                }

            }
        }
    }
		public IEnumerable<Type> BindExchangesForPublisher(Type messageType)
		{
			var messageName = new MessageName(messageType);

			using (IModel model = _connection.CreateModel())
			{
				model.ExchangeDeclare(messageName.ToString(), ExchangeType.Fanout, true, false, null);

				yield return messageType;

				foreach (var type in messageType.GetMessageTypes().Skip(1))
				{
					var interfaceName = new MessageName(type);

					model.ExchangeDeclare(interfaceName.ToString(), ExchangeType.Fanout, true, false, null);
					model.ExchangeBind(interfaceName.ToString(), messageName.ToString(), "");

					yield return type;
				}

				model.Close(200, "ok");
			}
		}
Esempio n. 4
0
	void CreateEvent(MessageName message){
		
		
		MovingJoystick move = new MovingJoystick();
		move.joystickName = gameObject.name;
		move.joystickAxis = joystickAxis;
		move.joystickValue = joystickValue;
		
		//
		if (!useBroadcast){
			switch (message){
			case MessageName.On_JoystickMove:
				if (On_JoystickMove!=null){
					On_JoystickMove( move);	
				}
				break;
			case MessageName.On_JoystickMoveEnd:
				if (On_JoystickMoveEnd!=null){
					On_JoystickMoveEnd( move);	
				}
				break;	
			}
		}
		else{
			switch(messageMode){
			case Broadcast.BroadcastMessage:
				ReceiverObjectGame.BroadcastMessage( message.ToString(),move,SendMessageOptions.DontRequireReceiver);
				break;
			case Broadcast.SendMessage:
				ReceiverObjectGame.SendMessage( message.ToString(),move,SendMessageOptions.DontRequireReceiver);
				break;
			case Broadcast.SendMessageUpwards:
				ReceiverObjectGame.SendMessageUpwards( message.ToString(),move,SendMessageOptions.DontRequireReceiver);
				break;
			}
		}
		
	}
		public void BindExchangesForSubscriber(Type messageType)
		{
			var messageName = new MessageName(messageType);

			BindExchange(_address.Name, messageName.ToString(), ExchangeType.Fanout, "");
		}
    private void RaiseEvent(MessageName msg)
    {
        if (this.interaction == InteractionType.Event)
        {
            if (!this.useBroadcast)
            {
                switch (msg)
                {
                    case MessageName.On_ButtonDown:
                        if (On_ButtonDown != null)
                        {
                            On_ButtonDown(base.gameObject.name);
                        }
                        break;

                    case MessageName.On_ButtonPress:
                        if (On_ButtonPress != null)
                        {
                            On_ButtonPress(base.gameObject.name);
                        }
                        break;

                    case MessageName.On_ButtonUp:
                        if (On_ButtonUp != null)
                        {
                            On_ButtonUp(base.gameObject.name);
                        }
                        break;
                }
            }
            else
            {
                string methodName = msg.ToString();
                if (((msg == MessageName.On_ButtonDown) && (this.downMethodName != string.Empty)) && this.useSpecificalMethod)
                {
                    methodName = this.downMethodName;
                }
                if (((msg == MessageName.On_ButtonPress) && (this.pressMethodName != string.Empty)) && this.useSpecificalMethod)
                {
                    methodName = this.pressMethodName;
                }
                if (((msg == MessageName.On_ButtonUp) && (this.upMethodName != string.Empty)) && this.useSpecificalMethod)
                {
                    methodName = this.upMethodName;
                }
                if (this.receiverGameObject != null)
                {
                    switch (this.messageMode)
                    {
                        case Broadcast.SendMessage:
                            this.receiverGameObject.SendMessage(methodName, base.name, SendMessageOptions.DontRequireReceiver);
                            break;

                        case Broadcast.SendMessageUpwards:
                            this.receiverGameObject.SendMessageUpwards(methodName, base.name, SendMessageOptions.DontRequireReceiver);
                            break;

                        case Broadcast.BroadcastMessage:
                            this.receiverGameObject.BroadcastMessage(methodName, base.name, SendMessageOptions.DontRequireReceiver);
                            break;
                    }
                }
                else
                {
                    Debug.LogError("Button : " + base.gameObject.name + " : you must setup receiver gameobject");
                }
            }
        }
    }
Esempio n. 7
0
    void RaiseEvent(MessageName msg)
    {
        if (interaction == InteractionType.Event)
        {
            if (!useBroadcast)
            {
                switch (msg)
                {
                case MessageName.On_ButtonDown:
                    if (On_ButtonDown != null)
                    {
                        On_ButtonDown(gameObject.name);
                    }
                    break;

                case MessageName.On_ButtonUp:
                    if (On_ButtonUp != null)
                    {
                        On_ButtonUp(gameObject.name);
                    }
                    break;

                case MessageName.On_ButtonPress:

                    if (On_ButtonPress != null)
                    {
                        On_ButtonPress(gameObject.name);
                    }
                    break;
                }
            }
            else
            {
                string method = msg.ToString();

                if (msg == MessageName.On_ButtonDown && downMethodName != "" && useSpecificalMethod)
                {
                    method = downMethodName;
                }

                if (msg == MessageName.On_ButtonPress && pressMethodName != "" && useSpecificalMethod)
                {
                    method = pressMethodName;
                }

                if (msg == MessageName.On_ButtonUp && upMethodName != "" && useSpecificalMethod)
                {
                    method = upMethodName;
                }
                if (receiverGameObject != null)
                {
                    switch (messageMode)
                    {
                    case Broadcast.BroadcastMessage:
                        receiverGameObject.BroadcastMessage(method, name, SendMessageOptions.DontRequireReceiver);
                        break;

                    case Broadcast.SendMessage:
                        receiverGameObject.SendMessage(method, name, SendMessageOptions.DontRequireReceiver);
                        break;

                    case Broadcast.SendMessageUpwards:
                        receiverGameObject.SendMessageUpwards(method, name, SendMessageOptions.DontRequireReceiver);
                        break;
                    }
                }
                else
                {
                    Debug.LogError("Button : " + gameObject.name + " : you must setup receiver gameobject");
                }
            }
        }
    }
        /// <summary>
        /// Adds an endpoint for the message type. This will look up all super-classes
        /// of the message's type (running for those as well) and then create
        /// message sinks corresponding to the type of message that is being published.
        /// </summary>
        /// <param name="messageType">The type of message to add an endpoint for.</param>
        void AddEndpointForType(Type messageType)
        {
            IEnumerable <Type> types = _inbound.SubscribeTopicsForPublisher(messageType, _formatter);

            foreach (Type type in types)
            {
                if (_added.Has(type))
                {
                    continue;
                }

                MessageName messageName = _formatter.GetMessageName(type);

                IAzureServiceBusEndpointAddress messageEndpointAddress = _address.ForTopic(messageName.ToString());

                FindOrAddEndpoint(type, messageEndpointAddress);
            }
        }
Esempio n. 9
0
        public void BindExchangesForSubscriber(Type messageType)
        {
            var messageName = new MessageName(messageType);

            BindExchange(_address.Name, messageName.ToString(), ExchangeType.Fanout, "");
        }