Commit a884f048 authored by redsuncore's avatar redsuncore

CameraUIController Added

move button can be disabled
parent b13adf80
...@@ -1779,6 +1779,7 @@ GameObject: ...@@ -1779,6 +1779,7 @@ GameObject:
- component: {fileID: 1096861574} - component: {fileID: 1096861574}
- component: {fileID: 1096861573} - component: {fileID: 1096861573}
- component: {fileID: 1096861572} - component: {fileID: 1096861572}
- component: {fileID: 1096861576}
m_Layer: 5 m_Layer: 5
m_Name: CameraUI m_Name: CameraUI
m_TagString: Untagged m_TagString: Untagged
...@@ -1865,6 +1866,23 @@ RectTransform: ...@@ -1865,6 +1866,23 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0, y: 0}
--- !u!114 &1096861576
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1096861571}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ef0f0d5d7f216094195cf0463442d75e, type: 3}
m_Name:
m_EditorClassIdentifier:
CameraCanvas: {fileID: 1096861574}
tempManagementUI: {fileID: 2074330600}
MoveButton: {fileID: 1334617258}
AttackButton: {fileID: 1727812862}
SkillButton: {fileID: 901706016}
WaitButton: {fileID: 1126363246}
--- !u!1 &1115068180 --- !u!1 &1115068180
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -2447,7 +2465,18 @@ MonoBehaviour: ...@@ -2447,7 +2465,18 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1334617259} m_TargetGraphic: {fileID: 1334617259}
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls:
- m_Target: {fileID: 1096861576}
m_MethodName: MoveButtonMethod
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null Culture=neutral, PublicKeyToken=null
--- !u!114 &1334617259 --- !u!114 &1334617259
...@@ -3808,6 +3837,7 @@ MonoBehaviour: ...@@ -3808,6 +3837,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 8b51e0c0f81024746977ba754d547c94, type: 3} m_Script: {fileID: 11500000, guid: 8b51e0c0f81024746977ba754d547c94, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
cellSelected: {fileID: 0}
cellPrefab: {fileID: 1334406944157384, guid: 5c7cd0aa3d8e4e84ebbe79c9371c9361, type: 2} cellPrefab: {fileID: 1334406944157384, guid: 5c7cd0aa3d8e4e84ebbe79c9371c9361, type: 2}
mainCamera: {fileID: 1122781158} mainCamera: {fileID: 1122781158}
focusObject: {fileID: 0} focusObject: {fileID: 0}
......
...@@ -76,8 +76,20 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -76,8 +76,20 @@ public class CIVGameManager : MonoBehaviour, IView {
} }
} }
private GameObject cellSelected = null; public static GameObject GetGameManager()
private CivModel.Terrain.Point? pointSelected; {
if(gameManager == null)
{
throw new NullReferenceException();
}
else
{
return gameManager;
}
}
public GameObject cellSelected = null;
public CivModel.Terrain.Point? pointSelected;
private bool readyToClick = false; private bool readyToClick = false;
public void CastRay() public void CastRay()
...@@ -98,7 +110,11 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -98,7 +110,11 @@ public class CIVGameManager : MonoBehaviour, IView {
readyToClick = false; readyToClick = false;
} }
else else
{
Debug.Log("notselected"); Debug.Log("notselected");
cellSelected = null;
pointSelected = null;
}
} }
...@@ -106,6 +122,7 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -106,6 +122,7 @@ public class CIVGameManager : MonoBehaviour, IView {
{ {
cellSelected = go; cellSelected = go;
pointSelected = FindCell(cellSelected); pointSelected = FindCell(cellSelected);
Debug.Log(pointSelected);
} }
public CivModel.Terrain.Point FindCell(GameObject go) public CivModel.Terrain.Point FindCell(GameObject go)
{ {
...@@ -158,15 +175,24 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -158,15 +175,24 @@ public class CIVGameManager : MonoBehaviour, IView {
public Text gold, population, happiness, labor, technology, ultimate; public Text gold, population, happiness, labor, technology, ultimate;
private int goldnum, popnum, happynum, labnum, technum, ultnum; private int goldnum, popnum, happynum, labnum, technum, ultnum;
void Awake()
// Use this for initialization
void Start()
{ {
DontDestroyOnLoad(this); DontDestroyOnLoad(this);
//System.Diagnostics.Debug.Assert(gameObject == null);
if (gameManager == null) if (gameManager == null)
{ {
gameManager = this.gameObject; gameManager = this.gameObject;
}
else
{
Destroy(this);
}
}
// Use this for initialization
void Start()
{
//System.Diagnostics.Debug.Assert(gameObject == null);
if (gameManager == this.gameObject)
{
Width = 10; Width = 10;
Height = 10; Height = 10;
mPresenter = new Presenter(this); mPresenter = new Presenter(this);
...@@ -262,7 +288,50 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -262,7 +288,50 @@ public class CIVGameManager : MonoBehaviour, IView {
labor.text = "노동력: " + labnum.ToString(); labor.text = "노동력: " + labnum.ToString();
technology.text = "기술력: " + technum.ToString(); technology.text = "기술력: " + technum.ToString();
ultimate.text = "궁극기: " + ultnum.ToString() + " %"; ultimate.text = "궁극기: " + ultnum.ToString() + " %";
/*switch(mPresenter.State)
{
case CivPresenter.Presenter.States.Normal:
{
std::string msg = "Turn: " + std::to_string(m_presenter->Game->TurnNumber);
if (m_presenter->IsThereTodos)
{
msg += " %c\x0f""waiting for command %c\x07(";
msg += "%c\x0f""m%c\x07: move ";
msg += "%c\x0f""q%c\x07: moving attack ";
msg += "%c\x0f""w%c\x07: holding attack ";
msg += "%c\x0f""1-9%c\x07 : special acts ";
msg += "%c\x0f""p%c\x07: production ";
msg += "%c\x0f""z%c\x07: skip)";
}
else
{
msg += " %c\x0fpress Enter for the next turn";
}
m_screen->PrintStringEx(0, scrsz.height - 1, 0b00000111, msg);
break;
}
case CivPresenter.Presenter.States.Move:
m_screen->PrintString(0, scrsz.height - 1, 0b00001111, "Move");
break;
case CivPresenter.Presenter.States.MovingAttack:
m_screen->PrintString(0, scrsz.height - 1, 0b00001111, "Moving Attack");
break;
case CivPresenter.Presenter.States.HoldingAttack:
m_screen->PrintString(0, scrsz.height - 1, 0b00001111, "Holding Attack");
break;
case CivPresenter.Presenter.States.SpecialAct:
m_screen->PrintString(0, scrsz.height - 1, 0b00001111,
"SpecialAct: " + std::to_string(m_presenter->StateParam));
break;
case CivPresenter.Presenter.States.Deploy:
m_screen->PrintString(0, scrsz.height - 1, 0b00001111, "Deploy");
break;
}*/
Render(mPresenter.Game.Terrain); Render(mPresenter.Game.Terrain);
} }
...@@ -284,7 +353,10 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -284,7 +353,10 @@ public class CIVGameManager : MonoBehaviour, IView {
} }
} }
public Presenter GetPresenter()
{
return mPresenter;
}
public void TurnEndSignal() public void TurnEndSignal()
{ {
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CivPresenter;
using CivModel;
public class CameraUIController : MonoBehaviour {
public Canvas CameraCanvas;
public Canvas tempManagementUI;
public Button MoveButton;
public Button AttackButton;
public Button SkillButton;
public Button WaitButton;
private GameObject gameManagerObject;
private CIVGameManager gameManager;
private Presenter mPresenter;
public void MoveButtonMethod()
{
Debug.Log("MoveButton");
if (gameManager.pointSelected.HasValue)
mPresenter.CommandMove();
}
public void SkillButtonMethod()
{
}
public void WaitButtonMethod()
{
}
public void AttackButtonMethod()
{
}
// Use this for initialization
void Start () {
gameManagerObject = CIVGameManager.GetGameManager();
gameManager = gameManagerObject.GetComponent<CIVGameManager>();
mPresenter = gameManager.GetPresenter();
tempManagementUI.enabled = false;
}
// Update is called once per frame
void Update () {
if(!gameManager.pointSelected.HasValue)
{
MoveButton.enabled = false;
}
else
{
MoveButton.enabled = true;
}
}
}
fileFormatVersion: 2
guid: ef0f0d5d7f216094195cf0463442d75e
timeCreated: 1516610478
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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