Commit badfc72c authored by redsuncore's avatar redsuncore

Deployment Queue now show items

쓰지 않는 코드들 삭제.
배치 버튼 아직 활성화되지 않음
현재 Selection은 Unit-Epic에서 모두 설정됨.
parent 55310787
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CivPresenter;
using CivModel;
using CivModel.Common;
public class CameraUIController : MonoBehaviour {
public Canvas CameraCanvas;
public Canvas tempManagementUI;
public Button MoveButton;
public Button AttackButton;
public Button SkillButton;
public Button WaitButton;
public GameObject UnitInfo;
public GameObject Actions;
public GameObject TurnEnd;
public Image Portrait;
public Text UnitName;
public Text UnitAttack;
public Text UnitDefence;
public Text UnitAP;
public Text UnitHP;
private GameObject gameManagerObject;
private GameManager gameManager;
private Presenter mPresenter;
/*public void SkillButtonMethod()
{
Debug.Log("SkillButton");
if(mPresenter.SelectedActor == null)
{
return;
}
Debug.Log(mPresenter.SelectedActor.GetType());
if (mPresenter.SelectedActor.GetType() == typeof(Pioneer))
{
mPresenter.CommandNumeric(0);
Debug.Log("Pioneer set City");
}
}*/
/*public void WaitButtonMethod()
{
Debug.Log("WaitButton");
mPresenter.CommandSkip();
}*/
/*public void AttackButtonMethod()
{
Debug.Log("AttackButton");
if(caseA)
mPresenter.CommandMovingAttack();
else(caseA)
mPresenter.CommandHoldingAttack
}*/
public void ActiveCameraUI(bool value)
{
UnitInfo.SetActive(value);
Actions.SetActive(value);
TurnEnd.SetActive(value);
}
// Use this for initialization
void Start ()
{
gameManagerObject = GameManager.I.gameObject;
gameManager = GameManager.I;
tempManagementUI.enabled = false;
}
// Update is called once per frame
void Update ()
{
if(mPresenter.SelectedActor == null)
{
MoveButton.enabled = false;
}
else
{
if (mPresenter.SelectedActor.RemainAP == 0)
{
MoveButton.enabled = false;
}
else
{
MoveButton.enabled = true;
}
}
if(mPresenter.SelectedActor == null)
{
UnitInfo.SetActive(false);
UnitName.text = "공허";
UnitAttack.text = "공격력 : 무한";
UnitDefence.text = "방어력 : 무한";
UnitAP.text = "어디든지";
}
else
{
UnitInfo.SetActive(true);
UnitName.text = mPresenter.SelectedActor.GetType().ToString().Replace("CivModel.Common.","");
UnitAttack.text = "공격력 : " + mPresenter.SelectedActor.AttackPower.ToString();
UnitDefence.text = "방어력 : " + mPresenter.SelectedActor.DefencePower.ToString();
UnitAP.text = mPresenter.SelectedActor.RemainAP + "/" + mPresenter.SelectedActor.MaxAP;
UnitHP.text = mPresenter.SelectedActor.RemainHP + "/" + mPresenter.SelectedActor.MaxHP;
}
}
}
fileFormatVersion: 2
guid: fd593fcf21b7651488dc22c010c87e95
timeCreated: 1519293669
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -2,7 +2,6 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CivPresenter;
using CivModel;
using CivModel.Common;
......@@ -16,11 +15,8 @@ public class ManagementUIController : MonoBehaviour {
private LinkedList<Production> mDeployment;
private IReadOnlyList<IProductionFactory> facList;
//private IReadOnlyList<Player> mPlayers;
private GameObject gameManagerObject;
private GameManager gameManager;
private PseudoFSM state;
private Game game;
private List<GameObject> PQlist;
......@@ -35,20 +31,8 @@ public class ManagementUIController : MonoBehaviour {
public GameObject depQueue;
public GameObject productableQueue;
public void SetManagementUI(bool val)
{
Debug.Log("manUI : " + val);
managementUI.enabled = val;
}
public void ManageFunction() // Management tab on/off button -> ManageMentUIActive
{
List<GameObject> tempList = new List<GameObject>();
Debug.Log("SelectList startMaking");
foreach (GameObject sq in SQlist)
......@@ -84,6 +68,7 @@ public class ManagementUIController : MonoBehaviour {
foreach (GameObject sq in SQlist)
{
sq.GetComponent<SelPrefab>().SetButton(SQlist.IndexOf(sq));
Debug.Log(SQlist.IndexOf(sq));
}
foreach (GameObject dq in DQlist)
{
......@@ -108,10 +93,7 @@ public class ManagementUIController : MonoBehaviour {
if (managementUIController == this)
{
gameManager = GameManager.I;
//mPresenter = gameManager.GetPresenter();
game = gameManager.Game;
state = PseudoFSM.I;
//mPlayers = mGame.Players;
SQlist = new List<GameObject>();
PQlist = new List<GameObject>();
DQlist = new List<GameObject>();
......@@ -195,12 +177,6 @@ public class ManagementUIController : MonoBehaviour {
}
DQlist = tempList;
}
/*public static void PrefabsSetting()
{
//ProPrefab.SetPresenter();
DepPrefab.SetPresenter();
SelPrefab.SetPresenter();
}*/
public static ManagementUIController GetManagementUIController()
{
if(managementUIController == null)
......
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
......@@ -7,8 +8,6 @@ using CivModel.Common;
public class DepPrefab : MonoBehaviour {
private static ManagementUIController uicontroller;
private Text[] textarguments;
private Image unitPrt;
private Button[] buttons;
......@@ -30,7 +29,6 @@ public class DepPrefab : MonoBehaviour {
void Start()
{
uicontroller = ManagementUIController.GetManagementUIController();
}
public GameObject MakeItem(Production prod)
......@@ -49,6 +47,7 @@ public class DepPrefab : MonoBehaviour {
break;
}
}
return this.gameObject;
}
......@@ -80,5 +79,65 @@ public class DepPrefab : MonoBehaviour {
public void SetButton(int i)
{
if (i == -1)
{
foreach (Button but in buttons)
{
but.enabled = false;
}
}
else
{
LinkedListNode<Production> dep = GameManager.I.Game.PlayerInTurn.Deployment.First;
for (int k = 0; k < i; k++)
{
dep = dep.Next;
}
foreach (Button but in buttons)
{
switch (but.name)
{
case "Deploy":
but.onClick.AddListener(delegate () { DeployItem(dep.Value); });
break;
}
}
}
}
public void DeployItem(Production dep)
{
if (dep.Completed)
{
CivModel.Terrain terrain = GameManager.I.Game.Terrain;
for (int i = 0; i < terrain.Width; i++)
{
for (int j = 0; j < terrain.Height; j++)
{
CivModel.Terrain.Point point = terrain.GetPoint(i, j);
if(dep.IsPlacable(point))
{
GameManager.I.Cells[point.Position.X, point.Position.Y].GetComponent<HexTile>().FlickerBlue();
}
}
}
for (int i = 0; i < terrain.Width; i++)
{
for (int j = 0; j < terrain.Height; j++)
{
CivModel.Terrain.Point point = terrain.GetPoint(i, j);
if (dep.IsPlacable(point))
{
GameManager.I.Cells[point.Position.X, point.Position.Y].GetComponent<HexTile>().StopFlickering();
}
}
}
}
else
{
Debug.Log("Error : not finished product");
throw new AccessViolationException();
}
}
}
......@@ -24,7 +24,6 @@ public class ProPrefab : MonoBehaviour {
}
}
buttons = gameObject.GetComponentsInChildren<Button>();
}
void Start()
{
......@@ -92,6 +91,11 @@ public class ProPrefab : MonoBehaviour {
}
else
{
LinkedListNode <Production> prod = GameManager.I.Game.PlayerInTurn.Production.First;
for(int k = 0; k < i; k++)
{
prod = prod.Next;
}
foreach (Button but in buttons)
{
}
......
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
......@@ -8,7 +9,6 @@ using CivModel.Common;
public class SelPrefab : MonoBehaviour
{
private static ManagementUIController uicontroller;
private Text[] textarguments;
private Image unitPrt;
private Button[] buttons;
......@@ -78,20 +78,21 @@ public class SelPrefab : MonoBehaviour
{
foreach (Button but in buttons)
{
if (but.name == "Produce")
switch (but.name)
{
case "Deploy":
but.onClick.AddListener(delegate () { ProduceItem(i); });
break;
}
}
}
private void ProduceItem(int i)
{
for (int k = 0; k < i; k++)
{
//presenter.CommandArrowKey(Direction.Down);
//i 번의 Selection thing 을 고르는 코드를 적자. 아직은 어떻게 골라야 할까? 일단 미루자.
}
IProductionFactory factory = GameManager.I.Game.PlayerInTurn.GetAvailableProduction()[i];
GameManager.I.Game.PlayerInTurn.Production.AddLast(factory.Create(GameManager.I.Game.PlayerInTurn));
Debug.Log(i + " inputed");
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