Commit 97f8c2b9 authored by redsuncore's avatar redsuncore

Deployment Activated

배치 가능.
parent 0525dff6
...@@ -22,7 +22,7 @@ GameObject: ...@@ -22,7 +22,7 @@ GameObject:
- component: {fileID: 222307349340161390} - component: {fileID: 222307349340161390}
- component: {fileID: 114352398467806800} - component: {fileID: 114352398467806800}
m_Layer: 5 m_Layer: 5
m_Name: Image m_Name: Portrait
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
...@@ -39,7 +39,7 @@ GameObject: ...@@ -39,7 +39,7 @@ GameObject:
- component: {fileID: 222964811671030584} - component: {fileID: 222964811671030584}
- component: {fileID: 114119453995735154} - component: {fileID: 114119453995735154}
m_Layer: 5 m_Layer: 5
m_Name: Text m_Name: Deploytext
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
...@@ -75,7 +75,7 @@ GameObject: ...@@ -75,7 +75,7 @@ GameObject:
- component: {fileID: 114477745039947856} - component: {fileID: 114477745039947856}
- component: {fileID: 114319455215444200} - component: {fileID: 114319455215444200}
m_Layer: 5 m_Layer: 5
m_Name: Place m_Name: Deploy
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
......
...@@ -97,7 +97,7 @@ Transform: ...@@ -97,7 +97,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1648198240922822} m_GameObject: {fileID: 1648198240922822}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -1} m_LocalPosition: {x: 0, y: 0, z: -3}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 4258910550557926} m_Father: {fileID: 4258910550557926}
......
...@@ -4655,6 +4655,7 @@ MonoBehaviour: ...@@ -4655,6 +4655,7 @@ MonoBehaviour:
cellPrefab: {fileID: 1334406944157384, guid: 5c7cd0aa3d8e4e84ebbe79c9371c9361, type: 2} cellPrefab: {fileID: 1334406944157384, guid: 5c7cd0aa3d8e4e84ebbe79c9371c9361, type: 2}
mainCamera: {fileID: 1122781158} mainCamera: {fileID: 1122781158}
focusObject: {fileID: 0} focusObject: {fileID: 0}
turnEndButton: {fileID: 2068105001}
gold: {fileID: 1841591261} gold: {fileID: 1841591261}
population: {fileID: 140570095} population: {fileID: 140570095}
happiness: {fileID: 833408104} happiness: {fileID: 833408104}
......
...@@ -26,7 +26,6 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -26,7 +26,6 @@ public class CIVGameManager : MonoBehaviour, IView {
public GameObject cellSelected = null; public GameObject cellSelected = null;
public CivModel.Terrain.Point? pointSelected; public CivModel.Terrain.Point? pointSelected;
private bool readyToClick = false;
public int Width { get; set; } public int Width { get; set; }
public int Height { get; set; } public int Height { get; set; }
...@@ -34,6 +33,8 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -34,6 +33,8 @@ public class CIVGameManager : MonoBehaviour, IView {
public GameObject cellPrefab; public GameObject cellPrefab;
public Camera mainCamera; public Camera mainCamera;
public GameObject focusObject; public GameObject focusObject;
public Button turnEndButton;
private GameObject[,] cells; private GameObject[,] cells;
private Presenter mPresenter; private Presenter mPresenter;
...@@ -129,7 +130,6 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -129,7 +130,6 @@ public class CIVGameManager : MonoBehaviour, IView {
{ {
Debug.Log(hit.collider.name + "Castray"); Debug.Log(hit.collider.name + "Castray");
SelectCell(hit.collider.gameObject); SelectCell(hit.collider.gameObject);
readyToClick = false;
} }
else else
{ {
...@@ -167,11 +167,6 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -167,11 +167,6 @@ public class CIVGameManager : MonoBehaviour, IView {
} }
public GameObject FindCell(CivModel.Terrain.Point pt) public GameObject FindCell(CivModel.Terrain.Point pt)
{ {
if (pt == null)
{
Debug.Log("no Gameobject");
throw new ArgumentNullException();
}
return cells[pt.Position.X, pt.Position.Y]; return cells[pt.Position.X, pt.Position.Y];
} }
/*public void Skill() /*public void Skill()
...@@ -244,10 +239,10 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -244,10 +239,10 @@ public class CIVGameManager : MonoBehaviour, IView {
Destroy(this); Destroy(this);
} }
goldnum = Convert.ToInt32(mainPlayer.Gold); goldnum = Convert.ToInt32(game.PlayerInTurn.Gold);
popnum = 0; // not Implemented popnum = 0; // not Implemented
happynum = Convert.ToInt32(mainPlayer.Happiness); happynum = Convert.ToInt32(game.PlayerInTurn.Happiness);
labnum = Convert.ToInt32(mainPlayer.Labor); labnum = Convert.ToInt32(game.PlayerInTurn.Labor);
technum = 0; // not Implemented technum = 0; // not Implemented
ultnum = 0; //not Implemented ultnum = 0; //not Implemented
} }
...@@ -301,6 +296,12 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -301,6 +296,12 @@ public class CIVGameManager : MonoBehaviour, IView {
case CivPresenter.Presenter.States.Deploy: case CivPresenter.Presenter.States.Deploy:
{ {
CastRay();
if (cellSelected != null)
{
mPresenter.FocusedPoint = pointSelected.Value;
}
mPresenter.CommandApply();
break; break;
} }
case CivPresenter.Presenter.States.ProductUI: case CivPresenter.Presenter.States.ProductUI:
...@@ -329,22 +330,22 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -329,22 +330,22 @@ public class CIVGameManager : MonoBehaviour, IView {
mPresenter.CommandCancel(); mPresenter.CommandCancel();
if (Input.GetKey(KeyCode.UpArrow)) if (Input.GetKey(KeyCode.UpArrow))
{ {
mPresenter.CommandArrowKey(Direction.Up); //mPresenter.CommandArrowKey(Direction.Up);
mainCamera.transform.Translate(new Vector3(0, cameraSpeed * delt, 0)); mainCamera.transform.Translate(new Vector3(0, cameraSpeed * delt, 0));
} }
if (Input.GetKey(KeyCode.DownArrow)) if (Input.GetKey(KeyCode.DownArrow))
{ {
mPresenter.CommandArrowKey(Direction.Down); //mPresenter.CommandArrowKey(Direction.Down);
mainCamera.transform.Translate(new Vector3(0, -cameraSpeed * delt, 0)); mainCamera.transform.Translate(new Vector3(0, -cameraSpeed * delt, 0));
} }
if (Input.GetKey(KeyCode.LeftArrow)) if (Input.GetKey(KeyCode.LeftArrow))
{ {
mPresenter.CommandArrowKey(Direction.Left); //mPresenter.CommandArrowKey(Direction.Left);
mainCamera.transform.Translate(new Vector3(-cameraSpeed * delt, 0, 0)); mainCamera.transform.Translate(new Vector3(-cameraSpeed * delt, 0, 0));
} }
if (Input.GetKey(KeyCode.RightArrow)) if (Input.GetKey(KeyCode.RightArrow))
{ {
mPresenter.CommandArrowKey(Direction.Right); //mPresenter.CommandArrowKey(Direction.Right);
mainCamera.transform.Translate(new Vector3(cameraSpeed * delt, 0, 0)); mainCamera.transform.Translate(new Vector3(cameraSpeed * delt, 0, 0));
} }
if (Input.GetKey(KeyCode.F)) if (Input.GetKey(KeyCode.F))
...@@ -352,24 +353,24 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -352,24 +353,24 @@ public class CIVGameManager : MonoBehaviour, IView {
mPresenter.CommandRefocus(); mPresenter.CommandRefocus();
Debug.Log("refocus request"); Debug.Log("refocus request");
} }
if(Input.GetKey(KeyCode.S)) /*if(Input.GetKey(KeyCode.S))
mPresenter.CommandSelect(); //mPresenter.CommandSelect();
if (Input.GetKey(KeyCode.D)) if (Input.GetKey(KeyCode.D))
mPresenter.CommandRemove(); //mPresenter.CommandRemove();
if (Input.GetKey(KeyCode.M)) if (Input.GetKey(KeyCode.M))
mPresenter.CommandMove(); //mPresenter.CommandMove();
if (Input.GetKey(KeyCode.Z)) if (Input.GetKey(KeyCode.Z))
mPresenter.CommandSkip(); //mPresenter.CommandSkip();
if (Input.GetKey(KeyCode.Q)) if (Input.GetKey(KeyCode.Q))
mPresenter.CommandMovingAttack(); //mPresenter.CommandMovingAttack();
if (Input.GetKey(KeyCode.W)) if (Input.GetKey(KeyCode.W))
mPresenter.CommandHoldingAttack(); //mPresenter.CommandHoldingAttack();
if(Input.GetKey(KeyCode.P)) if(Input.GetKey(KeyCode.P))
mPresenter.CommandProductUI(); //mPresenter.CommandProductUI();*/
if (Input.GetKey(KeyCode.Keypad1)) /*if (Input.GetKey(KeyCode.Keypad1))
mPresenter.CommandNumeric(0); mPresenter.CommandNumeric(0);
if (Input.GetKey(KeyCode.Keypad2)) if (Input.GetKey(KeyCode.Keypad2))
mPresenter.CommandNumeric(1); mPresenter.CommandNumeric(1);
...@@ -386,12 +387,12 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -386,12 +387,12 @@ public class CIVGameManager : MonoBehaviour, IView {
if (Input.GetKey(KeyCode.Keypad8)) if (Input.GetKey(KeyCode.Keypad8))
mPresenter.CommandNumeric(7); mPresenter.CommandNumeric(7);
if (Input.GetKey(KeyCode.Keypad9)) if (Input.GetKey(KeyCode.Keypad9))
mPresenter.CommandNumeric(8); mPresenter.CommandNumeric(8);*/
goldnum = Convert.ToInt32(mainPlayer.Gold); goldnum = Convert.ToInt32(game.PlayerInTurn.Gold);
popnum = 0; // not Implemented popnum = 0; // not Implemented
happynum = Convert.ToInt32(mainPlayer.Happiness); happynum = Convert.ToInt32(game.PlayerInTurn.Happiness);
labnum = Convert.ToInt32(mainPlayer.Labor); labnum = Convert.ToInt32(game.PlayerInTurn.Labor);
technum = 0; // not Implemented technum = 0; // not Implemented
ultnum = 0; //not Implemented ultnum = 0; //not Implemented
...@@ -404,8 +405,8 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -404,8 +405,8 @@ public class CIVGameManager : MonoBehaviour, IView {
Render(mPresenter.Game.Terrain); Render(mPresenter.Game.Terrain);
Debug.Log("Turn : " + game.TurnNumber + ", Player : " + game.PlayerNumberInTurn);
Debug.Log(mPresenter.SelectedActor);
switch (mPresenter.State)//for debug switch (mPresenter.State)//for debug
{ {
case CivPresenter.Presenter.States.Normal: case CivPresenter.Presenter.States.Normal:
...@@ -448,6 +449,16 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -448,6 +449,16 @@ public class CIVGameManager : MonoBehaviour, IView {
case CivPresenter.Presenter.States.Deploy: case CivPresenter.Presenter.States.Deploy:
{ {
Debug.Log("State : Deploy"); Debug.Log("State : Deploy");
for (int i = 0; i < Width; i++)
{
for (int j = 0; j < Height; j++)
{
if(mPresenter.DeployProduction.IsPlacable(mPresenter.Game.Terrain.GetPoint(i,j)))
{
cells[i,j].GetComponent<TilePrefab>().MovableTile();
}
}
}
break; break;
} }
case CivPresenter.Presenter.States.ProductUI: case CivPresenter.Presenter.States.ProductUI:
...@@ -473,6 +484,14 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -473,6 +484,14 @@ public class CIVGameManager : MonoBehaviour, IView {
default: default:
throw new NotImplementedException(); throw new NotImplementedException();
} }
if (!mPresenter.IsThereTodos)
{
turnEndButton.GetComponentInChildren<Text>().text = "턴 종료";
}
else
{
turnEndButton.GetComponentInChildren<Text>().text = "다음 캐릭터";
}
} }
// HEX Tiling // HEX Tiling
...@@ -508,6 +527,7 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -508,6 +527,7 @@ public class CIVGameManager : MonoBehaviour, IView {
else else
{ {
Debug.Log("Todo is remaining"); Debug.Log("Todo is remaining");
mPresenter.CommandApply();
} }
} }
......
...@@ -42,6 +42,10 @@ public class CameraUIController : MonoBehaviour { ...@@ -42,6 +42,10 @@ public class CameraUIController : MonoBehaviour {
public void SkillButtonMethod() public void SkillButtonMethod()
{ {
Debug.Log("SkillButton"); Debug.Log("SkillButton");
if(mPresenter.SelectedActor == null)
{
return;
}
Debug.Log(mPresenter.SelectedActor.GetType()); Debug.Log(mPresenter.SelectedActor.GetType());
if (mPresenter.SelectedActor.GetType() == typeof(Pioneer)) if (mPresenter.SelectedActor.GetType() == typeof(Pioneer))
{ {
......
...@@ -17,7 +17,7 @@ public class ManagementUIController : MonoBehaviour { ...@@ -17,7 +17,7 @@ public class ManagementUIController : MonoBehaviour {
private LinkedList<Production> mDeployment; private LinkedList<Production> mDeployment;
private IReadOnlyList<IProductionFactory> facList; private IReadOnlyList<IProductionFactory> facList;
private IReadOnlyList<Player> mPlayers; //private IReadOnlyList<Player> mPlayers;
private GameObject gameManagerObject; private GameObject gameManagerObject;
private CIVGameManager gameManager; private CIVGameManager gameManager;
...@@ -91,6 +91,10 @@ public class ManagementUIController : MonoBehaviour { ...@@ -91,6 +91,10 @@ public class ManagementUIController : MonoBehaviour {
{ {
sq.GetComponent<SelPrefab>().SetButton(SQlist.IndexOf(sq)); sq.GetComponent<SelPrefab>().SetButton(SQlist.IndexOf(sq));
} }
foreach (GameObject dq in DQlist)
{
dq.GetComponent<DepPrefab>().SetButton(DQlist.IndexOf(dq));
}
} }
} }
...@@ -120,7 +124,7 @@ public class ManagementUIController : MonoBehaviour { ...@@ -120,7 +124,7 @@ public class ManagementUIController : MonoBehaviour {
gameManager = gameManagerObject.GetComponent<CIVGameManager>(); gameManager = gameManagerObject.GetComponent<CIVGameManager>();
mPresenter = gameManager.GetPresenter(); mPresenter = gameManager.GetPresenter();
mGame = mPresenter.Game; mGame = mPresenter.Game;
mPlayers = mGame.Players; //mPlayers = mGame.Players;
} }
else else
{ {
...@@ -135,11 +139,6 @@ public class ManagementUIController : MonoBehaviour { ...@@ -135,11 +139,6 @@ public class ManagementUIController : MonoBehaviour {
switch (mPresenter.State)//for debug switch (mPresenter.State)//for debug
{ {
case CivPresenter.Presenter.States.Deploy:
{
SetManagementUI(true);
break;
}
case CivPresenter.Presenter.States.ProductUI: case CivPresenter.Presenter.States.ProductUI:
{ {
SetManagementUI(true); SetManagementUI(true);
...@@ -224,7 +223,7 @@ public class ManagementUIController : MonoBehaviour { ...@@ -224,7 +223,7 @@ public class ManagementUIController : MonoBehaviour {
} }
public static void PrefabsSetting() public static void PrefabsSetting()
{ {
ProPrefab.SetPresenter(); //ProPrefab.SetPresenter();
DepPrefab.SetPresenter(); DepPrefab.SetPresenter();
SelPrefab.SetPresenter(); SelPrefab.SetPresenter();
} }
......
...@@ -9,6 +9,7 @@ using CivPresenter; ...@@ -9,6 +9,7 @@ using CivPresenter;
public class DepPrefab : MonoBehaviour public class DepPrefab : MonoBehaviour
{ {
private static Presenter presenter; private static Presenter presenter;
private static ManagementUIController uicontroller;
private Text[] textarguments; private Text[] textarguments;
private Image unitPrt; private Image unitPrt;
...@@ -17,20 +18,21 @@ public class DepPrefab : MonoBehaviour ...@@ -17,20 +18,21 @@ public class DepPrefab : MonoBehaviour
void Awake() void Awake()
{ {
Debug.Log("call ProPre"); Debug.Log("call DepPre");
textarguments = gameObject.GetComponentsInChildren<Text>(); textarguments = gameObject.GetComponentsInChildren<Text>();
foreach (Image unt in gameObject.GetComponentsInChildren<Image>()) foreach (Image unt in gameObject.GetComponentsInChildren<Image>())
{ {
if (unt.name == "Image") if (unt.name == "Portrait")
{ {
unitPrt = unt; unitPrt = unt;
} }
} }
buttons = gameObject.GetComponentsInChildren<Button>();
} }
void Start() void Start()
{ {
uicontroller = ManagementUIController.GetManagementUIController();
} }
// Update is called once per frame // Update is called once per frame
...@@ -71,10 +73,30 @@ public class DepPrefab : MonoBehaviour ...@@ -71,10 +73,30 @@ public class DepPrefab : MonoBehaviour
} }
public void SetButton(int i) public void SetButton(int i)
{ {
foreach (Button but in buttons)
{
if (but.name == "Deploy")
{
but.onClick.AddListener(delegate () { DeployItem(i); });
}
}
} }
public static void SetPresenter() public static void SetPresenter()
{ {
presenter = CIVGameManager.GetGameManager().GetComponent<CIVGameManager>().GetPresenter(); presenter = CIVGameManager.GetGameManager().GetComponent<CIVGameManager>().GetPresenter();
} }
private void DeployItem(int i)
{
if (presenter.State == Presenter.States.ProductUI)
{
presenter.CommandNumeric(i);
presenter.CommandApply();
uicontroller.MakeProductionQ();
uicontroller.MakeDeploymentQ();
}
}
} }
...@@ -9,7 +9,7 @@ using CivPresenter; ...@@ -9,7 +9,7 @@ using CivPresenter;
public class ProPrefab : MonoBehaviour public class ProPrefab : MonoBehaviour
{ {
private static Presenter presenter; //private static Presenter presenter;
private Text[] textarguments; private Text[] textarguments;
private Image unitPrt; private Image unitPrt;
...@@ -83,8 +83,8 @@ public class ProPrefab : MonoBehaviour ...@@ -83,8 +83,8 @@ public class ProPrefab : MonoBehaviour
public void SetButton(int i) public void SetButton(int i)
{ {
} }
public static void SetPresenter() /*public static void SetPresenter()
{ {
presenter = CIVGameManager.GetGameManager().GetComponent<CIVGameManager>().GetPresenter(); presenter = CIVGameManager.GetGameManager().GetComponent<CIVGameManager>().GetPresenter();
} }*/
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment