Commit 2059eb23 authored by redsuncore's avatar redsuncore

Victory/Defeated Activated

승리 패배 화면 구현
parent 97f8c2b9
fileFormatVersion: 2
guid: 890521bae254d3449bc95bc022807c1a
timeCreated: 1516924843
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
......@@ -1209,6 +1209,7 @@ GameObject:
- component: {fileID: 401960986}
- component: {fileID: 401960985}
- component: {fileID: 401960984}
- component: {fileID: 401960988}
m_Layer: 5
m_Name: Ending
m_TagString: Untagged
......@@ -1291,6 +1292,19 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &401960988
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 401960983}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ca9207f97859836459f163b292d5721c, type: 3}
m_Name:
m_EditorClassIdentifier:
WinPrefab: {fileID: 1946831146169316, guid: 73e38289c8dbdcf4692905a270249884, type: 2}
LosePrefab: {fileID: 1904362418469180, guid: 6749e11b9d4ea6d4cb8d74a73a5b9184, type: 2}
--- !u!1 &460949051
GameObject:
m_ObjectHideFlags: 0
......@@ -2427,8 +2441,8 @@ MonoBehaviour:
SkillButton: {fileID: 901706016}
WaitButton: {fileID: 1126363246}
UnitInfo: {fileID: 1474852284}
Actions: {fileID: 0}
TurnEnd: {fileID: 0}
Actions: {fileID: 685271388}
TurnEnd: {fileID: 2068104999}
Portrait: {fileID: 109918048}
UnitName: {fileID: 1172741147}
UnitAttack: {fileID: 1442304659}
......@@ -4054,7 +4068,7 @@ GameObject:
- component: {fileID: 1913802877}
- component: {fileID: 1913802879}
m_Layer: 5
m_Name: Image
m_Name: Information
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......
......@@ -10,7 +10,7 @@ using CivModel.Common;
public class CIVGameManager : MonoBehaviour, IView {
private const float cameraSpeed = 4.0f;
private const float cameraSpeed = 12.0f;
public enum DistrictSprite { None, CityCenter }
public static Sprite[] DistrictSprites => districtSprites;
......@@ -30,8 +30,11 @@ public class CIVGameManager : MonoBehaviour, IView {
public int Width { get; set; }
public int Height { get; set; }
private Button[] cameraButtons;
public GameObject cellPrefab;
public Camera mainCamera;
private Canvas cameraUI;
public GameObject focusObject;
public Button turnEndButton;
......@@ -204,6 +207,16 @@ public class CIVGameManager : MonoBehaviour, IView {
mainPlayer = players[0];
Width = game.Terrain.Width;
Height = game.Terrain.Height;
Canvas[] acanvas = FindObjectsOfType<Canvas>();
foreach(Canvas can in acanvas)
{
switch(can.name)
{
case "CameraUI": cameraUI = can;
break;
}
}
cameraButtons = cameraUI.GetComponentsInChildren<Button>();
//gameMapModel = mPresenter.Game.Terrain;
var dss = Enum.GetValues(typeof(DistrictSprite));
......@@ -245,6 +258,7 @@ public class CIVGameManager : MonoBehaviour, IView {
labnum = Convert.ToInt32(game.PlayerInTurn.Labor);
technum = 0; // not Implemented
ultnum = 0; //not Implemented
ButtonSetup();
}
// Update is called once per frame
......@@ -281,10 +295,22 @@ public class CIVGameManager : MonoBehaviour, IView {
case CivPresenter.Presenter.States.MovingAttack:
{
CastRay();
if (cellSelected != null)
{
mPresenter.FocusedPoint = pointSelected.Value;
}
mPresenter.CommandApply();
break;
}
case CivPresenter.Presenter.States.HoldingAttack:
{
CastRay();
if (cellSelected != null)
{
mPresenter.FocusedPoint = pointSelected.Value;
}
mPresenter.CommandApply();
break;
}
......@@ -432,11 +458,31 @@ public class CIVGameManager : MonoBehaviour, IView {
case CivPresenter.Presenter.States.MovingAttack:
{
Debug.Log("State : MovingAttack");
for (int i = 0; i < Width; i++)
{
for (int j = 0; j < Height; j++)
{
if (mPresenter.RunningAction.IsActable(mPresenter.Game.Terrain.GetPoint(i, j)))
{
cells[i, j].GetComponent<TilePrefab>().AttackableTile();
}
}
}
break;
}
case CivPresenter.Presenter.States.HoldingAttack:
{
Debug.Log("State : HoldingAttack");
for (int i = 0; i < Width; i++)
{
for (int j = 0; j < Height; j++)
{
if (mPresenter.RunningAction.IsActable(mPresenter.Game.Terrain.GetPoint(i, j)))
{
cells[i, j].GetComponent<TilePrefab>().AttackableTile();
}
}
}
break;
}
......@@ -473,12 +519,12 @@ public class CIVGameManager : MonoBehaviour, IView {
}
case CivPresenter.Presenter.States.Victory:
{
Debug.Log("State : Deploy");
Debug.Log("State : Victory");
break;
}
case CivPresenter.Presenter.States.Defeated:
{
Debug.Log("State : Deploy");
Debug.Log("State : Defeated");
break;
}
default:
......@@ -530,7 +576,35 @@ public class CIVGameManager : MonoBehaviour, IView {
mPresenter.CommandApply();
}
}
public void ButtonSetup()
{
foreach(Button btn in cameraButtons)
{
switch(btn.name)
{
case "Attack":
Debug.Log(btn.name + " onclick addlistener");
btn.onClick.AddListener(delegate () { AttackButtonMethod(); });
break;
default:
Debug.Log(btn.name);break;
}
}
}
public void AttackButtonMethod()
{
if (mPresenter.State == CivPresenter.Presenter.States.Normal)
{
Debug.Log("Attack Button");
mPresenter.CommandMovingAttack();
if (mPresenter.State != CivPresenter.Presenter.States.MovingAttack)
{
mPresenter.CommandHoldingAttack();
}
}
}
}
public class ProductionFactoryTraits
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CivPresenter;
public class Ending : MonoBehaviour {
public GameObject WinPrefab;
public GameObject LosePrefab;
private Presenter mPresenter;
private static GameObject result;
private bool shown;
// Use this for initialization
void Start () {
shown = false;
mPresenter = CIVGameManager.GetGameManager().GetComponent<CIVGameManager>().GetPresenter();
}
// Update is called once per frame
void Update ()
{
switch (mPresenter.State)//for debug
{
case CivPresenter.Presenter.States.Victory:
{
WinorLose(true);
break;
}
case CivPresenter.Presenter.States.Defeated:
{
WinorLose(false);
break;
}
}
}
public void WinorLose(bool win)
{
if(result != null)
{ return; }
if(shown)
{ return; }
if (win)
{
result = Instantiate(WinPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
result.transform.SetParent(this.gameObject.transform);
result.transform.localScale = new Vector3(1f, 1f, 1f);
result.transform.localPosition = new Vector3(0f, 0f, 0f);
}
else
{
result = Instantiate(LosePrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
result.transform.SetParent(this.gameObject.transform);
result.transform.localScale = new Vector3(1f, 1f, 1f);
result.transform.localPosition = new Vector3(0f, 0f, 0f);
}
shown = true;
}
}
fileFormatVersion: 2
guid: ca9207f97859836459f163b292d5721c
timeCreated: 1516926496
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -29,6 +29,11 @@ public class TilePrefab : MonoBehaviour {
string color = "Magenta";
ChangeTile(color);
}
public void AttackableTile()
{
string color = "Red";
ChangeTile(color);
}
public void ChangeTile(CivModel.Terrain.Point terrainPoint)
{
var t1 = terrainPoint.Type;
......
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