예제 #1
0
 private void AddBuildingPanelControls(WorldInfoPanel infoPanel, out UIButton button, Vector3 customizeButtonOffset)
 {
     button = UIUtil.CreateToggleButton(infoPanel.component, customizeButtonOffset, UIAlignAnchor.TopRight, delegate(UIComponent component, UIMouseEventParameter param)
     {
         InstanceID instanceID = (InstanceID)infoPanel.GetType().GetField("m_InstanceID", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(infoPanel);
         var building          = BuildingManager.instance.m_buildings.m_buffer[instanceID.Building].Info;
         if (CustomizePanel == null || building != CurrentBuilding)
         {
             CustomizePanel = building.GenerateCustomizationPanel();
         }
         else
         {
             CustomizePanel.isVisible = false;
             UIUtil.DestroyDeeply(CustomizePanel);
         }
         if (component.hasFocus)
         {
             component.Unfocus();
         }
     });
 }