Esempio n. 1
0
            public List <String> GetTable(EntityDef r)
            {
                var FieldsAndKeys = new List <List <String> >();

                foreach (var f in r.Fields)
                {
                    if (f.Attribute.OnColumn)
                    {
                        FieldsAndKeys.Add(GetColumnDef(f));
                    }
                }
                {
                    var Name = RelationSchemaExtensions.GetLimitedKeyName("PK", String.Format("{0}_{1}", r.CollectionName, r.PrimaryKey.Columns.FriendlyName()), MaxNameLength);
                    FieldsAndKeys.Add(GetPrimaryKey(r.PrimaryKey, Name));
                }
                foreach (var k in r.UniqueKeys)
                {
                    var Name = RelationSchemaExtensions.GetLimitedKeyName("UQ", String.Format("{0}_{1}", r.CollectionName, k.Columns.FriendlyName()), MaxNameLength);
                    FieldsAndKeys.Add(GetUniqueKey(k, Name));
                }

                var NonUniqueKeys = new List <String>();

                foreach (var k in r.NonUniqueKeys)
                {
                    var Name = RelationSchemaExtensions.GetLimitedKeyName("IX", String.Format("{0}_{1}", r.CollectionName, k.Columns.FriendlyName()), MaxNameLength);
                    NonUniqueKeys.AddRange(GetNonUniqueKey(k, Name, r.CollectionName));
                }

                return(GetTemplate("Table").Substitute("Name", r.CollectionName).Substitute("FieldsAndKeys", JoinWithComma(FieldsAndKeys.ToArray())).Substitute("NonUniqueKeys", NonUniqueKeys));
            }
Esempio n. 2
0
        public Action <IWritableStream, RowVal> GetRowWriter(EntityDef e)
        {
            var cWriters = new List <Action <IWritableStream, ColumnVal> >();

            foreach (var c in e.Fields.Where(f => f.Attribute.OnColumn))
            {
                var cWriter = GetColumnWriter(c);
                cWriters.Add(cWriter);
            }
            Action <IWritableStream, RowVal> Writer = (s, r) =>
            {
                int k = 0;
                foreach (var cWriter in cWriters)
                {
                    cWriter(s, r.Columns[k]);
                    k += 1;
                }
                if (k != r.Columns.Count)
                {
                    throw new InvalidOperationException();
                }
            };

            return(Writer);
        }
Esempio n. 3
0
 public void SetRotation(Quaternion newrot, Quaternion oldrot, bool editPivot)
 {
     if (EntityDef != null)
     {
         if (editPivot)
         {
             EntityDef.SetPivotOrientationFromWidget(newrot);
         }
         else
         {
             EntityDef.SetOrientationFromWidget(newrot);
         }
     }
     else if (CarGenerator != null)
     {
         CarGenerator.SetOrientation(newrot);
     }
     else if (ScenarioNode != null)
     {
         ScenarioNode.SetOrientation(newrot);
     }
     else if (NavPoint != null)
     {
         NavPoint.SetOrientation(newrot);
     }
     else if (NavPortal != null)
     {
         NavPortal.SetOrientation(newrot);
     }
     else if (Audio != null)
     {
         Audio.SetOrientation(newrot);
     }
 }
Esempio n. 4
0
    private bool IsTransactionPendingOnThisCard()
    {
        CraftingManager manager = CraftingManager.Get();

        if (manager == null)
        {
            return(false);
        }
        PendingTransaction pendingTransaction = manager.GetPendingTransaction();

        if (pendingTransaction == null)
        {
            return(false);
        }
        EntityDef entityDef = this.m_actor.GetEntityDef();

        if (entityDef == null)
        {
            return(false);
        }
        if (pendingTransaction.CardID != entityDef.GetCardId())
        {
            return(false);
        }
        if (pendingTransaction.cardFlair != this.m_actor.GetCardFlair())
        {
            return(false);
        }
        return(true);
    }
Esempio n. 5
0
    public EntityDef GetEntityDef(string cardId)
    {
        EntityDef def = null;

        this.m_entityDefCache.TryGetValue(cardId, out def);
        return(def);
    }
    public TAG_CLASS?GetFirstCardClass()
    {
        if (this.m_collectionCardVisuals.Count == 0)
        {
            return(null);
        }
        CollectionCardVisual visual = this.m_collectionCardVisuals[0];

        if (!visual.IsShown())
        {
            return(null);
        }
        Actor actor = visual.GetActor();

        if (!actor.IsShown())
        {
            return(null);
        }
        EntityDef entityDef = actor.GetEntityDef();

        if (entityDef == null)
        {
            return(null);
        }
        return(new TAG_CLASS?(entityDef.GetClass()));
    }
 private void SetUpActor()
 {
     if (((this.m_actor != null) && (this.m_slot != null)) && !string.IsNullOrEmpty(this.m_slot.CardID))
     {
         EntityDef entityDef = DefLoader.Get().GetEntityDef(this.m_slot.CardID);
         bool      flag      = SceneMgr.Get().GetMode() == SceneMgr.Mode.COLLECTIONMANAGER;
         this.m_actor.SetDisablePremiumPortrait(true);
         this.m_actor.SetGhosted(flag && !this.m_slot.Owned);
         this.m_actor.SetEntityDef(entityDef);
         this.m_actor.SetCardFlair(new CardFlair(this.m_slot.Premium));
         bool cardIsUnique = (entityDef != null) ? entityDef.IsElite() : false;
         if ((cardIsUnique && this.m_inArena) && (this.m_slot.Count > 1))
         {
             cardIsUnique = false;
         }
         this.m_actor.UpdateDeckCardProperties(cardIsUnique, this.m_slot.Count, this.m_useSliderAnimations);
         CollectionCardCache.Get().LoadCardDef(entityDef.GetCardId(), delegate(string cardID, CardDef cardDef, object data) {
             if ((this.m_actor != null) && cardID.Equals(this.m_actor.GetEntityDef().GetCardId()))
             {
                 this.m_actor.SetCardDef(cardDef);
                 this.m_actor.UpdateAllComponents();
                 this.m_actor.UpdateMaterial(cardDef.GetDeckCardBarPortrait());
                 this.m_actor.UpdateGhostTileEffect();
             }
         }, null, new CardPortraitQuality(1, this.m_slot.Premium));
     }
 }
Esempio n. 8
0
 /// <summary>
 /// 根据网络数据设置实体属性值。
 /// </summary>
 /// <param name="args"></param>
 public void SetEntityInfo(BaseAttachedInfo info)
 {
     ID     = info.id;
     dbid   = info.dbid;
     entity = info.entity;
     SynEntityAttrs(info);
 }
Esempio n. 9
0
        public static string CreateDeleteSql(EntityDef entityDef)
        {
            EntityPropertyDef deletedProperty = entityDef.GetPropertyDef(nameof(Entity.Deleted)) !;
            EntityPropertyDef versionProperty = entityDef.GetPropertyDef(nameof(Entity.Version)) !;

            return($"update {entityDef.DbTableReservedName} set {versionProperty.DbReservedName}={versionProperty.DbReservedName}+1, {deletedProperty.DbReservedName}=1");
        }
Esempio n. 10
0
        public Func <RowVal, Node> GetRowWriter(EntityDef e)
        {
            var cWriters = new List <Func <ColumnVal, Node> >();

            foreach (var c in e.Fields.Where(f => f.Attribute.OnColumn))
            {
                var cWriter = GetColumnWriter(c);
                cWriters.Add(cWriter);
            }
            Func <RowVal, Node> Writer = r =>
            {
                var Nodes = new List <Node>();
                int k     = 0;
                foreach (var cWriter in cWriters)
                {
                    var c = cWriter(r.Columns[k]);
                    Nodes.Add(c);
                    k += 1;
                }
                if (k != r.Columns.Count)
                {
                    throw new InvalidOperationException();
                }
                return(Node.CreateStem(new Stem {
                    Name = e.Name, Children = Nodes
                }));
            };

            return(Writer);
        }
Esempio n. 11
0
        public static string CreateUpdateEntitySql(EntityDef entityDef, int number = 0)
        {
            StringBuilder args = new StringBuilder();

            foreach (EntityPropertyDef propertyInfo in entityDef.PropertyDefs)
            {
                if (propertyInfo.IsPrimaryKey)
                {
                    continue;
                }

                args.Append($" {propertyInfo.DbReservedName}={propertyInfo.DbParameterizedName}_{number},");
            }

            args.RemoveLast();

            EntityPropertyDef primaryKeyProperty = entityDef.PrimaryKeyPropertyDef;
            EntityPropertyDef deletedProperty    = entityDef.GetPropertyDef(nameof(Entity.Deleted)) !;
            EntityPropertyDef versionProperty    = entityDef.GetPropertyDef(nameof(Entity.Version)) !;

            StringBuilder where = new StringBuilder();

            where.Append($"{primaryKeyProperty.DbReservedName}={primaryKeyProperty.DbParameterizedName}_{number} AND ");
            where.Append($"{versionProperty.DbReservedName}={versionProperty.DbParameterizedName}_{number} - 1 AND ");
            where.Append($"{deletedProperty.DbReservedName}=0");

            return($"UPDATE {entityDef.DbTableReservedName} SET {args} WHERE {where};");
        }
Esempio n. 12
0
        public static MultiNodes BuildTable(EntityDef e, List <Semantics.Node> l)
        {
            var Lines = l.Select(n => new TableLine {
                Nodes = n.Stem.Children.Select(c => TableLineNode.CreateSingleLineLiteral(new SingleLineLiteral {
                    Text = c.Stem.Children.Single().Leaf
                })).ToList(), SingleLineComment = TreeFormat.Optional <SingleLineComment> .Empty
            }).ToList();
            var TableNodes = new TableNodes
            {
                ChildHead = new SingleLineLiteral {
                    Text = e.Name
                },
                ChildFields = e.Fields.Where(f => f.Attribute.OnColumn).Select(c => new SingleLineLiteral {
                    Text = c.Name
                }).ToList(),
                SingleLineComment = TreeFormat.Optional <SingleLineComment> .Empty,
                Children          = Lines,
                EndDirective      = TreeFormat.Optional <EndDirective> .Empty
            };
            var Table = new MultiLineNode
            {
                Head = new SingleLineLiteral {
                    Text = e.CollectionName
                },
                SingleLineComment = TreeFormat.Optional <SingleLineComment> .Empty,
                Children          = new List <MultiNodes> {
                    MultiNodes.CreateTableNodes(TableNodes)
                },
                EndDirective = TreeFormat.Optional <EndDirective> .Empty
            };

            return(MultiNodes.CreateNode(Node.CreateMultiLineNode(Table)));
        }
Esempio n. 13
0
        private void OnClick_CreateNewEntityDef(object sender, EventArgs e)
        {
            string entityName = null;

            for (int i = 0; i < 9999; i++)
            {
                entityName = "Entity" + i.ToString();
                if (!AllEntites.Values.Any(a => a.Name == entityName))
                {
                    break;
                }
            }
            if (string.IsNullOrEmpty(entityName))
            {
                entityName = Guid.NewGuid().ToString();
            }

            var entity = new EntityDef(entityName, false);

            AllEntites.Add(entity.Name, entity);
            RefreshEntityTree();
            foreach (TreeNode item in m_entityTreeView.Nodes)
            {
                if (item.Tag == entity)
                {
                    m_entityTreeView.SelectedNode = item;
                    break;
                }
            }
        }
 private FilteredArtStack RunFilters_MustPassAll(CollectionCardStack.ArtStack artStack)
 {
     if (this.FiltersExist())
     {
         EntityDef entityDef = DefLoader.Get().GetEntityDef(artStack.CardID);
         if (entityDef == null)
         {
             Log.Rachelle.Print(string.Format("WARNING CollectionFilter.RunFilters_MustPassAll() - entityDef for {0} is null", artStack.CardID), new object[0]);
             return(null);
         }
         foreach (CollectionFilter <GAME_TAG> filter in this.m_gameFilters)
         {
             if (!this.RunGameFilter(entityDef, filter))
             {
                 return(null);
             }
         }
         foreach (CollectionFilter <ACCOUNT_TAG> filter2 in this.m_accountFilters)
         {
             if (!this.RunAccountFilter(artStack, filter2))
             {
                 return(null);
             }
         }
         if (((this.m_textFilter != null) && this.m_textFilter.ShouldRunFilter()) && !this.RunTextFilter(entityDef, artStack, this.m_textFilter))
         {
             return(null);
         }
     }
     return(new FilteredArtStack(artStack));
 }
Esempio n. 15
0
        public Func <Node, RowVal> GetRowReader(EntityDef e)
        {
            var cReaders = new List <Func <Node, ColumnVal> >();

            foreach (var c in e.Fields.Where(f => f.Attribute.OnColumn))
            {
                var cReader = GetColumnReader(e, c);
                cReaders.Add(cReader);
            }
            Func <Node, RowVal> Reader = TreeRow =>
            {
                var Columns = new List <ColumnVal>();
                foreach (var cReader in cReaders)
                {
                    if (!TreeRow.OnStem)
                    {
                        throw new InvalidOperationException(String.Format("InvalidData: {0}[{1}]", e.Name, Columns.Count));
                    }
                    var c = cReader(TreeRow);
                    Columns.Add(c);
                }
                return(new RowVal {
                    Columns = Columns
                });
            };

            return(Reader);
        }
 private void CheckForCardOpened(BnetGameAccount oldPlayerAccount, BnetGameAccount newPlayerAccount, BnetPlayer newPlayer)
 {
     if (newPlayerAccount.GetCardsOpened() != oldPlayerAccount.GetCardsOpened())
     {
         string cardsOpened = newPlayerAccount.GetCardsOpened();
         if (!string.IsNullOrEmpty(cardsOpened))
         {
             char[]   separator = new char[] { ',' };
             string[] strArray  = cardsOpened.Split(separator);
             if (strArray.Length == 2)
             {
                 EntityDef entityDef = DefLoader.Get().GetEntityDef(strArray[0]);
                 if (entityDef != null)
                 {
                     if (strArray[1] == "1")
                     {
                         object[] args = new object[] { "5ecaf0ff", newPlayer.GetBestName(), entityDef.GetName(), "ffd200" };
                         this.AddToast(GameStrings.Format("GLOBAL_SOCIAL_TOAST_FRIEND_GOLDEN_LEGENDARY", args));
                     }
                     else
                     {
                         object[] objArray2 = new object[] { "5ecaf0ff", newPlayer.GetBestName(), entityDef.GetName(), "ff9c00" };
                         this.AddToast(GameStrings.Format("GLOBAL_SOCIAL_TOAST_FRIEND_LEGENDARY", objArray2));
                     }
                 }
             }
         }
     }
 }
 private void SetHeroPowerInfo(string heroPowerCardID, FullDef def, CardFlair cardFlair)
 {
     if (heroPowerCardID.Equals(this.m_heroPowerID))
     {
         EntityDef entityDef = def.GetEntityDef();
         if (cardFlair.Premium == TAG_PREMIUM.GOLDEN)
         {
             this.m_heroPowerActor.Hide();
             this.m_goldenHeroPowerActor.Show();
             this.m_goldenHeroPowerActor.SetEntityDef(def.GetEntityDef());
             this.m_goldenHeroPowerActor.SetCardDef(def.GetCardDef());
             this.m_goldenHeroPowerActor.SetUnlit();
             this.m_goldenHeroPowerActor.SetCardFlair(cardFlair);
             this.m_goldenHeroPowerActor.UpdateAllComponents();
         }
         else
         {
             this.m_heroPowerActor.Show();
             this.m_goldenHeroPowerActor.Hide();
             this.m_heroPowerActor.SetEntityDef(def.GetEntityDef());
             this.m_heroPowerActor.SetCardDef(def.GetCardDef());
             this.m_heroPowerActor.SetUnlit();
             this.m_heroPowerActor.UpdateAllComponents();
         }
         string name = entityDef.GetName();
         this.m_heroPowerName.Text = name;
         string cardTextInHand = entityDef.GetCardTextInHand();
         this.m_heroPowerDescription.Text = cardTextInHand;
     }
 }
Esempio n. 18
0
    private static void Main()
    {
        //
        // Create the rule application
        //
        var ruleAppDef = new RuleApplicationDef();

        // Add Entity
        var entityDef = new EntityDef("Rectangle");

        ruleAppDef.Entities.Add(entityDef);

        // Add Fields
        entityDef.Fields.Add(new FieldDef("Width", DataType.Number));
        entityDef.Fields.Add(new FieldDef("Length", DataType.Number));
        entityDef.Fields.Add(new FieldDef("Area", "Width * Length", DataType.Number));

        //
        // Run rules
        //
        using (var ruleSession = new RuleSession(ruleAppDef))
        {
            // create default entity state
            var entity = ruleSession.CreateEntity("Rectangle");

            entity.Fields["Width"].Value  = 20;
            entity.Fields["Length"].Value = 10;
            ruleSession.ApplyRules();

            Console.WriteLine("The area is: " + entity.Fields["Area"].Value);
            Console.ReadLine();
        }
    }
Esempio n. 19
0
            public List <String> GetProperty(EntityDef r, VariableDef f, int Index)
            {
                var Type         = f.Type;
                var PropertyType = GetPropertyTypeString(f);

                if (f.Attribute.OnColumn)
                {
                    var ColumnAttributes = GetColumnAttributes(r, f, Index);
                    var d = f.Description;
                    if (f.Type.OnOptional)
                    {
                        if (d == "")
                        {
                            d = "Optional";
                        }
                        else
                        {
                            d = "Optional\r\n" + d;
                        }
                    }
                    return(GetTemplate("ColumnProperty").Substitute("Name", f.Name).Substitute("ColumnAttributes", ColumnAttributes).Substitute("PropertyType", PropertyType).Substitute("XmlComment", GetXmlComment(d)));
                }
                else if (f.Attribute.OnNavigation)
                {
                    var a = f.Attribute.Navigation;

                    var AssociationParameters = GetAssociationParameters(r, f);
                    return(GetTemplate("AssociationProperty").Substitute("Name", f.Name).Substitute("AssociationParameters", AssociationParameters).Substitute("PropertyType", PropertyType).Substitute("XmlComment", GetXmlComment(f.Description)));
                }
                else
                {
                    throw new InvalidOperationException();
                }
            }
        public int CompareTo(object obj)
        {
            if (!(obj is CollectionCardStack.ArtStack))
            {
                throw new ArgumentException("Object is not an ArtStack.");
            }
            CollectionCardStack.ArtStack stack = obj as CollectionCardStack.ArtStack;
            EntityDef entityDef = DefLoader.Get().GetEntityDef(this.CardID);
            EntityDef def2      = DefLoader.Get().GetEntityDef(stack.CardID);

            if (!entityDef.Equals(def2))
            {
                return(CollectionManager.Get().EntityDefSortComparison(entityDef, def2));
            }
            if (!this.Flair.Equals(stack.Flair))
            {
                return(GameUtils.CardFlairSortComparisonAsc(this.Flair, stack.Flair));
            }
            if (!this.NewestInsertDate.Equals(stack.NewestInsertDate))
            {
                return(this.NewestInsertDate.CompareTo(stack.NewestInsertDate));
            }
            if (this.Count != stack.Count)
            {
                return(this.Count - stack.Count);
            }
            return(this.NumSeen - stack.NumSeen);
        }
Esempio n. 21
0
 public void Hide(EntityDef entityDef, CardFlair flair)
 {
     if ((this.m_entityDef == entityDef) && this.m_flair.Equals(flair))
     {
         this.Hide();
     }
 }
    private void LoadVanillaHeroCardDef()
    {
        Player player = null;

        foreach (Player player2 in GameState.Get().GetPlayerMap().Values)
        {
            if (player2.GetSide() == Player.Side.FRIENDLY)
            {
                player = player2;
                break;
            }
        }
        if (player == null)
        {
            Debug.LogWarning("GoldenHeroEvent.LoadVanillaHeroCardDef() - currentPlayer == null");
        }
        else
        {
            EntityDef entityDef = player.GetEntityDef();
            if (entityDef.GetCardSet() == TAG_CARD_SET.HERO_SKINS)
            {
                string vanillaHeroCardID    = CollectionManager.Get().GetVanillaHeroCardID(entityDef);
                CardPortraitQuality quality = new CardPortraitQuality(3, TAG_PREMIUM.NORMAL);
                DefLoader.Get().LoadCardDef(vanillaHeroCardID, new DefLoader.LoadDefCallback <CardDef>(this.OnVanillaHeroCardDefLoaded), new object(), quality);
            }
        }
    }
Esempio n. 23
0
        public void DuplicateEntityNameTest()
        {
            Helper             h       = new Helper();
            RuleApplicationDef source  = RuleApplicationDef.Load(_sourcePath);
            RuleApplicationDef dest    = RuleApplicationDef.Load(_destPath);
            EntityDef          entity  = new EntityDef();
            EntityDef          entity2 = new EntityDef();

            entity.Name  = "HelloWorld";
            entity2.Name = "HelloWorld";
            source.Entities.Add(entity);
            dest.Entities.Add(entity2);


            try
            {
                h.ImportToolkit(source, dest);
                Assert.Fail("Expected InvalidImportException.");
            }
            catch (Exception ex)
            {
                if (ex.GetType().ToString().Contains("InvalidImportException"))
                {
                    Assert.Pass("Got the expected exception");
                }
                else
                {
                    Assert.Fail("Did not get the expected exception.  Instead got: " + ex.GetType().ToString());
                }
            }
        }
Esempio n. 24
0
 public void SetScale(Vector3 newscale, bool editPivot)
 {
     if (MultipleSelectionItems != null)
     {
         if (editPivot)
         {//editing pivot scale is sort of meaningless..
         }
         else
         {
             var cen   = MultipleSelectionCenter;
             var ori   = MultipleSelectionRotation;
             var orinv = Quaternion.Invert(ori);
             var rsca  = newscale / MultipleSelectionScale;
             for (int i = 0; i < MultipleSelectionItems.Length; i++)
             {
                 if (MultipleSelectionItems[i].CollisionPoly == null)//skip polys, they use gathered verts
                 {
                     var refpos = MultipleSelectionItems[i].WidgetPosition;
                     var relpos = refpos - cen;
                     var newpos = ori.Multiply(orinv.Multiply(relpos) * rsca) + cen;
                     MultipleSelectionItems[i].SetPosition(newpos, false);
                     MultipleSelectionItems[i].SetScale(newscale, false);
                 }
             }
             if (GatheredCollisionVerts != null)
             {
                 for (int i = 0; i < GatheredCollisionVerts.Length; i++)
                 {
                     var refpos = GatheredCollisionVerts[i].Position;
                     var relpos = refpos - cen;
                     var newpos = ori.Multiply(orinv.Multiply(relpos) * rsca) + cen;
                     GatheredCollisionVerts[i].Position = newpos;
                 }
             }
             MultipleSelectionScale = newscale;
         }
     }
     else if (EntityDef != null)
     {
         EntityDef.SetScale(newscale);
     }
     else if (CarGenerator != null)
     {
         CarGenerator.SetScale(newscale);
         AABB = new BoundingBox(CarGenerator.BBMin, CarGenerator.BBMax);
     }
     else if (CollisionVertex != null)
     {
         //do nothing, but stop any poly from being scaled also
     }
     else if (CollisionPoly != null)
     {
         CollisionPoly.Scale = newscale;
     }
     else if (CollisionBounds != null)
     {
         CollisionBounds.Scale = newscale;
     }
 }
Esempio n. 25
0
 public void Show(CollectionDeck deck, EntityDef entity, CardFlair flair)
 {
     this.m_deck      = deck;
     this.m_entityDef = entity;
     this.m_flair     = flair;
     this.UpdateDeckCount();
     base.gameObject.SetActive(true);
 }
    public override string ToString()
    {
        EntityDef entityDef = DefLoader.Get().GetEntityDef(this.CardID);
        string    str       = (entityDef != null) ? entityDef.GetName() : "[UNKNOWN]";

        object[] args = new object[] { str, this.CardID, this.Premium, this.Count, base.Origin, base.OriginData };
        return(string.Format("[CardRewardData: cardName={0} CardID={1}, Premium={2} Count={3} Origin={4} OriginData={5}]", args));
    }
Esempio n. 27
0
        public static EntityDef AddEntity(this RuleApplicationDef ruleApplicationDef, string entityName)
        {
            var entityDef = new EntityDef();

            entityDef.Name = entityName;
            ruleApplicationDef.Entities.Add(entityDef);
            return(entityDef);
        }
Esempio n. 28
0
            public List <String> GetByKeyT(EntityDef r, Key k)
            {
                var KeyFriendlyName     = String.Join("And", k.Columns.Select(c => c.Name).ToArray());
                var KeyParameters       = GetKeyParameters(r, k);
                var KeyWhereExpressions = GetKeyWhereExpressions(r, k);

                return(GetTemplate("ByKeyT").Substitute("RecordName", r.Name).Substitute("KeyFriendlyName", KeyFriendlyName).Substitute("KeyParameters", KeyParameters).Substitute("KeyWhereExpressions", KeyWhereExpressions));
            }
Esempio n. 29
0
 public void SetPosition(Vector3 newpos, bool editPivot)
 {
     if (MultipleSelection)
     {
         //don't do anything here for multiselection
     }
     else if (EntityDef != null)
     {
         if (editPivot)
         {
             EntityDef.SetPivotPositionFromWidget(newpos);
         }
         else
         {
             EntityDef.SetPositionFromWidget(newpos);
         }
     }
     else if (CarGenerator != null)
     {
         CarGenerator.SetPosition(newpos);
     }
     else if (PathNode != null)
     {
         PathNode.SetPosition(newpos);
     }
     else if (CollisionPoly != null)
     {
         CollisionPoly.Position = newpos;
     }
     else if (CollisionBounds != null)
     {
         CollisionBounds.Position = newpos;
     }
     else if (NavPoly != null)
     {
         NavPoly.SetPosition(newpos);
     }
     else if (NavPoint != null)
     {
         NavPoint.SetPosition(newpos);
     }
     else if (NavPortal != null)
     {
         NavPortal.SetPosition(newpos);
     }
     else if (TrainTrackNode != null)
     {
         TrainTrackNode.SetPosition(newpos);
     }
     else if (ScenarioNode != null)
     {
         ScenarioNode.SetPosition(newpos);
     }
     else if (Audio != null)
     {
         Audio.SetPosition(newpos);
     }
 }
    public void UpdateLockVisual(EntityDef entityDef, CollectionCardVisual.LockType lockType)
    {
        if ((entityDef == null) || (lockType == CollectionCardVisual.LockType.NONE))
        {
            base.gameObject.SetActive(false);
        }
        else
        {
            GameObject allyBg;
            base.gameObject.SetActive(true);
            TAG_CARDTYPE cardType = entityDef.GetCardType();
            this.m_allyBg.SetActive(false);
            this.m_spellBg.SetActive(false);
            this.m_weaponBg.SetActive(false);
            switch (cardType)
            {
            case TAG_CARDTYPE.MINION:
                allyBg = this.m_allyBg;
                this.m_lockPlate.transform.localPosition = this.m_lockPlateBone.transform.localPosition;
                break;

            case TAG_CARDTYPE.SPELL:
                allyBg = this.m_spellBg;
                this.m_lockPlate.transform.localPosition = this.m_lockPlateBone.transform.localPosition;
                break;

            case TAG_CARDTYPE.WEAPON:
                allyBg = this.m_weaponBg;
                this.m_lockPlate.transform.localPosition = this.m_weaponLockPlateBone.transform.localPosition;
                break;

            default:
                allyBg = this.m_spellBg;
                break;
            }
            float num = 0f;
            switch (lockType)
            {
            case CollectionCardVisual.LockType.MAX_COPIES_IN_DECK:
            {
                num = 0f;
                int      num2 = !entityDef.IsElite() ? 2 : 1;
                object[] args = new object[] { num2 };
                this.SetLockText(GameStrings.Format("GLUE_COLLECTION_LOCK_MAX_DECK_COPIES", args));
                break;
            }

            case CollectionCardVisual.LockType.NO_MORE_INSTANCES:
                num = 1f;
                this.SetLockText(GameStrings.Get("GLUE_COLLECTION_LOCK_NO_MORE_INSTANCES"));
                break;
            }
            this.m_lockPlate.GetComponent <Renderer>().material.SetFloat("_Desaturate", num);
            allyBg.GetComponent <Renderer>().material.SetFloat("_Desaturate", num);
            allyBg.SetActive(true);
        }
    }
Esempio n. 31
0
 public static IntVec3 InteractionSquareWhenAt( EntityDef tDef, IntVec3 loc, IntRot rot )
 {
     IntVec3 rotatedOffset = tDef.interactionSquareOffset.RotatedBy(rot);
     return loc + rotatedOffset;
 }