Ajout de la barre de mana
Crée au lancement de l'application à partir d'un prefab "manaItem". Ce sont des boutons pour linstant (peut être à modifier...) 10 sont crée au lancement et agencés avec le système de Layout. Une fonction pour en activer un par jour (comme sur Hearthstone) a été implémenté mais n'est pas encore fonctionelle.
This commit is contained in:
parent
e0ff9f069a
commit
a7c9aaa5a2
|
@ -0,0 +1,148 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &100000
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
serializedVersion: 4
|
||||||
|
m_Component:
|
||||||
|
- 224: {fileID: 22400000}
|
||||||
|
- 222: {fileID: 22200000}
|
||||||
|
- 114: {fileID: 11400004}
|
||||||
|
- 114: {fileID: 11400002}
|
||||||
|
- 114: {fileID: 11400000}
|
||||||
|
- 114: {fileID: 11400006}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: ManaItem
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 100000}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_IgnoreLayout: 0
|
||||||
|
m_MinWidth: 40
|
||||||
|
m_MinHeight: 30
|
||||||
|
m_PreferredWidth: -1
|
||||||
|
m_PreferredHeight: -1
|
||||||
|
m_FlexibleWidth: -1
|
||||||
|
m_FlexibleHeight: -1
|
||||||
|
--- !u!114 &11400002
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 100000}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Navigation:
|
||||||
|
m_Mode: 3
|
||||||
|
m_SelectOnUp: {fileID: 0}
|
||||||
|
m_SelectOnDown: {fileID: 0}
|
||||||
|
m_SelectOnLeft: {fileID: 0}
|
||||||
|
m_SelectOnRight: {fileID: 0}
|
||||||
|
m_Transition: 1
|
||||||
|
m_Colors:
|
||||||
|
m_NormalColor: {r: .189121976, g: .461876631, b: .779411793, a: 1}
|
||||||
|
m_HighlightedColor: {r: .188235298, g: .4627451, b: .78039217, a: 1}
|
||||||
|
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
|
||||||
|
m_DisabledColor: {r: .531520367, g: .694621027, b: .83088237, a: .501960814}
|
||||||
|
m_ColorMultiplier: 1
|
||||||
|
m_FadeDuration: .100000001
|
||||||
|
m_SpriteState:
|
||||||
|
m_HighlightedSprite: {fileID: 0}
|
||||||
|
m_PressedSprite: {fileID: 0}
|
||||||
|
m_DisabledSprite: {fileID: 0}
|
||||||
|
m_AnimationTriggers:
|
||||||
|
m_NormalTrigger: Normal
|
||||||
|
m_HighlightedTrigger: Highlighted
|
||||||
|
m_PressedTrigger: Pressed
|
||||||
|
m_DisabledTrigger: Disabled
|
||||||
|
m_Interactable: 0
|
||||||
|
m_TargetGraphic: {fileID: 11400004}
|
||||||
|
m_OnClick:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||||
|
Culture=neutral, PublicKeyToken=null
|
||||||
|
--- !u!114 &11400004
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 100000}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_Type: 1
|
||||||
|
m_PreserveAspect: 0
|
||||||
|
m_FillCenter: 1
|
||||||
|
m_FillMethod: 4
|
||||||
|
m_FillAmount: 1
|
||||||
|
m_FillClockwise: 1
|
||||||
|
m_FillOrigin: 0
|
||||||
|
--- !u!114 &11400006
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 100000}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 9781d92cb7268914f9a8d87ccf55e3a4, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!222 &22200000
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 100000}
|
||||||
|
--- !u!224 &22400000
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 100000}
|
||||||
|
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: 0}
|
||||||
|
m_RootOrder: 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: .5, y: .5}
|
||||||
|
--- !u!1001 &100100000
|
||||||
|
Prefab:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications: []
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_ParentPrefab: {fileID: 0}
|
||||||
|
m_RootGameObject: {fileID: 100000}
|
||||||
|
m_IsPrefabParent: 1
|
||||||
|
m_IsExploded: 1
|
|
@ -0,0 +1,4 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 19394ecd1b3a67b45b66a7d5904bd53d
|
||||||
|
NativeFormatImporter:
|
||||||
|
userData:
|
2595
Assets/scene.unity
2595
Assets/scene.unity
File diff suppressed because it is too large
Load Diff
|
@ -102,4 +102,7 @@ public class DayController : MonoBehaviour {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getDay(){return dayNb;}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class ManaItem : MonoBehaviour {
|
||||||
|
|
||||||
|
string message;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9781d92cb7268914f9a8d87ccf55e3a4
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
|
@ -0,0 +1,59 @@
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class ManaStack : MonoBehaviour {
|
||||||
|
|
||||||
|
public GameObject manaItem;
|
||||||
|
public Transform contentPanel;
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
|
||||||
|
//création de la barre de mana.
|
||||||
|
for(int i=0; i<10; i++){
|
||||||
|
createMana ();
|
||||||
|
GameObject.Find("ManaItem(Clone)").name="ManaItem"+i;
|
||||||
|
//GameObject.Find("ManaItem"+i).GetComponent("Button").
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update () {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//crée un cristaux de mana. (appelée dix fois lors de la fonction Start).
|
||||||
|
void createMana(){
|
||||||
|
GameObject myNewButton = Instantiate (manaItem) as GameObject;
|
||||||
|
ManaItem mana = myNewButton.GetComponent<ManaItem> ();
|
||||||
|
myNewButton.transform.SetParent (contentPanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//ajoute le bon nombre de cristaux de mana chaque jour
|
||||||
|
public void addDaily(int nbDay){
|
||||||
|
|
||||||
|
GameObject manaItemObject;
|
||||||
|
Button manaButton;
|
||||||
|
|
||||||
|
|
||||||
|
if (nbDay > 9) {
|
||||||
|
nbDay = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<=nbDay; i++) {
|
||||||
|
manaItemObject = GameObject.Find("ManaItem"+i);
|
||||||
|
manaButton = manaItemObject.GetComponent<Button> ();
|
||||||
|
manaButton.interactable=true;
|
||||||
|
//GameObject.Find("ManaItem"+i).GetComponent("Button").int
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3a202e69955c69942b7bd8912eda89ec
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
Loading…
Reference in New Issue