silverua / slay-the-spire-map-in-unity

Implementation of the Slay the Spire Map in Unity3d
MIT License
273 stars 65 forks source link

I want a Panel that generates OuterMapParent #3

Closed hexclare closed 4 years ago

hexclare commented 4 years ago

Currently, an OuterMapParent is generated in the center of the scene on every launch. (Sorry for my mistake.) However, I want to be able to generate and display only OuterMapParent on the Panel that can be prepared in advance. Because OuterMapParent wants all the size and location of XYZ to depend on the parent UI Panel (I want it to fit the Panel size).

silverua commented 4 years ago

Can you elaborate on this a bit? I did not fully understand the goal. "OuterMapParent" is an empty game object that appears in the center of the scene, then we have "MapParentWithAScroll" as a child that has the background that we can scroll. Do you want to parent the OutterMapParent to some other object? Or what's the goal?

There will be problems with parenting this map to any UI objects (anything that has a Canvas as a parent). The line renderers and the selection circles around nodes may not work anymore. This map is intended to be used only outside of the Canvas and it should not be parented to UI Panels.

silverua commented 4 years ago

Is it a valid option to switch your UI to ScreenSpace-Camera, set the plane distance so that it is rendered behind the Map? You will get the Map rendered on top of your UI with this setup.

hexclare commented 4 years ago
This map is intended to be used only outside of the Canvas and it should not be parented to UI Panels.

I may have been thinking the wrong way to use OuterMapParent and DoozyUI. My goal is to use DoosyUI to show the Map only for some Canvas-Views and to hide the Map when it becomes another Canvas-View. I uploaded a video about the UI screen I want to do in the actual project to Youtube. https://youtu.be/RGlwbhwBrk0

silverua commented 4 years ago

Gotcha. One way of doing this is to actually rewrite the MapView.cs. For example, you can make OuterMapParent public, create it in the scene, link it into MapView, make it so that it is not destroyed when we are clearing the map, then deal with the consequences and figure out how to place it and scale it. You can also expose 2 Vector3s into the inspector for localPosition, scale of the OuterMapParent.

Another way of doing this - you can use the approach that I suggested above (keep the map relatively unchanged). And make it so that the map is shown on top of your UI when you go to that map panel. Either in code or with a button handler. You press the button to show your DoozyUI map panel and the same button also makes your Map visible. You press the button to hide your DoozyUI map panel and the same button clears the map. You can creatively use methods OnEnable() and OnDisable to make the map show/hide in sync with some other object in your scene.

hexclare commented 4 years ago

Thank you for your suggestion. I would like to adopt the latter method.👍