Exemple #1
0
 void Update()
 {
     TempCardControl();
     ControlCardPosition(SingleInfo.ThisRowCards);
     if (IsMyHandRegion)
     {
         RowCommand.RefreshHandCard(SingleInfo.ThisRowCards);
     }
 }
Exemple #2
0
 public void TempCardControl()
 {
     if (AgainstInfo.isMyTurn)
     {
         if (SingleInfo.TempCard == null && SingleInfo.CanBeSelected && AgainstInfo.PlayerFocusRegion == SingleInfo && !HasTempCard)
         {
             HasTempCard = true;
             _           = RowCommand.CreatTempCard(SingleInfo);
         }
         if (SingleInfo.TempCard != null && SingleInfo.Location != SingleInfo.ThisRowCards.IndexOf(SingleInfo.TempCard))
         {
             RowCommand.ChangeTempCard(SingleInfo);
         }
         if (SingleInfo.TempCard != null && !(SingleInfo.CanBeSelected && AgainstInfo.PlayerFocusRegion == SingleInfo))
         {
             RowCommand.DestoryTempCard(SingleInfo);
             HasTempCard = false;
         }
     }
 }
        public static bool IsTrue(this RowCommand rowCmd, List <KeyValuePair <string, object> > data, List <Schema.Domain.Attribute> attributes)
        {
            var rowFlag = false;
            var cndFlag = false;

            if (rowCmd.Conditions.NotEmpty())
            {
                foreach (var cmdCond in rowCmd.Conditions)
                {
                    if (data.Exists(n => n.Key.IsCaseInsensitiveEqual(cmdCond.AttributeName)))
                    {
                        var a    = data.Find(n => n.Key.IsCaseInsensitiveEqual(cmdCond.AttributeName));
                        var attr = attributes.Find(n => n.Name.IsCaseInsensitiveEqual(cmdCond.AttributeName));

                        //符合条件时
                        if (cmdCond.IsTrue(attr, a.Value))
                        {
                            //或者关系
                            if (rowCmd.LogicalOperator == LogicalOperator.Or)
                            {
                                cndFlag = true;
                                rowFlag = true;
                                break;
                            }
                            else//并且
                            {
                                cndFlag = true;
                                if (rowCmd.Conditions.Count() == 1)
                                {
                                    rowFlag = true;
                                    break;
                                }
                            }
                        }
                        else//不符合条件时
                        {
                            //或者关系
                            if (rowCmd.LogicalOperator == LogicalOperator.Or)
                            {
                                cndFlag = false;
                            }
                            else//并且
                            {
                                cndFlag = false;
                                rowFlag = false;
                                break;
                            }
                        }
                    }
                    if (rowFlag)
                    {
                        break;
                    }
                    else
                    {
                        rowFlag = cndFlag;
                    }
                }
            }
            return(rowFlag);
        }