예제 #1
0
    public void displayCard(GameObject card, string id, int posX, int expansion)
    {
        GameObject c = Instantiate(card, new Vector3(0, 0, 0), Quaternion.identity);

        c.transform.SetParent(gameObject.transform);
        DB_card.setIdentity(c, id, new Vector3(posX, -335 + 160 * expansion, 0), new Vector3(0.3f, 0.3f, 1));
    }
    public void RpcUseSpell(bool value, string id)
    {
        scr_playerController temp_data = gameObject.GetComponent <scr_playerController>();

        if (temp_data.isPlayer)
        {
            if (value == temp_data.isHost && id.Contains("#"))
            {
                scr_playerInGame.hand.Remove(id);
                scr_playerInGame.tomb.Add(id);
                gameObject.GetComponent <scr_playerInGame>().displayHand();
            }
        }
        else
        {
            if (value == temp_data.isHost)
            {
                foreach (GameObject cur in GameObject.FindGameObjectsWithTag("OtherDisp"))
                {
                    if (cur.GetComponent <scr_cardMove>().durability > 30)
                    {
                        cur.GetComponent <scr_cardMove>().durability = 30;
                    }
                }
                GameObject ins = Instantiate(otherDisp, GameObject.Find("Canvas").transform);
                DB_card.setIdentity(ins, id, new Vector3(-800, 400, 0), new Vector3(0.3f, 0.3f, 1));
                ins.GetComponent <scr_cardGUI>().enabled = false;
            }
        }
        GameObject med = GameObject.FindGameObjectWithTag("Meditator");

        med.GetComponent <scr_meditator>().
        createParticle(6, (transform.localPosition.y > 0)? new Vector3(-220f, 97f, -480f) : new Vector3(-220f, -155f, -480f), -1);
    }
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (!inGame)
     {
         ins = Instantiate(card, GameObject.Find("DDeckPanel").transform);
         ins.GetComponent <scr_cardGUI>().enabled = false;
         DB_card.setIdentity(ins, id, new Vector3(810f, -370f, 0), new Vector3(1.2f, 1.2f));
     }
     else
     {
         ins = Instantiate(card, GameObject.Find("Canvas").transform);
         ins.GetComponent <scr_cardGUI>().enabled = false;
         DB_card.setIdentity(ins, id, Vector3.zero, new Vector3(1.2f, 1.2f));
     }
 }
예제 #4
0
    public void drawCard()
    {
        if (deck.Count > 0)
        {
            int        drawIndex = Random.Range(0, deck.Count);
            GameObject ins       = Instantiate(card, GameObject.Find("Canvas").transform);
            DB_card.setIdentity(ins, (string)deck[drawIndex], new Vector3(172, 44, 0), new Vector3(0.3f, 0.3f, 1));
            ins.GetComponent <scr_cardMove>().enabled = true;
            ins.GetComponent <scr_cardGUI>().enabled  = false;
            ins.tag = "Undef";
            deck.RemoveAt(drawIndex);
        }
        else
        {
            gameObject.GetComponent <scr_playerIdentity>().CmdEmptyDeck();
        }

        informHand();
        displayHand();
    }
예제 #5
0
    public void setTable(ArrayList newTable, string code)
    {
        if (newTable != null && newTable.Count != 0)
        {
            selectTable = newTable;
        }
        else
        {
            Debug.Log("Cannot assign null table");
        }
        this.code = code;

        if (selectTable == null || selectTable.Count == 0)
        {
            Debug.Log("No elements Found");
        }
        for (int i = 0; i < selectTable.Count; i++)
        {
            Debug.Log((string)selectTable[i]);
        }
        GameObject grid = GameObject.FindGameObjectWithTag("SelectList");

        //Debug.Log(grid);
        //foreach (Transform childTr in grid.transform)
        //{
        //    Destroy(childTr.gameObject);
        //}
        for (int i = 0; i < selectTable.Count; i++)
        {
            GameObject ins = Instantiate(card, grid.transform);
            Debug.Log(ins);
            Debug.Log(selectTable[i]);
            DB_card.setIdentity(ins, (string)selectTable[i], Vector3.zero, Vector3.one);
            Debug.Log(ins.GetComponent <scr_card>().id);
            Debug.Log(ins.GetComponent <scr_card>().name);
            ins.GetComponent <scr_cardGUI>().enabled = false;
        }
    }
    public void OnPointerClick(PointerEventData eventData)
    {
        if (!inGame)
        {
            if (!flag)
            {
                scr_deckPanel deckData = deckPanel.GetComponent <scr_deckPanel>();

                if (!inDeck && scr_storeDeck.store_deck.Count < 30)
                {
                    int elementCnt      = 0;
                    int elementCntDelta = (int)DB_card.getIdentity(id)[3];
                    int insertIndex     = -1;
                    foreach (string curId in scr_storeDeck.store_deck)
                    {
                        if (curId == id)
                        {
                            elementCnt++;
                            insertIndex = scr_storeDeck.store_deck.IndexOf(id);
                        }
                    }

                    if (elementCnt < 3 - elementCntDelta)
                    {
                        if (insertIndex == -1)
                        {
                            scr_storeDeck.store_deck.Add(id);
                        }
                        else
                        {
                            scr_storeDeck.store_deck.Insert(insertIndex, id);
                        }
                        deckData.refresh();
                        if (ins != null)
                        {
                            Destroy(ins);
                        }
                    }
                }
                else
                {
                    scr_storeDeck.store_deck.Remove(id);
                    deckData.refresh();
                    if (ins != null)
                    {
                        Destroy(ins);
                    }
                }
            }
            else
            {
                int getExIndex = extras.IndexOf(id);

                if (getExIndex == extras.Count - 1)
                {
                    id = (string)extras[0];
                }
                else
                {
                    id = (string)extras[getExIndex + 1];
                }

                transform.GetChild(0).GetComponent <Text>().text = (string)DB_card.getIdentity(id)[4];
                scr_storeDeck.extraID = id;
                if (ins != null)
                {
                    Destroy(ins);
                }
                ins = Instantiate(card, GameObject.Find("DDeckPanel").transform);
                ins.GetComponent <scr_cardGUI>().enabled = false;
                DB_card.setIdentity(ins, id, new Vector3(810f, -370f, 0), new Vector3(1.2f, 1.2f));
            }
        }
        else
        {
            if (!inDeck)
            {
                switch (id)
                {
                case "Necropia":
                    scr_playerInGame.hand.Add("Dead_Necropia");
                    scr_playerInGame.tomb.Remove("Necropia");
                    if (ins != null)
                    {
                        Destroy(ins);
                    }
                    reloadList(false);
                    break;

                case "Keres":
                    scr_playerInGame.hand.Add("Keres");
                    scr_playerInGame.tomb.Remove("Keres");
                    if (ins != null)
                    {
                        Destroy(ins);
                    }
                    reloadList(false);
                    break;

                case "#grave_robber":
                    foreach (string cardId in scr_playerInGame.tomb)
                    {
                        string cardTag  = (string)DB_card.getIdentity(cardId)[6];
                        int    cardCost = (int)DB_card.getIdentity(cardId)[0];
                        if (cardTag.Contains("Dark") && cardCost == 5)
                        {
                            scr_playerInGame.tomb.Remove(cardId);
                            scr_playerInGame.hand.Add(cardId);
                            break;
                        }
                    }
                    scr_playerInGame.tomb.Remove("#grave_robber");
                    if (ins != null)
                    {
                        Destroy(ins);
                    }
                    reloadList(false);
                    break;

                case "#dark_ora":
                    ArrayList table = new ArrayList();
                    foreach (string cardId in scr_playerInGame.tomb)
                    {
                        string cardTag  = (string)DB_card.getIdentity(cardId)[6];
                        int    cardCost = (int)DB_card.getIdentity(cardId)[0];
                        if (cardTag.Contains("Dark") && cardCost <= 4)
                        {
                            table.Add(cardId);
                        }
                    }
                    if (table.Count != 0)
                    {
                        int drawIndex = Random.Range(0, table.Count);
                        scr_playerInGame.deck.Add(table[drawIndex]);
                    }
                    scr_playerInGame.tomb.Remove("#dark_ora");
                    if (ins != null)
                    {
                        Destroy(ins);
                    }
                    reloadList(false);
                    break;

                case "#emergency_deposit":
                    getPlayer().GetComponent <scr_playerIdentity>().CmdGainStatus(
                        getPlayer().GetComponent <scr_playerController>().isHost, 2, 0);
                    scr_playerInGame.tomb.Remove("#emergency_deposit");
                    if (ins != null)
                    {
                        Destroy(ins);
                    }
                    reloadList(false);
                    break;

                case "soulful_icefox":
                    while (true)
                    {
                        if (scr_playerInGame.tomb.Contains("kitten"))
                        {
                            getPlayer().GetComponent <scr_playerIdentity>().CmdGainStatus(
                                getPlayer().GetComponent <scr_playerController>().isHost, 1, 0);

                            scr_playerInGame.tomb.Remove("kitten");
                        }
                        else
                        {
                            break;
                        }
                    }
                    scr_playerInGame.tomb.Remove("soulful_icefox");
                    if (ins != null)
                    {
                        Destroy(ins);
                    }
                    reloadList(false);
                    break;

                default:
                    break;
                }
            }
        }
    }
예제 #7
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     ins = Instantiate(card, GameObject.Find("Canvas").transform);
     ins.GetComponent <scr_cardGUI>().enabled = false;
     DB_card.setIdentity(ins, scr_storeDeck.extraID, Vector3.zero, new Vector3(1.2f, 1.2f));
 }