public void callActionButtonFunction(MessageRunAction msg)
    {
        ActionButton ab = ActionButton.BUTTON_LIST[msg.buttonID];

        if (msg.childIndex != -1)
        {
            ab = ((ActionButtonParent)ab).getChildButtons()[msg.childIndex];
        }

        List <SidedEntity> list = new List <SidedEntity>();

        foreach (GameObject obj in msg.targets)
        {
            list.Add(obj.GetComponent <SidedEntity>());
        }

        ab.callFunction(list);
    }
Example #2
0
    public void callActionButton(ActionButton button, List <SidedEntity> targets)
    {
        if (button.executeOnClientSide())
        {
            button.callFunction(targets);
        }
        else
        {
            MessageRunAction msg;
            if (button is ActionButtonChild)
            {
                ActionButtonChild abc = (ActionButtonChild)button;
                msg = new MessageRunAction(abc.parentActionButton.getID(), abc.index, targets);
            }
            else
            {
                msg = new MessageRunAction(button.getID(), targets);
            }

            this.sendMessageToServer(msg);
        }
    }