Skip to content

Commit

Permalink
fixOverlayWnd
Browse files Browse the repository at this point in the history
  • Loading branch information
m-garin committed Mar 11, 2018
1 parent 69af2e7 commit 6a3daab
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 20 deletions.
1 change: 0 additions & 1 deletion Assets/Scripts/Buildings/Real/RealFactory.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using UnityEngine;
using System.Collections.Generic;
using Buildings;

namespace Buildings.Real
{
Expand Down
5 changes: 4 additions & 1 deletion Assets/Scripts/UI/AbstractWindowView.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine;
using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

Expand All @@ -8,6 +9,8 @@ public abstract class AbstractWindowView : MonoBehaviour
{
GameObject overlayWindow;

public abstract void OnOutsideClick();

protected void SetSelected(GameObject _go)
{
EventSystem.current.SetSelectedGameObject(_go);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/UI/BuildingManager/IInformationPanelView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
public interface IInformationPanelView : IWindowView
{
void UpdateView();
void Constructor(IPopUpModel _model);
void Constructor(IPopUpModel _model, IPopUpController _controller);
}
}
9 changes: 8 additions & 1 deletion Assets/Scripts/UI/BuildingManager/InformationPanelView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@ public class InformationPanelView : AbstractWindowView, IInformationPanelView
Text heightTextLine;

IPopUpModel model;
IPopUpController controller;

public void Constructor(IPopUpModel _model)
public void Constructor(IPopUpModel _model, IPopUpController _controller)
{
model = _model;
controller = _controller;
}

public void UpdateView()
{
widthTextLine.text = "Ширина: " + model.GetWidth();
heightTextLine.text = "Высота: " + model.GetHeight();
}

public override void OnOutsideClick()
{
controller.HideMenu();
}
}
}
2 changes: 1 addition & 1 deletion Assets/Scripts/UI/BuildingManager/PopUpController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void HideMenu()
public void ShowInfo()
{
menuView.Hide();
infoView.Constructor(model);
infoView.Constructor(model, this);
infoView.Show();
infoView.UpdateView();
}
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scripts/UI/BuildingManager/PopUpView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ void Start()
deleteBtn.onClick.AddListener(controller.DeleteObject);
}

public override void OnOutsideClick()
{
controller.HideMenu();
}

public IPopUpController Controller
{
set
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scripts/UI/Craft/CraftMenuView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,10 @@ public bool MenuIsOpen()
{
return this.gameObject.activeSelf;
}

public override void OnOutsideClick()
{
controller.ClickMenu();
}
}
}
6 changes: 4 additions & 2 deletions Assets/Scripts/UI/IWindowView.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

using System;

namespace UI
{
public interface IWindowView
{
void Show();
void Hide();
void Hide();
void OnOutsideClick();
}
}
2 changes: 1 addition & 1 deletion Assets/Scripts/UI/OverlayWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void SetParentCtrl(AbstractWindowView _ctrl)

public void OnPointerClick(PointerEventData eventData)
{
parentCtrl.Hide();
parentCtrl.OnOutsideClick();
}
}
}
22 changes: 10 additions & 12 deletions CityBuilder3D.userprefs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<Properties StartupConfiguration="{F8D7B36B-BD74-F76F-FBFF-95CB72BE723D}|">
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/Scripts/PlacementArea/CraftManager.cs">
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/Scripts/UI/BuildingManager/PopUpView.cs">
<Files>
<File FileName="Assets/Scripts/PlacementArea/BuildingsManager/BuildingsManager.cs" Line="17" Column="19" />
<File FileName="Assets/Scripts/Buildings/Ghosts/GhostFactory.cs" Line="9" Column="2" />
<File FileName="Assets/Scripts/Buildings/Real/RealFactory.cs" Line="2" Column="34" />
<File FileName="Assets/Scripts/Buildings/BuildingTypes.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/Buildings/Building.cs" Line="10" Column="13" />
<File FileName="Assets/Scripts/Buildings/IBuildingFactory.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/Buildings/IBuilding.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/PlacementArea/BuildingPlacementArea.cs" Line="18" Column="25" />
<File FileName="Assets/Scripts/PlacementArea/ICreatePlacementArea.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/PlacementArea/FitStatus.cs" Line="13" Column="1" />
<File FileName="Assets/Scripts/PlacementArea/CraftManager.cs" Line="14" Column="28" />
<File FileName="Assets/Scripts/UI/BuildingManager/InformationPanelView.cs" Line="32" Column="6" />
<File FileName="Assets/Scripts/PlacementArea/BuildingsManager/BuildingsManager.cs" Line="19" Column="9" />
<File FileName="Assets/Scripts/UI/BuildingManager/IInformationPanelView.cs" Line="8" Column="2" />
<File FileName="Assets/Scripts/UI/BuildingManager/PopUpController.cs" Line="41" Column="29" />
<File FileName="Assets/Scripts/UI/BuildingManager/PopUpView.cs" Line="25" Column="9" />
<File FileName="Assets/Scripts/UI/Craft/CraftMenuView.cs" Line="45" Column="36" />
<File FileName="Assets/Scripts/UI/AbstractWindowView.cs" Line="13" Column="1" />
<File FileName="Assets/Scripts/UI/OverlayWindow.cs" Line="20" Column="2" />
<File FileName="Assets/Scripts/UI/BuildingManager/IPopUpView.cs" Line="1" Column="1" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
Expand Down

0 comments on commit 6a3daab

Please sign in to comment.