Commit a19dde53 authored by Seungwon Ju's avatar Seungwon Ju

Deployment Completedgit add -A

parent def92683
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
Assets/AssetStoreTools*
# Visual Studio 2015 cache directory
/.vs/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
# Unity3D Generated File On Crash Reports
sysinfo.txt
# Builds
*.apk
*.unitypackage
# MacOS
.DS_Store
This diff is collapsed.
fileFormatVersion: 2
guid: b91b030bdd9519d4595880b42097209e
timeCreated: 1518251771
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b91b030bdd9519d4595880b42097209e
timeCreated: 1518251771
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -1148,7 +1148,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1841507268}
m_HandleRect: {fileID: 1841507267}
m_Direction: 2
m_Value: 0.99998355
m_Value: 0.9999992
m_Size: 0.87019
m_NumberOfSteps: 0
m_OnValueChanged:
......@@ -2547,7 +2547,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0.000030517578, y: -0.00004841719}
m_AnchoredPosition: {x: 0.000030517578, y: -0.0000026408234}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &191355288
......@@ -5088,7 +5088,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.000053677646, y: -0.00003277704}
m_AnchoredPosition: {x: -0.000053677646, y: -0.0000148695635}
m_SizeDelta: {x: 0, y: 300}
m_Pivot: {x: 0, y: 1}
--- !u!1 &454209707
......@@ -6493,8 +6493,8 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 733846993}
m_HandleRect: {fileID: 733846992}
m_Direction: 2
m_Value: 1
m_Size: 0.9999999
m_Value: 0
m_Size: 0.9999998
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
......@@ -9689,7 +9689,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0.000036194124, y: -0.00003277704}
m_AnchoredPosition: {x: 0.000030258068, y: -0.0000148695635}
m_SizeDelta: {x: 0, y: 300}
m_Pivot: {x: 0, y: 1}
--- !u!1 &1001046761
......@@ -9794,7 +9794,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -0.000015258789}
m_AnchoredPosition: {x: 0, y: -0.000030517578}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1004629748
......@@ -11763,7 +11763,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0.00006514437, y: -0.000010127624}
m_AnchoredPosition: {x: 0.00006514437, y: 0.000020389954}
m_SizeDelta: {x: 0, y: 300}
m_Pivot: {x: 0, y: 1}
--- !u!1 &1173066205
......@@ -13150,7 +13150,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\uAE30\uC2201"
m_Text: "\uD3EC\uACA9"
--- !u!222 &1321951785
CanvasRenderer:
m_ObjectHideFlags: 0
......@@ -14151,7 +14151,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.00001036023, y: 0.0005912781}
m_AnchoredPosition: {x: -0.00001036023, y: 0.000022888184}
m_SizeDelta: {x: 0, y: 300}
m_Pivot: {x: 0, y: 1}
--- !u!1 &1465630758
......
......@@ -5,6 +5,7 @@ using UnityEngine;
using CivModel;
using System.Threading.Tasks;
using System.IO;
using UnityEngine.EventSystems;
public class GameManager : MonoBehaviour {
......@@ -30,7 +31,17 @@ public class GameManager : MonoBehaviour {
private List<GameObject> _units = new List<GameObject>();
public List<GameObject> Units { get { return _units; } }
public Material[] materials;
//Deploy를 위한 추가
private bool _inDepState = false;
public bool DepState { get { return _inDepState; } }
private Production _deployment;
public Production Deployment { get { return _deployment; } }
///Deploy를 위한 추가 끝
public Material[] materials;
public CivModel.Terrain.Point selectedPoint;
public HexTile selectedTile;
......@@ -298,5 +309,81 @@ public class GameManager : MonoBehaviour {
}
}
// Deploy 하는 부분
public void DepStateEnter(Production dep, DeployPrefab deployprefab)
{
// State change
if (dep == null || _inDepState) return;
_inDepState = true;
_deployment = dep;
// Select deploy tile
CivModel.Terrain terrain = Instance.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))
{
Instance.Tiles[point.Position.X, point.Position.Y].GetComponent<HexTile>().FlickerBlue();
}
}
}
CivModel.Terrain.Point StartPoint = Instance.selectedPoint;
IEnumerator _coroutine = DeployUnit(StartPoint, dep, deployprefab);
StartCoroutine(_coroutine);
}
IEnumerator DeployUnit(CivModel.Terrain.Point point, Production dep, DeployPrefab deployprefab)
{
while (true)
{
CivModel.Terrain.Point destPoint = Instance.selectedPoint;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (!EventSystem.current.IsPointerOverGameObject() && Input.GetMouseButtonDown(0))
{
// Flicker하고 있는 Tile을 선택했을 때
if (Instance.selectedTile.isFlickering)
{
if (dep.IsPlacable(destPoint))
{
Game.PlayerInTurn.Deployment.Remove(dep);
dep.Place(destPoint);
DepStateExit(deployprefab);
GameManager.Instance.UpdateUnit();
GameManager.Instance.UpdateMap();
break;
}
else
{
DepStateExit(deployprefab);
break;
}
}
DepStateExit(deployprefab);
break;
}
yield return null;
}
}
void DepStateExit(DeployPrefab deployprefab)
{
_inDepState = false;
_deployment = null;
CivModel.Terrain terrain = Instance.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);
Instance.Tiles[point.Position.X, point.Position.Y].GetComponent<HexTile>().StopFlickering();
}
}
GameManager.Instance.UpdateUnit();
GameManager.Instance.UpdateMap();
}
}
\ No newline at end of file
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using CivModel;
public class MinimapTile : MonoBehaviour {
public CivModel.Terrain.Point point;
public Vector3 unity_point;
Transform owner_color;
Transform city_active;
Player owner;
TileBuilding City;
// Use this for initialization
void Start () {
SetOwner();
SetCity();
}
public void SetPoints(CivModel.Terrain.Point p1) {
this.point = p1;
this.unity_point = GameManager.ModelPntToUnityPnt(p1, -200f);
}
public void SetPoints(CivModel.Terrain.Point p1, Vector3 p2) {
this.point = p1;
this.unity_point = new Vector3(p2.x, p2.y, p2.z);
}
public void SetOwner() {
owner_color = transform.GetChild(0).transform;
owner = point.TileOwner;
if (owner == null) {
owner_color.GetChild(9).gameObject.SetActive(true);
if ((int)point.Type == 1) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(true);
}
}
else if (owner == GameManager.Instance.Game.Players[0]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(0).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[1]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(1).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[2]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(2).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[3]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(3).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[4]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(4).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[5]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(5).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[6]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(6).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[7]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(7).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[8]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(8).gameObject.SetActive(true);
}
}
public void SetCity() {
City = point.TileBuilding;
city_active = transform.GetChild(1).transform;
if(City is CityBase) {
city_active.GetChild(0).gameObject.SetActive(true);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using CivModel;
public class MinimapTile : MonoBehaviour {
public CivModel.Terrain.Point point;
public Vector3 unity_point;
Transform owner_color;
Transform city_active;
Player owner;
TileBuilding City;
// Use this for initialization
void Start () {
SetOwner();
SetCity();
}
public void SetPoints(CivModel.Terrain.Point p1) {
this.point = p1;
this.unity_point = GameManager.ModelPntToUnityPnt(p1, -200f);
}
public void SetPoints(CivModel.Terrain.Point p1, Vector3 p2) {
this.point = p1;
this.unity_point = new Vector3(p2.x, p2.y, p2.z);
}
public void SetOwner() {
owner_color = transform.GetChild(0).transform;
owner = point.TileOwner;
if (owner == null) {
owner_color.GetChild(9).gameObject.SetActive(true);
if ((int)point.Type == 1) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(true);
}
}
else if (owner == GameManager.Instance.Game.Players[0]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(0).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[1]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(1).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[2]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(2).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[3]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(3).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[4]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(4).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[5]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(5).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[6]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(6).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[7]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(7).gameObject.SetActive(true);
}
else if (owner == GameManager.Instance.Game.Players[8]) {
owner_color.GetChild(9).gameObject.SetActive(false);
owner_color.GetChild(10).gameObject.SetActive(false);
owner_color.GetChild(8).gameObject.SetActive(true);
}
}
public void SetCity() {
City = point.TileBuilding;
city_active = transform.GetChild(1).transform;
if(City is CityBase) {
city_active.GetChild(0).gameObject.SetActive(true);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CivModel;
using CivModel.Common;
public class InvestmentController : MonoBehaviour {
using CivModel.Common;
public class InvestmentController : MonoBehaviour {
public GameObject InvestmentUI;
public GameObject Tax;
public GameObject EcoInv;
......@@ -24,8 +24,8 @@ public class InvestmentController : MonoBehaviour {
private Text logiRateText;
private static InvestmentController _IVUIController;
public static InvestmentController I { get { return _IVUIController; } }
public static InvestmentController I { get { return _IVUIController; } }
void Awake()
{
// Singleton
......@@ -40,19 +40,19 @@ public class InvestmentController : MonoBehaviour {
}
// Use this when scene changing exists
// DontDestroyOnLoad(gameObject);
}
// Use this for initialization
void Start () {
}
// Use this for initialization
void Start () {
taxSlider = Tax.GetComponentInChildren<Slider>();
eiSlider = EcoInv.GetComponentInChildren<Slider>();
tiSlider = TechInv.GetComponentInChildren<Slider>();
logiSlider = Logistics.GetComponentInChildren<Slider>();
initSlider();
}
// Update is called once per frame
void Update () {
initSlider();
}
// Update is called once per frame
void Update () {
GameManager.Instance.Game.PlayerInTurn.TaxRate = ((double)((int)(taxSlider.value * 100))) / 100f;
GameManager.Instance.Game.PlayerInTurn.EconomicInvestmentRatio = ((double)((int)(eiSlider.value * 100))) / 100f;
GameManager.Instance.Game.PlayerInTurn.ResearchInvestmentRatio = ((double)((int)(tiSlider.value * 100))) / 100f;
......@@ -61,9 +61,9 @@ public class InvestmentController : MonoBehaviour {
taxRateText.text = ((int)(taxSlider.value * 100)).ToString() + "%";
eiRateText.text = ((int)(eiSlider.value * 100)).ToString() + "%";
tiRateText.text = ((int)(tiSlider.value * 100)).ToString() + "%";
logiRateText.text = ((int)(logiSlider.value * 100)).ToString() + "%";
}
logiRateText.text = ((int)(logiSlider.value * 100)).ToString() + "%";
}
public void initSlider()
{
taxSlider.maxValue = 1f;
......@@ -127,5 +127,5 @@ public class InvestmentController : MonoBehaviour {
public void ChangeLogiValue(float adden)
{
logiSlider.value += adden;
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CivModel;
using CivModel.Common;
using System.Linq;
public class ProductablePrefab : MonoBehaviour {
private static ManagementController uicontroller;
private Text[] textarguments;
private Image unitPrt;
private Button[] buttons;
void Awake()
{
//Debug.Log("call SelPre");
textarguments = gameObject.GetComponentsInChildren<Text>();
foreach (Image unt in gameObject.GetComponentsInChildren<Image>())
{
if (unt.name == "Portrait")
{
unitPrt = unt;
}
}
buttons = gameObject.GetComponentsInChildren<Button>();
}
// Use this for initialization
void Start()
{
uicontroller = ManagementController.GetManagementController();
}
// Update is called once per frame
void Update()
{
}
public GameObject MakeItem(IProductionFactory fact)
{
//Debug.Log("Selection Queue Item Made");
string nameofFactory = ProductionFactoryTraits.GetFactoryName(fact);
unitPrt.sprite = Resources.Load(("Portraits/" + (ProductionFactoryTraits.GetFacPortName(fact)).ToLower()), typeof(Sprite)) as Sprite;
foreach (Text txt in textarguments)
{
switch (txt.name)
{
case "UnitName":
txt.text = nameofFactory;
break;
case "NumberOfUnits":
txt.text = "X 1";
break;
}
}
return this.gameObject;
}
public GameObject MakeItem()
{
unitPrt.enabled = false;
//Debug.Log("NULL Selection Queue");
foreach (Text txt in textarguments)
{
switch (txt.name)
{
case "UnitName":
txt.text = "생산 가능 유닛 없음";
txt.fontSize = Screen.height / 40;
break;
case "NumberOfUnits":
txt.text = "";
break;
}
}
foreach (Button but in buttons)
{
but.gameObject.SetActive(false);
}
return this.gameObject;
}
public void SetButton(IProductionFactory fac)
{
foreach (Button but in buttons)
{
switch (but.name)
{
case "Deploy":
but.onClick.AddListener(delegate () { ProduceItem(fac); });
break;
}
}
}
private void ProduceItem(IProductionFactory fac)
{
GameManager.Instance.Game.PlayerInTurn.Production.AddLast(fac.Create(GameManager.Instance.Game.PlayerInTurn));
//Debug.Log(i + " inputed");
uicontroller.MakeProductionQ();
uicontroller.MakeDeploymentQ();
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CivModel;
using CivModel.Common;
using System.Linq;
public class ProductablePrefab : MonoBehaviour {
private static ManagementController uicontroller;
private Text[] textarguments;
private Image unitPrt;
private Button[] buttons;
void Awake()
{
//Debug.Log("call SelPre");
textarguments = gameObject.GetComponentsInChildren<Text>();
foreach (Image unt in gameObject.GetComponentsInChildren<Image>())
{
if (unt.name == "Portrait")
{
unitPrt = unt;
}
}
buttons = gameObject.GetComponentsInChildren<Button>();
}
// Use this for initialization
void Start()
{
uicontroller = ManagementController.GetManagementController();
}
// Update is called once per frame
void Update()
{
}
public GameObject MakeItem(IProductionFactory fact)
{
//Debug.Log("Selection Queue Item Made");
string nameofFactory = ProductionFactoryTraits.GetFactoryName(fact);
unitPrt.sprite = Resources.Load(("Portraits/" + (ProductionFactoryTraits.GetFacPortName(fact)).ToLower()), typeof(Sprite)) as Sprite;
foreach (Text txt in textarguments)
{
switch (txt.name)
{
case "UnitName":
txt.text = nameofFactory;
break;
case "NumberOfUnits":
txt.text = "X 1";
break;
}
}
return this.gameObject;
}
public GameObject MakeItem()
{
unitPrt.enabled = false;
//Debug.Log("NULL Selection Queue");
foreach (Text txt in textarguments)
{
switch (txt.name)
{
case "UnitName":
txt.text = "생산 가능 유닛 없음";
txt.fontSize = Screen.height / 40;
break;
case "NumberOfUnits":
txt.text = "";
break;
}
}
foreach (Button but in buttons)
{
but.gameObject.SetActive(false);
}
return this.gameObject;
}
public void SetButton(IProductionFactory fac)
{
foreach (Button but in buttons)
{
switch (but.name)
{
case "Deploy":
but.onClick.AddListener(delegate () { ProduceItem(fac); });
break;
}
}
}
private void ProduceItem(IProductionFactory fac)
{
GameManager.Instance.Game.PlayerInTurn.Production.AddLast(fac.Create(GameManager.Instance.Game.PlayerInTurn));
//Debug.Log(i + " inputed");
uicontroller.MakeProductionQ();
uicontroller.MakeDeploymentQ();
}
}
This diff is collapsed.
......@@ -123,28 +123,34 @@ public class UIManager : MonoBehaviour
StartCoroutine(_tileCoroutine);
}
}
if (GameManager.Instance.selectedActor != null)
{
unitInfo.SetActive(true);
UnitPortrait.sprite = Resources.Load(("Portraits/" + (ProductionFactoryTraits.GetPortName(GameManager.Instance.selectedActor)).ToLower()), typeof(Sprite)) as Sprite;
if(GameManager.Instance.selectedActor is CivModel.Unit) {
GameObject.Find("UnitName").GetComponent<Text>().text = ProductionFactoryTraits.GetName(GameManager.Instance.selectedActor);
} else if(GameManager.Instance.selectedActor is CivModel.CityBase) {
GameObject.Find("UnitName").GetComponent<Text>().text = GameManager.Instance.selectedActor.Name;
if (questUI.activeSelf == false && managementUI.activeSelf == false)
{
if (GameManager.Instance.selectedActor != null)
{
unitInfo.SetActive(true);
UnitPortrait.sprite = Resources.Load(("Portraits/" + (ProductionFactoryTraits.GetPortName(GameManager.Instance.selectedActor)).ToLower()), typeof(Sprite)) as Sprite;
if (GameManager.Instance.selectedActor is CivModel.Actor)
{
GameObject.Find("UnitName").GetComponent<Text>().text = ProductionFactoryTraits.GetName(GameManager.Instance.selectedActor);
}
if (GameManager.Instance.selectedActor is CivModel.CityBase)
{
GameObject.Find("UnitName").GetComponent<Text>().text = GameManager.Instance.selectedActor.Name;
}
GameObject.Find("UnitAttack").GetComponent<Text>().text = GameManager.Instance.selectedActor.AttackPower.ToString();
GameObject.Find("UnitDefence").GetComponent<Text>().text = GameManager.Instance.selectedActor.DefencePower.ToString();
GameObject.Find("UnitEffect").GetComponent<Text>().text = GameManager.Instance.selectedActor.RemainHP.ToString() + "/" + GameManager.Instance.selectedActor.MaxHP;
GameObject.Find("ActionPoint").GetComponent<Text>().text = GameManager.Instance.selectedActor.RemainAP.ToString() + "/" + GameManager.Instance.selectedActor.MaxAP;
GameObject.Find("HealthPoint").GetComponent<RectTransform>().sizeDelta = new Vector2(30, 280 * (float)GameManager.Instance.selectedActor.RemainHP / (float)GameManager.Instance.selectedActor.MaxHP);
}
else unitInfo.SetActive(false);
if (SpecialSpec.activeSelf == true)
{
string specialText = "";
GameObject.Find("SpecialSpecText").GetComponent<Text>().text = specialText;
}
GameObject.Find("UnitAttack").GetComponent<Text>().text = GameManager.Instance.selectedActor.AttackPower.ToString();
GameObject.Find("UnitDefence").GetComponent<Text>().text = GameManager.Instance.selectedActor.DefencePower.ToString();
GameObject.Find("UnitEffect").GetComponent<Text>().text = GameManager.Instance.selectedActor.RemainHP.ToString() + "/" + GameManager.Instance.selectedActor.MaxHP;
GameObject.Find("ActionPoint").GetComponent<Text>().text = GameManager.Instance.selectedActor.RemainAP.ToString() + "/" + GameManager.Instance.selectedActor.MaxAP;
GameObject.Find("HealthPoint").GetComponent<RectTransform>().sizeDelta = new Vector2(30, 280 * (float)GameManager.Instance.selectedActor.RemainHP / (float)GameManager.Instance.selectedActor.MaxHP);
}
else unitInfo.SetActive(false);
if (SpecialSpec.activeSelf == true)
{
string specialText = "";
GameObject.Find("SpecialSpecText").GetComponent<Text>().text = specialText;
}
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ViewFieldSquareControl : MonoBehaviour {
Vector3 Scaler;
int zoom_counter;
// Use this for initialization
void Start () {
Scaler = new Vector3(0.22f, 0.22f, 0.22f);
zoom_counter = 2;
}
// Update is called once per frame
void Update () {
if(Input.GetAxis("Mouse ScrollWheel") < 0 && zoom_counter < 2)
{
GetComponent<Transform>().localScale += Scaler;
zoom_counter++;
}
if (Input.GetAxis("Mouse ScrollWheel") > 0 && zoom_counter > 0)
{
GetComponent<Transform>().localScale -= Scaler;
zoom_counter--;
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ViewFieldSquareControl : MonoBehaviour {
Vector3 Scaler;
int zoom_counter;
// Use this for initialization
void Start () {
Scaler = new Vector3(0.22f, 0.22f, 0.22f);
zoom_counter = 2;
}
// Update is called once per frame
void Update () {
if(Input.GetAxis("Mouse ScrollWheel") < 0 && zoom_counter < 2)
{
GetComponent<Transform>().localScale += Scaler;
zoom_counter++;
}
if (Input.GetAxis("Mouse ScrollWheel") > 0 && zoom_counter > 0)
{
GetComponent<Transform>().localScale -= Scaler;
zoom_counter--;
}
}
}
......@@ -83,18 +83,19 @@ public class Unit : MonoBehaviour {
Debug.Log("Selected Actor is NULL");
return;
}
else if (GameManager.Instance.selectedActor is CivModel.Unit)
{
// Select movable adjacent tiles
_parameterPoints = GameManager.Instance.selectedActor.PlacedPoint.Value.Adjacents();
for (int i = 0; i < _parameterPoints.Length; i++)
{
if (GameManager.Instance.selectedActor.MovingAttackAct.IsActable(_parameterPoints[i]))
if (GameManager.Instance.selectedActor.MovingAttackAct != null && GameManager.Instance.selectedActor.MovingAttackAct.IsActable(_parameterPoints[i]))
{
CivModel.Position pos = _parameterPoints[i].Value.Position;
GameManager.Instance.Tiles[pos.X, pos.Y].GetComponent<HexTile>().FlickerRed();
}
else if (GameManager.Instance.selectedActor.MoveAct.IsActable(_parameterPoints[i]))
else if (GameManager.Instance.selectedActor.MoveAct != null && GameManager.Instance.selectedActor.MoveAct.IsActable(_parameterPoints[i]))
{
CivModel.Position pos = _parameterPoints[i].Value.Position;
GameManager.Instance.Tiles[pos.X, pos.Y].GetComponent<HexTile>().FlickerBlue();
......@@ -146,7 +147,7 @@ public class Unit : MonoBehaviour {
else
{
CivModel.Position pos = _parameterPoints[i].Value.Position;
Debug.Log("Cannot Attack to (" + pos.X + ", " + pos.Y + ")");
//Debug.Log("Cannot Attack to (" + pos.X + ", " + pos.Y + ")");
}
}
IEnumerator _coroutine = AttackUnit(GameManager.Instance.selectedActor);
......@@ -214,12 +215,17 @@ public class Unit : MonoBehaviour {
GameManager.Instance.UpdateUnit();
break;
}
else {
else if (unitToMove.MoveAct != null && unitToMove.MoveAct.IsActable(destPoint)){
unitToMove.MoveAct.Act(destPoint);
MoveStateExit();
GameManager.Instance.UpdateUnit();
break;
}
else {
Debug.Log("The Unit Cannot Move");
MoveStateExit();
break;
}
}
// Flicker 하지 않는 타일 선택
else {
......@@ -309,7 +315,6 @@ public class Unit : MonoBehaviour {
public void SkillStateExit(CivModel.Actor unitToSkill) {
foreach (CivModel.Terrain.Point pnt in _skillParameterPoints) {
Debug.Log(pnt);
CivModel.Position pos = pnt.Position;
GameManager.Instance.Tiles[pos.X, pos.Y].GetComponent<HexTile>().StopFlickering();
}
......
19;0;4;0;0
\ No newline at end of file
2;0;196608;0;0
\ No newline at end of file
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using CivModel;
......@@ -32,29 +31,23 @@ public class GameUI : MonoBehaviour {
else
{
mapUI.transform.Find("EndTurn").GetComponentInChildren<Button>().enabled = true;
/* for testing only
foreach(CivModel.Unit x in GameManager.Instance.Game.PlayerInTurn.Units)
{
x.RemainAP = 0;
}
*/
if (!GameManager.Instance.Game.PlayerInTurn.Units.All(u => u.RemainAP == 0 || u.SkipFlag))
/*
if (GameManager.Instance.isThereTodos && !PseudoFSM.Instance.DepState)
{
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().text = "유닛이 명령을 기다리고 있습니다";
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().fontSize = 35;
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().fontSize = 30;
}
else if (GameManager.Instance.selectedActor != null)
else if (PseudoFSM.Instance.DepState)
{
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().text = "배치 취소";
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().fontSize = 40;
}
else
{
*/
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().text = "다음 턴";
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().fontSize = 40;
}
//}
updatePanel();
}
......
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CivModel;
using CivModel.Common;
public class DeployPrefab : MonoBehaviour
{
public static GameObject DeployingObject;
private Text[] textarguments;
private Image unitPrt;
private Button[] buttons;
// Use this for initialization
private bool _inDepState = false;
public bool DepState { get { return _inDepState; } }
private Production _deployment;
public Production Deployment { get { return _deployment; } }
void Awake()
{
//Debug.Log("call DepPre");
textarguments = gameObject.GetComponentsInChildren<Text>();
foreach (Image unt in gameObject.GetComponentsInChildren<Image>())
{
if (unt.name == "Portrait")
{
unitPrt = unt;
}
}
buttons = gameObject.GetComponentsInChildren<Button>();
}
void Start()
{
}
public GameObject MakeItem(Production prod)
{
string nameofProduction = ProductionFactoryTraits.GetFactoryName(prod.Factory);
unitPrt.sprite = Resources.Load(("Portraits/" + (ProductionFactoryTraits.GetFacPortName(prod.Factory)).ToLower()), typeof(Sprite)) as Sprite;
foreach (Text txt in textarguments)
{
switch (txt.name)
{
case "UnitName":
txt.text = nameofProduction;
break;
case "NumberOfUnits":
txt.text = "X 1";
break;
}
}
return this.gameObject;
}
public GameObject MakeItem()
{
unitPrt.enabled = false;
foreach (Text txt in textarguments)
{
switch (txt.name)
{
case "UnitName":
txt.text = "비었음";
break;
case "NumberOfUnits":
txt.text = "";
break;
}
}
foreach (Button but in buttons)
{
but.gameObject.SetActive(false);
}
return this.gameObject;
}
// Update is called once per frame
void Update()
{
}
public void SetButton(int i)
{
if (i == -1)
{
foreach (Button but in buttons)
{
but.enabled = false;
}
}
else
{
LinkedListNode<Production> dep = GameManager.Instance.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); DeployingObject = this.gameObject; });
break;
}
}
}
}
public void DeployItem(Production dep)
{
if (dep.IsCompleted)
{
DepStateEnter(dep);
UIManager.Instance.mapUI.SetActive(true);
UIManager.Instance.managementUI.SetActive(false);
UIManager.Instance.questUI.SetActive(false);
}
else
{
//Debug.Log("Error : not finished product");
throw new AccessViolationException();
}
}
public void DepStateEnter(Production dep)
{
// State change
if (dep == null || _inDepState) return;
_inDepState = true;
_deployment = dep;
// Select deploy tile
CivModel.Terrain terrain = GameManager.Instance.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.Instance.Tiles[point.Position.X, point.Position.Y].GetComponent<HexTile>().FlickerBlue();
}
}
IEnumerator _coroutine = DeployUnit(GameManager.Instance.selectedPoint, dep);
StartCoroutine(_coroutine);
}
}
IEnumerator DeployUnit(CivModel.Terrain.Point point, Production dep)
{
while (true)
{
CivModel.Terrain.Point destPoint = GameManager.Instance.selectedPoint;
// 새로운 Point 을 선택했을 때
if (point != destPoint)
{
// Flicker하고 있는 Tile을 선택했을 때
if (GameManager.Instance.selectedTile.isFlickering)
{
if (dep.IsPlacable(destPoint))
{
//여기에 유닛을 생성하는 걸 추가해야 함
GameManager.Instance.UpdateUnit();
break;
}
else
{
DepStateExit();
}
}
// Flicker 하지 않는 타일 선택
else
{
DepStateExit();
}
}
yield return null;
}
}
void DepStateExit()
{
_inDepState = false;
_deployment = null;
CivModel.Terrain terrain = GameManager.Instance.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);
GameManager.Instance.Tiles[point.Position.X, point.Position.Y].GetComponent<HexTile>().StopFlickering();
}
}
}
}
# ===========================
# Default Collab Ignore Rules
# ===========================
# OS Generated
# ============
.DS_Store
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
[Tt]humbs.db
[Dd]esktop.ini
# Visual Studio / MonoDevelop generated
# =====================================
[Ee]xported[Oo]bj/
*.userprefs
*.csproj
*.pidb
*.suo
*.sln
*.user
*.unityproj
*.booproj
# Unity generated
# ===============
[Oo]bj/
[Bb]uild
sysinfo.txt
*.stackdump
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CivModel;
using System.Threading.Tasks;
public class GameUI : MonoBehaviour {
public GameObject mapUI;
public Text goldText, populationText, happinessText, researchText, laborText;
private UIController uicontroller;
private ManagementController managementcontroller;
// Use this for initialization
void Start () {
mapUI = GameObject.Find("MapUI");
uicontroller = UIController.GetUIController();
managementcontroller = ManagementController.GetManagementController();
}
// Update is called once per frame
void Update () {
if (GameManager.Instance.Game.PlayerInTurn.IsAIControlled)
{
mapUI.transform.Find("EndTurn").GetComponentInChildren<Button>().enabled = false;
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().text = "다른 플레이어가 턴 진행 중입니다. 기다려 주십시오.";
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().fontSize = Screen.height / 20;
}
else
{
mapUI.transform.Find("EndTurn").GetComponentInChildren<Button>().enabled = true;
if (GameManager.Instance.isThereTodos)
{
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().text = "유닛이 명령을 기다리고 있습니다";
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().fontSize = 30;
}
else
{
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().text = "다음 턴";
mapUI.transform.Find("EndTurn").GetComponentInChildren<Text>().fontSize = 40;
}
updatePanel();
}
}
public void updatePanel()
{
double gold = GameManager.Instance.Game.PlayerInTurn.Gold;
double goldTurn = GameManager.Instance.Game.PlayerInTurn.GoldIncome;
goldText.text = "금: " + gold + "\n(턴당 " + goldTurn + ")";
double population = GameManager.Instance.Game.PlayerInTurn.Population;
populationText.text = "인구: " + population;
double happiness = GameManager.Instance.Game.PlayerInTurn.Happiness;
double happinessTurn = GameManager.Instance.Game.PlayerInTurn.HappinessIncome;
happinessText.text = "행복: " + happiness + "\n(턴당 " + happinessTurn + ")";
double research = GameManager.Instance.Game.PlayerInTurn.Research;
double researchTurn = GameManager.Instance.Game.PlayerInTurn.ResearchIncome;
researchText.text = "기술력: " + research + "\n(턴당 " + researchTurn + ")";
double labor = GameManager.Instance.Game.PlayerInTurn.Labor;
laborText.text = "노동력: " + labor;
}
public void updateQuest()
{
uicontroller.MakeQuestQueue();
}
public void updateManagement()
{
managementcontroller.begin();
}
public void onClickNextTurn()
{
if (GameManager.Instance.isThereTodos)
{
GameManager.Instance.FocusOnActableUnit();
}
else
{
// Debug.Log(Game.PlayerNumberInTurn);
if (GameManager.Instance.Game.PlayerInTurn == GameManager.Instance.Game.Players[0])
GameManager.Instance.Game.EndTurn();
GameManager.Instance.Game.StartTurn();
while (GameManager.Instance.Game.PlayerInTurn.IsAIControlled)
{
// Debug.Log(Game.PlayerNumberInTurn);
GameManager.Instance.Game.PlayerInTurn.DoAITurnAction().GetAwaiter().GetResult();
GameManager.Instance.Game.EndTurn();
GameManager.Instance.Game.StartTurn();
}
GameManager.Instance.UpdateMap();
GameManager.Instance.UpdateUnit();
UIManager.Instance.ButtonInteractChange();
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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