Ejemplo n.º 1
0
        public async Task <IActionResult> GetBoardsAsync()
        {
            User user = await _userManager.GetUserAsync(HttpContext.User).ConfigureAwait(false);

            IEnumerable <int> memberOfBoards = _context.MemberOf.Where(m => m.MemberID == user.Id).Select(m => m.BoardId).ToList();

            IEnumerable <Board> boardas = _context.Boards.Where(b => b.Owner == user || memberOfBoards.Contains(b.Id)).ToList();

            ICollection <BoardInfo> boards = new List <BoardInfo>();

            foreach (Board b in boardas)
            {
                BoardInfo boardInfo = new BoardInfo
                {
                    Name  = b.BoardName,
                    Id    = b.Id.ToString(),
                    Lanes = new List <ColumnInfo>(),
                };

                int totalCount = 0;

                b.Columns = _context.Columns.Where(col => col.BoardId == b.Id).ToList();

                foreach (Column c in b.Columns)
                {
                    ColumnInfo column = new ColumnInfo
                    {
                        Id    = c.ID.ToString(),
                        Title = c.Category,
                        Cards = new List <CardsInfo>(),
                    };

                    c.Cards = _context.Cards.Where(card => card.ColumnId == c.ID).ToList();

                    foreach (Card ca in c.Cards)
                    {
                        CardsInfo info = new CardsInfo
                        {
                            Description = ca.Description,
                            Id          = ca.ID.ToString(),
                            Title       = ca.Title,
                        };

                        column.Cards.Add(info);
                        totalCount++;
                    }

                    boardInfo.Lanes.Add(column);
                }

                foreach (ColumnInfo c in boardInfo.Lanes)
                {
                    c.Label = string.Format("{0}/{1}", c.Cards.Count, totalCount);
                }

                boards.Add(boardInfo);
            }

            return(Ok(boards));
        }
Ejemplo n.º 2
0
    public void CreateXMLmap(CardsInfo info)
    {
        card = new CardBase[MapSizeX + 1][];
        for (int x = 0; x <= MapSizeX; x++)
        {
            card[x] = new CardBase[MapSizeY + 1];
            for (int y = 0; y <= MapSizeY; y++)
            {
                float   X = x * HexW;
                float   Y = y * HexH;
                Vector3 v = new Vector3(X, 0, Y);
                card[x][y] = ((GameObject)Instantiate(GO_hex)).GetComponent <CardBase>();

                card[x][y].transform.position = v;

                Vector3 r = new Vector3(90, 0, 0);
                card[x][y].transform.rotation = Quaternion.Euler(r);
                card[x][y].Buttonnum          = x;
                card[x][y].InGame             = false;
                card[x][y].X = x;
                card[x][y].Y = y;
            }
        }
        MapSizeX = info.MapSizeX;
        MapSizeY = info.MapSizeY;
        cardUse  = new CardUseBase[info.MapSizeX + 1][];
        for (int x = 0; x <= info.MapSizeX; x++)
        {
            cardUse[x] = new CardUseBase[info.MapSizeY + 1];
        }

        for (int i = 0; i < info.cardInfos.Count; ++i)
        {
            int x  = info.cardInfos[i].X;
            int y  = info.cardInfos[i].Y;
            int id = info.cardInfos[i].card_id;

            if (id <= 3)
            {
                cardUse[x][y] = (MagicCard)GameObject.Instantiate(Cards[id]).GetComponent <MagicCard>();
            }
            else
            {
                cardUse[x][y] = (SummonCard)GameObject.Instantiate(Cards[id]).GetComponent <SummonCard>();
            }
            cardUse[x][y].card_id = id;
            float   X = x * HexW;
            float   Y = y * HexH;
            Vector3 v = new Vector3(X, 0.3f, Y);
            cardUse[x][y].transform.position = v;

            Vector3 r = new Vector3(90, 0, 0);
            cardUse[x][y].transform.rotation = Quaternion.Euler(r);
            cardUse[x][y].Buttonnum          = x;
            cardUse[x][y].InGame             = false;
            cardUse[x][y].X = x;
            cardUse[x][y].Y = y;
            card[x][y].SetCost(cardUse[x][y].cost);
        }
    }
Ejemplo n.º 3
0
        /// <summary>
        /// 使用品牌名称查询商品信息
        /// </summary>
        /// <param name="Cards_name">品牌名称</param>
        /// <returns>品牌表集合</returns>
        public List <CardsInfo> GetCardsByCards_name(string Cards_name)
        {
            List <CardsInfo> lc  = new List <CardsInfo>();
            SqlConnection    con = new SqlConnection(conStr);

            try
            {
                con.Open();
                string        sql = string.Format("select * from Cards where Cardsname like '%{0}%'", Cards_name);
                SqlCommand    com = new SqlCommand(sql, con);
                SqlDataReader dr  = com.ExecuteReader();
                while (dr.Read())
                {
                    CardsInfo u = new CardsInfo();
                    u.CardsId   = Convert.ToInt32(dr["Cardsid"]);
                    u.CardsName = dr["Cardsname"].ToString();
                    lc.Add(u);
                }
                dr.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("系统出现异常,请您稍后再试!");
            }
            finally
            {
                con.Close();
            }
            return(lc);
        }
Ejemplo n.º 4
0
    public CardsInfo LoadCardData(string path)
    {
        CardsInfo info = new CardsInfo();


        // xmlFile.Load(MapPath);
        string      strFile     = path;
        string      strPath     = string.Empty;
        string      strFilePath = Application.persistentDataPath + "/" + strFile;
        XmlDocument xmlFile     = new XmlDocument();

        if (Application.platform == RuntimePlatform.Android)
        {
            TextAsset textAsset = Resources.Load("XML/" + strFile) as TextAsset;
            xmlFile.LoadXml(textAsset.text);
        }
        else
        {
            string Path = Application.streamingAssetsPath + "/" + strFile + ".xml";
            xmlFile.Load(Path);
            //xmlFile.Load(MapPath);
        }


        XmlNode mapSize = xmlFile.SelectSingleNode("MapInfo/MapSize");

        string mapSizeString = mapSize.InnerText;

        string[] sizes = mapSizeString.Split(' ');
        Debug.Log(info.MapSizeX = int.Parse(sizes[0]));
        int mapSizeX = info.MapSizeX = int.Parse(sizes[0]);
        int mapSizeY = info.MapSizeY = int.Parse(sizes[1]);

        XmlNodeList hexes = xmlFile.SelectNodes("MapInfo/card");

        foreach (XmlNode hex in hexes)
        {
            string   mapposStr = hex["CardPos"].InnerText;
            string[] maposes   = mapposStr.Split(' ');
            int      mapX      = int.Parse(maposes[0]);
            int      mapY      = int.Parse(maposes[1]);
            int      id        = int.Parse(maposes[2]);


            CardUseBase card = new CardUseBase();
            card.X       = mapX;
            card.Y       = mapY;
            card.card_id = id;
            info.cardInfos.Add(card);
        }
        return(info);
    }
Ejemplo n.º 5
0
    public override void ReceiveStartInfo(CardsInfo info)
    {
        base.ReceiveStartInfo(info);
        print("eu sou uma spell");
        // base.initialInfo = info;

        // base.cardId = info.cardId;
        // base.Life = info.life;
        // base.Gold = info.gold;
        // base.Power = info.power;
        // base.design.sprite = info.design;

        // base.nameText.text = JsonReader.TranslateTo(UserPrefs.lenguage).cards[cardId].name;
        // base.descText.text = JsonReader.TranslateTo(UserPrefs.lenguage).cards[cardId].description;
    }
Ejemplo n.º 6
0
        /// <summary>
        /// 使用商品名称查询库存信息
        /// </summary>
        /// <param name="Prot_Name">商品名称</param>
        /// <returns></returns>
        public List <StoreRoom> GetStoreRoomByProt_Name(string Prot_Name)
        {
            List <StoreRoom> ls  = new List <StoreRoom>();
            SqlConnection    con = new SqlConnection(conStr);

            try
            {
                con.Open();
                string        sql = string.Format("select productInfo.*,Cards.Cardsname,providers.Privname,storeRoom.storelastNum,storeRoom.storesum,storeRoom.storeid  from productInfo,Cards,providers,storeRoom where productInfo.ProtCard=Cards.Cardsid and productInfo.ProtproviderId=providers.Privid and productInfo.Protid=storeRoom.Protid and productInfo.Protname like '%{0}%'", Prot_Name);
                SqlCommand    com = new SqlCommand(sql, con);
                SqlDataReader dr  = com.ExecuteReader();
                while (dr.Read())
                {
                    StoreRoom sr = new StoreRoom();
                    sr.Prot_id          = Convert.ToInt32(dr["Protid"]);
                    sr.Prot_name        = dr["Protname"].ToString();
                    sr.Prot_retailprice = Convert.ToSingle(dr["Protretailprice"]);
                    sr.Prot_tradeprice  = Convert.ToSingle(dr["Prottradeprice"]);
                    sr.Prot_Bigunit     = dr["ProtBigunit"].ToString();
                    sr.Prot_smallunit   = dr["Protsmallunit"].ToString();
                    sr.Prot_rate        = Convert.ToInt32(dr["ProtRate"]);
                    CardsInfo cardsInfo = new CardsInfo();
                    cardsInfo.CardsId = Convert.ToInt32(dr["ProtCard"]);
                    Providers providers = new Providers();
                    providers.Priv_id = Convert.ToInt32(dr["ProtproviderId"]);
                    sr.Prot_date      = Convert.ToDateTime(dr["Protdate"]);
                    sr.Cards_name     = dr["Cardsname"].ToString();
                    sr.Priv_name      = dr["Privname"].ToString();
                    sr.Store_id       = Convert.ToInt32(dr["storeid"]);
                    sr.Store_sum      = Convert.ToInt32(dr["storesum"]);
                    sr.Store_lastNum  = Convert.ToInt32(dr["storelastNum"]);
                    ls.Add(sr);
                }
                dr.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("系统出现异常,请您稍后再试!");
            }
            finally
            {
                con.Close();
            }
            return(ls);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 使用商品名称查询商品信息
        /// </summary>
        /// <param name="Prot_name">商品名称</param>
        /// <returns>商品类集合</returns>
        public List <ProductInfo> GetProductInfoByProt_Name(string Prot_name)
        {
            List <ProductInfo> lp  = new List <ProductInfo>();
            SqlConnection      con = new SqlConnection(conStr);//数据库连接对象

            try
            {
                con.Open();
                string        sql = string.Format("select productInfo.*,Cards.*,providers.* from productInfo,Cards,providers where productInfo.Protcard=Cards.Cardsid and productInfo.ProtproviderId=providers.Privid and ProtName like '%{0}%'", Prot_name);
                SqlCommand    com = new SqlCommand(sql, con);
                SqlDataReader dr  = com.ExecuteReader();
                while (dr.Read())
                {
                    ProductInfo p = new ProductInfo();
                    p.Prot_id          = Convert.ToInt32(dr["Protid"]);
                    p.Prot_name        = dr["Protname"].ToString();
                    p.Prot_retailprice = Convert.ToSingle(dr["Protretailprice"]);
                    p.Prot_tradeprice  = Convert.ToSingle(dr["Prottradeprice"]);
                    p.Prot_Bigunit     = dr["ProtBigunit"].ToString();
                    p.Prot_smallunit   = dr["Protsmallunit"].ToString();
                    p.Prot_rate        = Convert.ToInt32(dr["Protrate"]);
                    p.ProvName         = dr["PrivName"].ToString();
                    p.CardsName        = dr["CardsName"].ToString();
                    p.Prot_providerId  = Convert.ToInt32(dr["PrivId"]);
                    p.ProvName         = dr["PrivName"].ToString();
                    p.Prot_date        = Convert.ToDateTime(dr["Protdate"]);
                    CardsInfo loadCards = new CardsInfo();
                    loadCards.CardsId   = Convert.ToInt32(dr["CardsId"]);
                    loadCards.CardsName = dr["CardsName"].ToString();
                    lp.Add(p);
                }
                dr.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("系统出现异常,请您稍后再试!");
            }
            finally
            {
                con.Close();
            }
            con.Close();
            return(lp);
        }
    public IEnumerator GetDatesCards()
    {
        UnityWebRequest req = UnityWebRequest.Get(SoundUi.Instance.urlCards);

        req.SetRequestHeader("Authorization", "Token " + SoundUi.Instance.TokenAPI);

        yield return(req.SendWebRequest());

        if (req.result == UnityWebRequest.Result.ConnectionError || req.result == UnityWebRequest.Result.ProtocolError)
        {
            Debug.Log(req.error);
        }
        else
        {
            Debug.Log(req.downloadHandler.text);
            myObject = JsonUtility.FromJson <CardsInfo>("{\"cardAPIList\":" + req.downloadHandler.text + "}");

            for (int i = 0; i < myObject.cardAPIList.Length; i++)
            {
                ids[i]   = myObject.cardAPIList[i].id;
                names[i] = myObject.cardAPIList[i].name;
            }

            for (int j = 0; j < myObject.cardAPIList.Length; j++)
            {
                GameObject fatherCard = ScrollCards.gameObject.transform.GetChild(pos[j]).gameObject;
                fatherCard.SetActive(true);
                GameObject newCard = Instantiate(prefabCard, fatherCard.transform);
                newCard.gameObject.transform.SetParent(fatherCard.transform);

                cards[j] = newCard;
                cards[j].GetComponent <CardNew>().idCard = j;
                cards[j].GetComponent <CardNew>().AssignCard(j);
            }

            shuffle();
        }
    }
Ejemplo n.º 9
0
        /// <summary>
        /// 使用品牌名称查询商品信息
        /// </summary>
        /// <param name="Cards_name">品牌名称</param>
        /// <returns>品牌表集合</returns>
        public static List <CardsInfo> GetCardsByCards_name(string Cards_name)
        {
            List <CardsInfo> lc  = new List <CardsInfo>();
            SqlConnection    con = new SqlConnection(conStr);

            con.Open();
            string     sql = "select * from Cards where Cardsname like '%'+@Cardsname+'%'";
            SqlCommand com = new SqlCommand(sql, con);

            com.Parameters.Add("@Cardsname", SqlDbType.VarChar, 50).Value = Cards_name;
            SqlDataReader dr = com.ExecuteReader();

            while (dr.Read())
            {
                CardsInfo cardsInfo = new CardsInfo();
                cardsInfo.CardsId   = Convert.ToInt32(dr["Cardsid"]);
                cardsInfo.CardsName = dr["Cardsname"].ToString();
                lc.Add(cardsInfo);
            }
            dr.Close();
            con.Close();
            return(lc);
        }
Ejemplo n.º 10
0
    void CreateCard(uint index = 0) // if index == 0, the card will not have information (Enemy card)
    {
        if (handActualCount < MaxCardInHand)
        {
            CardsInfo cardInfo = Resources.Load <CardsInfo>("Cards/Attributes/" + index.ToString());
            Card      newCard  = InstantiateCardByType(cardInfo.typeCard);

            newCard.ReceiveStartInfo(cardInfo);

            handActualCount++;

            if (index == 0)
            {
                newCard.GetComponent <Image>().sprite = cardInfo.design;
                newCard.transform.GetChild(0).gameObject.SetActive(false);
                newCard.transform.GetChild(1).gameObject.SetActive(false);
            }

            newCard.startPosition = startPosInitialCard;
            newCard.finalPosition = finalPosInitialCard;

            StartCoroutine(ShowInitializedCard(newCard));
        }
    }