Ejemplo n.º 1
0
    private static void ExtractSideEffectBundle(CardTypes cardType, XmlNode node_CardInfo, SideEffectBundle seb)
    {
        SideEffectExecute.SideEffectFrom sideEffectFrom = SideEffectExecute.SideEffectFrom.Unknown;
        switch (cardType)
        {
        case CardTypes.Mech:
            sideEffectFrom = SideEffectExecute.SideEffectFrom.MechSideEffect;
            break;

        case CardTypes.Equip:
            sideEffectFrom = SideEffectExecute.SideEffectFrom.EquipSideEffect;
            break;

        case CardTypes.Spell:
            sideEffectFrom = SideEffectExecute.SideEffectFrom.SpellCard;
            break;

        case CardTypes.Energy:
            sideEffectFrom = SideEffectExecute.SideEffectFrom.EnergyCard;
            break;
        }

        for (int k = 0; k < node_CardInfo.ChildNodes.Count; k++)
        {
            XmlNode node_SideEffectExecute      = node_CardInfo.ChildNodes.Item(k);
            SideEffectExecute.ExecuteSetting es = SideEffectExecute.ExecuteSetting.GenerateFromXMLNode(node_SideEffectExecute);

            List <SideEffectBase> ses = new List <SideEffectBase>();

            for (int m = 0; m < node_SideEffectExecute.ChildNodes.Count; m++)
            {
                XmlNode        node_SideEffect = node_SideEffectExecute.ChildNodes.Item(m);
                SideEffectBase sideEffect      = AllSideEffects.SideEffectsNameDict[node_SideEffect.Attributes["name"].Value].Clone();
                GetInfoForSideEffect(node_SideEffect, sideEffect);
                ses.Add(sideEffect);
            }

            SideEffectExecute see = new SideEffectExecute(sideEffectFrom, ses, es);
            seb.AddSideEffectExecute(see);
        }
    }
Ejemplo n.º 2
0
    public void Initialize(CardInfo_Base cardInfo, SideEffectBundle seb, UnityAction onRefreshText)
    {
        foreach (CardPropertyForm_SideEffectExecute cpfsee in CardPropertyForm_SideEffectExecuteRows)
        {
            cpfsee.PoolRecycle();
        }

        CardPropertyForm_SideEffectExecuteRows.Clear();

        if (cardInfo != null)
        {
            if (seb == cardInfo.SideEffectBundle)
            {
                LanguageManager.Instance.RegisterTextKey(SideEffectBundleText, "CardEditorPanel_SideEffectBundleText");
            }
            else
            {
                LanguageManager.Instance.RegisterTextKey(SideEffectBundleText, "CardEditorPanel_SideEffectBundleAuraText");
            }

            AddSideEffectExecuteButton.onClick.RemoveAllListeners();
            AddSideEffectExecuteButton.onClick.AddListener(delegate
            {
                SideEffectExecute.SideEffectFrom sef            = SideEffectExecute.SideEffectFrom.Unknown;
                SideEffectExecute.ExecuteSetting executeSetting = SideEffectExecute.ExecuteSetting_Presets[SideEffectExecute.ExecuteSettingTypes.PlayOutEffect].Clone();

                switch (cardInfo.BaseInfo.CardType)
                {
                case CardTypes.Mech:
                    sef            = SideEffectExecute.SideEffectFrom.MechSideEffect;
                    executeSetting = SideEffectExecute.ExecuteSetting_Presets[SideEffectExecute.ExecuteSettingTypes.BattleCry];
                    break;

                case CardTypes.Equip:
                    sef            = SideEffectExecute.SideEffectFrom.EquipSideEffect;
                    executeSetting = SideEffectExecute.ExecuteSetting_Presets[SideEffectExecute.ExecuteSettingTypes.EquipBattleCry];
                    break;

                case CardTypes.Spell:
                    sef            = SideEffectExecute.SideEffectFrom.SpellCard;
                    executeSetting = SideEffectExecute.ExecuteSetting_Presets[SideEffectExecute.ExecuteSettingTypes.PlayOutEffect];
                    break;

                case CardTypes.Energy:
                    sef            = SideEffectExecute.SideEffectFrom.EnergyCard;
                    executeSetting = SideEffectExecute.ExecuteSetting_Presets[SideEffectExecute.ExecuteSettingTypes.PlayOutEffect];
                    break;
                    //todo from buff
                }

                SideEffectExecute newSEE = new SideEffectExecute(sef, new List <SideEffectBase> {
                    AllSideEffects.GetSideEffect("Damage").Clone()
                }, executeSetting);

                seb.AddSideEffectExecute(newSEE);
                seb.RefreshSideEffectExecutesDict();
                Initialize(cardInfo, seb, onRefreshText);
                onRefreshText();
                StartCoroutine(ClientUtils.UpdateLayout((RectTransform)UIManager.Instance.GetBaseUIForm <CardEditorPanel>().CardPropertiesContainer));
            });

            RefreshSideEffectBundleTransformButton.onClick.RemoveAllListeners();
            RefreshSideEffectBundleTransformButton.onClick.AddListener(delegate { StartCoroutine(ClientUtils.UpdateLayout((RectTransform)UIManager.Instance.GetBaseUIForm <CardEditorPanel>().CardPropertiesContainer)); }
                                                                       );

            foreach (SideEffectExecute see in seb.SideEffectExecutes)
            {
                CardPropertyForm_SideEffectExecute cpfsee = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.CardPropertyForm_SideEffectExecute].AllocateGameObject <CardPropertyForm_SideEffectExecute>(SideEffectExecuteRowContainer);
                cpfsee.Initialize(SideEffectExecute.GetSideEffectFromByCardType(cardInfo.BaseInfo.CardType), see, onRefreshText, delegate
                {
                    seb.RemoveSideEffectExecute(see);
                    Initialize(cardInfo, seb, onRefreshText);
                    onRefreshText();
                    StartCoroutine(ClientUtils.UpdateLayout((RectTransform)SideEffectExecuteRowContainer));
                });
                CardPropertyForm_SideEffectExecuteRows.Add(cpfsee);
            }
        }
    }