Exemplo n.º 1
0
 public virtual void Init()
 {
     // UI
     this.m_RectTransform       = this.transform as RectTransform;
     this.m_RectTransform.pivot = new Vector2(0.5f, 1f);
     // GROUP
     this.m_Group               = GameObject.FindObjectOfType <CGroupCard>();
     this.m_Board               = GameObject.FindObjectOfType <CBoard>();
     this.m_LayoutGroup         = this.GetComponent <VerticalLayoutGroup>();
     this.m_LayoutGroup.enabled = false;
     // CARDS
     this.m_Cards = new List <CCard>();
 }
Exemplo n.º 2
0
 public virtual void Init()
 {
     // UI
     this.m_RectTransform = this.transform as RectTransform;
     // GROUP
     this.m_Group        = GameObject.FindObjectOfType <CGroupCard>();
     this.m_GroupColumns = this.transform.Find("GroupColumns").GetComponent <RectTransform>();
     // COLUMN
     this.m_Columns = this.transform.GetComponentsInChildren <CColumn>();
     for (int i = 0; i < this.m_Columns.Length; i++)
     {
         this.m_Columns[i].Init();
     }
     // CARD
     this.m_CardPrefab = Resources.Load <CCard>("Cards/Card");
     // POINTS
     this.m_ReturnBox                = this.transform.Find("ReturnCardPoint").GetComponent <CReturnBox>();
     this.m_SpawnCardPoint           = this.transform.Find("SpawnCardPoint").GetComponent <RectTransform>();
     this.m_DrawCardsToColumnsButton = this.transform.Find("DrawCardsToColumnsButton").GetComponent <Button>();
     this.m_DrawCardsToColumnsButton.onClick.AddListener(this.OnNextDraw);
     this.m_ResetButton = this.transform.Find("ResetButton").GetComponent <Button>();
     this.m_ResetButton.onClick.AddListener(this.OnResetMatch);
     this.m_HintButton = this.transform.Find("HintButton").GetComponent <Button>();
     this.m_HintButton.onClick.AddListener(this.OnActiveHint);
     // DRAW CARDS
     this.m_OnBoardCards = new List <CCard>();
     for (int i = 0; i < this.m_DataCards.Length; i++)
     {
         var value = this.m_DataCards[i];
         var card  = Instantiate(this.m_CardPrefab);
         card.Init();
         card.Setup(value);
         card.SetParentInCenter(this.m_SpawnCardPoint);
         this.m_OnBoardCards.Add(card);
     }
     this.m_ReturnBox.Init();
     this.m_OnHintCards = new List <object>();
     // BLOCK
     CBoard.BOARD_LOCK = true;
     // ORIENTATION
     // this.CalculateBaseOrientation(Input.deviceOrientation);
     // var orientationManager = GameObject.FindObjectOfType<CUIOrientation>();
     // orientationManager.OnOrientationChange.AddListener (this.CalculateBaseOrientation);
     // SHUFFLE
     this.ShuffleCards();
     // On START DRAW
     Invoke("OnStartDraw", 1f);
 }
Exemplo n.º 3
0
 public virtual void Init()
 {
     // UI
     this.m_RectTransform           = this.transform as RectTransform;
     this.m_RectTransform.anchorMin = new Vector2(0.5f, 0.5f);
     this.m_RectTransform.anchorMax = new Vector2(0.5f, 0.5f);
     this.m_DragObject = this.GetComponent <RectTransform>();
     this.m_BGImage    = this.GetComponent <Image>();
     this.originalPanelLocalPosition = dragObject.localPosition;
     // GROUP
     this.m_Group = GameObject.FindObjectOfType <CGroupCard>();
     // DROP
     this.m_IsDropped = false;
     // ANIM
     this.m_MoveAnimated = this.GetComponent <TAnimated>();
     this.m_IsMoving     = false;
     // SET SIZE
     this.m_RectTransform.sizeDelta = CARD_SIZE;
 }