Commit 0525dff6 authored by redsuncore's avatar redsuncore

Production Queue Activated

생산 큐, 배치 큐 출력 가능.
생산 선택 큐에서 생산 큐로 선택한 유닛 보낼 수 있음.
parent dc380f10
...@@ -55,6 +55,7 @@ GameObject: ...@@ -55,6 +55,7 @@ GameObject:
- component: {fileID: 224370154200431468} - component: {fileID: 224370154200431468}
- component: {fileID: 222753816676270096} - component: {fileID: 222753816676270096}
- component: {fileID: 114644775417974404} - component: {fileID: 114644775417974404}
- component: {fileID: 114964981432633434}
m_Layer: 5 m_Layer: 5
m_Name: Deployment1 m_Name: Deployment1
m_TagString: Untagged m_TagString: Untagged
...@@ -285,6 +286,17 @@ MonoBehaviour: ...@@ -285,6 +286,17 @@ MonoBehaviour:
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: Hwan Jedi Knights m_Text: Hwan Jedi Knights
--- !u!114 &114964981432633434
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1800725053202814}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bdf0fa739872652438abde0f4b5f6f2a, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!222 &222307349340161390 --- !u!222 &222307349340161390
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
......
...@@ -160,6 +160,7 @@ GameObject: ...@@ -160,6 +160,7 @@ GameObject:
- component: {fileID: 224863861108230814} - component: {fileID: 224863861108230814}
- component: {fileID: 222679810446373650} - component: {fileID: 222679810446373650}
- component: {fileID: 114075808498673992} - component: {fileID: 114075808498673992}
- component: {fileID: 114012751408763578}
m_Layer: 5 m_Layer: 5
m_Name: Production1 m_Name: Production1
m_TagString: Untagged m_TagString: Untagged
...@@ -288,6 +289,17 @@ GameObject: ...@@ -288,6 +289,17 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!114 &114012751408763578
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1581501842086604}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3ce71f86ddf9be04dac73d95cd355f41, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114020135092923888 --- !u!114 &114020135092923888
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
......
...@@ -22,7 +22,7 @@ GameObject: ...@@ -22,7 +22,7 @@ GameObject:
- component: {fileID: 222061989232178070} - component: {fileID: 222061989232178070}
- component: {fileID: 114770192334369870} - component: {fileID: 114770192334369870}
m_Layer: 5 m_Layer: 5
m_Name: Text m_Name: Numbers
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: 222038997346745586} - component: {fileID: 222038997346745586}
- component: {fileID: 114563862818528520} - component: {fileID: 114563862818528520}
m_Layer: 5 m_Layer: 5
m_Name: Text m_Name: ProduceButtonText
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
...@@ -56,7 +56,7 @@ GameObject: ...@@ -56,7 +56,7 @@ GameObject:
- component: {fileID: 222850713779482780} - component: {fileID: 222850713779482780}
- component: {fileID: 114720005112721926} - component: {fileID: 114720005112721926}
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
...@@ -473,9 +473,9 @@ RectTransform: ...@@ -473,9 +473,9 @@ RectTransform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 4, y: -4} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 240, y: 40} m_SizeDelta: {x: 240, y: 40}
m_Pivot: {x: 0, y: 1} m_Pivot: {x: 0, y: 1}
--- !u!224 &224822556772684986 --- !u!224 &224822556772684986
......
...@@ -38,7 +38,7 @@ RenderSettings: ...@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0} m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1} m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -264,8 +264,7 @@ RectTransform: ...@@ -264,8 +264,7 @@ RectTransform:
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: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children: []
- {fileID: 992871568}
m_Father: {fileID: 943360799} m_Father: {fileID: 943360799}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
...@@ -1839,106 +1838,6 @@ CanvasRenderer: ...@@ -1839,106 +1838,6 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 704505546} m_GameObject: {fileID: 704505546}
--- !u!1001 &796870828
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1994927160}
m_Modifications:
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_SizeDelta.x
value: 354
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_SizeDelta.y
value: 40
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_Pivot.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_Pivot.y
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 47ef1c05cbecfff42aec8f14c7958d12, type: 2}
m_IsPrefabParent: 0
--- !u!1 &833408102 --- !u!1 &833408102
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -2222,111 +2121,6 @@ CanvasRenderer: ...@@ -2222,111 +2121,6 @@ CanvasRenderer:
type: 2} type: 2}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 943360798} m_GameObject: {fileID: 943360798}
--- !u!1001 &992871567
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 42516958}
m_Modifications:
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_SizeDelta.x
value: 354
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_SizeDelta.y
value: 40
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_Pivot.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_Pivot.y
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: e251050c3a94e2a47be7fa8a4796fbbd, type: 2}
m_IsPrefabParent: 0
--- !u!224 &992871568 stripped
RectTransform:
m_PrefabParentObject: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
m_PrefabInternal: {fileID: 992871567}
--- !u!1 &1038595374 --- !u!1 &1038595374
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -3516,11 +3310,6 @@ CanvasRenderer: ...@@ -3516,11 +3310,6 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1474852284} m_GameObject: {fileID: 1474852284}
--- !u!224 &1489474474 stripped
RectTransform:
m_PrefabParentObject: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
m_PrefabInternal: {fileID: 796870828}
--- !u!1 &1515273671 --- !u!1 &1515273671
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -3905,8 +3694,8 @@ MonoBehaviour: ...@@ -3905,8 +3694,8 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1218335426} m_TargetGraphic: {fileID: 1218335426}
m_HandleRect: {fileID: 1218335425} m_HandleRect: {fileID: 1218335425}
m_Direction: 2 m_Direction: 2
m_Value: 0 m_Value: 1
m_Size: 1 m_Size: 0.99999994
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
m_PersistentCalls: m_PersistentCalls:
...@@ -4511,8 +4300,7 @@ RectTransform: ...@@ -4511,8 +4300,7 @@ RectTransform:
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: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children: []
- {fileID: 1489474474}
m_Father: {fileID: 1038595375} m_Father: {fileID: 1038595375}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......
...@@ -237,7 +237,7 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -237,7 +237,7 @@ public class CIVGameManager : MonoBehaviour, IView {
cells = new GameObject[Width, Height]; cells = new GameObject[Width, Height];
DrawMap(); DrawMap();
Focus(new Position { X = 5, Y = 5 }); //testcase ManagementUIController.PrefabsSetting();
} }
else else
{ {
......
...@@ -8,11 +8,14 @@ using CivModel.Common; ...@@ -8,11 +8,14 @@ using CivModel.Common;
public class ManagementUIController : MonoBehaviour { public class ManagementUIController : MonoBehaviour {
private static ManagementUIController managementUIController;
public Canvas managementUI; public Canvas managementUI;
public Button managementTab; public Button managementTab;
private LinkedList<Production> mProduction; private LinkedList<Production> mProduction;
private LinkedList<Production> mDeployment; private LinkedList<Production> mDeployment;
private IReadOnlyList<IProductionFactory> facList;
private IReadOnlyList<Player> mPlayers; private IReadOnlyList<Player> mPlayers;
...@@ -33,7 +36,6 @@ public class ManagementUIController : MonoBehaviour { ...@@ -33,7 +36,6 @@ public class ManagementUIController : MonoBehaviour {
public GameObject depQueue; public GameObject depQueue;
public GameObject productableQueue; public GameObject productableQueue;
private IReadOnlyList<IProductionFactory> facList;
...@@ -44,31 +46,6 @@ public class ManagementUIController : MonoBehaviour { ...@@ -44,31 +46,6 @@ public class ManagementUIController : MonoBehaviour {
managementUI.enabled = val; managementUI.enabled = val;
} }
public GameObject MakeDeploymentItem(GameObject prefab, Unit unit)
{
GameObject item = Instantiate(prefab);
item.GetComponents<Text>()[1].text = unit.GetType().ToString();
return item;
}
public GameObject MakeProductItem(GameObject prefab, Unit unit)
{
GameObject item = Instantiate(prefab);
item.GetComponents<Text>()[1].text = unit.GetType().ToString();
return item;
}
public GameObject MakeSelectionItem(GameObject prefab, Unit unit)
{
GameObject item = Instantiate(prefab);
item.GetComponents<Text>()[1].text = unit.GetType().ToString();
return item;
}
public void InitiateSelectionTap(Player player)
{
mPresenter.CommandApply();
var factoryList = mPresenter.AvailableProduction;
}
public void ManageButton() // Management tab on/off button public void ManageButton() // Management tab on/off button
{ {
...@@ -108,23 +85,47 @@ public class ManagementUIController : MonoBehaviour { ...@@ -108,23 +85,47 @@ public class ManagementUIController : MonoBehaviour {
} }
SQlist = tempList; SQlist = tempList;
mPresenter.CommandCancel(); mPresenter.CommandCancel();
MakeProductionQ();
MakeDeploymentQ();
foreach(GameObject sq in SQlist)
{
sq.GetComponent<SelPrefab>().SetButton(SQlist.IndexOf(sq));
}
} }
} }
else if (mPresenter.State == Presenter.States.ProductUI) else if (mPresenter.State == Presenter.States.ProductUI)
{ {
mPresenter.CommandCancel(); mPresenter.CommandCancel();
} }
} }
void Awake()
{
DontDestroyOnLoad(this);
if (managementUIController == null)
{
managementUIController = this;
}
else
{
Destroy(this);
}
}
void Start() void Start()
{ {
gameManagerObject = CIVGameManager.GetGameManager(); if (managementUIController == this)
gameManager = gameManagerObject.GetComponent<CIVGameManager>(); {
mPresenter = gameManager.GetPresenter(); gameManagerObject = CIVGameManager.GetGameManager();
gameManager = gameManagerObject.GetComponent<CIVGameManager>();
mPlayers = mPresenter.Game.Players; mPresenter = gameManager.GetPresenter();
SQlist = new List<GameObject>(); mGame = mPresenter.Game;
mPlayers = mGame.Players;
}
else
{
Destroy(this);
}
} }
void Update() void Update()
...@@ -154,31 +155,86 @@ public class ManagementUIController : MonoBehaviour { ...@@ -154,31 +155,86 @@ public class ManagementUIController : MonoBehaviour {
break; break;
} }
} }
public void AddNewProduction(bool val)
{
Debug.Log("new production in queue");
}
public void MakeProductionQ() public void MakeProductionQ()
{ {
for (int i = 0; i < mProduction.Count; i++) List<GameObject> tempList = new List<GameObject>();
Debug.Log("ProductionList startMaking");
foreach (GameObject pq in PQlist)
{ {
PQlist[i] = Instantiate(proPrefab); Destroy(pq);
PQlist[i].GetComponent<Text>().text = 3 + "턴 이후 종료"; // need to calculate how many turns are left
} }
PQlist.Clear();
mProduction = mGame.PlayerInTurn.Production;
Debug.Log("ProList : " + mProduction.Count);
Debug.Log("ProductionList Updated");
foreach (Production prod in mProduction)
{
var PPrefab = Instantiate(proPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
PPrefab.transform.SetParent(proQueue.transform);
PPrefab.transform.localScale = new Vector3(1f, 1f, 1f);
PPrefab.transform.localPosition = new Vector3(0f, 0f, 0f);
tempList.Add(PPrefab.GetComponent<ProPrefab>().MakeItem(prod));
}
if (mProduction.Count == 0)
{
Debug.Log("ProductionList null");
var PPrefab = Instantiate(proPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
PPrefab.transform.SetParent(proQueue.transform);
PPrefab.transform.localScale = new Vector3(1f, 1f, 1f);
PPrefab.transform.localPosition = new Vector3(0f, 0f, 0f);
PPrefab.GetComponent<ProPrefab>().MakeItem();
tempList.Add(PPrefab);
}
PQlist = tempList;
} }
public void MakeDeploymentQ() public void MakeDeploymentQ()
{ {
for (int i = 0; i < mDeployment.Count; i++) List<GameObject> tempList = new List<GameObject>();
Debug.Log("DeploymentList startMaking");
foreach (GameObject dq in DQlist)
{ {
DQlist[i] = Instantiate(depPrefab); Destroy(dq);
} }
DQlist.Clear();
mDeployment = mGame.PlayerInTurn.Deployment;
Debug.Log("DepList : " + mDeployment.Count);
Debug.Log("DeploymentList Updated");
foreach (Production prod in mDeployment)
{
var DPrefab = Instantiate(depPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
DPrefab.transform.SetParent(depQueue.transform);
DPrefab.transform.localScale = new Vector3(1f, 1f, 1f);
DPrefab.transform.localPosition = new Vector3(0f, 0f, 0f);
tempList.Add(DPrefab.GetComponent<DepPrefab>().MakeItem(prod));
}
if (mDeployment.Count == 0)
{
Debug.Log("DeploymentList null");
var DPrefab = Instantiate(depPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
DPrefab.transform.SetParent(depQueue.transform);
DPrefab.transform.localScale = new Vector3(1f, 1f, 1f);
DPrefab.transform.localPosition = new Vector3(0f, 0f, 0f);
tempList.Add(DPrefab.GetComponent<DepPrefab>().MakeItem());
tempList.Add(DPrefab);
}
DQlist = tempList;
}
public static void PrefabsSetting()
{
ProPrefab.SetPresenter();
DepPrefab.SetPresenter();
SelPrefab.SetPresenter();
}
public static ManagementUIController GetManagementUIController()
{
if(managementUIController == null)
{
Debug.Log("managementUIController not made");
throw new MissingComponentException();
}
return managementUIController;
} }
} }
\ No newline at end of file
...@@ -8,18 +8,24 @@ using CivPresenter; ...@@ -8,18 +8,24 @@ using CivPresenter;
public class DepPrefab : MonoBehaviour public class DepPrefab : MonoBehaviour
{ {
private static Presenter presenter;
private Text unitName; private Text[] textarguments;
private Image unitPrt; private Image unitPrt;
private Button[] buttons;
// Use this for initialization // Use this for initialization
void Awake() void Awake()
{ {
Debug.Log("call DepPre"); Debug.Log("call ProPre");
unitName = gameObject.GetComponentsInChildren<Text>()[2]; textarguments = gameObject.GetComponentsInChildren<Text>();
unitName.text = "초기"; foreach (Image unt in gameObject.GetComponentsInChildren<Image>())
{
unitPrt = gameObject.GetComponentsInChildren<Image>()[0]; if (unt.name == "Image")
{
unitPrt = unt;
}
}
} }
void Start() void Start()
...@@ -33,23 +39,42 @@ public class DepPrefab : MonoBehaviour ...@@ -33,23 +39,42 @@ public class DepPrefab : MonoBehaviour
} }
public GameObject MakeItem(IProductionFactory fact) public GameObject MakeItem(Production prod)
{ {
string nameofFactory = ProductionFactoryTraits.GetFactoryName(fact); string nameofProduction = ProductionFactoryTraits.GetFactoryName(prod.Factory);
unitPrt.sprite = Resources.Load<Sprite>("Unit_portrait/" + nameofFactory); unitPrt.sprite = Resources.Load<Sprite>("Unit_portrait/" + nameofProduction + "_portrait");
unitName.text = nameofFactory; foreach (Text txt in textarguments)
{
switch (txt.name)
{
case "UnitName":
txt.text = nameofProduction;
break;
}
}
return this.gameObject; return this.gameObject;
} }
public GameObject MakeItem() public GameObject MakeItem()
{ {
if (unitName == null) unitPrt.enabled = false;
foreach (Text txt in textarguments)
{ {
Debug.Log("Noname"); switch (txt.name)
{
case "UnitName":
txt.text = "비었음";
break;
}
} }
unitName.text = "배치 가능 유닛 없음";
unitName.fontSize = 10;
return this.gameObject; return this.gameObject;
} }
public void SetButton(int i)
{
}
public static void SetPresenter()
{
presenter = CIVGameManager.GetGameManager().GetComponent<CIVGameManager>().GetPresenter();
}
} }
using System.Collections; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
using CivModel;
using CivModel.Common;
using CivPresenter;
public class ProPrefab : MonoBehaviour { public class ProPrefab : MonoBehaviour
{
private static Presenter presenter;
// Use this for initialization private Text[] textarguments;
void Start () { private Image unitPrt;
private Button[] buttons;
} // Use this for initialization
void Awake()
// Update is called once per frame {
void Update () { Debug.Log("call ProPre");
textarguments = gameObject.GetComponentsInChildren<Text>();
} foreach(Image unt in gameObject.GetComponentsInChildren<Image>())
{
if(unt.name == "Image")
{
unitPrt = unt;
}
}
}
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public GameObject MakeItem(Production prod)
{
string nameofProduction = ProductionFactoryTraits.GetFactoryName(prod.Factory);
unitPrt.sprite = Resources.Load<Sprite>("Unit_portrait/" + nameofProduction + "_portrait");
foreach (Text txt in textarguments)
{
switch(txt.name)
{
case "TurnsLeft":
txt.text = "?턴 이후 배치 가능.";
break;
case "UnitName":
txt.text = nameofProduction;
break;
case "GoldPer":
txt.text = "금 : 턴당 " + "?" + " (" + "?" + "/" + Convert.ToInt32(prod.TotalCost).ToString() + ")";
break;
case "LaborPer":
txt.text = "노동력 : 턴당 " + "?" + " (" + Convert.ToInt32(prod.LaborInputed).ToString() + "/" + Convert.ToInt32(prod.TotalCost).ToString() + ")";
break;
}
}
return this.gameObject;
}
public GameObject MakeItem()
{
unitPrt.enabled = false;
foreach (Text txt in textarguments)
{
switch (txt.name)
{
case "TurnsLeft":
txt.text = "비었음";
break;
case "UnitName":
txt.text = "B었음";
break;
}
}
return this.gameObject;
}
public void SetButton(int i)
{
}
public static void SetPresenter()
{
presenter = CIVGameManager.GetGameManager().GetComponent<CIVGameManager>().GetPresenter();
}
} }
...@@ -8,22 +8,31 @@ using CivPresenter; ...@@ -8,22 +8,31 @@ using CivPresenter;
public class SelPrefab : MonoBehaviour { public class SelPrefab : MonoBehaviour {
private static Presenter presenter;
private static ManagementUIController uicontroller;
private Text unitName; private Text unitName;
private Image unitPrt; private Image unitPrt;
private Text theNumberofProduce; private Text theNumberofProduce;
// Use this for initialization private Button[] buttons;
void Awake () { // Use this for initialization
void Awake () {
Debug.Log("call SelPre"); Debug.Log("call SelPre");
unitName = gameObject.GetComponentsInChildren<Text>()[1]; unitName = gameObject.GetComponentsInChildren<Text>()[1];
unitName.text = "초기"; unitName.text = "초기";
foreach (Image unt in gameObject.GetComponentsInChildren<Image>())
unitPrt = gameObject.GetComponentsInChildren<Image>()[0]; {
if (unt.name == "Portrait")
{
unitPrt = unt;
}
}
buttons = gameObject.GetComponentsInChildren<Button>();
theNumberofProduce = gameObject.GetComponentsInChildren<Text>()[2]; theNumberofProduce = gameObject.GetComponentsInChildren<Text>()[2];
} }
void Start() void Start()
{ {
uicontroller = ManagementUIController.GetManagementUIController();
} }
// Update is called once per frame // Update is called once per frame
...@@ -32,22 +41,49 @@ public class SelPrefab : MonoBehaviour { ...@@ -32,22 +41,49 @@ public class SelPrefab : MonoBehaviour {
public GameObject MakeItem(IProductionFactory fact) public GameObject MakeItem(IProductionFactory fact)
{ {
Debug.Log("Selection Queue Item Made");
string nameofFactory = ProductionFactoryTraits.GetFactoryName(fact); string nameofFactory = ProductionFactoryTraits.GetFactoryName(fact);
unitPrt.sprite = Resources.Load<Sprite>("Unit_portrait/" + nameofFactory); unitPrt.sprite = Resources.Load<Sprite>("Unit_portrait/" + nameofFactory +"_portrait");
unitName.text = nameofFactory; unitName.text = nameofFactory;
theNumberofProduce.text = "X 1"; theNumberofProduce.text = "X 1";
return this.gameObject; return this.gameObject;
} }
public GameObject MakeItem() public GameObject MakeItem()
{ {
if(unitName == null) unitPrt.enabled = false;
{ Debug.Log("NULL Selection Queue");
Debug.Log("Fuck");
}
unitName.text = "생산 가능 유닛 없음"; unitName.text = "생산 가능 유닛 없음";
unitName.fontSize = 10; unitName.fontSize = 10;
theNumberofProduce.text = ""; theNumberofProduce.text = "";
return this.gameObject; return this.gameObject;
} }
public void SetButton(int i)
{
foreach (Button but in buttons)
{
if (but.name == "Produce")
{
but.onClick.AddListener(delegate() { ProduceItem(i); });
}
}
}
public static void SetPresenter()
{
presenter = CIVGameManager.GetGameManager().GetComponent<CIVGameManager>().GetPresenter();
}
private void ProduceItem(int i)
{
if(presenter.State == Presenter.States.ProductUI)
{
presenter.CommandApply();
for(int k = 0; k < i; k++)
{
presenter.CommandArrowKey(Direction.Down);
}
presenter.CommandApply();
uicontroller.MakeProductionQ();
uicontroller.MakeDeploymentQ();
}
}
} }
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