Commit f635cd4d authored by 18손재민's avatar 18손재민

Merge remote-tracking branch 'tetra-tower/UI'

parents 76ccc2a8 702ca643
fileFormatVersion: 2
guid: 9f325419105859b439f5678b1c560963
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -1341,11 +1341,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3a9b430bb1c39ea4e9820b5c6510da1f, type: 3}
m_Name:
m_EditorClassIdentifier:
cellSprites: []
cellSprites:
- {fileID: 21300004, guid: 137b0e8d2160bab45893f33e02df312a, type: 3}
- {fileID: 21300000, guid: 137b0e8d2160bab45893f33e02df312a, type: 3}
- {fileID: 21300002, guid: 137b0e8d2160bab45893f33e02df312a, type: 3}
cellObj: {fileID: 1322655041097828, guid: a413c94742056eb42a0fb2896e81d287, type: 2}
rowObj: {fileID: 1211859245884242, guid: 64e119a3b05f7e643a2873db8c703f88, type: 2}
isDead: 0
textUI: {fileID: 0}
--- !u!114 &114934012017033118
MonoBehaviour:
m_ObjectHideFlags: 1
......
fileFormatVersion: 2
guid: e92df8eed60682643a4380829c5546e2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_SourcePrefab: {fileID: 0}
m_RootGameObject: {fileID: 1813912364111484}
m_IsPrefabAsset: 1
--- !u!1 &1208630702526062
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 224901548203493508}
- component: {fileID: 222462642363945872}
- component: {fileID: 114051075353211474}
m_Layer: 5
m_Name: Inventory Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1813912364111484
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 224677920009192142}
- component: {fileID: 223614052718207098}
- component: {fileID: 114829131213021812}
- component: {fileID: 114010573879188626}
- component: {fileID: 114499813606064436}
m_Layer: 5
m_Name: Inventory Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114010573879188626
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1813912364111484}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &114051075353211474
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1208630702526062}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &114499813606064436
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1813912364111484}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f387f56bed3e2d34b8a70ebc65ac286e, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114829131213021812
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1813912364111484}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!222 &222462642363945872
CanvasRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1208630702526062}
m_CullTransparentMesh: 0
--- !u!223 &223614052718207098
Canvas:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1813912364111484}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 1
m_TargetDisplay: 0
--- !u!224 &224677920009192142
RectTransform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1813912364111484}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 224901548203493508}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!224 &224901548203493508
RectTransform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1208630702526062}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224677920009192142}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1280, y: 720}
m_Pivot: {x: 0, y: 0}
fileFormatVersion: 2
guid: 6f4b64053265cff4a8f45462c67584a4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -801,6 +801,106 @@ Prefab:
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 668207ef06c134e40b24375977c2c930, type: 2}
m_IsPrefabAsset: 0
--- !u!1001 &1338081863
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_RootOrder
value: 11
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_Pivot.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224677920009192142, guid: 6f4b64053265cff4a8f45462c67584a4,
type: 2}
propertyPath: m_Pivot.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6f4b64053265cff4a8f45462c67584a4, type: 2}
m_IsPrefabAsset: 0
--- !u!1001 &1501222773
Prefab:
m_ObjectHideFlags: 0
......
This diff is collapsed.
fileFormatVersion: 2
guid: bf635dd77ac1012428fad326c391af96
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: c95d79ce9d66a0041b946d4ef1c10776
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Random = UnityEngine.Random;
/// <summary>
/// Healthbar manager
......@@ -51,10 +53,6 @@ public class LifeCrystalUI : MonoBehaviour
/// LifeCrystal enabled if isDead == false
/// </summary>
public bool isDead;
/// <summary>
/// Text output, for debugging purpose
/// </summary>
public Text textUI;
////////////////////////////////////////////////// Protected variables
private int lifeCount, goldCount, height;
/// <summary>
......@@ -98,7 +96,7 @@ public class LifeCrystalUI : MonoBehaviour
{
if (cell[x][y] == CellType.Gold)
goldCount--;
updateCell(x, y, CellType.Empty);
UpdateCell(x, y, CellType.Empty);
dmg--;
lifeCount--;
}
......@@ -145,7 +143,7 @@ public class LifeCrystalUI : MonoBehaviour
if (cell[x][y] == CellType.Life)
{
if (mixer[redLifeIndex] == 1)
updateCell(x, y, CellType.Gold);
UpdateCell(x, y, CellType.Gold);
redLifeIndex++;
}
}
......@@ -173,7 +171,7 @@ public class LifeCrystalUI : MonoBehaviour
{
if (isDead) return false;
Vector2Int dropxy = dropSimulation(frag.grid);
Vector2Int dropxy = DropSimulation(frag.grid);
if (dropxy.y == 0) return false;
StartCoroutine(DropBlock(frag, dropxy));
......@@ -196,11 +194,42 @@ public class LifeCrystalUI : MonoBehaviour
for (int x = 2; x >= 0; x--)
if (cell[x][y] == CellType.Gold && gold > 0)
{
updateCell(x, y, CellType.Life);
UpdateCell(x, y, CellType.Life);
gold--;
}
return true;
}
/// <summary>
/// Adds a new row to LifeCrystalUI
/// </summary>
public void AddNewRow()
{
if (height >= 33) return;
GameObject newRow = Instantiate(rowObj, pivotPosition + gridSize * new Vector3(0, height, 0), Quaternion.Euler(Vector3.zero), transform.Find("Frame"));
newRow.name = "Row" + height;
CellType[][] temp = new CellType[3][] { new CellType[height + 1], new CellType[height + 1], new CellType[height + 1] };
Image[][] temp2 = new Image[3][] { new Image[height + 1], new Image[height + 1], new Image[height + 1] };
for (int i = 0; i < 3; i++)
{
Array.Copy(cell[i], temp[i], height + 1);
Array.Copy(cellImg[i], temp2[i], height + 1);
}
cell = temp; cellImg = temp2;
cell[0][height] = cell[1][height] = cell[2][height] = CellType.Empty;
GameObject[] newCells = new GameObject[3];
for (int i = 0; i < 3; i++)
{
newCells[i] = Instantiate(cellObj, pivotPosition + gridSize * new Vector3(i - 1, height, 0),
Quaternion.Euler(Vector3.zero), transform.Find("Cells"));
newCells[i].name = "LC" + (1 + 3 * height + i).ToString("00");
cellImg[i][height] = newCells[i].GetComponent<Image>();
UpdateCell(i, height, 0);
}
height++;
}
////////////////////////////////////////////////// Basic functions
/// <summary>
/// Initialization
......@@ -237,7 +266,7 @@ public class LifeCrystalUI : MonoBehaviour
/// <param name="x">X position of the cell to update: 0~2 (0 on the left)</param>
/// <param name="y">Y position of the cell to update: 0~(height-1) (0 on the bottom)</param>
/// <param name="value"></param>
void updateCell(int x, int y, CellType value)
void UpdateCell(int x, int y, CellType value)
{
cell[x][y] = value;
cellImg[x][y].sprite = cellSprites[(int)value];
......@@ -259,7 +288,7 @@ public class LifeCrystalUI : MonoBehaviour
/// <para/> X: 0~2 (0 on the bottom)
/// <para/> Y: 0~(height-1) (0 on the left)</param>
/// <returns>Vector2(drop position(0~2), drop depth(0~height))</returns>
Vector2Int dropSimulation(CellType[][] grid)
Vector2Int DropSimulation(CellType[][] grid)
{
int bWidth = grid.Length;
int bHeight = grid[0].Length;
......@@ -333,7 +362,7 @@ public class LifeCrystalUI : MonoBehaviour
{
if (frag.grid[x][y] != CellType.Empty)
{
updateCell(dropxy.x + x, height - dropxy.y + y, frag.grid[x][y]);
UpdateCell(dropxy.x + x, height - dropxy.y + y, frag.grid[x][y]);
droppingCells.Add(new Vector2Int(dropxy.x + x, height - dropxy.y + y));
lifeCount++;
}
......
fileFormatVersion: 2
guid: 9131e6c7ac79278499e6a74b49e4ddc2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InventoryUI : MonoBehaviour {
Canvas canvas;
bool isActive;
void Start()
{
canvas = gameObject.GetComponent<Canvas>();
canvas.enabled = false;
isActive = false;
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Tab))
{
isActive = !isActive;
canvas.enabled = isActive;
if (isActive)
Time.timeScale = 0;
else
Time.timeScale = 1;
}
}
}
fileFormatVersion: 2
guid: f387f56bed3e2d34b8a70ebc65ac286e
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