123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine;
- public class ChipManager : MonoBehaviour
- {
- public static ChipManager Instance { get; private set; }
- public float ChipSetSpace
- {
- get
- {
- return this.m_ChipSetSpace;
- }
- }
- public Vector3 ChipStackSpace
- {
- get
- {
- return this.m_ChipStackSpace;
- }
- }
- public float FallingLength
- {
- get
- {
- return this.m_FallingLength;
- }
- }
- public float FallingTime
- {
- get
- {
- return this.m_FallingTime;
- }
- }
- public int StackCount
- {
- get
- {
- return this.m_StackCount;
- }
- }
- public float TimeOffset
- {
- get
- {
- return this.m_TimeOffset;
- }
- }
- public List<ChipManager.Chip> ChipList
- {
- get
- {
- return this.m_ChipDataList;
- }
- }
- public ChipStack[] ChipStacks
- {
- get
- {
- return this.m_ChipStack;
- }
- }
- private void Awake()
- {
- ChipManager.Instance = this;
- this.m_ChipDataList = (from chip in this.ChipList
- orderby chip.value descending
- select chip).ToList<ChipManager.Chip>();
- foreach (ChipManager.Chip chip2 in this.m_ChipDataList)
- {
- chip2.chip_obj = Resources.Load<GameObject>(BlackjackGame.BlackJackResource("Prefab/Coin/" + chip2.chipname));
- }
- }
- private void StackCall()
- {
- if (this.StackEndCallBack != null)
- {
- this.StackEndCallBack();
- }
- this.StackEndCallBack = null;
- }
- public void StackEndAction()
- {
- if (this.m_ChipStack.Any((ChipStack chip) => !chip.ChipUpdateEnd))
- {
- return;
- }
- base.Invoke("StackCall", this.m_StackEndPause);
- }
- public void ClearBet()
- {
- BjPlayer.Instance.ClearBet();
- this.ResetStacks();
- }
- public void UpdateStacks()
- {
- foreach (ChipStack chipStack in this.ChipStacks)
- {
- chipStack.UpdateChips();
- }
- this.StackEndAction();
- }
- public void HardReset()
- {
- foreach (ChipStack chipStack in this.ChipStacks)
- {
- chipStack.IsWinningStack = false;
- }
- }
- public void ResetStacks()
- {
- foreach (ChipStack chipStack in this.ChipStacks)
- {
- chipStack.ResetChips();
- }
- }
- [SerializeField]
- private float m_StackEndPause = 0.5f;
- [SerializeField]
- [Header("チップの設置間隔(アニメーション開始時)")]
- private float m_ChipSetSpace = 0.5f;
- [SerializeField]
- [Header("チップの設置間隔(通常時)")]
- private Vector3 m_ChipStackSpace = Vector3.zero;
- [SerializeField]
- [Header("チップは最低この高さから落とす")]
- private float m_FallingLength = 2.75f;
- [SerializeField]
- [Header("チップのアニメーション所要時間")]
- private float m_FallingTime = 0.7f;
- [SerializeField]
- [Header("チップのアニメーションラグ時間")]
- private float m_TimeOffset = 0.05f;
- [SerializeField]
- [Header("この枚数毎にスタック")]
- private int m_StackCount = 10;
- [SerializeField]
- private List<ChipManager.Chip> m_ChipDataList = new List<ChipManager.Chip>();
- public Action StackEndCallBack;
- [SerializeField]
- [Header("チップを載せておく場所")]
- private ChipStack[] m_ChipStack = new ChipStack[4];
- [Serializable]
- public class Chip
- {
- public int value;
- public string chipname;
- [HideInInspector]
- public GameObject chip_obj;
- }
- }
|