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);
        }
Esempio n. 2
0
        public static bool LoadGameData_Path(ModifierModel __instance)
        {
            // 如果MOD状态是关闭的话
            if (!FormationMod.enable)
            {
                // 执行原本的方法
                return(true);
            }
            __instance.mGameData = Singleton <DataManager> .Instance.Load <ModifierGameData>(__instance.mName, DataType.Game, null);

            bool flag = __instance.mGameData == null;

            if (flag)
            {
                //__instance.mLogService.LogError(__instance.mName + "Model 游戏数据加载失败");
                ILogService mLogService = Traverse.Create(__instance).Field("mLogService").GetValue <ILogService>();
                mLogService.LogError(__instance.mName + "Model 游戏数据加载失败");
            }
            else
            {
                List <string> list = ListPool <string> .Get();

                Singleton <DataManager> .Instance.GetAllDirName(ref list, "ModifierInfo/", DataType.Game, -1);

                for (int i = 0; i < list.Count; i++)
                {
                    string       key          = list[i];
                    ModifierInfo modifierInfo = __instance.LoadModifierInfoByID(key);
                }
                ListPool <string> .Recycle(list);

                //FormationMod.logger.Log($" init ModifierInfoMap");
                for (int i = 0; i < FormationFileLoad.Size; i++)
                {
                    FormationInfo formationInfo = FormationFileLoad.fiList[i];
                    for (int i2 = 0; i2 < formationInfo.Positions.Count; i2++)
                    {
                        ModifierInfo newModifierInfo_0 = __instance.CloneModifierInfo(__instance.ModifierInfoMap["martial-baguaxinfa"], "martial-" + formationInfo.Name + i2);
                        // 需要初始化所有的阵法buff,每个阵型每个位置的buff不同
                        ModifierUtil.setModifierInfo(newModifierInfo_0, formationInfo.NameCN, formationInfo.Name, formationInfo.Positions[i2]);
                    }
                }
                //ModifierInfo newModifierInfo_1 = __instance.CloneModifierInfo(__instance.ModifierInfoMap["martial-baguaxinfa"], "martial-" + ModifierUtil.formationPY[1]);
                //ModifierUtil.setModifierInfo(newModifierInfo_1, ModifierUtil.formationCN[1], ModifierUtil.formationPY[1], "10");
            }
            // 返回false表示不执行原方法
            return(false);
        }
Esempio n. 3
0
        public static bool LoadAllSkillInfo_Path(MartialSkillModel __instance)
        {
            // 如果MOD状态是关闭的话
            if (!FormationMod.enable)
            {
                // 执行原本的方法
                return(true);
            }
            List <string> list = ListPool <string> .Get();

            Singleton <DataManager> .Instance.GetAllDirName(ref list, "Martial/MartialInfo/", DataType.Game, -1);

            for (int i = 0; i < list.Count; i++)
            {
                string           key = list[i];
                MartialSkillInfo martialSkillInfo = Traverse.Create(__instance).Method("LoadSkillInfoByID", key).GetValue <MartialSkillInfo>();
                //FormationMod.logger.Log(JsonUtility.ToJson(martialSkillInfo));
            }
            ListPool <string> .Recycle(list);

            Dictionary <string, MartialSkillInfo> mMartialInfoMap = Traverse.Create(__instance).Field("mMartialInfoMap").GetValue <Dictionary <string, MartialSkillInfo> >();
            // 自定义功法,从八卦心法clone出来
            MartialSkillInfo oldMartialSkillInfo = __instance.GetSkillInfoByID("baguaxinfa");

            for (int i = 0; i < FormationFileLoad.Size; i++)
            {
                FormationInfo formationInfo = FormationFileLoad.fiList[i];
                for (int i2 = 0; i2 < formationInfo.Positions.Count; i2++)
                {
                    MartialSkillInfo newMartialSkillInfo             = __instance.CloneMartial(oldMartialSkillInfo, formationInfo.Name + i2);
                    Dictionary <int, MartialMovesInfo> mMovesInfoMap = newMartialSkillInfo.GetAllMovesInfoMap();
                    // 将buff的id改成自定义的buff
                    mMovesInfoMap[2].UpdateModifierID("martial-baguaxinfa", "martial-" + formationInfo.Name + i2);
                    //FormationMod.logger.Log("martial-" + formationInfo.Name + i2);
                }
                //MartialSkillInfo newMartialSkillInfo = __instance.CloneMartial(oldMartialSkillInfo, formationInfo.Name);
                //Dictionary<int, MartialMovesInfo> mMovesInfoMap = newMartialSkillInfo.GetAllMovesInfoMap();
                //// 将buff的id改成自定义的buff
                //mMovesInfoMap[2].UpdateModifierID("martial-baguaxinfa", "martial-" + formationInfo.Name);
            }

            // 返回false表示不执行原方法
            return(false);
        }