コード例 #1
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            ColorCard entity = new ColorCard();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();

            txtFormNO.Text             = entity.FormNO.ToString();
            txtFormDate.DateTime       = entity.FormDate;
            txtReqDate.DateTime        = entity.ReqDate;
            drpSaleOPID.EditValue      = entity.SaleOPID.ToString();
            drpVendorID.EditValue      = entity.VendorID.ToString();
            drpShopID.EditValue        = entity.ShopID.ToString();
            txtMakeOPID.Text           = entity.MakeOPID.ToString();
            txtMakeOPName.Text         = entity.MakeOPName.ToString();
            txtMakeDate.DateTime       = entity.MakeDate;
            txtCheckOPID.Text          = entity.CheckOPID.ToString();
            txtCheckDate.DateTime      = entity.CheckDate;
            txtRemark.Text             = entity.Remark.ToString();
            drpSampleType.EditValue    = entity.SampleType;
            chkFirstLightSource.Text   = entity.FirstLightSource;
            chkSencondLightSource.Text = entity.SencondLightSource;
            drpVendorOPID.EditValue    = entity.VendorOPID;
            drpFactoryOPID.EditValue   = entity.FactoryOPID;
            txtHG.Text        = entity.HG;
            txtFactoryID.Text = entity.FactoryID;

            HTDataSubmitFlag = entity.SubmitFlag;
            HTDataDelFlag    = entity.DelFlag;
            if (!findFlag)
            {
            }

            BindGridDts();
        }
コード例 #2
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_Entity"></param>
        /// <param name="p_BE"></param>
        /// <param name="sqlTrans"></param>
        public void RSave(ColorCard p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = "DELETE FROM Dev_ColorCardDts WHERE MainID=" + p_Entity.ID.ToString();
                sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(p_BE));
                sqlTrans.ExecuteNonQuery(sql);                                                                            //删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据
                sql = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM Dev_ColorCardDts WHERE MainID=" + p_Entity.ID.ToString(); ////找到最大的Seq    将获得最大Seq的语句放到循环外更高效(多人操作时会有问题吗?)
                int MSEQ = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString());
                for (int i = 0; i < p_BE.Length; i++)
                {
                    ColorCardDts entitydts = (ColorCardDts)p_BE[i];
                    if (entitydts.ID != 0)//ID不为0说明数据库中已经存在
                    {
                        this.RUpdate(entitydts, sqlTrans);
                    }
                    else
                    {
                        entitydts.Seq    = MSEQ;
                        entitydts.MainID = p_Entity.ID;
                        this.RAdd(entitydts, sqlTrans);

                        MSEQ++;//最大值加1
                    }
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
コード例 #3
0
    public void CmdGetCard()
    {
        ColorCard cc = ColorCardStack.DrawCard();

        if (cc.Equals(default(ColorCard)))
        {
            // Stack is empty --> Reshuffle
            ColorCardStack.ReshuffleStack(SpawnedCards);
            cc = ColorCardStack.DrawCard();
        }

        TargetTakeCard(connectionToClient, cc);

        if (player.GetCurrentDrawCount() > 0)
        {
            player.SetCurrentDrawCount(player.GetCurrentDrawCount() - 1);
        }

        int index = networkManager.GetConnectedClients().IndexOf(connectionToClient);

        Player.playerCardsCount[index] += 1;
        player.SetCardsCount(Player.playerCardsCount);

        // Sync new card count with all clients
        RpcSetPlayerCardsCount(Player.playerCardsCount);
    }
コード例 #4
0
ファイル: ColorCardCtl.cs プロジェクト: zhp-apeng/HTMLTERP
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                ColorCard MasterEntity = (ColorCard)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Dev_ColorCard WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
コード例 #5
0
ファイル: Dealer.cs プロジェクト: chaletweb/Poker-Kata
 public void PopulateCardPack(List <Card> cards, ColorCard colorCard)
 {
     for (var i = 2; i <= 14; i++)
     {
         cards.Add(new Card(i, colorCard));
     }
 }
コード例 #6
0
ファイル: MainMenu.cs プロジェクト: LaserCannon/OneTouchCards
    IEnumerator Start()
    {
        TitlePrt.Stop();
        PressStart.enabled = false;

        Title.position = Title.position + Vector3.up * 5f;

        yield return(new WaitForSeconds(0.1f));

        ColorCard.FadeToPicture(0.5f);

        audio.clip = Music;
        audio.Play();

        StartCoroutine(MoveTitle());

        yield return(new WaitForSeconds(1f));

        audio.PlayOneShot(Voice, 1f);

        yield return(new WaitForSeconds(1.75f));

        TitlePrt.Play();

        yield return(ColorCard.FadeToColor(Color.white, 0f));

        StartCoroutine(BeginFlashing());

        yield return(ColorCard.FadeToPicture(0.5f));
    }
コード例 #7
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private ColorCard EntityGet()
        {
            ColorCard entity = new ColorCard();

            entity.ID = HTDataID;
            entity.SelectByID();

            entity.FormNO             = txtFormNO.Text.Trim();
            entity.FormDate           = txtFormDate.DateTime.Date;
            entity.ReqDate            = txtReqDate.DateTime.Date;
            entity.SaleOPID           = SysConvert.ToString(drpSaleOPID.EditValue);
            entity.VendorID           = SysConvert.ToString(drpVendorID.EditValue);
            entity.ShopID             = SysConvert.ToString(drpShopID.EditValue);
            entity.MakeOPID           = txtMakeOPID.Text.Trim();
            entity.MakeOPName         = txtMakeOPName.Text.Trim();
            entity.MakeDate           = txtMakeDate.DateTime.Date;
            entity.CheckOPID          = txtCheckOPID.Text.Trim();
            entity.CheckDate          = txtCheckDate.DateTime.Date;
            entity.Remark             = txtRemark.Text.Trim();
            entity.SampleType         = SysConvert.ToInt32(drpSampleType.EditValue);
            entity.FirstLightSource   = SysConvert.ToString(chkFirstLightSource.Text);
            entity.SencondLightSource = SysConvert.ToString(chkSencondLightSource.Text);
            entity.VendorOPID         = SysConvert.ToString(drpVendorOPID.EditValue);
            entity.FactoryOPID        = SysConvert.ToString(drpFactoryOPID.EditValue);
            entity.HG = txtHG.Text.Trim();

            entity.FactoryID = txtFactoryID.Text.Trim();

            return(entity);
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: microcropoc/Hanaby-game
        static bool PromtColorPlayer(ColorCard color, Player player, params int[] numbersCards)
        {
            if (numbersCards.Length == 0)
            {
                if (player.CardsPlayer.Any(p => p.Color == color))
                {
                    return(false);
                }
            }

            for (int i = 1; i <= player.CardsPlayer.Count; i++)
            {
                if (player.CardsPlayer[i - 1].Color == color)
                {
                    //проверяет, правильно ли подсказаны карты
                    if (numbersCards.Any(p => p == i))
                    {
                        player.CardsPlayer[i - 1].VisibleColor = true;
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
コード例 #9
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                ColorCard entity = (ColorCard)p_BE;

                string    sql = "SELECT FormNo FROM Dev_ColorCard WHERE FormNo=" + SysString.ToDBString(entity.FormNO);
                DataTable dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("单号已存在,请重新生成");
                }

                ColorCardCtl control = new ColorCardCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Dev_ColorCard, sqlTrans);
                control.AddNew(entity);



                FormNoControlRule fnrule = new FormNoControlRule();
                fnrule.RAddSort("Dev_ColorCard", "FormNo", 0, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
コード例 #10
0
        /// <summary>
        /// 删除
        /// </summary>
        public override void EntityDelete()
        {
            ColorCardRule rule   = new ColorCardRule();
            ColorCard     entity = EntityGet();

            rule.RDelete(entity);
        }
コード例 #11
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private ColorCard EntityGet()
        {
            ColorCard entity = new ColorCard();

            entity.ID = HTDataID;
            return(entity);
        }
コード例 #12
0
    void RpcSetTopColor(ColorCard.Color color)
    {
        ColorCard c = player.GetTopCard();

        c.color = color;
        player.SetTopCard(c);
    }
コード例 #13
0
    public void CmdChangeTopColor(ColorCard.Color color)
    {
        ColorCard c = player.GetTopCard();

        c.color = color;
        player.SetTopCard(c);

        RpcSetTopColor(color);
    }
コード例 #14
0
        /// <summary>
        /// 修改
        /// </summary>
        public override void EntityUpdate()
        {
            ColorCardRule rule   = new ColorCardRule();
            ColorCard     entity = EntityGet();

            ColorCardDts[] entitydts = EntityDtsGet();
            entity.SubmitFlag = this.HTSubmitFlagUpdateGet();
            rule.RUpdate(entity, entitydts);
        }
コード例 #15
0
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            ColorCardRule rule   = new ColorCardRule();
            ColorCard     entity = EntityGet();

            ColorCardDts[] entitydts = EntityDtsGet();

            entity.SubmitFlag = this.HTSubmitFlagInsertGet();
            rule.RAdd(entity, entitydts);
            return(entity.ID);
        }
コード例 #16
0
    public void UpdateCard(ColorCard newCard)
    {
        cardData = newCard;
        // Set new cards color
        Renderer r = cardCube.GetComponent <Renderer>();

        r.material.SetColor("_Color", cardData.color);

        // Set new cards name
        cardName.text = cardData.name.ToString();
    }
コード例 #17
0
ファイル: Player.cs プロジェクト: ifumi/ColorCardGame
    private IEnumerator WaitForColorpickerToFinish(ColorCard playedCard)
    {
        yield return(new WaitUntil(() => colorPicker.GetPickedColor() != ColorCard.Color.NONE)); // Wait till user selects color

        playedCard.color = colorPicker.GetPickedColor();
        colorPicker.Reset();

        connection.CmdChangeTopColor(playedCard.color);
        connection.CmdSetNextTurn();
        MyCards.Remove(playedCard);
        colorPicker.Hide();
    }
コード例 #18
0
    public void CmdPlayCard(ColorCard c)
    {
        Debug.Log("Player " + connectionToClient.connectionId + " played Unocard: " + c.value + ", " + c.color + ", " + c.value);

        // Decrement card count for playing player
        int playerIdx = networkManager.GetConnectedClients().IndexOf(connectionToClient);

        Player.playerCardsCount[playerIdx] -= 1;
        player.SetCardsCount(Player.playerCardsCount);

        // Sync new card count with all clients
        RpcSetPlayerCardsCount(Player.playerCardsCount);

        // Spawn the card on the board
        CmdSpawnCardOnGameboard(c);

        // Check win
        if (Player.playerCardsCount[playerIdx] == 0)
        {
            // Player won
            CmdSetWinner(playerIdx);
            return;
        }


        // Check if we have to do something (set reverse or set drawCount)
        int count = player.GetCurrentDrawCount();

        if (player.GetTopCard().type == ColorCard.Type.WILD4)
        {
            count += 4;
        }
        if (player.GetTopCard().type == ColorCard.Type.DRAW2)
        {
            count += 2;
        }
        if (player.GetTopCard().type == ColorCard.Type.REVERSE)
        {
            player.SetReverse(!player.GetReverse());  // toggle reverse

            if (NetworkServer.connections.Count == 2) // if its only 2 players we have to provide skip functionality
            {
                CmdIncrementPlayerIndex();
            }
        }
        if (player.GetTopCard().type == ColorCard.Type.SKIP) // Increment player by 1 more
        {
            CmdIncrementPlayerIndex();
        }

        player.SetCurrentDrawCount(count); // Save it on the server
    }
コード例 #19
0
    void RpcSetTopCard(GameObject go, ColorCard card, Quaternion angle)
    {
        // Set angle
        go.transform.rotation = angle;

        // Set texture
        CardSpriteLoader ctl = go.GetComponent <CardSpriteLoader>();

        ctl.SetSprite(card.type, card.color, card.value);

        // Save the top card to later check if this play is valid.
        player.SetTopCard(card);
    }
コード例 #20
0
ファイル: MainMenu.cs プロジェクト: LaserCannon/OneTouchCards
    IEnumerator MoveToSong()
    {
        yield return(ColorCard.FadeToBlack(0.5f));

        Vector3 pos = Camera.main.transform.position;

        pos.x = 10;
        Camera.main.transform.position = pos;

        yield return(ColorCard.FadeToPicture(0.5f));

        isSelectingSong = true;
    }
コード例 #21
0
        /// <summary>
        /// 检验字段值是否已存在
        /// </summary>
        /// <param name="p_TableName">表名</param>
        /// <param name="p_FieldName">字段名</param>
        /// <param name="p_FieldValue">字段值</param>
        /// <param name="p_KeyField">主键(只考虑主键为ID的情况)</param>
        /// <param name="p_KeyValue">主键值</param>
        /// <param name="p_sqlTrans"></param>
        /// <returns></returns>
        private bool CheckFieldValueIsExist(BaseEntity p_BE, string p_FieldName, string p_FieldValue, IDBTransAccess p_sqlTrans)
        {
            ColorCard entity = (ColorCard)p_BE;
            bool      ret    = false;
            string    sql    = string.Format(" SELECT {0} FROM {1} WHERE 1=1 AND {0}={2} AND {3}<>{4}", p_FieldName, ColorCard.TableName, SysString.ToDBString(p_FieldValue), "ID", entity.ID);
            DataTable dt     = p_sqlTrans.Fill(sql);

            if (dt.Rows.Count != 0)
            {
                ret = true;
            }

            return(ret);
        }
コード例 #22
0
ファイル: CardWheel.cs プロジェクト: ifumi/ColorCardGame
    /// <summary>
    /// Adds the given card to the card wheel.
    /// </summary>
    /// <param name="card">Card.</param>
    public void AddCard(ColorCard card)
    {
        GameObject newCard = Instantiate(cardPrefab, GetCardPosition(cardUIObjects.Count), Quaternion.Euler(0, 0, -cardUIObjects.Count * CARD_ANGLE_INCREMENT));

        newCard.transform.parent = gameObject.transform;
        CardSpriteLoader ctl = newCard.GetComponent <CardSpriteLoader>();

        ctl.SetSprite(card.type, card.color, card.value);

        cardUIObjects.Add(newCard);
        addedCards.Add(card);
        cardCount++;

        RealingnCards();
    }
コード例 #23
0
ファイル: Player.cs プロジェクト: ifumi/ColorCardGame
 public void PlayCard(ColorCard card)
 {
     connection.CmdPlayCard(card); // send the card to the server
     if (card.type == ColorCard.Type.WILD || card.type == ColorCard.Type.WILD4)
     {
         // we first have to set the color by the user
         colorPicker.Show();                               // show the color picker
         StartCoroutine(WaitForColorpickerToFinish(card)); // Wait for the colorpicker to finish before giving turn
     }
     else
     {
         connection.CmdSetNextTurn();
     }
     MyCards.Remove(card);
 }
コード例 #24
0
 private void OnMouseDown()
 {
     if (deck.CardsLeft > 0)
     {
         ColorCard  newCard = deck.Draw();
         GameObject p       = Instantiate(prefab, new Vector3(-9 + 3 * (5 - deck.CardsLeft), 0, 0), Quaternion.identity);
         p.GetComponent <GameObjectCard>().UpdateCard(newCard);
         p.transform.SetParent(board);
         // UpdateCard(newCard);
         Debug.Log(deck.CardsLeft.ToString() + " cards left in the deck!");
         if (deck.CardsLeft == 0)
         {
             gameObject.SetActive(false);
         }
     }
 }
コード例 #25
0
    IEnumerator Start()
    {
        ColorCard.FadeToBlack(0f);
        yield return(null);

        ColorCard.FadeToPicture(1f);
        yield return(new WaitForSeconds(2f));

        State = GameState.Start;

        StartCoroutine(DoIntroAndBegin());

        P1.onCardSelected += OnCardSelected;
        P2.onCardSelected += OnCardSelected;

        BattleMgr.onBattleOver += OnBattleEnded;
    }
コード例 #26
0
ファイル: CardWheel.cs プロジェクト: ifumi/ColorCardGame
    public void RemoveCard(ColorCard card)
    {
        int index = addedCards.IndexOf(card);
        // Remove gameobject from wheel
        GameObject go = cardUIObjects[index];

        if (go != null)
        {
            Destroy(go); // Maybe do some cool animated stuff here.
        }

        // Remove from our lists
        cardUIObjects.RemoveAt(index);
        addedCards.RemoveAt(index);
        cardCount--;

        RealingnCards();
    }
コード例 #27
0
    void CmdSpawnCardOnGameboard(ColorCard card)
    {
        // Add random angle here
        Quaternion newAngle = Quaternion.Euler(0, 0, UnityEngine.Random.Range(-10.0f, 10.0f));

        currentCard.transform.rotation = newAngle;
        // Set texture
        CardSpriteLoader ctl = currentCard.GetComponent <CardSpriteLoader>();

        ctl.SetSprite(card.type, card.color, card.value);

        //NetworkServer.Spawn(currentCard); // Spawn on network
        SpawnedCards.Push(card); // Store on server stack
        player.SetTopCard(card);

        // Propagate new card with texture and angle change also to all clients
        RpcSetTopCard(currentCard, card, newAngle);
    }
コード例 #28
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         ColorCard    entity  = (ColorCard)p_BE;
         ColorCardCtl control = new ColorCardCtl(sqlTrans);
         control.Update(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
コード例 #29
0
ファイル: MainMenu.cs プロジェクト: LaserCannon/OneTouchCards
    IEnumerator BeginFlashing()
    {
        float t = 0f;

        while (!Input.GetMouseButtonDown(0))
        {
            if (Mathf.FloorToInt(t) % 2 == 0)
            {
                PressStart.enabled = true;
            }
            else
            {
                PressStart.enabled = false;
            }

            t += Time.deltaTime * 4f;

            yield return(null);
        }

        yield return(ColorCard.FadeToBlack(0.5f));

        Vector3 pos = Camera.main.transform.position;

        pos.x = 0f;
        Camera.main.transform.position = pos;
        yield return(null);

        yield return(ColorCard.FadeToPicture(0.5f));

        SelectionMenu1.CreatePool();

        yield return(new WaitForSeconds(0.25f));

        SelectionMenu2.CreatePool();

        poolCreated = true;
    }
コード例 #30
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_BE">要删除的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                ColorCard    entity  = (ColorCard)p_BE;
                ColorCardCtl control = new ColorCardCtl(sqlTrans);


                string sql = "DELETE FROM Dev_ColorCardDts WHERE MainID=" + entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据

                control.Delete(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
コード例 #31
0
ファイル: Khanab.cs プロジェクト: Cherten0K/-Kontur.Intership
 public void TellColor(ColorCard color, IEnumerable<int> numberCards)
 {
     throw new NotImplementedException();
 }