Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        gameboard_impl = new GameboardImpl();
        gameboard_impl.SetNotificator(this);

        instance = this;

        int X_SIZE = gameboard_impl.cells.GetLength(0);
        int Y_SIZE = gameboard_impl.cells.GetLength(1);

        //ToDo move it to CellData
        float offset_x = ((Y_SIZE - 1) * CellData.cell_width + ((X_SIZE - 1) % 2) * CellData.cell_width / 2) / 2;
        float offset_y = ((X_SIZE - 1) * CellData.cell_radius * 1.5f) / 2;

        foreach (GameboardCell cell in gameboard_impl.cells)
        {
            if (cell.active)
            {
                float x = cell.board_y * CellData.cell_width + (cell.board_x % 2) * CellData.cell_width / 2 - offset_x;
                float y = cell.board_x * CellData.cell_radius * 1.5f - offset_y;

                Vector3    offset  = new Vector3(x, 0.02f, y);
                GameObject cll_obj = Instantiate(cell_obj) as GameObject;

                CellData cell_data = cll_obj.GetComponent <CellData>();
                cll_obj.transform.position = offset;
                cell_data.cell             = cell;
                cell.notificator           = cell_data;

                cells_list.Add(cell_data);
            }
        }

        for (gameboard_impl.cur_command_idx = 0; gameboard_impl.cur_command_idx < GameboardImpl.players_qty; ++gameboard_impl.cur_command_idx)
        {
            gameboard_impl.commands[gameboard_impl.cur_command_idx] = new CommandInfo();
        }

        for (gameboard_impl.cur_command_idx = 0; gameboard_impl.cur_command_idx < GameboardImpl.players_qty; ++gameboard_impl.cur_command_idx)
        {
            Figure        boss      = DataBase.Bosses[0];
            GameboardCell cur_cell  = gameboard_impl.cells[gameboard_impl.cells.GetLength(0) / 2, (gameboard_impl.cur_command_idx == 0) ? 0 : (gameboard_impl.cells.GetLength(1) - 2)];
            var           boss_card = new CardImpl(boss);
            gameboard_impl.commands[gameboard_impl.cur_command_idx].hand.Add(boss_card);
            OnCardSelected(boss_card);
            HitCell(new ClickInfo(FindCell(cur_cell)));
        }

        ChangeCommand();

        var command = gameboard_impl.commands [gameboard_impl.cur_command_idx];

        foreach (UnitImpl unit in command.staff)
        {
            unit.made_move = true;//ToDo this is hack!
        }

        //gameboard_impl.GetCards () [0].GetMoves () [3].MakeMove (gameboard_impl);
    }
Ejemplo n.º 2
0
    void Start()
    {
        this.gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>();
        this.cardImpl    = new LightningBolt();
        this.image       = this.GetComponent <Image>();
        var sprite = Resources.Load <Sprite>(this.cardImpl.ImagePath());

        this.image.sprite = sprite;
    }
        public object updatecard(CardDetails card)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Icard        icard = new CardImpl();
            CardResponse rs    = icard.updatecard(card);

            return(rs);
        }
        public object Getcards(long uid)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Icard getcards = new CardImpl();
            List <TB_ECOMM_CARD_DETAILS> ud = getcards.getcards(uid);

            return(ud);
        }
        public object Getcarddefault(long uid)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Icard        getcard = new CardImpl();
            List <Cards> ud      = getcard.getcarddefault(uid);

            return(ud);
        }
        public object Getcard(long cid)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Icard  getcard = new CardImpl();
            object ud      = getcard.getcard(cid);

            return(ud);
        }
        public object addpaymentdetail(CardDetails card)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Icard        addcard = new CardImpl();
            CardResponse rs      = addcard.addpaymentdetail(card);

            return(rs);
        }
        public object deletecard(long CID)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Icard  iitem = new CardImpl();
            object rs    = iitem.deletecard(CID);

            return(rs);
        }
Ejemplo n.º 9
0
    public void SetToolTip(CardImpl card)
    {
        GameObject canvas = GameObject.Find("Canvas");

        tool_tip = Instantiate(canvas.GetComponent <UIScript>().card_obj) as GameObject;

        tool_tip.GetComponent <RectTransform> ().localScale = new Vector3(3, 3, 3);
        tool_tip.transform.SetParent(canvas.transform);
        tool_tip.SetActive(false);
        tool_tip.GetComponent <CardData> ().SetFigure(card);
        System.Array.ForEach(tool_tip.GetComponentsInChildren <Button>(), x => x.interactable = true);
    }
Ejemplo n.º 10
0
 public void OnCardSelected(CardImpl card)
 {
     if (IsDudeSelected() || IsAICalculating())
     {
         ClearAvailableCells();
     }
     else
     {
         List <Move> moves = card.GetMoves(gameboard_impl);
         if (moves.Count > 0)
         {
             NewMovesAvailable(moves);
         }
     }
 }
Ejemplo n.º 11
0
 public void CastCard(CardImpl impl)
 {
     impl.Cast(this);
 }
Ejemplo n.º 12
0
    //ToDo disable during animation
    public void SetFigure(CardImpl card)
    {
        this.card = card;
        GetComponentInChildren <Text>().text = card.name;

        Text[] prop_vals = GetComponentsInChildren <Text>();
        foreach (Text prop_val in prop_vals)
        {
            if (prop_val.gameObject.transform.parent.name == "Speed")
            {
                prop_val.text = card.speed >= 0 ? card.speed.ToString() : "";
            }
            if (prop_val.gameObject.transform.parent.name == "Health")
            {
                prop_val.text = card.defaultHP >= 0 ? card.defaultHP.ToString() : "";
            }
            if (prop_val.gameObject.transform.parent.name == "Strength")
            {
                prop_val.text = card.strength >= 0 ? card.strength.ToString() : "";
            }
            if (prop_val.gameObject.transform.parent.name == "Cost")
            {
                prop_val.text = card.cost >= 0 ? card.cost.ToString() : "";
            }
        }

        foreach (var image in GetComponentsInChildren <Image>())
        {
            if (card.isRangedAttack && image.sprite.name == "sword")
            {
                image.sprite = bow_texture;
            }

            if (card.defaultHP == -1 && image.sprite.name == "heart")
            {
                image.gameObject.SetActive(false);
            }

            if (card.speed == -1 && image.sprite.name == "steps")
            {
                image.gameObject.SetActive(false);
            }

            if (card.strength == -1 && image.sprite.name == "sword")
            {
                image.gameObject.SetActive(false);
            }

            if (card.cost == -1 && image.sprite.name == "diamond")
            {
                image.gameObject.SetActive(false);
            }

            if (card.imageName != "" && image.sprite.name == "Dude")
            {
                image.sprite = Resources.Load <Sprite>("Images/" + card.imageName);
            }
        }

        if (card.isHaste || card.isVampire || card.armor > 0 || card.healing > 0 || card.isGiant)
        {
            foreach (var image in GetComponentsInChildren <Image>())
            {
                if (image.name == "Ability")
                {
                    var text = System.Array.Find(GetComponentsInChildren <Text>(), x => x.name == "Ability_val");
                    image.enabled = true;
                    if (card.armor > 0)                     //ToDo if armor AND haste AND vampire ???
                    {
                        image.sprite = shield_texture;

                        text.enabled = true;
                        text.text    = card.armor.ToString();
                    }
                    else if (card.isVampire)
                    {
                        image.sprite = teeth_texture;
                    }
                    else if (card.isGiant)
                    {
                        image.sprite = giant_texture;
                    }
                    else if (card.healing > 0)
                    {
                        image.sprite = cross_texture;

                        text.enabled = true;
                        text.text    = card.healing.ToString();
                    }
                }
            }
        }
    }