Commit 97f8c2b9 authored by redsuncore's avatar redsuncore

Deployment Activated

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