Commit 59b46630 authored by redsuncore's avatar redsuncore

Production Queue shows informations

생산 큐에서 이제 얼마 후 생성 가능한지와 자원의 Input양을 보여줌.
parent d4e36d8d
...@@ -109,11 +109,11 @@ public class GameManager : MonoBehaviour { ...@@ -109,11 +109,11 @@ public class GameManager : MonoBehaviour {
{ {
if (tile.isFlickering) if (tile.isFlickering)
{ {
if(SelectedActor.HoldingAttackAct != null) if(SelectedActor.HoldingAttackAct != null && SelectedActor.HoldingAttackAct.IsActable(tile.point))
{ {
SelectedActor.HoldingAttackAct.Act(tile.point); SelectedActor.HoldingAttackAct.Act(tile.point);
} }
else if(SelectedActor.MovingAttackAct != null) else if(SelectedActor.MovingAttackAct != null && SelectedActor.MovingAttackAct.IsActable(tile.point))
{ {
SelectedActor.MovingAttackAct.Act(tile.point); SelectedActor.MovingAttackAct.Act(tile.point);
} }
...@@ -330,6 +330,18 @@ public static class ProductionFactoryTraits ...@@ -330,6 +330,18 @@ public static class ProductionFactoryTraits
case "JediKnightProductionFactory": case "JediKnightProductionFactory":
result = "제다이 기사"; result = "제다이 기사";
break; break;
case "CityCenterProductionFactory":
result = "도심부";
break;
case "FakeKnightProductionFactory":
result = "가짜 기사(테스팅)";
break;
case "FactoryBuildingProductionFactory":
result = "공장";
break;
case "LaboratoryBuildingProductionFactory":
result = "연구소";
break;
default: default:
result = "unknown : " + name; result = "unknown : " + name;
break; break;
...@@ -349,6 +361,18 @@ public static class ProductionFactoryTraits ...@@ -349,6 +361,18 @@ public static class ProductionFactoryTraits
case "JediKnight": case "JediKnight":
result = "제다이 기사"; result = "제다이 기사";
break; break;
case "CityCenter":
result = "도심부";
break;
case "FakeKnight":
result = "가짜 기사(테스팅)";
break;
case "FactoryBuilding":
result = "공장";
break;
case "LabortoryBuilding":
result = "연구소";
break;
default: default:
result = "unknown : " + name; result = "unknown : " + name;
break; break;
......
...@@ -203,7 +203,6 @@ public class ManagementUIController : MonoBehaviour { ...@@ -203,7 +203,6 @@ public class ManagementUIController : MonoBehaviour {
public void MakeProductionQ() public void MakeProductionQ()
{ {
ProPrefab.ResetTestingNumber();
List<GameObject> tempList = new List<GameObject>(); List<GameObject> tempList = new List<GameObject>();
Debug.Log("ProductionList startMaking"); Debug.Log("ProductionList startMaking");
foreach (GameObject pq in PQlist) foreach (GameObject pq in PQlist)
......
...@@ -7,8 +7,7 @@ using CivModel; ...@@ -7,8 +7,7 @@ using CivModel;
using CivModel.Common; using CivModel.Common;
public class ProPrefab : MonoBehaviour { public class ProPrefab : MonoBehaviour {
private static int unitNum = 0;
private Text[] textarguments; private Text[] textarguments;
private Image unitPrt; private Image unitPrt;
private Button[] buttons; private Button[] buttons;
...@@ -40,24 +39,58 @@ public class ProPrefab : MonoBehaviour { ...@@ -40,24 +39,58 @@ public class ProPrefab : MonoBehaviour {
{ {
string nameofProduction = ProductionFactoryTraits.GetFactoryName(prod.Factory); string nameofProduction = ProductionFactoryTraits.GetFactoryName(prod.Factory);
unitPrt.sprite = Resources.Load<Sprite>("Unit_portrait/" + nameofProduction + "_portrait"); unitPrt.sprite = Resources.Load<Sprite>("Unit_portrait/" + nameofProduction + "_portrait");
//남은 턴 계산하는 중
Double leftturn;
string resultturn;
if (prod.EstimatedGoldInputing == 0 || prod.EstimatedLaborInputing == 0)
{
Debug.Log(prod.EstimatedGoldInputing + " : " + prod.EstimatedLaborInputing + " : " + prod.TotalGoldCost + " : " + prod.GoldInputed + " : " + prod.TotalLaborCost + " : " + prod.LaborInputed);
if ((prod.TotalGoldCost - prod.GoldInputed) == 0 && (prod.TotalLaborCost - prod.LaborInputed) == 0)
{
leftturn = -1f;
}
else
{
if ((prod.TotalGoldCost - prod.GoldInputed) == 0)
leftturn = (prod.TotalLaborCost - prod.LaborInputed) / prod.EstimatedLaborInputing;
else if ((prod.TotalLaborCost - prod.LaborInputed) == 0)
leftturn = (prod.TotalGoldCost - prod.GoldInputed) / prod.EstimatedGoldInputing;
else
leftturn = -1f;
}
}
else
{
leftturn = Math.Max(((prod.TotalGoldCost - prod.GoldInputed) / prod.EstimatedGoldInputing),((prod.TotalLaborCost - prod.LaborInputed) / prod.EstimatedLaborInputing));
}
if (leftturn == -1 || Double.IsInfinity(leftturn))
resultturn = "?";
else
{
Debug.Log(leftturn);
resultturn = Convert.ToInt32(leftturn).ToString();
}
//텍스트 표시
foreach (Text txt in textarguments) foreach (Text txt in textarguments)
{ {
switch (txt.name) switch (txt.name)
{ {
case "TurnsLeft": case "TurnsLeft":
txt.text = "?턴 이후 배치 가능."; txt.text = resultturn + "턴 이후 배치 가능.";
break; break;
case "UnitName": case "UnitName":
txt.text = nameofProduction + " " + unitNum++; txt.text = nameofProduction + " ";
break; break;
case "Required Resource": case "Required Resource":
txt.text = "금 : 턴당 " + "?" + " (" + "?" + "/" + Convert.ToInt32(prod.TotalGoldCost).ToString() + ")" txt.text = "금 : 턴당 " + Convert.ToInt32(prod.EstimatedGoldInputing) + " (" + Convert.ToInt32(prod.GoldInputed)+ "/" + Convert.ToInt32(prod.TotalGoldCost).ToString() + ")"
+"\n노동력 : 턴당 " + "?" + " (" + Convert.ToInt32(prod.LaborInputed).ToString() + "/" + Convert.ToInt32(prod.TotalLaborCost).ToString() + ")"; +"\n노동력 : 턴당 " + Convert.ToInt32(prod.EstimatedLaborInputing) + " (" + Convert.ToInt32(prod.LaborInputed).ToString() + "/" + Convert.ToInt32(prod.TotalLaborCost).ToString() + ")";
break; break;
} }
} }
return this.gameObject; return this.gameObject;
} }
//production이 비었을 때 블랭크 아이템 만들기
public GameObject MakeItem() public GameObject MakeItem()
{ {
unitPrt.enabled = false; unitPrt.enabled = false;
...@@ -82,6 +115,7 @@ public class ProPrefab : MonoBehaviour { ...@@ -82,6 +115,7 @@ public class ProPrefab : MonoBehaviour {
} }
return this.gameObject; return this.gameObject;
} }
//버튼 기능 붙이는 함수
public void SetButton(int i) public void SetButton(int i)
{ {
if(i == -1) if(i == -1)
...@@ -116,6 +150,8 @@ public class ProPrefab : MonoBehaviour { ...@@ -116,6 +150,8 @@ public class ProPrefab : MonoBehaviour {
GameManager.I.Game.PlayerInTurn.Production.AddFirst(prod); GameManager.I.Game.PlayerInTurn.Production.AddFirst(prod);
ManagementUIController.GetManagementUIController().MakeProductionQ(); ManagementUIController.GetManagementUIController().MakeProductionQ();
}); });
if (GameManager.I.Game.PlayerInTurn.Production.First == prod)
but.enabled = false;
break; break;
case "Up": case "Up":
but.onClick.AddListener(delegate () { but.onClick.AddListener(delegate () {
...@@ -125,8 +161,10 @@ public class ProPrefab : MonoBehaviour { ...@@ -125,8 +161,10 @@ public class ProPrefab : MonoBehaviour {
GameManager.I.Game.PlayerInTurn.Production.AddBefore(temprod, prod); GameManager.I.Game.PlayerInTurn.Production.AddBefore(temprod, prod);
ManagementUIController.GetManagementUIController().MakeProductionQ(); ManagementUIController.GetManagementUIController().MakeProductionQ();
}); });
if (GameManager.I.Game.PlayerInTurn.Production.First == prod)
but.enabled = false;
break; break;
case "Down": case "Bottom":
but.onClick.AddListener(delegate () { but.onClick.AddListener(delegate () {
Debug.Log(but.name); Debug.Log(but.name);
LinkedListNode<Production> temprod = prod.Next; LinkedListNode<Production> temprod = prod.Next;
...@@ -134,8 +172,10 @@ public class ProPrefab : MonoBehaviour { ...@@ -134,8 +172,10 @@ public class ProPrefab : MonoBehaviour {
GameManager.I.Game.PlayerInTurn.Production.AddLast(prod); GameManager.I.Game.PlayerInTurn.Production.AddLast(prod);
ManagementUIController.GetManagementUIController().MakeProductionQ(); ManagementUIController.GetManagementUIController().MakeProductionQ();
}); });
if (GameManager.I.Game.PlayerInTurn.Production.Last == prod)
but.enabled = false;
break; break;
case "Bottom": case "Down":
but.onClick.AddListener(delegate () { but.onClick.AddListener(delegate () {
Debug.Log(but.name); Debug.Log(but.name);
LinkedListNode<Production> temprod = prod.Next; LinkedListNode<Production> temprod = prod.Next;
...@@ -143,13 +183,11 @@ public class ProPrefab : MonoBehaviour { ...@@ -143,13 +183,11 @@ public class ProPrefab : MonoBehaviour {
GameManager.I.Game.PlayerInTurn.Production.AddAfter(temprod, prod); GameManager.I.Game.PlayerInTurn.Production.AddAfter(temprod, prod);
ManagementUIController.GetManagementUIController().MakeProductionQ(); ManagementUIController.GetManagementUIController().MakeProductionQ();
}); });
if (GameManager.I.Game.PlayerInTurn.Production.Last == prod)
but.enabled = false;
break; break;
} }
} }
} }
} }
public static void ResetTestingNumber()
{
unitNum = 0;
}
} }
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