Пример #1
0
    public static CardInfo_Base GetRandomCardInfoByLevelNum(int levelNum, HashSet <int> exceptCardIDs = null)
    {
        if (exceptCardIDs == null)
        {
            exceptCardIDs = new HashSet <int>();
        }

        CardInfo_Base res = null;

        if (CardLevelDict.ContainsKey(levelNum))
        {
            List <CardInfo_Base> levelCards       = CloneVariantUtils.List(CardLevelDict[levelNum]);
            List <CardInfo_Base> removeLevelCards = new List <CardInfo_Base>();
            foreach (CardInfo_Base cb in levelCards)
            {
                if (exceptCardIDs.Contains(cb.CardID))
                {
                    removeLevelCards.Add(cb);
                }
            }

            foreach (CardInfo_Base cb in removeLevelCards)
            {
                levelCards.Remove(cb);
            }

            if (levelCards.Count >= 1)
            {
                res = Utils.GetRandomFromList(levelCards, 1)[0];
            }
        }

        return(res == null ? res : res.Clone());
    }
Пример #2
0
    public MechaComponentInfo Clone()
    {
        MechaComponentInfo mci = new MechaComponentInfo(MechaComponentType, GridPos, TotalLife, DropProbability);

        mci.OccupiedGridPositions = CloneVariantUtils.List(OccupiedGridPositions);
        return(mci);
    }
Пример #3
0
 public ExecutorInfo Clone()
 {
     return(new ExecutorInfo(
                ClientId,
                SideEffectExecutorID,
                MechId,
                CardId,
                CardInstanceId,
                EquipId,
                CloneVariantUtils.List(TargetClientIds),
                CloneVariantUtils.List(TargetMechIds),
                CloneVariantUtils.List(TargetCardInstanceIds),
                CloneVariantUtils.List(TargetEquipIds),
                CloneVariantUtils.SortedDictionary(ValueDictionary),
                IsPlayerBuff));
 }
Пример #4
0
    /// <summary>
    /// Load all prefabs to see which grids does a mecha component take
    /// </summary>
    private void LoadBlockOccupiedGridInfo()
    {
        MechaComponentOccupiedGridPosDict.Clear();
        List <MechaComponentBase> mcbs = new List <MechaComponentBase>();

        foreach (string s in Enum.GetNames(typeof(MechaComponentType)))
        {
            MechaComponentType mcType = (MechaComponentType)Enum.Parse(typeof(MechaComponentType), s);
            MechaComponentBase mcb    = MechaComponentBase.BaseInitialize(new MechaComponentInfo(mcType, new GridPos(0, 0, GridPos.Orientation.Up), 10, 0), null);
            mcbs.Add(mcb);
            MechaComponentOccupiedGridPosDict.Add(mcType, CloneVariantUtils.List(mcb.MechaComponentGrids.MechaComponentGridPositions));
        }

        foreach (MechaComponentBase mcb in mcbs)
        {
            DestroyImmediate(mcb.gameObject);
        }
    }
Пример #5
0
    private SideEffectBase CloneCore(bool withChange)
    {
        Assembly       assembly = AllSideEffects.CurrentAssembly; // 获取当前程序集
        SideEffectBase copy     = (SideEffectBase)assembly.CreateInstance("SideEffects." + Name);

        copy.Name     = Name;
        copy.DescRaws = CloneVariantUtils.SortedDictionary(DescRaws);
        if (withChange)
        {
            copy.M_SideEffectParam = M_SideEffectParam.CloneWithFactor();
        }
        else
        {
            copy.M_SideEffectParam = M_SideEffectParam.Clone();
        }
        copy.Sub_SideEffect = CloneVariantUtils.List(Sub_SideEffect);
        return(copy);
    }
Пример #6
0
    public void Initialize(MechaComponentInfo mci, int width, int height, GridPos myPos, List <GridPos> realPositionsInBagPanel, bool moving)
    {
        MechaComponentInfo = mci;
        Image.sprite       = BagManager.Instance.MechaComponentSpriteDict[mci.MechaComponentType];
        Width   = width;
        Height  = height;
        GridPos = myPos;
        if (!moving)
        {
            GridPos_BeforeMove = myPos;
        }

        // Resize and rotate to fit the grid
        Vector2 size      = new Vector2(Width * BagManager.Instance.BagItemGridSize, Height * BagManager.Instance.BagItemGridSize);
        Vector2 size_rev  = new Vector2(Height * BagManager.Instance.BagItemGridSize, Width * BagManager.Instance.BagItemGridSize);
        bool    isRotated = GridPos.orientation == GridPos.Orientation.Right || GridPos.orientation == GridPos.Orientation.Left;

        if (isRotated)
        {
            ((RectTransform)transform).sizeDelta = size;
            BagItemGridHitBoxes.Initialize(realPositionsInBagPanel, myPos);
            Image.rectTransform.sizeDelta = size_rev;
            Image.transform.rotation      = Quaternion.Euler(0, 0, 90f);
        }
        else
        {
            ((RectTransform)transform).sizeDelta = size;
            BagItemGridHitBoxes.Initialize(realPositionsInBagPanel, myPos);
            Image.rectTransform.sizeDelta = size;
            Image.transform.rotation      = Quaternion.Euler(0, 0, 0f);
        }

        ((RectTransform)transform).anchoredPosition = new Vector2(GridPos.x * BagManager.Instance.BagItemGridSize, -GridPos.z * BagManager.Instance.BagItemGridSize);
        RealPositionsInBagPanel = realPositionsInBagPanel;
        if (!moving)
        {
            RealPositionsInBagPanel_BeforeMove = CloneVariantUtils.List(RealPositionsInBagPanel);
        }
    }
Пример #7
0
 public CardPriority Clone()
 {
     return(new CardPriority(CloneVariantUtils.List(CardIDListByPriority)));
 }
Пример #8
0
    public override Level Clone()
    {
        Enemy enemy = new Enemy(LevelPicID, CloneVariantUtils.SortedDictionary(LevelNames), DifficultyLevel, BuildInfo.Clone(), EnemyType, CloneVariantUtils.List(BonusGroups), CloneVariantUtils.List(CardComboList), CardPriority);

        enemy.LevelID = LevelID;
        return(enemy);
    }
Пример #9
0
    public override Level Clone()
    {
        Shop shop = new Shop(LevelPicID, CloneVariantUtils.SortedDictionary(LevelNames), DifficultyLevel, CloneVariantUtils.List(ShopItems), ShopItemCardCount, ShopItemOthersCount);

        shop.LevelID = LevelID;
        return(shop);
    }
Пример #10
0
 public CardCombo Clone()
 {
     return(new CardCombo(CloneVariantUtils.List(ComboCardIDList)));
 }
Пример #11
0
 public BonusGroup Clone()
 {
     return(new BonusGroup(IsAlways, CloneVariantUtils.List(Bonuses), Probability, IsSingleton));
 }