public static bool Write()
        {
            //StringWriter sw = new StringWriter();
            //JsonWriter writer = new JsonTextWriter(sw);

            FormationInfo fi = new FormationInfo();
            // position1
            FormationPosition fp1 = new FormationPosition();

            fp1.Buffs = new List <PositionBuff>();
            fp1.Buffs.Add(new PositionBuff(CharacterPropertyType.Atk, "50"));
            fp1.Buffs.Add(new PositionBuff(CharacterPropertyType.RecieveDamage, "40"));
            // position1
            FormationPosition fp2 = new FormationPosition();

            fp2.Buffs = new List <PositionBuff>();
            fp2.Buffs.Add(new PositionBuff(CharacterPropertyType.Atk, "50"));
            fp2.Buffs.Add(new PositionBuff(CharacterPropertyType.RecieveDamage, "40"));
            // position1
            FormationPosition fp3 = new FormationPosition();

            fp3.Buffs = new List <PositionBuff>();
            fp3.Buffs.Add(new PositionBuff(CharacterPropertyType.Atk, "50"));
            fp3.Buffs.Add(new PositionBuff(CharacterPropertyType.RecieveDamage, "40"));
            // position1
            FormationPosition fp4 = new FormationPosition();

            fp4.Buffs = new List <PositionBuff>();
            fp4.Buffs.Add(new PositionBuff(CharacterPropertyType.Atk, "50"));
            fp4.Buffs.Add(new PositionBuff(CharacterPropertyType.RecieveDamage, "40"));
            // position1
            FormationPosition fp5 = new FormationPosition();

            fp5.Buffs = new List <PositionBuff>();
            fp5.Buffs.Add(new PositionBuff(CharacterPropertyType.Atk, "50"));
            fp5.Buffs.Add(new PositionBuff(CharacterPropertyType.RecieveDamage, "40"));


            fi.Name      = "zhenfa1";
            fi.Positions = new List <FormationPosition>();
            fi.Positions.Add(fp1);
            fi.Positions.Add(fp2);
            fi.Positions.Add(fp3);
            fi.Positions.Add(fp4);
            fi.Positions.Add(fp5);



            Console.WriteLine(JsonConvert.SerializeObject(new List <FormationInfo>()
            {
                fi
            }, Formatting.Indented));
            //Console.WriteLine(JsonConvert.SerializeObject(new List<FormationInfo>() { fi }));


            return(false);
        }
Exemplo n.º 2
0
        /// 设置ModifierInfo
        /// </summary>
        /// <param name="nameCN">中文名</param>
        /// <param name="namePY">拼音</param>
        /// <param name="modifier">要配置的buff</param>
        /// <param name="IntValue">整数字符串</param>
        public static void setModifierInfo(ModifierInfo modifier, string nameCN, string namePY, FormationPosition formationPosition)
        {
            // 设置为战斗后移除
            modifier.flags = ModifierFlags.RemoveAfterCombat;
            // 设置鼠标移上去时的描述
            LanguageData mLanguageData = modifier.GetLanguageData();

            mLanguageData.SetText("Name", nameCN);
            mLanguageData.SetText("Desc", nameCN + "施展中");
            mLanguageData.ID = "martial-" + namePY;
            //foreach (KeyValuePair<string, string> kv in mLanguageData.Map)
            //{
            //    FormationMod.logger.Log($"LanguageData key:{kv.Key}value:{kv.Value}");
            //}
            List <AdditionalProperty> mProperties = modifier.Properties;

            // 清楚旧的属性
            mProperties.Clear();

            for (int i = 0; i < formationPosition.Buffs.Count; i++)
            {
                PositionBuff Buffs = formationPosition.Buffs[i];
                // 添加属性为参数值
                VariableValue variableValue = new VariableValue();
                variableValue.Type  = VariableValueType.Value;
                variableValue.value = Buffs.Value;
                // 新的属性
                AdditionalProperty newAdditionalProperty = new AdditionalProperty();
                newAdditionalProperty.IsFactor = true;
                //newAdditionalProperty.IsFactor = false;
                newAdditionalProperty.effectType = PropertyEffectType.Add;
                newAdditionalProperty.property   = Buffs.BuffType;
                newAdditionalProperty.Value      = variableValue;

                // 添加属性
                mProperties.Add(newAdditionalProperty);
            }


            //foreach (AdditionalProperty additionalProperty in mProperties)
            //{
            //    FormationMod.logger.Log($"additionalProperty IsFactor:{additionalProperty.IsFactor}|effectType:{additionalProperty.effectType}|property:{additionalProperty.property}");
            //    FormationMod.logger.Log($"additionalProperty VariableValueType: { additionalProperty.Value.Type}|value: { additionalProperty.Value.value}");
            //}
        }