Making and Object uniteractable - object

So I have a part of my game where the character is selecting an area of the map. And it opening up a panel. I have made it so that happens but an=m now stuck on the other part of it. I want only certain area of the map to be intractable, so that I can bar the player from selecting areas of the map that they aren't ready for. I have no idea how to make game objects in the game uninteractable. I have looked on Stack overflow, Youtube an d the Unity API to no success. Can someone help me with that.

How to make things un-interactable will vary depending on your situation. I'll be presuming that you're map is broken up into a grid of sorts.
The basic setup would involve a bool, probably called 'CanAccessZone'.
Then you'll need a class, to store any access info and popup logic, by popup logic I mean make the element either non-interactable or show a popup, with the shown popup being dependant on 'CanAccessZone'. This class can then be set up by your Map class when the level is loaded, or you could let the popup class grab the necessary values from the Map class.
If you're using Unity's UI buttons for the map pieces, then you could set interactable to false, until you want to let the player access the zone. If you want to display a popup informing the player that they can't access the zone, then your button will be interactable, but the click will delegate to your popup logic method.
It's a similiar principle if you're using gameobjects as buttons. You'd be using any of the OnMouse events to handle click events. https://docs.unity3d.com/ScriptReference/MonoBehaviour.html
Hopefully this'll lead you in the right direction.

Related

Fetching Gmail UI element

This is not strict Gmail-API question, but is closely related to Gmail.
I have small extension for Gmail that allows users to zoom on incoming emails and list of emails. video explanation on YT
For that to work, I need to fetch that upper-left corner element and inject button in it, so that users can easily invoke popup with zoom controls.
Problem is, in new Gmail, that element is changing Class Name regularly (second time in the last month), and since I'm fetching it trough ClassName, extension gets broken (no button injected).
Is there any "safe" element, that won't change class in the next update, so that I can hook my logic onto it?
I was thinking to fetch form element (the main search on top), and then trough hierarchy and previous sibling get that left element...
but I'm not sure if that will work, maybe because of some customization or right-to-left languages DOM structure is not the same

change between menu or pause screens on libgdx

i´m trying to made a couple screens like a menu or a pause, and in these screens i want to put some "other screens", for example in my menu i want a button options and then the app slides and shows another screen with options like music/volume, or like a castlevania/megaman game when the user pause the game, some options are displayed, change the inventory, buy an hability or something like that, in this case when we try to manage the inventory the screen change an shows the information about the current inventory, so my question is how is managed this on libgdx, because i know there is a screen class but is that the way to do it?, constantly change between screens or there's another way.
This is actually what you need scene2D.
scene2d is well equipped for laying out, drawing, and handling input for game menus, HUD overlays, tools, and other UIs. The scene2d.ui package provides many actors and other utilities specifically for building UIs.
Lets assume you know about Stage which you will need to add your Actors like(buttons,textfield,input) all you have to do is implement Table, part of scene2D that contains method such as setVisible.
Lets say for example this is your log-in HUD. Now you want to hide it when a button is clicked.
Table table = new Table();
table.add(textField);
table.add(logInButton);
stage.addActor(table);
if(hideButton.isChecked())
{
table.setvisible(false)
}
else
{
table.setVisible(true)
}
This will hide all your Actors that contains in your table.

Coded ui objects in UIMap

I have a question regarding coded ui UIMap.
Every time I record an action on the same application, coded ui generates a new object for the same window in the application.
It looks like:
UIAdminWindow
UIAdminWindow1
UIAdminWindow2
and so on...
every window class holds different buttons, even though it's the same window.
Thus it's very hard to keep code maintenance.
What i would like is that every time i perform actions and records on a window, even if not at the same time, the already generated class for this window, will be updated with the new controls.
any suggestions to why it happens?
Thanks a lot!
You can clean up your UIMaps by doing two things:
Use the UIMap Toolbox (from codeplex) to move controls within the UIMap so they are all under one control tree.
When you have duplicate UI controls, go to the properties for the action that references the duplicate control and change the UI Control property to point to the original control in the UIMap.
The duplicate trees should now be unreferenced and you can delete it from your map, keeping things clean.
And yes, it's a pain to do, but it's worth it for maintainability.
In UIMap.uitest you can change the action name and the control name for better maintenance.
For example: you can set UIAdminWindow as FirstAcessWindow or other name that will express comfortably the control or the action.
What I can guess is that there is some randomly generated content or element identification data such as class or title that may be causing it. This may be caused by different username for example. Also you can update the element from UI map element tree.

Swapping ActionBar items when displaying different Tabs and Detail Views

this is not a technical question, but one for advice regarding the best practices in designing an Android tablet UI.
I've got my concept of an Android Phone app pinned down.
The first activity (master view) launched contains a tab bar with three fragments from which the user can launch detail view activities of different sorts.
Both the master-view activity and the detail-view activities have actions in their action bars. Different detail views have different action items.
My question is: How should I organize and display the action items on a tablet, where an activity combines both views side by side?
The problem is the unified action bar for both the master-view fragment and whatever kind of detail fragment is shown. I do not think it is a good idea to start messing with the contents of the action bar whenever a different kind of detail view is opened.
The Android Design Guide does not tell you much on that front. There is a sample of a Contacts app in the "Multi-pane Layouts" section, but it does not actually deal with the problem. It evades it, by putting the single relevant action as an icon inside the detail view fragment.
Any advice with regards to best practices and references are appreciated.
I would suggest leaving your master details icons in the action bar, whilst putting your details view icons in another view/area within the details fragment.
My reasoning would be that icons in the action bar affect / are associated with the whole app / view on screen. Whilst your details icons only affect the details view and therefor should not be in the action menu when showing multiple fragments.
I guess you will have to see how the designs look..
I am not a fan of the action bar icons being changed from within the same activity (even if it contains multiple fragments), however when you load a new activity (like in your phone design) then I say yeah throw them in the action bar.
If I understand your question correctly, which I think is basically a question of how multiple Fragments (i.e. when on a multi-pane layout such as on a tablet) should contribute to the single ActionBar, it's quite straightforward and it is actually briefly discussed in the documentation here. Essentially, you can have the multiple Fragments all contributing their own menu items / action items to the single action bar, via some simple API calls.

Monotouch: arrange the UINavigationController back button in a different position

How can I arrange (programatically) the back button of a UINavigationController in a different position?
For example, suppose that the back button (visible in the upper bar of a UINavigationController) has these coordinates: 67 for x and 10 for y. I would arrange the back button for these coordinates: 89 for x and 10 for y.
Do I have to override these measures in a specific method (for example viewDidLoad() method)?
Thank you. Regards.
I guess this cannot be done in a simple way as you can manipulate the navigation bar only via few properties. So there are basically two methods:
1) traverse the UI tree and search for the actual button control created by iOS for you in the navigation toolbar and change its Frame property. You can always get to the inner controls by the Subviews property, so call navigationController.Subviews and iterate through that until you find the control you would like to move, btw it could be deep in the hierarchy, depends. And with iOS update this can change, so this is a bit of a hack, but usually such technique works well.
2) do the custom way. Hide the actual navigation bar, and do the navigation yourself via custom buttons, add a UIButton to your interface, in the action for that call popViewController on the navigationController. If you're inside a view controller, you can use this.navigationController.PopViewControllerAnimated (...);
If you need nice buttons, use this PSD, works well for me http://www.teehanlax.com/blog/2010/06/14/iphone-gui-psd-v4/
Hope this helps. If so, please vote.

Resources