Commit d4e36d8d authored by redsuncore's avatar redsuncore

Production Queue Button Activated, Deploying Bug fixed

생산 큐 삭제, Priority 변경 가능.
배치할 때 배치 큐에서 유닛 사라지지 않아 게속 배치할 수 있던 문제 해결.
parent 864c39d6
......@@ -310,6 +310,7 @@ public class GameManager : MonoBehaviour {
void Deploy(CivModel.Terrain.Point point, Production dep)
{
dep.Place(point);
Game.PlayerInTurn.Deployment.Remove(dep);
PseudoFSM.I.NormalStateEnter();
}
}
......
......@@ -49,6 +49,7 @@ public class ManagementUIController : MonoBehaviour {
{
if(fac.ProductionResultType != null)
{
fac.ProductionResultType.GetInterface("battleclasslevel");
PartSelectionQ(EpicQlist, EpicQueue, fac);
}
}
......@@ -85,7 +86,6 @@ public class ManagementUIController : MonoBehaviour {
productableQueue = null;
Debug.Log("Error : qlist = " + qlist);
throw new MissingComponentException();
break;
}
Debug.Log("SelectionList : " + ASQlist.IndexOf(qlist) + "null");
var SPrefab = Instantiate(productablePrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
......@@ -96,6 +96,11 @@ public class ManagementUIController : MonoBehaviour {
qlist.Add(SPrefab);
}
}
foreach (GameObject sq in EpicQlist)
{
sq.GetComponent<SelPrefab>().SetButton(EpicQlist.IndexOf(sq));
Debug.Log(EpicQlist.IndexOf(sq));
}
}
//각 Factory의 분야를 읽어서 해당하는 Queue에 집어넣는 역할
private GameObject PartSelectionQ(List<GameObject> SQlist, GameObject productableQueue, IProductionFactory fac)
......@@ -147,11 +152,6 @@ public class ManagementUIController : MonoBehaviour {
MakeSelectionQ();
MakeProductionQ();
MakeDeploymentQ();
foreach (GameObject sq in EpicQlist)
{
sq.GetComponent<SelPrefab>().SetButton(EpicQlist.IndexOf(sq));
Debug.Log(EpicQlist.IndexOf(sq));
}
foreach (GameObject dq in DQlist)
{
dq.GetComponent<DepPrefab>().SetButton(DQlist.IndexOf(dq));
......@@ -233,7 +233,10 @@ public class ManagementUIController : MonoBehaviour {
tempList.Add(PPrefab);
}
PQlist = tempList;
foreach (GameObject pq in PQlist)
{
pq.GetComponent<ProPrefab>().SetButton(PQlist.IndexOf(pq));
}
}
public void MakeDeploymentQ()
......@@ -267,6 +270,10 @@ public class ManagementUIController : MonoBehaviour {
tempList.Add(DPrefab);
}
DQlist = tempList;
foreach (GameObject dq in DQlist)
{
dq.GetComponent<DepPrefab>().SetButton(DQlist.IndexOf(dq));
}
}
public static ManagementUIController GetManagementUIController()
{
......
......@@ -8,9 +8,12 @@ using CivModel.Common;
public class DepPrefab : MonoBehaviour {
public static GameObject DeployingObject;
private Text[] textarguments;
private Image unitPrt;
private Button[] buttons;
// Use this for initialization
void Awake()
......@@ -98,7 +101,8 @@ public class DepPrefab : MonoBehaviour {
switch (but.name)
{
case "Deploy":
but.onClick.AddListener(delegate () { DeployItem(dep.Value); });
but.onClick.AddListener(delegate () { DeployItem(dep.Value); DeployingObject = this.gameObject; });
break;
}
}
......
......@@ -105,16 +105,15 @@ public class ProPrefab : MonoBehaviour {
case "Delete":
but.onClick.AddListener(delegate () {
Debug.Log(but.name);
prod.List.Remove(prod);
GameManager.I.Game.PlayerInTurn.Production.Remove(prod);
ManagementUIController.GetManagementUIController().MakeProductionQ();
});
break;
case "Top":
but.onClick.AddListener(delegate () {
Debug.Log(but.name);
LinkedListNode<Production> temprod = prod.Previous;
prod.List.Remove(prod);
temprod.List.AddFirst(prod);
GameManager.I.Game.PlayerInTurn.Production.Remove(prod);
GameManager.I.Game.PlayerInTurn.Production.AddFirst(prod);
ManagementUIController.GetManagementUIController().MakeProductionQ();
});
break;
......@@ -122,8 +121,8 @@ public class ProPrefab : MonoBehaviour {
but.onClick.AddListener(delegate () {
Debug.Log(but.name);
LinkedListNode<Production> temprod = prod.Previous;
prod.List.Remove(prod);
temprod.List.AddBefore(temprod, prod);
GameManager.I.Game.PlayerInTurn.Production.Remove(prod);
GameManager.I.Game.PlayerInTurn.Production.AddBefore(temprod, prod);
ManagementUIController.GetManagementUIController().MakeProductionQ();
});
break;
......@@ -131,8 +130,8 @@ public class ProPrefab : MonoBehaviour {
but.onClick.AddListener(delegate () {
Debug.Log(but.name);
LinkedListNode<Production> temprod = prod.Next;
prod.List.Remove(prod);
temprod.List.AddLast(prod);
GameManager.I.Game.PlayerInTurn.Production.Remove(prod);
GameManager.I.Game.PlayerInTurn.Production.AddLast(prod);
ManagementUIController.GetManagementUIController().MakeProductionQ();
});
break;
......@@ -140,13 +139,12 @@ public class ProPrefab : MonoBehaviour {
but.onClick.AddListener(delegate () {
Debug.Log(but.name);
LinkedListNode<Production> temprod = prod.Next;
prod.List.Remove(prod);
temprod.List.AddAfter(temprod, prod);
GameManager.I.Game.PlayerInTurn.Production.Remove(prod);
GameManager.I.Game.PlayerInTurn.Production.AddAfter(temprod, prod);
ManagementUIController.GetManagementUIController().MakeProductionQ();
});
break;
}
ManagementUIController.GetManagementUIController().MakeProductionQ();
}
}
}
......
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