DrawPileUI and DiscardPileUI
This commit is contained in:
parent
567b732f85
commit
05fee309c3
8 changed files with 338 additions and 7 deletions
|
|
@ -27,11 +27,6 @@ public class BattleController : MonoBehaviour
|
||||||
private int energy;
|
private int energy;
|
||||||
|
|
||||||
void Awake() {
|
void Awake() {
|
||||||
}
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
this.heroDeck = new HeroDeck(cardIds);
|
this.heroDeck = new HeroDeck(cardIds);
|
||||||
|
|
||||||
heroes = new BattleHero[3];
|
heroes = new BattleHero[3];
|
||||||
|
|
@ -78,7 +73,11 @@ public class BattleController : MonoBehaviour
|
||||||
this.battlePlayerControls.OnCardUsed += this.NotifyCardUsed;
|
this.battlePlayerControls.OnCardUsed += this.NotifyCardUsed;
|
||||||
this.battlePlayerControls.OnTurnPassed += this.NotifyTurnPassed;
|
this.battlePlayerControls.OnTurnPassed += this.NotifyTurnPassed;
|
||||||
this.heroDeck.OnHandPileChanged += this.battlePlayerControls.NotifyHandPileChanged;
|
this.heroDeck.OnHandPileChanged += this.battlePlayerControls.NotifyHandPileChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
DecideEnemyTarget();
|
DecideEnemyTarget();
|
||||||
StartHeroTurn();
|
StartHeroTurn();
|
||||||
}
|
}
|
||||||
|
|
@ -155,4 +154,8 @@ public class BattleController : MonoBehaviour
|
||||||
public int GetMaxEnergy() {
|
public int GetMaxEnergy() {
|
||||||
return this.maxEnergy;
|
return this.maxEnergy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HeroDeck GetHeroDeck() {
|
||||||
|
return this.heroDeck;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,6 @@ public class BattlePlayerControls : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyHandPileChanged() {
|
public void NotifyHandPileChanged() {
|
||||||
SetHand(this.heroDeck.GetHand());
|
SetHand(this.heroDeck.GetHandPile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -264,6 +264,8 @@ RectTransform:
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1415908914}
|
- {fileID: 1415908914}
|
||||||
- {fileID: 24180900}
|
- {fileID: 24180900}
|
||||||
|
- {fileID: 1887276863}
|
||||||
|
- {fileID: 2103461257}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 3
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
|
@ -550,6 +552,84 @@ Transform:
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &1242658818
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1242658819}
|
||||||
|
- component: {fileID: 1242658821}
|
||||||
|
- component: {fileID: 1242658820}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: DrawPileText
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &1242658819
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1242658818}
|
||||||
|
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: 1887276863}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: -467.1, y: -316}
|
||||||
|
m_SizeDelta: {x: 171.60992, y: 30}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &1242658820
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1242658818}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 0.93333334, g: 0.93333334, b: 0.93333334, a: 1}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_FontData:
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_FontSize: 20
|
||||||
|
m_FontStyle: 1
|
||||||
|
m_BestFit: 0
|
||||||
|
m_MinSize: 2
|
||||||
|
m_MaxSize: 40
|
||||||
|
m_Alignment: 3
|
||||||
|
m_AlignByGeometry: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_HorizontalOverflow: 0
|
||||||
|
m_VerticalOverflow: 0
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Text: 'Draw pile: 5'
|
||||||
|
--- !u!222 &1242658821
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1242658818}
|
||||||
|
m_CullTransparentMesh: 0
|
||||||
--- !u!1 &1415908913
|
--- !u!1 &1415908913
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -727,6 +807,186 @@ Transform:
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &1522237120
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1522237121}
|
||||||
|
- component: {fileID: 1522237123}
|
||||||
|
- component: {fileID: 1522237122}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: DiscardPileText
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &1522237121
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1522237120}
|
||||||
|
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: 2103461257}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: -467.1, y: -345.14}
|
||||||
|
m_SizeDelta: {x: 171.60992, y: 30}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &1522237122
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1522237120}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 0.93333334, g: 0.93333334, b: 0.93333334, a: 1}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_FontData:
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_FontSize: 20
|
||||||
|
m_FontStyle: 1
|
||||||
|
m_BestFit: 0
|
||||||
|
m_MinSize: 2
|
||||||
|
m_MaxSize: 40
|
||||||
|
m_Alignment: 3
|
||||||
|
m_AlignByGeometry: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_HorizontalOverflow: 0
|
||||||
|
m_VerticalOverflow: 0
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Text: 'Draw pile: 5'
|
||||||
|
--- !u!222 &1522237123
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1522237120}
|
||||||
|
m_CullTransparentMesh: 0
|
||||||
|
--- !u!1 &1887276862
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1887276863}
|
||||||
|
- component: {fileID: 1887276864}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: DrawPileUI
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &1887276863
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1887276862}
|
||||||
|
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:
|
||||||
|
- {fileID: 1242658819}
|
||||||
|
m_Father: {fileID: 35522592}
|
||||||
|
m_RootOrder: 2
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 60}
|
||||||
|
m_SizeDelta: {x: 100, y: 100}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &1887276864
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1887276862}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: b39e026c50828b04ab3d0627aaf962d6, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
text: {fileID: 1242658820}
|
||||||
|
battleController: {fileID: 359124400}
|
||||||
|
--- !u!1 &2103461256
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2103461257}
|
||||||
|
- component: {fileID: 2103461258}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: DiscardPileUI
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &2103461257
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2103461256}
|
||||||
|
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:
|
||||||
|
- {fileID: 1522237121}
|
||||||
|
m_Father: {fileID: 35522592}
|
||||||
|
m_RootOrder: 3
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 60}
|
||||||
|
m_SizeDelta: {x: 100, y: 100}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &2103461258
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2103461256}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: b39e026c50828b04ab3d0627aaf962d6, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
text: {fileID: 1522237122}
|
||||||
|
battleController: {fileID: 359124400}
|
||||||
--- !u!1 &2141503599
|
--- !u!1 &2141503599
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
19
Assets/Battle/DiscardPileUI.cs
Normal file
19
Assets/Battle/DiscardPileUI.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class DiscardPileUI : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Text text;
|
||||||
|
public BattleController battleController;
|
||||||
|
|
||||||
|
void Start() {
|
||||||
|
this.battleController.GetHeroDeck().OnDiscardPileChanged += NotifyDiscardPileChanged;
|
||||||
|
NotifyDiscardPileChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NotifyDiscardPileChanged() {
|
||||||
|
text.text = "Discard pile: " + this.battleController.GetHeroDeck().GetDiscardPile().Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Battle/DiscardPileUI.cs.meta
Normal file
11
Assets/Battle/DiscardPileUI.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 077ba059e9689fa4990b9aea8bff3ded
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
19
Assets/Battle/DrawPileUI.cs
Normal file
19
Assets/Battle/DrawPileUI.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class DrawPileUI : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Text text;
|
||||||
|
public BattleController battleController;
|
||||||
|
|
||||||
|
void Start() {
|
||||||
|
this.battleController.GetHeroDeck().OnDrawPileChanged += NotifyDrawPileChanged;
|
||||||
|
NotifyDrawPileChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NotifyDrawPileChanged() {
|
||||||
|
text.text = "Draw pile: " + this.battleController.GetHeroDeck().GetDrawPile().Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Battle/DrawPileUI.cs.meta
Normal file
11
Assets/Battle/DrawPileUI.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b39e026c50828b04ab3d0627aaf962d6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -29,10 +29,18 @@ public class HeroDeck
|
||||||
this.drawPile.Shuffle();
|
this.drawPile.Shuffle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BaseCard> GetHand() {
|
public List<BaseCard> GetDrawPile() {
|
||||||
|
return drawPile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BaseCard> GetHandPile() {
|
||||||
return handPile;
|
return handPile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<BaseCard> GetDiscardPile() {
|
||||||
|
return discardPile;
|
||||||
|
}
|
||||||
|
|
||||||
public void DrawHand() {
|
public void DrawHand() {
|
||||||
for (int i = 0; i < DEFAULT_HAND_DRAWN; i++) {
|
for (int i = 0; i < DEFAULT_HAND_DRAWN; i++) {
|
||||||
DrawCardInternal();
|
DrawCardInternal();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue